Skip to content

rpm: Ship SELinux policy denying AF_ALG sockets#1318

Merged
thaJeztah merged 1 commit intodocker:masterfrom
vvoland:fix-alg
May 6, 2026
Merged

rpm: Ship SELinux policy denying AF_ALG sockets#1318
thaJeztah merged 1 commit intodocker:masterfrom
vvoland:fix-alg

Conversation

@vvoland
Copy link
Copy Markdown
Contributor

@vvoland vvoland commented May 5, 2026

Note: This requires dockerd to be configured withselinux-enabled: true (through daemon.json or cli flag). It is NOT enabled by default

Ship a CIL policy module that denies AF_ALG socket creation for all container domains (container_t, spc_t). Like AppArmor, SELinux hooks into the kernel's security_socket_create() LSM callback, which fires regardless of whether the socket was created via socket(2) or the legacy socketcall(2) multiplexer. This blocks AF_ALG selectively without disrupting other socketcall usage by 32-bit binaries.

This complements the seccomp profile change in moby, which blocks socket(AF_ALG) but cannot filter socketcall arguments. On SELinux-only systems (Fedora, RHEL, CentOS) where AppArmor is not available, this CIL module provides equivalent protection.

Load the module from %post when SELinux is enabled, warning but keeping installation non-fatal if semodule cannot load it. Remove the module on uninstall.

- What I did

- Description for the changelog

@vvoland vvoland self-assigned this May 5, 2026
Comment thread rpm/selinux/docker-af-alg-deny.cil Outdated
@vvoland vvoland closed this May 6, 2026
@vvoland vvoland reopened this May 6, 2026
@vvoland vvoland marked this pull request as ready for review May 6, 2026 16:20
Ship a CIL policy module that denies AF_ALG socket creation for all
container domains (container_t, spc_t). Like AppArmor, SELinux hooks
into the kernel's security_socket_create() LSM callback, which fires
regardless of whether the socket was created via socket(2) or the
legacy socketcall(2) multiplexer. This blocks AF_ALG selectively
without disrupting other socketcall usage by 32-bit binaries.

This complements the seccomp profile change in moby, which blocks
socket(AF_ALG) but cannot filter socketcall arguments.

On SELinux-only systems (Fedora, RHEL, CentOS) where AppArmor is not
available, this CIL module provides equivalent protection.

Load the module from %post when SELinux is enabled, warning but keeping
installation non-fatal if semodule cannot load it. Remove the module on
uninstall.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland vvoland requested review from a team and thaJeztah May 6, 2026 17:03
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah thaJeztah merged commit bd72004 into docker:master May 6, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants