-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathdefinitions.yaml
1966 lines (1855 loc) · 72.8 KB
/
definitions.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
controls:
id: "18.09"
description: "CIS Docker Community Edition Benchmark"
groups:
- id: 1
description: "Host Configuration"
checks:
- id: 1.1
description: "General Configuration"
checks:
- id: 1.1.1
description: "Ensure the container host has been Hardened (Not Scored)"
type: manual
audit: |
Ensure that the host specific security guidelines are followed.
Ask the system administrators which security benchmark the current
host system should currently be compliant with and check that security
standards associated with this standard are currently in place.
remediation: |
You may consider various CIS Security Benchmarks for your container host.
If you have other security guidelines or regulatory requirements
to adhere to, please follow them as suitable in your environment.
scored: false
- id: 1.1.2
description: "Ensure that the version of Docker is up to date (Not Scored)"
type: manual
audit: "docker version"
remediation: |
You should monitor versions of Docker releases and make sure
your software is updated as required.
scored: false
- id: 1.2
description: "Linux Hosts Specific Configuration"
checks:
- id: 1.2.1
description: "Ensure a separate partition for containers has been created (Scored)"
audit: "grep '$docker-storage\\s' /proc/mounts"
tests:
test_items:
- flag: "$docker-storage"
set: true
remediation: |
For new installations, you should create a separate partition for the $docker-storage mount point.
For systems which have already been installed,
you should use the Logical Volume Manager (LVM)
within Linux to create a new partition.
scored: true
- id: 1.2.2
description: "Ensure only trusted users are allowed to control Docker daemon (Scored)"
audit: "getent group docker"
type: manual
remediation: |
You should remove any untrusted users from the docker group.
Additionally, you should not create a mapping of sensitive directories from the host to container volumes."
scored: true
- id: 1.2.3
description: "Ensure auditing is configured for the docker daemon (Scored)"
audit: "auditctl -l | grep /usr/bin/dockerd"
tests:
test_items:
- flag: "/usr/bin/dockerd"
set: true
remediation: |
You should add rules for the Docker daemon. For example:
Add the line below to the
/etc/audit/audit.rules file:
-w /usr/bin/dockerd -k docker
Then, restart the audit daemon using the following command service auditd restart"
scored: true
- id: 1.2.4
description: "Ensure auditing is configured for Docker files and directories -
$docker-storage (Scored)"
audit: "auditctl -l | grep $docker-storage"
tests:
test_items:
- flag: "$docker-storage"
set: true
remediation: |
You should add a rule for the $docker-storage directory.
For example, Add the line as below to the /etc/audit/audit.rules file:
-w $docker-storage -k docker
Then restart the audit daemon. For example,
service auditd restart"
scored: true
- id: 1.2.5
description: "Ensure auditing is configured for Docker files and directories -
/etc/docker (Scored)"
audit: "auditctl -l | grep /etc/docker"
tests:
test_items:
- flag: "/etc/docker"
set: true
remediation: |
You should add a rule for the /etc/docker directory.
For example: Add the line below to the /etc/audit/audit.rules file:
-w /etc/docker -k docker
Then restart the audit daemon. For example:
service auditd restart"
scored: true
- id: 1.2.6
description: "Ensure auditing is configured for Docker files and directories -
docker.service (Scored)"
audit: "systemctl show -p FragmentPath docker.service | awk -F \"=\" '{print $2}' |xargs -I % test -f % && auditctl -l | grep `systemctl show -p FragmentPath docker.service | awk -F \"=\" '{print $2}'`"
tests:
test_items:
- flag: "docker.service"
set: true
remediation: |
If the file exists, a rule for it should be added.
For example: Add the line as below in /etc/audit/audit.rules file:
-w /usr/lib/systemd/system/docker.service -k docker
Then restart the audit daemon. For example:
service auditd restart
scored: true
- id: 1.2.7
description: "Ensure auditing is configured for Docker files and directories -
docker.socket (Scored)"
audit: "systemctl show -p FragmentPath docker.socket | awk -F \"=\" '{print $2}' |xargs -I % test -f % && auditctl -l | grep `systemctl show -p FragmentPath docker.socket | awk -F \"=\" '{print $2}'`"
tests:
test_items:
- flag: "docker.socket"
set: true
remediation: |
If the file exists, you should add a rule for it.
For example: Add the line below to the /etc/audit/audit.rules file:
-w /usr/lib/systemd/system/docker.socket -k docker
Then restart the audit daemon. For example:
service auditd restart"
scored: true
- id: 1.2.8
description: "Ensure auditing is configured for Docker files and directories -
/etc/default/docker (Scored)"
audit: "auditctl -l | grep /etc/default/docker"
tests:
test_items:
- flag: "/etc/default/docker"
set: true
remediation: |
You should add a rule for the /etc/default/docker file.
For example: Add the line below to the /etc/audit/audit.rules file:
-w /etc/default/docker -k docker
Then restart the audit daemon. For example:
service auditd restart
scored: true
- id: 1.2.9
description: "Ensure auditing is configured for Docker files and directories - /etc/sysconfig/docker (Scored)"
audit: "auditctl -l | grep /etc/sysconfig/docker"
tests:
test_items:
- flag: "/etc/sysconfig/docker"
set: true
remediation: |
You should add a rule for the /etc/sysconfig/docker file.
For example: Add the line below to the /etc/audit/audit.rules file:
-w /etc/sysconfig/docker -k docker
Then restart the audit daemon. For example:
service auditd restart
scored: true
- id: 1.2.10
description: "Ensure auditing is configured for Docker files and directories -
/etc/docker/daemon.json (Scored)"
audit: "auditctl -l | grep /etc/docker/daemon.json"
tests:
test_items:
- flag: "/etc/docker/daemon.json"
set: true
remediation: |
You should add a rule for the /etc/docker/daemon.json file.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /etc/docker/daemon.json -k docker
Then restart the audit daemon.
For example:
service auditd restart
scored: true
- id: 1.2.11
description: "Ensure auditing is configured for Docker files and directories -
/usr/bin/docker-containerd (Scored)"
audit: "auditctl -l | grep /usr/bin/containerd"
tests:
test_items:
- flag: "/usr/bin/containerd"
set: true
remediation: |
You should add a rule for the /usr/bin/containerd file.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /usr/bin/containerd -k docker
Then restart the audit daemon.
For example:
service auditd restart
scored: true
- id: 1.2.12
description: "Ensure auditing is configured for Docker files and directories -
/usr/sbin/runc (Scored)"
audit: "auditctl -l | grep /usr/sbin/runc"
tests:
test_items:
- flag: "/usr/sbin/runc"
set: true
remediation: |
You should add a rule for /usr/sbin/runc file.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /usr/sbin/runc -k docker
Then restart the audit daemon.
For example:
service auditd restart
scored: true
- id: 2
description: "Docker daemon configuration"
checks:
- id: 2.1
description: "Ensure network traffic is restricted between containers on the
default bridge (Scored)"
audit: "docker network ls --quiet | xargs docker network inspect --format '{{ .Name }}: {{ .Options }}'"
tests:
test_items:
- flag: "com.docker.network.bridge.enable_icc:true"
set: false
remediation: |
Edit the Docker daemon configuration file to ensure that icc is disabled. It should include
the following setting
"icc": false
Alernatively, run the docker daemon directly and pass --icc=false as an argument.
For Example,
dockerd --icc=false
scored: true
- id: 2.2.a
description: "Ensure the logging level is set to 'info' (Scored)"
audit: "ps -ef | grep dockerd"
tests:
bin_op: or
test_items:
- flag: "--log-level"
set: false
- flag: "--log-level"
compare:
op: eq
value: "info"
set: true
remediation: |
Ensure that the Docker daemon configuration file has the following configuration included
"log-level": "info"
Alternatively, run the Docker daemon as below:
dockerd --log-level="info"
scored: true
- id: 2.2.b
description: "Ensure the logging level is set to 'info' (Scored)"
audit: "grep log-level /etc/docker/daemon.json"
tests:
test_items:
- flag: "\"log-level\""
compare:
op: eq
value: "info"
set: true
remediation: |
Ensure that the Docker daemon configuration file has the following configuration included
"log-level": "info"
Alternatively, run the Docker daemon as below:
dockerd --log-level="info"
scored: true
- id: 2.3
description: "Ensure Docker is allowed to make changes to iptables (Scored)"
audit: "ps -ef | grep dockerd"
tests:
bin_op: or
test_items:
- flag: "--iptables"
set: false
- flag: "--iptables"
compare:
op: eq
value: true
set: true
remediation: |
Do not run the Docker daemon with --iptables=false parameter. For example, do not
start the Docker daemon as below:
dockerd --iptables=false
scored: true
- id: 2.4
description: "Ensure insecure registries are not used (Scored)"
audit: "docker info --format 'Insecure Registries: {{.RegistryConfig.InsecureRegistryCIDRs}}'"
type: manual
remediation: |
You should ensure that no insecure registries are in use.
scored: true
- id: 2.5
description: "Ensure aufs storage driver is not used (Scored)"
audit: "docker info --format 'Storage Driver: {{ .Driver }}'"
tests:
test_items:
- flag: "aufs"
set: false
remediation: |
Do not explicitly use aufs as storage driver.
For example, do not start Docker daemon as below:
dockerd --storage-driver aufs
scored: true
- id: 2.6.a
description: "Ensure TLS authentication for Docker daemon is configured (Scored)"
audit: "ps -ef | grep dockerd"
tests:
bin_op: and
test_items:
- flag: "--tlsverify"
set: true
- flag: "--tlscacert"
set: true
- flag: "--tlscert"
set: true
- flag: "--tlskey"
set: true
remediation: |
Follow the steps mentioned in the Docker documentation or other references.
scored: true
- id: 2.6.b
description: "Ensure TLS authentication for Docker daemon is configured (Scored)"
audit: 'grep tls /etc/docker/daemon.json | tr -d ","'
tests:
bin_op: and
test_items:
- flag: '"tlsverify"'
compare:
op: eq
value: true
set: true
- flag: '"tlscacert"'
compare:
op: noteq
value: '""'
set: true
- flag: '"tlscert"'
compare:
op: noteq
value: '""'
set: true
- flag: '"tlskey"'
compare:
op: noteq
value: '""'
set: true
remediation: |
Follow the steps mentioned in the Docker documentation or other references.
scored: true
- id: 2.7
description: "Ensure the default ulimit is configured appropriately (Not Scored)"
audit: "ps -ef | grep dockerd"
type: manual
tests:
test_items:
- flag: "--default-ulimit"
set: true
remediation: |
Run the docker in daemon mode and pass --default-ulimit as argument with respective
ulimits as appropriate in your environment.
For Example,
dockerd --default-ulimit nproc=1024:2048 --default-ulimit nofile=100:200
scored: false
- id: 2.8
description: "Enable user namespace support (Scored)"
audit: "docker info --format '{{ .SecurityOptions }}'"
tests:
test_items:
- flag: "userns"
compare:
op: has
value: "userns"
set: true
remediation: |
Please consult the Docker documentation for various ways in which this can be configured
depending upon your requirements. Your steps might also vary based on platform - For
example, on Red Hat, sub-UIDs and sub-GIDs mapping creation do not work automatically.
You might have to create your own mapping.
The high-level steps are as below:
Step 1: Ensure that the files /etc/subuid and /etc/subgid exist.
touch /etc/subuid /etc/subgid
Step 2: Start the docker daemon with --userns-remap flag
dockerd --userns-remap=default
scored: true
- id: 2.9.a
description: "Ensure the default cgroup usage has been confirmed (Scored)"
audit: "ps -ef | grep dockerd"
tests:
bin_op: or
test_items:
- flag: "--cgroup-parent"
set: false
- flag: "--cgroup-parent"
compare:
op: nothave
value: "/docker"
set: true
remediation: |
The default setting is in line with good security practice and can be left in situ. If you wish
to specifically set a non-default cgroup, pass the --cgroup-parent parameter to the Docker
daemon when starting it.
For example,
dockerd --cgroup-parent=/foobar
scored: true
- id: 2.9.b
description: "Ensure the default cgroup usage has been confirmed (Scored)"
audit: "grep cgroup-parent /etc/docker/daemon.json"
tests:
bin_op: or
test_items:
- flag: ""
compare:
op: eq
value: ""
set: false
- flag: '"cgroup-parent"'
compare:
op: nothave
value: "/docker"
set: true
remediation: |
The default setting is in line with good security practice and can be left in situ. If you wish
to specifically set a non-default cgroup, pass the --cgroup-parent parameter to the Docker
daemon when starting it.
For example,
dockerd --cgroup-parent=/foobar
scored: true
- id: 2.10.a
description: "Ensure base device size is not changed until needed (Scored)"
audit: "ps -ef | grep dockerd"
tests:
test_items:
- flag: "--storage-opt"
set: false
remediation: |
Do not set --storage-opt dm.basesize until needed.
scored: true
- id: 2.10.b
description: "Ensure base device size is not changed until needed (Scored)"
audit: "grep storage-opt /etc/docker/daemon.json"
tests:
test_items:
- flag: '"storage-opt"'
compare:
op: eq
value: ""
set: true
remediation: |
Do not set --storage-opt dm.basesize until needed.
scored: true
- id: 2.11.a
description: "Ensure that authorization for Docker client commands is enabled (Scored)"
audit: "ps -ef | grep dockerd"
tests:
test_items:
- flag: "--authorization-plugin"
set: true
remediation: |
Step 1: Install/Create an authorization plugin.
Step 2: Configure the authorization policy as desired.
Step 3: Start the docker daemon as below:
dockerd --authorization-plugin=<PLUGIN_ID>
scored: true
- id: 2.11.b
description: "Ensure that authorization for Docker client commands is enabled (Scored)"
audit: 'grep authorization-plugin /etc/docker/daemon.json | tr -d ","'
tests:
test_items:
- flag: '"authorization-plugins"'
compare:
op: noteq
value: "[]"
set: true
remediation: |
Step 1: Install/Create an authorization plugin.
Step 2: Configure the authorization policy as desired.
Step 3: Start the docker daemon as below:
dockerd --authorization-plugin=<PLUGIN_ID>
scored: true
- id: 2.12
description: "Ensure centralized and remote logging is configured (Scored)"
audit: "ps -ef | grep dockerd"
tests:
test_items:
- flag: "--log-driver"
set: true
remediation: |
Step 1: Setup the desired log driver by following its documentation.
Step 2: Start the docker daemon with that logging driver.
For example,
dockerd --log-driver=syslog --log-opt syslog-address=tcp://192.xxx.xxx.xxx
scored: true
- id: 2.13.a
description: "Ensure live restore is Enabled (Scored)"
audit: "ps -ef | grep dockerd"
tests:
test_items:
- flag: "--live-restore"
set: true
remediation: |
Run the docker in daemon mode and pass --live-restore as an argument.
For Example,
dockerd --live-restore
scored: true
- id: 2.13.b
description: "Ensure live restore is Enabled (Scored)"
audit: 'grep live-restore /etc/docker/daemon.json | tr -d ","'
tests:
test_items:
- flag: '"live-restore"'
compare:
op: eq
value: "true"
set: true
remediation: |
Run the docker in daemon mode and pass --live-restore as an argument.
For Example,
dockerd --live-restore
scored: true
- id: 2.14.a
description: "Ensure Userland Proxy is Disabled (Scored)"
audit: "ps -ef | grep dockerd"
tests:
test_items:
- flag: "--userland-proxy"
compare:
op: eq
value: "false"
set: true
remediation: |
You should run the Docker daemon as below:
dockerd --userland-proxy=false
scored: true
- id: 2.14.b
description: "Disable Userland Proxy (Scored)"
audit: 'grep userland-proxy /etc/docker/daemon.json | tr -d ","'
tests:
test_items:
- flag: '"userland-proxy"'
compare:
op: eq
value: "false"
set: true
remediation: |
You should run the Docker daemon as below:
dockerd --userland-proxy=false
scored: true
- id: 2.15
description: "Ensure that a daemon-wide custom seccomp profile is applied if appropriate
(Not Scored)"
audit: "docker info --format '{{ .SecurityOptions }}'"
tests:
test_items:
- flag: "profile"
compare:
op: nothave
value: "default"
set: true
remediation: |
By default, Docker's default seccomp profile is applied. If this is adequate for your
environment, no action is necessary. Alternatively, if you choose to apply your own
seccomp profile, use the --seccomp-profile flag at daemon start or put it in the daemon
runtime parameters file.
dockerd --seccomp-profile </path/to/seccomp/profile>
scored: false
- id: 2.16
description: "Ensure that experimental features are not implemented in production (Scored)"
audit: "docker version --format '{{ .Server.Experimental }}'"
tests:
test_items:
- flag: "false"
compare:
op: eq
value: "false"
set: true
remediation: |
You should not pass --experimental as a runtime parameter to the Docker daemon on
production systems.
scored: true
- id: 2.17.a
description: "Ensure containers are restricted from acquiring new privileges (Scored)"
audit: "ps -ef | grep dockerd"
tests:
test_items:
- flag: "--no-new-privileges"
compare:
op: eq
value: "true"
set: true
remediation: |
You should run the Docker daemon as below:
dockerd --no-new-privileges
scored: true
- id: 2.17.b
description: "Ensure containers are restricted from acquiring new privileges (Scored)"
audit: 'grep no-new-privileges /etc/docker/daemon.json | tr -d ","'
tests:
test_items:
- flag: '"no-new-privileges"'
compare:
op: eq
value: "true"
set: true
remediation: |
For example, you should start your container as below:
docker run --rm -it --security-opt=no-new-privileges ubuntu bash
scored: true
- id: 3
description: "Docker daemon configuration files"
checks:
- id: 3.1
description: "Ensure that docker.service file ownership is set to root:root (Scored)"
audit: systemctl show -p FragmentPath docker.service | cut -d= -f2 | xargs stat -c %U:%G
tests:
test_items:
- flag: "root:root"
compare:
op: eq
value: "root:root"
set: true
remediation: |
Step 1: Find out the file location:
systemctl show -p FragmentPath docker.service
Step 2: If the file does not exist, this recommendation is not applicable. If the file does exists,
you should execute the below command with the correct file path to set the ownership and group
ownership and group for the file to root .
For example,
chown root:root /usr/lib/systemd/system/docker.service
scored: true
- id: 3.2
description: "Ensure that docker.service file permissions are appropriately set
(Scored)"
audit: systemctl show -p FragmentPath docker.service | cut -d= -f2 | xargs stat -c "permissions=%a"
tests:
test_items:
- flag: "permissions"
compare:
op: bitmask
value: "644"
set: true
remediation: |
Step 1: Find out the file location:
systemctl show -p FragmentPath docker.service
Step 2: If the file does not exist, this recommendation is not applicable. If the file exists,
execute the below command with the correct file path to set the file permissions to 644 .
For example,
chmod 644 /usr/lib/systemd/system/docker.service
scored: true
- id: 3.3
description: "Ensure that docker.socket file ownership is set to root:root (Scored)"
audit: systemctl show -p FragmentPath docker.socket | cut -d= -f2 | xargs stat -c %U:%G
tests:
test_items:
- flag: "root:root"
compare:
op: eq
value: "root:root"
set: true
remediation: |
Step 1: Find out the file location:
systemctl show -p FragmentPath docker.socket
Step 2: If the file does not exist, this recommendation is not applicable. If the file exists,
execute the command below, including the correct file path to set the ownership and group
ownership for the file to root .
For example,
chown root:root /usr/lib/systemd/system/docker.socket
scored: true
- id: 3.4
description: "Ensure that docker.socket file permissions are set to 644 or more
restrictive (Scored)"
audit: systemctl show -p FragmentPath docker.socket | cut -d= -f2 | xargs stat -c "permissions=%a"
tests:
test_items:
- flag: "permissions"
compare:
op: bitmask
value: "644"
set: true
remediation: |
Step 1: Find out the file location:
systemctl show -p FragmentPath docker.socket
Step 2: If the file does not exist, this recommendation is not applicable. If the file does exists, you
should execute the command below, including the correct file path in order to verify that
the file permissions are set to 644 or more restrictively.
For example,
chmod 644 /usr/lib/systemd/system/docker.socket
scored: true
- id: 3.5
description: "Ensure that /etc/docker directory ownership is set to root:root
(Scored)"
audit: stat -c %U:%G /etc/docker
tests:
test_items:
- flag: "root:root"
compare:
op: eq
value: "root:root"
set: true
remediation: |
To resolve this issue you should run the following command:
chown root:root /etc/docker
This sets the ownership and group-ownership for the directory to root .
scored: true
- id: 3.6
description: "Ensure that /etc/docker directory permissions are set to 755 or more
restrictive (Scored)"
audit: stat -c "permissions=%a" /etc/docker
tests:
test_items:
- flag: "permissions"
compare:
op: bitmask
value: "755"
set: true
remediation: |
You should run the following command:
chmod 755 /etc/docker
This sets the permissions for the directory to 755 .
scored: true
- id: 3.7
description: "Ensure that registry certificate file ownership is set to root:root
(Scored)"
audit: stat -c %U:%G /etc/docker/certs.d/*
tests:
test_items:
- flag: "root:root"
set: true
remediation: |
The following command could be executed:
chown root:root /etc/docker/certs.d/<registry-name>/*
This would set the individual ownership and group ownership for the registry certificate
files to root.
scored: true
- id: 3.8
description: "Ensure that registry certificate file permissions are set to 444 or
more restrictive (Scored)"
audit: stat -c "permissions=%a" /etc/docker/certs.d/*
tests:
test_items:
- flag: "permissions"
compare:
op: bitmask
value: "444"
set: true
remediation: |
You should execute the following command:
chmod 444 /etc/docker/certs.d/<registry-name>/*
This would set the permissions for registry certificate files to 444 .
scored: true
- id: 3.9
description: "Ensure that TLS CA certificate file ownership is set to root:root
(Scored)"
type: manual
remediation: |
You should execute the following command:
chown root:root <path to TLS CA certificate file>
This sets the individual ownership and group ownership for the TLS CA certificate file to root.
scored: true
- id: 3.10
description: "Ensure that TLS CA certificate file permissions are set to 444 or
more restrictive (Scored)"
type: manual
remediation: |
You should execute the following command: chmod 444 <path to TLS CA certificate file>
chmod 444 <path to TLS CA certificate file>
This sets the file permissions on the TLS CA file to 444.
scored: true
- id: 3.11
description: "Ensure that Docker server certificate file ownership is set to
root:root (Scored)"
type: manual
remediation: |
You should run the following command:
chown root:root <path to Docker server certificate file>
This sets the individual ownership and the group ownership for the Docker server
certificate file to root.
scored: true
- id: 3.12
description: "Ensure that Docker server certificate file permissions are set to 444
or more restrictive (Scored)"
type: manual
remediation: |
You should execute the command below:
chmod 444 <path to Docker server certificate file>
This sets the file permissions of the Docker server certificate file to 444 .
scored: true
- id: 3.13
description: "Ensure that Docker server certificate key file ownership is set to
root:root (Scored)"
type: manual
remediation: |
You should execute the following command:
chown root:root <path to Docker server certificate key file>
This sets the individual ownership and group ownership for the Docker server certificate
key file to root.
scored: true
- id: 3.14
description: "Ensure that the Docker server certificate key file permissions are set to 400 (Scored)"
type: manual
remediation: |
You should execute the following command:
chmod 400 <path to Docker server certificate key file>
This sets the Docker server certificate key file permissions to 400 .
scored: true
- id: 3.15
description: "Ensure that Docker socket file ownership is set to root:docker
(Scored)"
audit: stat -c %U:%G /var/run/docker.sock
tests:
test_items:
- flag: "root:docker"
compare:
op: eq
value: "root:docker"
set: true
remediation: |
You should execute the following command:
chown root:docker /var/run/docker.sock
This would set the ownership to root and group-ownership to docker for default Docker
socket file.
scored: true
- id: 3.16
description: "Ensure that Docker socket file permissions are set to 660 or more
restrictive (Scored)"
audit: stat -c "permissions=%a" /var/run/docker.sock
tests:
test_items:
- flag: "permissions"
compare:
op: bitmask
value: "660"
set: true
remediation: |
You should execute the command below.
chmod 660 /var/run/docker.sock
This sets the file permissions of the Docker socket file to 660 .
scored: true
- id: 3.17
description: "Ensure that daemon.json file ownership is set to root:root (Scored)"
audit: /bin/sh -c "if [ -f /etc/docker/daemon.json ]; then stat -c %U:%G /etc/docker/daemon.json; fi"
tests:
test_items:
- flag: "root:root"
compare:
op: eq
value: "root:root"
set: true
remediation: |
You should execute the command below:
chown root:root /etc/docker/daemon.json
This sets the ownership and group-ownership for the file to root .
scored: true
- id: 3.18
description: "Ensure that daemon.json file permissions are set to 644 or more
restrictive (Scored)"
audit: /bin/sh -c "if [ -f /etc/docker/daemon.json ]; then stat -c "permissions=%a" /etc/docker/daemon.json; fi"
tests:
bin_op: or
test_items:
- flag: "permissions"
compare:
op: bitmask
value: "644"
set: true
remediation: |
You should execute the command below
chmod 644 /etc/docker/daemon.json
This sets the file permissions for this file to 644.
scored: true
- id: 3.19
description: "Ensure that /etc/default/docker file ownership is set to root:root
(Scored)"
audit: /bin/sh -c "if [ -f /etc/default/docker ]; then stat -c %U:%G /etc/default/docker; fi"
tests:
test_items:
- flag: "root:root"
compare:
op: eq
value: "root:root"
set: true
remediation: |
You should execute the following command
chown root:root /etc/default/docker
This sets the ownership and group-ownership for the file to root .
scored: true
- id: 3.20
description: "Ensure that the /etc/sysconfig/docker file ownership is set to root:root (Scored)"
audit: "/bin/sh -c \"if [ -f /etc/sysconfig/docker ]; then stat -c %U:%G /etc/sysconfig/docker; fi\""
tests:
test_items:
- flag: "root:root"
compare:
op: eq
value: "root:root"
set: true
remediation: |
You should execute the following command
chown root:root /etc/sysconfig/docker
This sets the ownership and group-ownership for the file to root .
scored: true
- id: 3.21
description: "Ensure that /etc/sysconfig/docker file permissions are set to 644 or
more restrictive (Scored)"
audit: /bin/sh -c "if [ -f /etc/sysconfig/docker ]; then stat -c "permissions=%a" /etc/sysconfig/docker; fi"
tests:
test_items:
- flag: "permissions"
compare:
op: bitmask
value: "644"
set: true
remediation: |
You should execute the following command:
chmod 644 /etc/sysconfig/docker
This sets the file permissions for this file to 644.
scored: true
- id: 3.22
description: "Ensure that /etc/default/docker file permissions are set to 644 or
more restrictive (Scored)"
audit: /bin/sh -c "if [ -f /etc/default/docker ]; then stat -c "permissions=%a" /etc/default/docker; fi"
tests:
test_items:
- flag: "permissions"
compare:
op: bitmask
value: "644"
set: true
remediation: |
You should execute the following command:
chmod 644 /etc/default/docker
This sets the file permissions for this file to 644.
scored: true
- id: 4
description: "Container Images and Build File Configuration"
checks:
- id: 4.1
description: "Ensure that a user for the container has been created (Scored)"
audit: "docker ps --quiet | xargs --max-args=1 -I{} docker exec {} cat /proc/1/status | grep '^Uid:' | awk '{print \"User=\"$3}'"
use_multiple_values: true
tests:
bin_op: and
test_items:
- flag: "User"
compare:
op: nothave
value: "root"
set: true
- flag: "User"