Closed osorito closed 3 months ago
I suspect the check expects "/var/lib/docker" to be in a partition separate from other "/var/" paths (as those will be used by other tools)
Since Ansible is on the table, I modified the server creation script.
omar@Blaze:~/docker-bench-security$ sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 5G 0 disk
├─sda1 8:1 0 4G 0 part /
├─sda14 8:14 0 4M 0 part
├─sda15 8:15 0 106M 0 part /boot/efi
└─sda16 259:0 0 913M 0 part /boot
sdb 8:16 0 25G 0 disk
├─sdb1 8:17 0 12.5G 0 part /home
├─sdb2 8:18 0 5G 0 part /var
├─sdb3 8:19 0 6.3G 0 part /tmp
└─sdb4 8:20 0 1.2G 0 part /var/lib/docker
sr0 11:0 1 4M 0 rom
#cloud-config
disk_setup:
/dev/sdb:
table_type: "gpt"
layout:
- 50
- 20
- 25
- 5
overwrite: true
.....
- label: var_docker_disk
filesystem: "ext4"
device: "/dev/sdb"
partition: "sdb4"
.....
- cmd: mkfs -t %(filesystem)s -L %(label)s %(device)s
label: var_lib_dockr
filesystem: "ext4"
device: "/dev/sdb4"
mounts:
- ["/dev/sdb1", "/home"]
- ["/dev/sdb4", "/var/lib/docker"]
Code should check to see if /var is on a separate partition.
How big should said /var/lib/docker partition be? on my case I made it 5% of disk size.
The code expects docker info -f '{{ .DockerRootDir }}'
to be a separate partition.
Regarding size, it's always site specific. 5% might be enough in your case, if you increase the number of containers you might need to increase the size.
Describe the bug A clear and concise description of what the bug is.
The docker-bench-security gives the following error
Ensure a separate partition for containers has been created (Automated)
Steps followed
Tested it sudo ./docker-bench-security.sh
Verified /var is on a separate partition
Version
Distribution [Ubuntu 24.04]
Expected behavior A clear and concise description of what you expected to happen.
Those warnings should not happen.
Output If applicable, add output that you get from the tool or the related section