Join our Newsletter — 33% off our NHI Course
Home› Glossary› Cyber Security› AppArmor AF_UNIX Mediation
Cyber Security

AppArmor AF_UNIX Mediation

← Back to Glossary
By NHI Mgmt Group Updated October 31, 2026 Domain: Cyber Security

AppArmor AF_UNIX mediation is the control of Unix domain socket connections through AppArmor policy. It allows administrators to permit or deny socket communication based on labels, socket type, address, and peer context, closing an important gap in workload and process isolation on Linux.

How AppArmor AF_UNIX mediation works

AppArmor can mediate Unix domain socket traffic by evaluating the process label, socket type, address, and peer context before allowing a connection. That makes local inter-process communication part of the access-control surface, rather than an implicit trust channel inside a host.

In practice, this means a policy can distinguish which confined programs may talk to which peers, including services that communicate through filesystem-backed sockets or abstract namespace sockets. The control is especially useful where a local service boundary matters as much as a network boundary.

Why AF_UNIX mediation matters for isolation

Unix domain sockets are often used for privileged helper services, desktop session buses, container tooling, and other high-trust local channels. Without mediation, any process that can reach the socket path or namespace may be able to interact with a service that was never meant to be generally available.

AppArmor closes that gap by making peer relationships explicit in policy. That reduces the chance that a compromised process can laterally reach a sensitive local service simply because both run on the same machine.

For Linux hardening guidance that treats AppArmor as part of a broader host control set, see the Linux Server Hardening Guide.

Policy elements that shape mediation decisions

AF_UNIX mediation is not just about socket existence. The policy decision can depend on the label assigned to the current process, the class of socket being opened, and the peer label presented during communication. That lets administrators model trust between specific confined workloads rather than rely on broad host-level assumptions.

This is why the feature is a good fit for service isolation. It can separate tightly scoped daemons, helpers, and user-session components even when they share the same kernel and the same local transport mechanism.

For the broader AppArmor profile model, including enforce versus complain behavior and rollout patterns, the AppArmor Guide is the most direct companion resource.

Common deployment scenarios and operational trade-offs

AF_UNIX mediation is most valuable where local trust is too broad by default. Typical uses include restricting administrative helpers, limiting which services may consume a local API socket, and preventing unrelated workloads from speaking over a shared inter-process channel.

The trade-off is policy complexity. If labels, peer expectations, or socket paths are not mapped carefully, administrators can create denial of service for legitimate components or leave a service effectively unprotected because the policy is too permissive.

For container and runtime contexts where AppArmor works alongside other confinement controls, the Container Runtime Security Guide explains how AppArmor fits into a layered isolation model.

Risk and Threat Considerations

Unix domain sockets often carry privileged local trust, so weak mediation can turn a single compromised process into a path toward sensitive local services. The risk is greatest when a socket is assumed to be "local only" and therefore not subjected to the same access discipline as a network endpoint.

Failure mechanism: A process that should have been confined can reach an AF_UNIX socket because policy does not distinguish the right peer label, socket class, or local endpoint context. That can expose administrative interfaces, session services, or helper daemons to unauthorized local interaction.

Impact: Attackers who obtain code execution on the host may use the socket channel to expand access, manipulate trusted services, or move from an unprivileged foothold toward higher-value local control.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST SP 800-53 Rev 5 sets the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5AC-3 — Access EnforcementAF_UNIX mediation enforces who may connect to a local socket
AC-4 — Information Flow EnforcementPolicy constrains information flow between confined local peers
IA-9 — Identification and Authentication (Non-Organizational Users)Peer context on sockets can function as local service-to-service authentication
Recommendation — Apply AC-3 to enforce label-based allow/deny decisions for local IPC sockets. Use AC-4 to restrict which labels may exchange data over Unix domain sockets. Use IA-9 where socket peer identity is part of service authentication.
ISO/IEC 27001:2022A.8.22 — Segregation of networksLocal IPC policy helps separate service communication paths on a host
Recommendation — Use A.8.22 to segment service channels and reduce unintended local reachability.

Practitioner Guidance

Why practitioners should care: AF_UNIX mediation is one of the few controls that can make local IPC boundaries explicit instead of implicit. It is most valuable when the service boundary itself matters, not just the network perimeter around the host.

What to watch for: Review any service that exposes a Unix socket and ask whether the peer relationship should be label-bound, especially for admin tooling, session buses, and helper processes. If the socket is broadly reachable by design, treat that as a policy decision that needs justification rather than an accident of deployment.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on October 31, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org