Closed Omniflux closed 5 years ago
Hi Omniflux,
i copy paste your howto in README file. Thanks for your fix!
@Omniflux @hermanekt
I guess the issue is not completely resolved.
I added these lines to my service configuration and it works when restarting the service manually with systemctl restart fail2ban
.
BUT after reboot socket got recreated and permissions got back to defaults again.
Made some troubleshooting but no luck yet.
I was not able to figure out why it is happening, but it works when move these commands to a separate script and call it from systemd
unit:
[Service]
ExecStartPost=/usr/bin/bash -c "/lib/systemd/system/fail2ban-fix-socket-permissions.sh"
fail2ban-fix-socket-permissions.sh:
#!/bin/bash
while ! [ -S /run/fail2ban/fail2ban.sock ]; do sleep 1; done
/bin/chgrp fail2ban /run/fail2ban/fail2ban.sock
/bin/chmod g+w /run/fail2ban/fail2ban.sock
Do not forget to make chmod +x /lib/systemd/system/fail2ban-fix-socket-permissions.sh
Works perfectly now.
The installation instructions cover changing the fail2ban socket permissions for access as a non root user, however these changes are lost the next time the socket is created.
To persist on a system where fail2ban is managed by systemd, add the following to the fail2ban service override file
systemctl edit fail2ban