SELinux makes use of extended attributes that can appended to the directory structures on the disk. Think of these as meta data. Access Control Lists (ACLs) being another.
The extended attributes that you need to append to a directory are called contexts and SELinux acts like a traffic cop, making sure that an executable that has certain contexts is allowed to access the filesystem based on these contexts. You can see what's available on the directory using the -Z
switch to ls
.
$ sudo ls -Z /var/www
drwxr-xr-x. root root system_u:object_r:httpd_sys_script_exec_t:s0 cgi-bin
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 html
Here you can see that these directories have the context httpd_sys_script_exec_t:s0
on the cgi-bin
dir. and the html
dir. has httpd_sys_content_t:s0
.
You can add these using the chcon
command:
$ sudo chcon -t httpd_sys_content_t public_html
The command you're asking about will simply load the module mypoll.pp
I do not believe it will grant any permissions to anything, there is likely more messages in the audit.log
that you're missing with your command, that will tell you in more detail what you need to do to allow access.
I'd encourage you to take some time and familiarize yourself with SELinux. It's confusing at first but is generally straightforward, after spending a little time with it. See the resources below to get you started.
References