| name | cis-docker-1.1.5 |
| description | Ensure auditing is configured for Docker files and directories - /var/lib/docker |
| category | cis-docker |
| version | 1.8.0 |
| author | cyberstrike-official |
| tags | ["cis","docker","linux","containers","host-configuration","auditing"] |
| cis_id | 1.1.5 |
| cis_benchmark | CIS Docker Benchmark v1.8.0 |
| tech_stack | ["linux","docker"] |
| cwe_ids | [] |
| chains_with | [] |
| prerequisites | [] |
| severity_boost | {} |
Ensure auditing is configured for Docker files and directories - /var/lib/docker (Manual)
Description
Audit /var/lib/docker or data-root.
Rationale
As well as auditing the normal Linux file system and system calls, you should also audit all Docker related files and directories. The Docker daemon runs with root privileges and its behaviour depends on some key files and directories. /var/lib/docker is one such directory. As it holds all the information about containers it should be audited.
Impact
Auditing can generate large log files. You should ensure that these are rotated and archived periodically. A separate partition should also be created for audit logs to avoid filling up any other critical partition.
Audit
You should verify that there is an audit rule applied to the /var/lib/docker directory or whatever your data-root directory is set to.
You can configure the Docker daemon to use a different directory, using the data-root configuration option. For example:
{
"data-root": "/mnt/docker-data"
}
To perform an audit execute the command below:
auditctl -l | grep /var/lib/docker
or
auditctl -l | grep data-root
This should list a rule for the /var/lib/docker directory.
Remediation
You should add a rule for the /var/lib/docker directory.
Adding exclusions for /var/lib/docker/overlay2 & /var/lib/docker/volumes reduces the audit messages to a more manageable level.
For example,
Add the line as below to the /etc/audit/rules.d/audit.rules file:
-a exit,always -F path=/var/lib/docker -F perm=war -k docker
-a exit,never -F dir=/var/lib/docker/volumes
-a exit,never -F dir=/var/lib/docker/overlay2
or for systems with namespace-remapping enabled
-a exit,always -F path=/var/lib/docker -F perm=war -k docker
-a ,never -F =/var/lib/165536.165536/volumes
-a ,never -F =/var/lib/docker/165536.165536/overlay2