Skip to content

rpm: Ship SELinux policy denying AF_ALG sockets#1318

Draft
vvoland wants to merge 1 commit intodocker:masterfrom
vvoland:fix-alg
Draft

rpm: Ship SELinux policy denying AF_ALG sockets#1318
vvoland wants to merge 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
;;
;; Requires SELinux userspace >= 3.6 for CIL deny support.
;; Requires container-selinux for the container_domain attribute.
(deny container_domain self (alg_socket (create)))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, that would work!

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>
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