Monitoring SELinux
SELinux writes log entries that enable system administrators to monitor its operation. The following subsections explain the format of SELinux log messages, some logging subtleties, and how to use the Audit2allow utility to automatically generate rules to allow operations logged as denied.
SELinux Log Message Format
When a program attempts an operation that is checked by the SELinux security engine, SELinux may make a log entry. As more fully explained in Chapter 2, operations that are denied generally cause a log entry to be made, whereas permitted operations generally do not. However, SELinux policy rules can override this principle.
Apart from the timestamp and other information that accompanies every system log message, SELinux log messages have the following general format:
avc:result{operation} for pid=pidexe=exepath=opathdev=devno:ptnoino=nodescontext=sourcetcontext=targettclass=class
Tip
A given SELinux log message may omit one or more of the attribute-value pairs given in the general format. Log messages include only the applicable attribute-value pairs.
The variable fields within the log message have the following meanings:
-
result The value
grantedordenied, indicating whether SELinux permitted or prohibited the operation.-
operation The operation that was attempted, such as
readorwrite. SELinux defines about 150 operations. Appendix B summarizes the SELinux operations that can appear in log messages.-
pid The process ID of the process that attempted ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access