Open primeroz opened 1 year ago
Encountered on CAPA Flatcar image as well. It doesn't happen 100% of the time.
giantswarm@ip-10-0-214-124 ~ $ sudo systemctl status audit-rules
× audit-rules.service - Load Security Auditing Rules
Loaded: loaded (/usr/lib/systemd/system/audit-rules.service; enabled; preset: enabled)
Drop-In: /etc/systemd/system/audit-rules.service.d
└─10-wait-for-containerd.conf
Active: failed (Result: exit-code) since Wed 2023-08-30 17:00:01 UTC; 1h 0min ago
Main PID: 1493 (code=exited, status=1/FAILURE)
CPU: 23ms
Aug 30 17:00:00 localhost systemd[1]: Starting audit-rules.service...
Aug 30 17:00:01 localhost augenrules[1531]: Error sending add rule data request (Rule exists)
Aug 30 17:00:01 localhost augenrules[1531]: There was an error in line 5 of /etc/audit/audit.rules
Aug 30 17:00:01 localhost augenrules[1531]: No rules
Aug 30 17:00:01 localhost systemd[1]: audit-rules.service: Main process exited, code=exited, status=1/FAILURE
Aug 30 17:00:01 localhost systemd[1]: audit-rules.service: Failed with result 'exit-code'.
Aug 30 17:00:01 localhost systemd[1]: Failed to start audit-rules.service.
Files in /etc/audit/rules/d
directory
ip-10-0-214-124 /etc/audit # ls -lh rules.d/
total 4.0K
lrwxrwxrwx. 1 root root 39 Aug 30 12:33 00-clear.rules -> /usr/share/audit/rules.d/00-clear.rules
lrwxrwxrwx. 1 root root 41 Aug 30 12:33 80-selinux.rules -> /usr/share/audit/rules.d/80-selinux.rules
lrwxrwxrwx. 1 root root 41 Aug 30 12:33 99-default.rules -> /usr/share/audit/rules.d/99-default.rules
-rw-r--r--. 1 root root 511 Aug 30 12:35 containerd.rules
My hutch is that containerd.rules
file doesn't have a numeric prefix, so this file might be read before 00-clear.rules
or after 99-default.rules
. If it's after 99-default.rules
, audit-rules.service
doesn't fail, however if it's before 00-clear.rules
then audit-rules.service
fails 🤔 ❓
Note that audit-rules.service
doesn't restart on failure, as it's Type=oneshot
In CAPA, this is fixed with adding Restart=on-failure
to audit-rules.service
- name: audit-rules.service
enabled: true
dropins:
- name: 10-wait-for-containerd.conf
contents: |
[Service]
ExecStartPre=/bin/bash -c "while [ ! -f /etc/audit/rules.d/containerd.rules ]; do echo 'Waiting for /etc/audit/rules.d/containerd.rules to be written' && sleep 1; done"
Restart=on-failure <-- Added this
Motivation
Follow up to https://github.com/giantswarm/roadmap/issues/1659
With our custom CAPZ Flatcar image there is an error reported by the
audit-rules.service
All rules seems to have loaded though
Also it doe snot happen 100% of the time on all nodes
TODO
For Turtles