🔐

SELinux & AppArmor Audit Log Translator

type=AVC denial & DENIED forensic analysis · surgical remediation without disabling MAC
MYSYSAD.COM awaiting log input
Raw Audit Log Input /var/log/audit/audit.log · dmesg · journalctl -k
🔍
No Log Parsed Yet
Paste a type=AVC SELinux denial or an AppArmor apparmor="DENIED" line above and click Translate Log. Load the example scenarios to see it in action.
Share MySysAd

⚠️ IMPORTANT DISCLAIMER: The tools and scripts on this site are provided "AS IS" for educational purposes.

Review destructive commands before executing. By using this site, you assume all risk and agree to our Full Terms of Service.

Fix SELinux and AppArmor denials properly

When SELinux or AppArmor blocks something, the log line is hard to read and the tempting fix is to switch protection off. Paste the denial and you get what was blocked, which process tried it, and the narrowest fix: a file label, a boolean or a port label, instead of setenforce 0.

Common questions

How do I read an SELinux AVC denial?

In avc: denied { read } for pid=1234 comm="nginx" name="index.html" scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file, the process nginx running as type httpd_t was refused read on a file labelled user_home_t. The fix is almost always to give the file the right label, not to change the policy.

How do I fix SELinux “permission denied” for files served by Apache or Nginx?

Label the folder for web content and apply the label: sudo semanage fcontext -a -t httpd_sys_content_t "/srv/www(/.*)?" then sudo restorecon -Rv /srv/www. Use httpd_sys_rw_content_t for folders the app must write to. Files moved with mv keep their old label, which is a common cause.

Why can’t my web server connect to a database or backend?

SELinux stops web servers making network connections by default. sudo setsebool -P httpd_can_network_connect 1 allows it (or httpd_can_network_connect_db for databases only). getsebool -a | grep httpd lists the related switches.

How do I let a service listen on a non-standard port?

Add the port to the right type: sudo semanage port -a -t http_port_t -p tcp 8081 for a web server, or ssh_port_t for SSH on another port. semanage port -l | grep http shows which ports are already allowed.

Should I use audit2allow?

Only after the label and boolean fixes don’t apply. audit2allow writes a policy module that allows exactly what was denied, which can open far more than intended. Read its output before loading it. For AppArmor, sudo aa-logprof plays a similar role, and aa-complain logs without blocking while you test.

Related tools: Permission Simulator · Error Message Decoder · All tools A–Z