SSOGEN / Learn / Mandatory Access Control: When Labels Decide, Not Owners

Learn

Mandatory Access Control: When Labels Decide, Not Owners

Under mandatory access control (MAC), a central policy compares a label on the process with a label on the object. The object's owner cannot change the outcome.

A server module with a blue tag faces a folder with a grey tab across a shut brass gate; an unused key lies in front
Only the two MAC rows take the decision away from the file's owner.

NIST defines mandatory access control by who decides: a central authority, not the owner of the object. NIST’s example is military classification, where a data owner can neither grant a top-secret clearance nor relabel a top-secret file as secret.

On Linux the central authority is a kernel security module such as SELinux. It compares the label on a process with the label on a file, against a policy only the policy author can change. chmod does not move that decision.

How DAC, SELinux, MLS and RBAC judge the same payroll request

A finance web app runs as Apache. dana asks it for the Q3 payroll report, and the app opens /home/dana/q3-payroll.csv for reading. Each model reads different data and returns its own verdict.

Model Reads Values in this request Verdict Who can change it
DAC (Linux mode bits) Owner, group, mode Owner dana, mode -rw-r--r--, home directory mode 0711; Apache’s user falls under “other”, which may read Allow dana, with chmod, chown or an ACL
MAC, type enforcement (SELinux) Process domain and file type Process system_u:system_r:httpd_t; file user_u:object_r:user_home_t Deny: no policy rule lets httpd_t read user_home_t The policy author. dana’s chmod changes nothing
MAC, levels (an MLS policy) Clearance against classification Apache cleared to s1, file classified s2 Deny: no read up A security officer. The owner cannot relabel the file down
RBAC (in the app) Roles held and each role’s permissions dana holds Payroll Analyst, which may read payroll reports Allow Whoever assigns roles

The request fails, because every layer must allow it. Only the two MAC rows take the decision away from the file’s owner. The RBAC row works one layer up, inside the application; roles against attributes is covered on RBAC vs ABAC.

What an SELinux label and a denial look like

SELinux attaches a security context to every process and every object. Its form is user:role:type[:range]. Under the targeted policy, the type field carries the decision.

The CentOS wiki shows the case from the table: Apache, in httpd_t, cannot read a user_home_t file in a home directory, even when its mode makes it world readable.

When SELinux refuses, it writes an AVC record to the audit log. Here is one from the Gentoo wiki, a file read refused:

/var/log/audit/audit.log, one AVC denial (Gentoo wiki)
type=AVC msg=audit(1363289005.532:184): avc: denied { read } for pid=29199 comm="Trace"
name="online" dev="sysfs" ino=30 scontext=staff_u:staff_r:googletalk_plugin_t
tcontext=system_u:object_r:sysfs_t tclass=file
The same record, field by field
State
denied
What SELinux did. In permissive mode the record still says denied, although the access went through.
Permission
read
The operation the process asked for.
Process
pid=29199 comm="Trace"
Who asked. comm keeps the name after the process has exited.
Source context
staff_u:staff_r:googletalk_plugin_t
The label of the process, its domain.
Target context
system_u:object_r:sysfs_t
The label of the file.
Target class
file
The object class. Others include dir and sockets.

Most denials on a working server come from a wrong label, not a missing rule. The CentOS wiki gives the standard case:

Before: moved with mv. dana edits index.html in her home directory and moves it into /var/www/html. mv keeps the source label, user_home_t, so Apache is still refused.

After: relabeled with restorecon. restorecon -v /var/www/html/index.html restores the directory’s default type, httpd_sys_content_t, and Apache can read the file. A cp normally takes that type from the start.

Linux checks both, in order

The discretionary check runs first. MAC runs only on what DAC already allowed.

  1. DAC: owner, group and mode bits

    The kernel checks the mode bits and any access control list. A refusal here ends the request, and SELinux is never asked.

  2. MAC: the security server

    If DAC allows, the SELinux security server checks the policy. A process cannot bypass it with SELinux enabled.

Windows runs the other way round. Mandatory Integrity Control evaluates access before the check against the object’s DACL.

Levels and the Bell-LaPadula rules

Type enforcement asks which domain and which type are involved. Multi-level security (MLS) asks how secret they are. SELinux implements MLS on the Bell-LaPadula model and adds the level to the label.

A level is a sensitivity plus optional categories: s0, s1:c0, s7:c10.c15. A range has a low and a high level, such as s0 - s15:c0.c1023. A level on a process is a clearance; on an object, a classification.

Rule What it stops
No read up A process at Confidential cannot read a Secret file.
No write down A process at Secret cannot write a Confidential file, so secret content cannot drift down a level.
Categories (MCS) Multi-category security uses categories without the hierarchy. Each SELinux-enabled virtual machine runs in its own MCS category. Android uses generated categories, so an app running for one user cannot read files the same app wrote for another user.

A process may still write up. It can copy a file to Secret but cannot read it back without stepping up. Trusted processes can be granted exemptions from these rules, which matches NIST’s “trusted subjects”.

Where MAC runs today

On Linux, every MAC module plugs into the Linux Security Module framework. CONFIG_LSM sets the modules at build time and lsm= overrides them at boot.

  • SELinux: labels. Type enforcement plus MLS and MCS, decided from security contexts.
  • AppArmor: profiles. Per-program profiles loaded from user space. A program without a profile runs unconfined, under standard DAC only.
  • Smack: labels. Simplified Mandatory Access Control Kernel. It stores labels in extended attributes on the file system.
  • TOMOYO: path names. A name-based MAC module that decides from the path of the file.
  • Windows MIC: integrity levels. Four levels: low, medium, high and system. A low process cannot write to a medium object, even when the DACL allows it.

Central rules for every application

The principle applies above the kernel too. In SSOGEN, application access rules are one organization-wide list that decides which applications signed-in people may reach.

  • Always first: Block Drew Carter.When the person is Drew Carter, then Deny.
  • Rule: Contractors in office hours.When in group Contractors, Monday to Friday, 08:00 to 18:00 Europe/London, then Allow.
  • Checked in order. The topmost matching rule decides, and the default Deny covers everyone else.
  • Above each application. A Deny refuses the person whatever the application’s own policy says.
  • Pick lists only. A rule cannot name a group or network that does not exist. If a group in a rule is later deleted, SSOGEN refuses every launch the list governs rather than guess.

Questions people ask

How does mandatory access control work?

Every subject and object carries a label, and a central policy compares the two on each access. On SELinux, the subject is a process and the label is its security context. The kernel’s security server checks the policy after the normal permission check. Users and their programs cannot change the labels or the policy.

What types of MAC exist?

SELinux offers two forms: type enforcement and multi-level security. Type enforcement confines each process domain to the object types its policy allows. MLS adds Bell-LaPadula levels, with no read up and no write down. MCS reuses the level field for categories without hierarchy. AppArmor and TOMOYO decide from programs and paths instead of labels.

What are the disadvantages of MAC?

Somebody has to write and maintain the policy, and a mislabeled file looks like a broken application. The mv case above is typical: the mode bits allow access, yet the service is refused. The common shortcut is permissive mode, which logs denied and enforces nothing. Fix the label with restorecon or semanage fcontext instead.

What are the benefits of MAC?

A compromised service stays inside its domain. The CentOS wiki makes the point with Apache: an exploited httpd_t process can neither reach files outside its types nor start processes in other domains. Owners cannot leak a file with chmod, and the policy applies to every subject and object the same way.

What are the five main types of access control?

The usual five are DAC, MAC, RBAC, ABAC and relationship-based access control (ReBAC). DAC lets the owner decide. MAC lets a central policy decide from labels. RBAC grants through roles, ABAC through attributes, and ReBAC through relationships between people and objects.

Where these facts come from

Sources, all read 2026-11-18:

Updated