Use it to confirm SELinux is actively protecting the system.
Enforcing
Enforcing mode applies the SELinux policy: denied operations are blocked and logged as AVC denials. It is the default and intended mode on RHEL.
1. getenforce — Enforcing?
2. grep ^SELINUX= /etc/selinux/config — enforcing at boot?
3. Permissive domains: semanage permissive -l.
4. Recent denials handled?
5. Switch back: setenforce 1.
policy loaded → enforcing → every access checked → denials blocked and logged
For SELinux → Enforcing, continue with the first unproven Topic check: Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for Enforcing. If that boundary is healthy, advance to the adjacent check: Read back the effective runtime state and precedence rather than assuming an edited file, package state or service status is active. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
runtime enforcing mode → subject/object contexts → policy decision → AVC/audit → blocked/allowed syscall → application result
Healthy evidence: runtime reports enforcing, expected allows succeed, expected denies block, AVCs correlate cleanly and no broad workaround is required
Step 2 Verification and output interpretation Verify boundary
For SELinux/AppArmor, correlate denial records with current mode/profile/labels and confirm the access vector/path actually matches the failing operation.
Verification chain. runtime enforcing mode → subject/object contexts → policy decision → AVC/audit → blocked/allowed syscall → application result
Step 3 Commands Verify boundary
getenforce
setenforce 1
grep ^SELINUX= /etc/selinux/config
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: unexpected denials occur, required operations fail without understood AVC context, audit is missing, or enforcement is disabled as a workaround
Step 5 Common mistakes Narrow the fault
- Enforcing after relabel without testing services.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Check both the running mode (getenforce) and the configured boot mode (/etc/selinux/config). Per-domain permissive (semanage permissive -a <domain>) is a narrower alternative to global permissive.
getenforce / sestatus— mode and policyls -Z <path>— file contextps -eZ | grep <proc>— process contextausearch -m AVC -ts recent— recent denialssemanage fcontext -l | grep <path>— context rules for a path
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
Enforcing shows policy is active for covered SELinux decisions, but it does not show policy correctness, full audit retention or the absence of other DAC/service failures.
In depth
Enforcing mode
In enforcing mode, SELinux blocks every access the policy doesn't allow, and logs it. The selinux(8) manual page describes enforcing as the mode in which denied accesses are both blocked and audited. It's set with SELINUX=enforcing in /etc/selinux/config. Red Hat's SELinux guide describes enforcing as the default, and the recommended state.
Running in enforcing mode day to day
| Practice | Reason |
|---|---|
| Use packaged locations and ports where possible | The policy already knows them |
| Add file contexts for custom paths before deploying | Files get the right type from the start |
Use restorecon after copying, restoring or moving files | mv keeps the old label; cp gets the target's label |
Check ausearch -m AVC after each change | Problems show up immediately |
Keep semanage customisations under configuration management | Rebuilding a host reproduces them |
Confirming the mode
| Command | Shows |
|---|---|
getenforce | Enforcing, Permissive or Disabled |
sestatus | Mode, the mode from the config file, the policy, MLS state |
cat /sys/fs/selinux/enforce | 1 (enforcing) or 0 (permissive) |
Moving from permissive to enforcing
| Step | Command |
|---|---|
| 1. Fix all current denials while permissive | ausearch -m AVC -ts boot |
| 2. Switch the running system | setenforce 1 |
| 3. Test the important services | — |
| 4. Make it permanent | SELINUX=enforcing in /etc/selinux/config |
| 5. Reboot at a planned time | Confirms that boot works in enforcing |
Booting with a temporary override
The kernel parameter enforcing=0 boots in permissive mode once, without changing the configuration. That's useful when a policy problem prevents booting.
host$ getenforce
Enforcing
host$ sestatus | grep -E "Current mode|Mode from config file|Policy MLS"
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
host$ grep ^SELINUX= /etc/selinux/config
SELINUX=enforcing
host$ sudo cp /tmp/app.conf /etc/app/app.conf && sudo mv /tmp/app2.conf /etc/app/app2.conf
host$ ls -Z /etc/app/
system_u:object_r:etc_t:s0 app.conf
unconfined_u:object_r:user_tmp_t:s0 app2.conf
host$ sudo restorecon -v /etc/app/app2.conf
Reading the example
The copied file got etc_t, the type of its new directory. The moved file kept user_tmp_t from /tmp, and a service reading /etc/app would be denied access to it. restorecon gives it the right label. This copy-versus-move difference causes many "it worked in permissive mode" surprises.
Documented example, not captured output.
How it works at runtime
Enforcing is part of SELinux → Enforcing. SELinux Enforcing mode applies loaded policy decisions so denied operations are blocked and normally audited, making runtime mode and the exact AVC/workload correlation central evidence.
Runtime state ownership and mechanics. Linux security composes authentication (PAM and service mechanisms), identity/credentials, DAC permissions/ACLs, capabilities, LSM policy such as SELinux/AppArmor, audit and service/network policy. SELinux labels/types and AppArmor path/profile rules differ in policy model, while auditd records selected security-relevant events rather than making authorization decisions.
Topic-specific state model. SELinux Enforcing mode applies loaded policy decisions so denied operations are blocked and normally audited, making runtime mode and the exact AVC/workload correlation central evidence.
Interpretation rule. - Enforcing mode ≠ correct labels or correct policy.
- No denial during one test ≠ all required paths are covered or the application is healthy.
Quick reference
Enforcing mode blocks and logs policy violations (AVC denials).
getenforce
setenforce 1
grep ^SELINUX= /etc/selinux/config # persistent: enforcing
ausearch -m AVC,USER_AVC -ts today
journalctl -t setroubleshoot
sealert -a /var/log/audit/audit.log
Some denials are hidden by dontaudit rules; temporarily semodule -DB disables them to see everything (semodule -B restores). Keep production in enforcing — RHEL's targeted policy confines network-facing daemons with little impact on normal admin work.
Limits and how it fails
Primary failure point. Enforcing shows policy is active for covered SELinux decisions, but it does not show policy correctness, full audit retention or the absence of other DAC/service failures.
Disabling SELinux/AppArmor to make an error disappear only localizes a policy boundary and can hide the real label/profile defect.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
PAM stack order/control flags matter; sudo/SSH hardening can lock out administration; SELinux policy should normally be fixed through correct labels/booleans/policy rather than permanent disablement; AppArmor profiles should move from complain to enforce only after reviewing legitimate workload behavior.
Distribution/platform context. Enforcing owns runtime policy enforcement behavior.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in SELinux → Enforcing. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://selinuxproject.org/page/Main_Page · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Enforcing operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Enforcing.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | SELinux Enforcing mode applies loaded policy decisions so denied operations are blocked and normally audited, making runtime mode and the exact AVC/workload correlation central evidence. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin host + boot/time + real identity/workload → identify authoritative policy/key/trust source → read back loaded/effective runtime state → reproduce one safe allow/deny/handshake test → correlate audit/service/kernel evidence → locate first failed boundary → make the smallest persistent change → repeat original workload + regression/recovery check. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | runtime enforcing mode → subject/object contexts → policy decision → AVC/audit → blocked/allowed syscall → application result | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Enforcing proves policy is active for covered SELinux decisions; it does not prove policy correctness, full audit retention or the absence of other DAC/service failures. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux security/trust evidence can establish this proof path: runtime enforcing mode → subject/object contexts → policy decision → AVC/audit → blocked/allowed syscall → application result | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove unobserved identities, objects, policies, namespaces, endpoints or time periods. Enforcing proves policy is active for covered SELinux decisions; it does not prove policy correctness, full audit retention or the absence of other DAC/service failures. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven security/trust boundary, capture the adjacent effective state and audit/handshake evidence, make only the demonstrated persistent change, then repeat the original workload plus recovery/regression checks. | Continue to the next unresolved boundary while preserving the original test condition. |
Enforcing · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | Enforcing |
|---|---|
| Topic path | SELinux → Enforcing |
| Runtime state | SELinux Enforcing mode applies loaded policy decisions so denied operations are blocked and normally audited, making runtime mode and the exact AVC/workload correlation central evidence. |
| Fast checks | - Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for Enforcing. - Read back the effective runtime state and precedence rather than assuming an edited file, package state or service status is active. - Reproduce one safe allowed/denied or handshake/access test and correlate kernel/service/audit evidence at the first relevant boundary. - Apply the smallest persistent cause-specific change, then repeat the original test plus an adjacent regression/recovery check. |
| Verification chain | runtime enforcing mode → subject/object contexts → policy decision → AVC/audit → blocked/allowed syscall → application result Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. |
| Failure boundary | Enforcing proves policy is active for covered SELinux decisions; it does not prove policy correctness, full audit retention or the absence of other DAC/service failures. Boundary chain: process credentials/namespace → path/mount lookup → DAC/ACL/LSM → filesystem metadata → block/device/backend → completion/read-back. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |