-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get_service_file unable to find containerd.sock #548
Comments
Hi @spedersen-emailage and nice catch, could you please test #549? |
@konstruktoid It looks like that
I deleted the |
yeah, that's an "interesting" output. ~$ systemctl show --no-pager "dontexist" && echo $?
[...]
LoadError=org.freedesktop.systemd1.NoSuchUnit "Unit dontexist.service not found."
Transient=no
Perpetual=no
StartLimitIntervalUSec=10s
StartLimitBurst=5
StartLimitAction=none
FailureAction=none
SuccessAction=none
CollectMode=inactive
0
~$ systemctl show -p FragmentPath "dontexist" && echo $?
FragmentPath=
0 |
updated 287fd87 |
@konstruktoid The updated
After I modified the function, it works:
diff:
|
yeah, there's a bit of inconsistencies there. $ git grep containerd.sock
tests/1_host_configuration.sh: local desc="Ensure auditing is configured for Docker files and directories - containerd.sock (Automated)"
tests/1_host_configuration.sh: remediation="Install auditd. Add -w $(get_service_file containerd.socket) -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
tests/1_host_configuration.sh: file="$(get_service_file containerd.socket)"
tests/3_docker_daemon_configuration_files.sh: local remediation="You should run the following command: chown root:root /run/containerd/containerd.sock. This sets the ownership and group ownership for the file to root."
tests/3_docker_daemon_configuration_files.sh: file="/run/containerd/containerd.sock"
tests/3_docker_daemon_configuration_files.sh: local remediation="You should run the following command: chmod 660 /run/containerd/containerd.sock. This sets the file permissions for this file to 660."
tests/3_docker_daemon_configuration_files.sh: file="/run/containerd/containerd.sock" |
updated |
@konstruktoid Confirmed!
|
Thanks @spedersen-emailage |
get_service_file
looks for$SERVICE
in these directories:/etc/systemd/system/
/lib/systemd/system/
/usr/lib/systemd/system/
As well as looks at systemctl's
FragmentPath
property.Reference:
docker-bench-security/functions/helper_lib.sh
Lines 132 to 148 in 820abe9
CIS test 1.1.8 throws
INFO
and remediation has a blank recommendation becausecontainerd.sock
is not found in any of those directories or via FP.Note the extra space between
-w
and-k
above.Instead, when docker runs with active containers, it's only found at
/run/containerd/containerd.sock
.This has been observed with Docker v20.10.25 on Amazon Linux 2 and v25.0.3 on Amazon Linux 2023.
Note
--containerd
points to/run/containerd/containerd.sock
.I checked CIS Docker Benchmark v1.6.0 and it does not specify the location of containerd.sock, only that you find it and monitor it.
Can the tests be updated to check
/run
as well?The text was updated successfully, but these errors were encountered: