From 198b7358942ae3852daf9d498a962434183198b9 Mon Sep 17 00:00:00 2001 From: Cuong Dong <809166+gineer01@users.noreply.github.com> Date: Fri, 20 Sep 2024 14:44:02 -0700 Subject: [PATCH] Update run to make fail2ban.local consistent with jail.local Updating /config/fail2ban/jail.local will update its copy in /etc/fail2ban/. Users would expect the same behavior with fail2ban.local --- root/etc/s6-overlay/s6-rc.d/init-fail2ban-config/run | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-fail2ban-config/run b/root/etc/s6-overlay/s6-rc.d/init-fail2ban-config/run index 6022729d..2eaf61b4 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-fail2ban-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-fail2ban-config/run @@ -17,6 +17,10 @@ cp -R /defaults/fail2ban/action.d /config/fail2ban/ if [[ ! -f /config/fail2ban/jail.local ]]; then cp /defaults/fail2ban/jail.local /config/fail2ban/jail.local fi +# if fail2ban.local is missing in /config, copy default +if [[ ! -f /config/fail2ban/fail2ban.local ]]; then + cp /defaults/fail2ban/fail2ban.local /config/fail2ban/fail2ban.local +fi # Replace fail2ban config with user config if [[ -d /etc/fail2ban/filter.d ]]; then rm -rf /etc/fail2ban/filter.d @@ -26,7 +30,7 @@ if [[ -d /etc/fail2ban/action.d ]]; then fi cp -R /config/fail2ban/filter.d /etc/fail2ban/ cp -R /config/fail2ban/action.d /etc/fail2ban/ -cp /defaults/fail2ban/fail2ban.local /etc/fail2ban/ +cp /config/fail2ban/fail2ban.local /etc/fail2ban/fail2ban.local cp /config/fail2ban/jail.local /etc/fail2ban/jail.local # logfiles needed by fail2ban