audit-userspace icon indicating copy to clipboard operation
audit-userspace copied to clipboard

Remove RefuseManualStop=yes from systemd unit?

Open mikhailnov opened this issue 2 years ago • 4 comments

auditd.service has the following line: RefuseManualStop=yes It makes systemctl stop auditd not work, but systemctl kill auditd still works. It is not good to force users to stop the daemon by SIGKILL instead of a normal stop.

It was introduced by commit https://github.com/linux-audit/audit-userspace/commit/e94faad18f13da6acc183e98d51d1a93cdc24c03 9 years ago, but I cannot understand why it is needed. I think RefuseManualStop=yes can be removed nowadays.

mikhailnov avatar May 04 '22 22:05 mikhailnov

It is needed because there are requirements to associate any user interacting with the audit system in audit events. When you use systemctl, it uses dbus to talk to systemd, which in turn sends a signal to auditd. Auditd asks the kernel who did this and it says no one instead of the user. That is wrong.

If you use the service command, it sends the signal directly in the user context and then auditd asks the kernel who did that and it reports the correct user id. I have asked for changes to systemctl for years and they refuse to make any changes. So, you should use the service command unless systemd makes changes.

stevegrubb avatar May 05 '22 12:05 stevegrubb

Thanks for explaining! But systemctl kill auditd still allows to kill the daemon...

mikhailnov avatar May 16 '22 07:05 mikhailnov

That would be a bug in systemctl. They probably say they have to do this for emergency purposes on system shutdown.

stevegrubb avatar May 18 '22 12:05 stevegrubb

Ok. I see your point. Thanks for explaining.

mikhailnov avatar May 18 '22 23:05 mikhailnov

auditctl --signal stop was created earlier this year to avoid using the service command. This is the best we can do right now.

stevegrubb avatar Jul 27 '23 17:07 stevegrubb