{"id":89,"date":"2011-05-05T14:17:16","date_gmt":"2011-05-05T14:17:16","guid":{"rendered":"http:\/\/www.salsaunited.net\/blog\/?p=89"},"modified":"2011-05-05T14:17:16","modified_gmt":"2011-05-05T14:17:16","slug":"selinux-cheat-sheet","status":"publish","type":"post","link":"https:\/\/blog.domb.net\/?p=89","title":{"rendered":"RHEL6 SELinux cheat sheet"},"content":{"rendered":"<p><!-- \t\t@page { margin: 0.79in } \t\tP { margin-bottom: 0.08in } -->Lot of admin turn SELinux off because it looks complicated. Here is a cheat sheet to make your life easier<\/p>\n<p><span style=\"font-family: Arial,sans-serif; color: #000000;\"><span style=\"font-size: small;\">Two important documentations about Selinux can be found here:<\/span><\/span><\/p>\n<p><span style=\"color: #000000;\"><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">http:\/\/docs.redhat.com\/docs\/en-US\/Red_Hat_Enterprise_Linux\/6\/html\/Security-Enhanced_Linux\/index.html<\/span><\/span><\/strong><\/span><\/p>\n<p><span style=\"color: #000000;\"><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">http:\/\/docs.redhat.com\/docs\/en-US\/Red_Hat_Enterprise_Linux\/6\/html\/Managing_Confined_Services\/index.html<\/span><\/span><\/strong><\/span><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p><em><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">If you work on Centos or Redhat, install the following packages on your system: <\/span><\/span><\/em><\/p>\n<p><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">setroubleshoot.noarch<\/span><\/span><\/strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\"> : Helps troubleshoot SELinux problems<\/span><\/span><\/p>\n<p><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">setroubleshoot-plugins.noarch<\/span><\/span><\/strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\"> : Analysis plugins for use with setroubleshoot<\/span><\/span><\/p>\n<p><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">setroubleshoot-server.noarch<\/span><\/span><\/strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\"> : SELinux troubleshoot server<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">yum install setroubleshoot<\/span><\/span><\/strong><\/p>\n<p><em><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Start the setroubleshootd daemon:<\/span><\/span><\/em><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]#<\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">setroubleshootd<\/span><\/span><\/strong><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p><em><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Get the status of selinux:<\/span><\/span><\/em><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]#<\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">sestatus<\/span><\/span><\/strong><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">SELinux status: enabled<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">SELinuxfs mount: \/selinux<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Current mode: enforcing<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Mode from config file: enforcing<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Policy version: 21<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Policy from config file: targeted<\/span><\/span><\/p>\n<p><em><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Check for permissive or enforcing mode: <\/span><\/span><\/em><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]#<\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">getenforce<\/span><\/span><\/strong><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">If you get back a <\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">1<\/span><\/span><\/strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\"> selinux is turned on if you get back a <\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">0<\/span><\/span><\/strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\"> its turned off.<\/span><\/span><\/p>\n<p><em><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Switch selinux modes from permissive to enforcing and back: <\/span><\/span><\/em><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]#<\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">setenforce 1<\/span><\/span><\/strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\"> (will set enforcing mode)<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]#<\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">setenforce 0<\/span><\/span><\/strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\"> (will set permissive mode)<\/span><\/span><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p><em><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Selinux AVC Log files: <\/span><\/span><\/em><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">All selinux logs can be found in <\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">\/var\/log\/audit\/audit.log<\/span><\/span><\/strong><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">SELinux logfiles looks very crytpy without the tool sealert. Here an extract of the log without and with the command sealert:<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]#<\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">less \/var\/log\/audit\/audit.log<\/span><\/span><\/strong><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">type=DAEMON_START msg=audit(1304542876.396:4843): auditd start, ver=1.7.18 format=raw kernel=2.6.18-238.el5 auid=4294967295 pid=2553 subj=system_u:system_r:auditd_t:s0 res=success<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">type=CONFIG_CHANGE msg=audit(1304542876.570:4): audit_enabled=1 old=0 by auid=4294967295 subj=system_u:system_r:auditd_t:s0 res=1<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">sealert -a \/var\/log\/audit\/audit.log | less<\/span><\/span><\/strong><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">found 1 alerts in \/var\/log\/audit\/audit.log<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Summary:<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">SELinux is preventing nagios (nagios_t) &#8220;getattr&#8221; to \/var\/nagios\/objects.cache<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">(var_t).<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Detailed Description:<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[SELinux is in permissive mode, the operation would have been denied but was<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">permitted due to permissive mode.]<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">SELinux denied access requested by nagios. It is not expected that this access<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">is required by nagios and this access may signal an intrusion attempt. It is<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">also possible that the specific version or configuration of the application is<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">causing it to require additional access.<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Allowing Access:<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Sometimes labeling problems can cause SELinux denials. You could try to restore<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">the default system file context for \/var\/nagios\/objects.cache,<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">restorecon -v &#8216;\/var\/nagios\/objects.cache&#8217;<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">If this does not work, there is currently no automatic way to allow this access.<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Instead, you can generate a local policy module to allow this access &#8211; see FAQ<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">(http:\/\/fedora.redhat.com\/docs\/selinux-faq-fc5\/#id2961385) Or you can disable<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">SELinux protection altogether. Disabling SELinux protection is not recommended.<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Please file a bug report (http:\/\/bugzilla.redhat.com\/bugzilla\/enter_bug.cgi)<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">against this package.<\/span><\/span><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p><em><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">SELinux bool variables: <\/span><\/span><\/em><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Each service has its own ruleset. The Selinux bools can be found with the command getsebool<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Here and example for the httpd service<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">getsebool -a | grep httpd <\/span><\/span><\/strong><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">allow_httpd_anon_write &#8211;&gt; off<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">allow_httpd_sys_script_anon_write &#8211;&gt; off<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">httpd_builtin_scripting &#8211;&gt; on<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">httpd_can_network_connect &#8211;&gt; off<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">httpd_can_network_connect_db &#8211;&gt; off<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">httpd_can_network_relay &#8211;&gt; off<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">httpd_can_sendmail &#8211;&gt; on<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">If you would start the apache server you would not be able to connect to it, because the <\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">httpd_can_network_connect<\/span><\/span><\/strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\"> is turned <\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">off. <\/span><\/span><\/strong><\/p>\n<p><em><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Set sebool to on:<\/span><\/span><\/em><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">setsebool -P httpd_can_network_connect =on<\/span><\/span><\/strong><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Now you are able to start the apache server and connect to it.<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Selinux Manpage<br \/>\n<\/span><\/span><\/p>\n<p>[root@client1 ~]#man httpd_selinux<strong> <\/strong><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p><em>Restore default security context of files or directories (File labeling): <\/em><\/p>\n<p><em><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Check filecontext:<\/span><\/span><\/em><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">ls -Z<\/span><\/span><\/strong><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">drwxr-xr-x root root root:object_r:httpd_sys_content_t nagvis<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">drwxr-xr-x root root root:object_r:httpd_sys_content_t nconf<\/span><\/span><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><strong><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">restorecon -v \/var\/www\/html\/index.html <\/span><\/span><\/span><\/strong><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><\/span><strong><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">restorecon -Rv \/var\/www\/html\/index.html<\/span><\/span><\/span><\/strong><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\"> <\/span><\/span><\/span><\/p>\n<p><em><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">To check if a restore is needed: <\/span><\/span><\/span><\/em><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><\/span><strong><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">restorecon -Rv -n \/var\/www\/html<\/span><\/span><\/span><\/strong><\/p>\n<p><em><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Set new security context not persistent: <\/span><\/span><\/em><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><\/span><strong><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">chcon -Rv \u2013type=httpd_sys_content_t \/html<\/span><\/span><\/span><\/strong><\/p>\n<p><em><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Set new security context not persistent:<\/span><\/span><\/span><\/em><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><\/span><strong><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">semanage fcontext -a -t httpd_sys_content_t \u201c\/html(\/.*)?\u201d<\/span><\/span><\/span><\/strong><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p><em><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Open non standard ports for httpd service:<\/span><\/span><\/em><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><\/span><strong><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">semanage port -a -t http_port_t \u2013 p tcp 81<\/span><\/span><\/span><\/strong><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">List all the ports managed permitted by selinux<\/span><\/span><\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><\/span><strong><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">semanage port -l<\/span><\/span><\/span><\/strong><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p><em><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Create selinux rule:<\/span><\/span><\/span><\/em><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><\/span><strong><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">grep security_context_t \/var\/log\/audit\/audit.log | audit2allow -m nagios1 &gt; nagios.te<\/span><\/span><\/strong><\/p>\n<p><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">now review the rules in the .te file.<\/span><\/span><\/p>\n<p><em><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Create selinux module: <\/span><\/span><\/em><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><\/span><strong><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">grep security_context_t \/var\/log\/audit\/audit.log | audit2allow -M nagios1<\/span><\/span><\/span><\/strong><\/p>\n<p><em><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">Install the module:<\/span><\/span><\/span><\/em><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">[root@client1 ~]# <\/span><\/span><\/span><strong><span style=\"color: #000000;\"><span style=\"font-family: Arial,sans-serif;\"><span style=\"font-size: small;\">semodule -i nagios1.pp<\/span><\/span><\/span><\/strong><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lot of admin turn SELinux off because it looks complicated. Here is a cheat sheet to make your life easier Two important documentations about Selinux can be found here: http:\/\/docs.redhat.com\/docs\/en-US\/Red_Hat_Enterprise_Linux\/6\/html\/Security-Enhanced_Linux\/index.html http:\/\/docs.redhat.com\/docs\/en-US\/Red_Hat_Enterprise_Linux\/6\/html\/Managing_Confined_Services\/index.html &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; If you work on Centos or Redhat, install the following packages on your system: setroubleshoot.noarch : Helps troubleshoot SELinux problems setroubleshoot-plugins.noarch : Analysis&#8230;<\/p>\n","protected":false},"author":1,"featured_media":161,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-89","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts\/89","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=89"}],"version-history":[{"count":0,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts\/89\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/media\/161"}],"wp:attachment":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=89"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=89"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=89"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}