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:

  1. Create a policy called mydokuwiki.te with the following content:
    apache_content_template(dokuwiki)
  2. 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) ...

Get SELinux Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.