Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

sealert

Explain SELinux denials in plain text, with the likely cause and the commands that fix it.

Level
Everyday Linux
Group
SELinux and security
Needs root
Yes
Package
setroubleshoot-server

What it does

With setroubleshoot-server installed, every AVC denial is analyzed. sealert -a /var/log/audit/audit.log prints a report per problem: what was blocked, why, and suggestions ("you need to change the label…", "turn on boolean…", "allow the port…"). Short messages also go to the journal (journalctl -t setroubleshoot) with an ID for sealert -l ID.

How to write it

sealert -a FILE
sealert -l ID | -l "*"
sealert -b

Options 9

Most used

-a, --analyze FILE
Analyze a log file (like audit.log).
-l, --lookupid ID
Show the report of one alert ID (* = all).
-b, --browser
Open the GUI browser.
-s, --service
Start as a D-Bus service.
-S, --noservice
Do not use the service.
-u, --user
User mode.
-p, --printer
Print to the terminal.
-e, --emacs
Emacs format.
-h, --help
Show help.

Examples 10

$ run as a normal user# run as root (or with sudo)

  1. 1Install it

    dnf install -y setroubleshoot-server

    Restart auditd or reboot so it gets the events.

  2. 2Analyze the whole audit log

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

    One block per kind of denial, with fixes.

  3. 3Short messages in the journal

    journalctl -t setroubleshoot --since -1h
    setroubleshoot[2310]: SELinux is preventing /usr/sbin/httpd from read access on the file index.html. For complete SELinux messages run: sealert -l 3f6a…

    Copy the ID.

  4. 4Full report for one alert

    sealert -l 3f6a2b1c-…

    Cause and suggestions.

  5. 5All alerts

    sealert -l "*"

    Every stored alert.

  6. 6Typical suggestion: wrong label

    sealert -a /var/log/audit/audit.log | grep -A3 'restorecon'

    Run the restorecon it shows.

  7. 7Typical suggestion: boolean

    sealert -a /var/log/audit/audit.log | grep setsebool

    Use the boolean it names (with -P).

  8. 8Do not just follow audit2allow advice (security)

    sealert -a /var/log/audit/audit.log | grep -B2 audit2allow

    The last suggestion is often "make a module" — only if nothing else fits.

  9. 9Analyze an old log

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

    Rotated logs.

  10. 10Check the service

    systemctl status setroubleshootd

    Runs on demand through D-Bus.

Exit codes

0Done.
1Error.