1919fi
2020
2121# 3.2
22- check_3_2=" 3.2 - Verify that docker.service file permissions are set to 644"
22+ check_3_2=" 3.2 - Verify that docker.service file permissions are set to 644 or more restrictive "
2323file=" $( get_systemd_service_file docker.service) "
2424if [ -f " $file " ]; then
25- if [ " $( stat -c %a $file ) " -eq 644 ]; then
25+ if [ " $( stat -c %a $file ) " -eq 644 -o " $( stat -c %a $file ) " -eq 600 ]; then
2626 pass " $check_3_2 "
2727 else
2828 warn " $check_3_2 "
4949fi
5050
5151# 3.4
52- check_3_4=" 3.4 - Verify that docker.socket file permissions are set to 644"
52+ check_3_4=" 3.4 - Verify that docker.socket file permissions are set to 644 or more restrictive "
5353file=" $( get_systemd_service_file docker.socket) "
5454if [ -f " $file " ]; then
55- if [ " $( stat -c %a $file ) " -eq 644 ]; then
55+ if [ " $( stat -c %a $file ) " -eq 644 -o " $( stat -c %a $file ) " -eq 600 ]; then
5656 pass " $check_3_4 "
5757 else
5858 warn " $check_3_4 "
7979fi
8080
8181# 3.6
82- check_3_6=" 3.6 - Verify that /etc/docker directory permissions are set to 755"
82+ check_3_6=" 3.6 - Verify that /etc/docker directory permissions are set to 755 or more restrictive "
8383directory=" /etc/docker"
8484if [ -d " $directory " ]; then
8585 if [ " $( stat -c %a $directory ) " -eq 755 ]; then
119119fi
120120
121121# 3.8
122- check_3_8=" 3.8 - Verify that registry certificate file permissions are set to 444"
122+ check_3_8=" 3.8 - Verify that registry certificate file permissions are set to 444 or more restrictive "
123123directory=" /etc/docker/certs.d/"
124124if [ -d " $directory " ]; then
125125 fail=0
156156fi
157157
158158# 3.10
159- check_3_10=" 3.10 - Verify that TLS CA certificate file permissions are set to 444"
159+ check_3_10=" 3.10 - Verify that TLS CA certificate file permissions are set to 444 or more restrictive "
160160tlscacert=$( get_docker_effective_command_line_args ' --tlscacert' | sed -n ' s/.*tlscacert=\([^s]\)/\1/p' | sed ' s/--/ --/g' | cut -d " " -f 1)
161161if [ -f " $tlscacert " ]; then
162162 perms=$( ls -ld " $tlscacert " | awk ' {print $1}' )
187187fi
188188
189189# 3.12
190- check_3_12=" 3.12 - Verify that Docker server certificate file permissions are set to 444"
190+ check_3_12=" 3.12 - Verify that Docker server certificate file permissions are set to 444 or more restrictive "
191191tlscert=$( get_docker_effective_command_line_args ' --tlscert' | sed -n ' s/.*tlscert=\([^s]\)/\1/p' | sed ' s/--/ --/g' | cut -d " " -f 1)
192192if [ -f " $tlscert " ]; then
193193 perms=$( ls -ld " $tlscert " | awk ' {print $1}' )
218218fi
219219
220220# 3.14
221- check_3_14=" 3.14 - Verify that Docker server key file permissions are set to 400"
221+ check_3_14=" 3.14 - Verify that Docker server key file permissions are set to 400 or more restrictive "
222222tlskey=$( get_docker_effective_command_line_args ' --tlskey' | sed -n ' s/.*tlskey=\([^s]\)/\1/p' | sed ' s/--/ --/g' | cut -d " " -f 1)
223223if [ -f " $tlskey " ]; then
224224 perms=$( ls -ld " $tlskey " | awk ' {print $1}' )
@@ -249,10 +249,10 @@ else
249249fi
250250
251251# 3.16
252- check_3_16=" 3.16 - Verify that Docker socket file permissions are set to 660"
252+ check_3_16=" 3.16 - Verify that Docker socket file permissions are set to 660 or more restrictive "
253253file=" /var/run/docker.sock"
254254if [ -S " $file " ]; then
255- if [ " $( stat -c %a $file ) " -eq 660 ]; then
255+ if [ " $( stat -c %a $file ) " -eq 660 -o " $( stat -c %a $file ) " -eq 600 ]; then
256256 pass " $check_3_16 "
257257 else
258258 warn " $check_3_16 "
@@ -279,10 +279,10 @@ else
279279fi
280280
281281# 3.18
282- check_3_18=" 3.18 - Verify that daemon.json file permissions are set to 644"
282+ check_3_18=" 3.18 - Verify that daemon.json file permissions are set to 644 or more restrictive "
283283file=" /etc/docker/daemon.json"
284284if [ -f " $file " ]; then
285- if [ " $( stat -c %a $file ) " -eq 644 ]; then
285+ if [ " $( stat -c %a $file ) " -eq 644 -o " $( stat -c %a $file ) " -eq 600 ]; then
286286 pass " $check_3_18 "
287287 else
288288 warn " $check_3_18 "
@@ -309,10 +309,10 @@ else
309309fi
310310
311311# 3.20
312- check_3_20=" 3.20 - Verify that /etc/default/docker file permissions are set to 644"
312+ check_3_20=" 3.20 - Verify that /etc/default/docker file permissions are set to 644 or more restrictive "
313313file=" /etc/default/docker"
314314if [ -f " $file " ]; then
315- if [ " $( stat -c %a $file ) " -eq 644 ]; then
315+ if [ " $( stat -c %a $file ) " -eq 644 -o " $( stat -c %a $file ) " -eq 600 ]; then
316316 pass " $check_3_20 "
317317 else
318318 warn " $check_3_20 "
0 commit comments