I have some specific group/permissions set for my fail2ban.sock
file to make Zabbix able to monitor Fail2ban as described here https://github.com/hermanekt/zabbix-fail2ban-discovery-
I added the following lines to systemd service configuration to make sure the permissions will be correct after service restart:
[Service]
ExecStartPost=/bin/sh -c "while ! [ -S /run/fail2ban/fail2ban.sock ]; do sleep 1; done"
ExecStartPost=/bin/chgrp fail2ban /run/fail2ban/fail2ban.sock
ExecStartPost=/bin/chmod g+w /run/fail2ban/fail2ban.sock
It works perfectly when I'm trying to restart the service manually using systemctl restart fail2ban
. But for some reason, it does not work after the reboot.
I tried adding some debug lines to ExecStartPost
with dummy echo
and they are there, so ExecStartPost
actions are being executed. But looks like something else re-writes permission on boot.
Any ideas on how to troubleshoot?