Skip to main content
Notes ๐Ÿง๐Ÿ’ก๐Ÿ’ฅ
โ€œIf you can't find it, stash it better.โ€ โ€” Tux
  • Login

๐Ÿ›ก๏ธ SELinux Alert: NGINX Cert Access Denied

Wed, 07/09/2025 - 1:10pm by tux

๐Ÿšจ SELinux: NGINX Fails to Start After Update (Cert Access Denied)

Symptom:
After running dnf update, nginx fails to restart.
Even though nginx -t passes, you get:

Job for nginx.service failed because the control process exited with error code.

โœ… Root Cause

SELinux has blocked nginx from accessing one of your certificate files (star_fullchain.crt), likely due to a label mismatch after updates or file changes.


๐Ÿ” Confirm with:

journalctl -xe | grep nginx

Youโ€™ll see something like:

SELinux is preventing nginx from reading /etc/pki/nginx/star_fullchain.crt

๐Ÿ› ๏ธ Fix It (TL;DR)

sudo restorecon -Rv /etc/pki/nginx
sudo systemctl restart nginx

This resets SELinux labels to what nginx expects.


๐Ÿง  Optional: Full Analysis with sealert

If setroubleshoot is installed:

sealert -a /var/log/audit/audit.log

This will explain the exact denial and recommend a fix (e.g., restorecon, semanage, etc.)

If not installed:

sudo dnf install setroubleshoot-server
sudo systemctl enable --now setroubleshootd

๐Ÿงช Show Labels for Debugging

ls -Z /etc/pki/nginx

Correct label for certs is typically:

cert_t

๐Ÿ“Œ Do NOT Disable SELinux

The proper fix is to correct the label, not to weaken security.


๐Ÿ’ฌ Summary

Step

Command

Check logs

journalctl -xe | grep nginx

Fix labels

restorecon -Rv /etc/pki/nginx

Full audit help

sealert -a /var/log/audit/audit.log

Restart nginx

systemctl restart nginx


๐Ÿฐ

nginx
cert
access
  • Log in to post comments
Powered by Backdrop CMS
๐Ÿง _tux