Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

Enforcing

Direct answer

Enforcing mode applies the SELinux policy: denied operations are blocked and logged as AVC denials. It is the default and intended mode on RHEL.

When to use this

Use it to confirm SELinux is actively protecting the system.

First 30 seconds

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.

Operational verification

policy loaded → enforcing → every access checked → denials blocked and logged

Evidence · next step

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
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Scope / prerequisiteUse it to confirm SELinux is actively protecting the system.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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 references

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.

observation · 1
Key points

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.

Key checks
  • getenforce / sestatus — mode and policy
  • ls -Z <path> — file context
  • ps -eZ | grep <proc> — process context
  • ausearch -m AVC -ts recent — recent denials
  • semanage 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

PracticeReason
Use packaged locations and ports where possibleThe policy already knows them
Add file contexts for custom paths before deployingFiles get the right type from the start
Use restorecon after copying, restoring or moving filesmv keeps the old label; cp gets the target's label
Check ausearch -m AVC after each changeProblems show up immediately
Keep semanage customisations under configuration managementRebuilding a host reproduces them

Confirming the mode

CommandShows
getenforceEnforcing, Permissive or Disabled
sestatusMode, the mode from the config file, the policy, MLS state
cat /sys/fs/selinux/enforce1 (enforcing) or 0 (permissive)

Moving from permissive to enforcing

StepCommand
1. Fix all current denials while permissiveausearch -m AVC -ts boot
2. Switch the running systemsetenforce 1
3. Test the important services—
4. Make it permanentSELINUX=enforcing in /etc/selinux/config
5. Reboot at a planned timeConfirms 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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

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%
Technical changelog & impact

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.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

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.

Aliases that resolve here
selinux enforcinggetenforce enforcingselinux enforce mode
Embedded reference data

Quick lookup tables

Enforcing operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for Enforcing.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateSELinux 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 verificationPin 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 chainruntime enforcing mode → subject/object contexts → policy decision → AVC/audit → blocked/allowed syscall → application resultTrace requested/configured state through effective state to the observed workload result.
Failure boundaryEnforcing 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 evidenceCorrelated Linux security/trust evidence can establish this proof path: runtime enforcing mode → subject/object contexts → policy decision → AVC/audit → blocked/allowed syscall → application resultUse this observation only for the specific claim it actually supports.
Evidence limitIt 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 checkContinue 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 boundaryEnforcing
Topic pathSELinux → Enforcing
Runtime stateSELinux 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 chainruntime 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 boundaryEnforcing 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 ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?