Using custom content types
Next up is to create our own set of content types for a web application that does not have a policy associated with it yet. We will use DokuWiki (available at https://www.dokuwiki.org) as an example.
Getting ready
Install DokuWiki either through the Linux distributions' package manager or manually through a downloaded release from the main site. In this example, we assume that DokuWiki is installed at /srv/web/dokuwiki/
.
How to do it…
To use custom web content types, follow the next set of steps:
Create a policy called
mydokuwiki.te
with the following content:apache_content_template(dokuwiki)
Add a file context definition file called
mydokuwiki.fc
, which contains the following code:/srv/web/dokuwiki/lib/plugins(/.*)? gen_context(system_u:object_r:httpd_dokuwiki_rw_content_t,s0) /srv/web/dokuwiki/conf(/.*)? gen_context(system_u:object_r:httpd_dokuwiki_rw_content_t,s0) /srv/web/dokuwiki/data(/.*)? gen_context(system_u:object_r:httpd_dokuwiki_rw_content_t,s0) /srv/web...