Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStats

Categories

πŸ€– Artificial Intelligence
☁️ Cloud and Infrastructure
πŸ’Ύ Data and Databases
πŸ’Ό Professional Skills
🎯 Programming and Development
πŸ”’ Security and Networking
πŸ“š Specialized Topics
HomeAboutTopicsPricingMy VaultStats
LEVEL 0
0/5 XP
GitHub
Β© 2026 CheatGridβ„’. All rights reserved.
Privacy PolicyTerms of UseAboutContact

SELinux and AppArmor Mandatory Access Control Cheat Sheet

SELinux and AppArmor Mandatory Access Control Cheat Sheet

Back to Operating Systems and CLI
Updated 2026-05-21
Next Topic: SSH and OpenSSH Configuration Mastery Cheat Sheet

Mandatory Access Control (MAC) enforces security policies set by a system administrator that users and processes cannot override β€” unlike Discretionary Access Control (DAC), where file owners decide permissions. SELinux and AppArmor are the two dominant MAC implementations for Linux, both delivered as Linux Security Modules (LSMs) that supplement, never replace, the traditional Unix DAC model. The critical mental model to internalize is that SELinux labels every subject (process) and object (file, port, socket) with a security context and asks "is this label allowed to do this action to that label?", while AppArmor attaches rules to the pathname of executables and asks "is this program allowed to access this path?" β€” a label-vs-path duality that determines almost every practical difference between the two systems.

What This Cheat Sheet Covers

This topic spans 19 focused tables and 156 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.

Table 1: MAC vs DAC β€” Core Access Control ModelsTable 2: SELinux Modes and ConfigurationTable 3: SELinux Security Context β€” Users, Roles, Types, LevelsTable 4: SELinux File Context ManagementTable 5: SELinux BooleansTable 6: SELinux Port LabelingTable 7: SELinux Troubleshooting β€” Audit Logs and ToolsTable 8: SELinux Custom Policy ModulesTable 9: SELinux Users and Role-Based Access ControlTable 10: SELinux MLS and MCSTable 11: AppArmor β€” Profiles, Modes, and Core ToolsTable 12: AppArmor Profile Syntax and RulesTable 13: AppArmor Profile Development ToolsTable 14: AppArmor Abstractions and TunablesTable 15: Container Integration β€” SELinux and AppArmorTable 16: SELinux vs AppArmor β€” Philosophy and ComparisonTable 17: Common Application Hardening WorkflowsTable 18: Workflow β€” Responding to a DenialTable 19: Performance and CI/CD Considerations

Table 1: MAC vs DAC β€” Core Access Control Models

Understanding the distinction between MAC and DAC is the foundation for everything else in SELinux and AppArmor. DAC governs everyday Unix permissions; MAC adds a mandatory layer that even root cannot bypass without explicit policy permission.

ConceptExampleDescription
DAC (Discretionary Access Control)
chmod 644 file.txt
chown alice file.txt
β€’ Traditional Unix model
β€’ resource owner decides permissions β€” root can override everything
MAC (Mandatory Access Control)
SELinux: httpd_t domain cannot write shadow_t files
Centrally defined policy enforced by the kernel β€” even root cannot override it without policy changes.
DAC checked first
DAC denies β†’ MAC never runs;
DAC allows β†’ MAC policy checked next
β€’ SELinux rules are evaluated only after DAC rules pass
β€’ a DAC denial stops the check immediately

More in Operating Systems and CLI

  • rsync File Synchronization and Backup Cheat Sheet
  • SSH and OpenSSH Configuration Mastery Cheat Sheet
  • AWS CLI Cheat Sheet
  • GCP CLI Cheat Sheet
  • Linux Text Processing with grep, sed, and awk Cheat Sheet
  • systemd and Linux Service Management Cheat Sheet
View all 48 topics in Operating Systems and CLI