]> git.ipfire.org Git - thirdparty/systemd.git/commit
basic/audit-util: make a test request before enabling use of audit
authorNick Rosbrook <nick.rosbrook@canonical.com>
Tue, 2 May 2023 16:30:31 +0000 (12:30 -0400)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 5 May 2023 20:06:16 +0000 (21:06 +0100)
commit362235bf59f8ddc6d67be3d6c8604f7fd05d383d
tree76a7682ca37a01940f98722b5169ad2d2dbf5b78
parent6ad7989ea03064a0ed8e562e1e2f69305b98f633
basic/audit-util: make a test request before enabling use of audit

If a container manager does not follow the guidance in
https://systemd.io/CONTAINER_INTERFACE/ regarding audit capabilities,
then the current check may not be sufficient to determine that audit
will function properly. In particular, when calling bind() on the audit
fd, we will get EPERM if running in a user-namespaced container.

Expand the check to make an AUDIT_GET_FEATURE request on the audit fd to
test if it is working. If this fails with ECONNREFUSED, we know it is
because the kernel does not support the use of audit outside of the
initial user namespace.

Note that the approach of this patch was suggested here:
https://github.com/systemd/systemd/pull/19443#issuecomment-829566659

Fixes: #6519
src/basic/audit-util.c