From 887fca86ec1684ffa119d3f19e8a4525bc65f907 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Sun, 10 May 2026 19:26:21 +0200 Subject: [PATCH] fix(fail2ban): escape % in 3x-ipl action date format (#4218) Fail2ban parses % as variable interpolation in action.d configs, so the unescaped %Y/%m/%d %H:%M:%S in the date command crashed fail2ban on startup. Double the %s in the heredoc so the rendered action file contains %% and fail2ban collapses it back to a literal % when invoking the shell command. --- DockerEntrypoint.sh | 4 ++-- x-ui.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DockerEntrypoint.sh b/DockerEntrypoint.sh index 4479a4c5..2e5dd750 100644 --- a/DockerEntrypoint.sh +++ b/DockerEntrypoint.sh @@ -43,10 +43,10 @@ actionstop = -D -p -j f2b- actioncheck = -n -L | grep -q 'f2b-[ \t]' actionban = -I f2b- 1 -s -j - echo "\$(date +"%Y/%m/%d %H:%M:%S") BAN [Email] = [IP] = banned for seconds." >> $LOG_FOLDER/3xipl-banned.log + echo "\$(date +"%%Y/%%m/%%d %%H:%%M:%%S") BAN [Email] = [IP] = banned for seconds." >> $LOG_FOLDER/3xipl-banned.log actionunban = -D f2b- -s -j - echo "\$(date +"%Y/%m/%d %H:%M:%S") UNBAN [Email] = [IP] = unbanned." >> $LOG_FOLDER/3xipl-banned.log + echo "\$(date +"%%Y/%%m/%%d %%H:%%M:%%S") UNBAN [Email] = [IP] = unbanned." >> $LOG_FOLDER/3xipl-banned.log [Init] name = default diff --git a/x-ui.sh b/x-ui.sh index 5cf41ca7..abba9226 100644 --- a/x-ui.sh +++ b/x-ui.sh @@ -2109,10 +2109,10 @@ actionstop = -D -p -j f2b- actioncheck = -n -L | grep -q 'f2b-[ \t]' actionban = -I f2b- 1 -s -j - echo "\$(date +"%Y/%m/%d %H:%M:%S") BAN [Email] = [IP] = banned for seconds." >> ${iplimit_banned_log_path} + echo "\$(date +"%%Y/%%m/%%d %%H:%%M:%%S") BAN [Email] = [IP] = banned for seconds." >> ${iplimit_banned_log_path} actionunban = -D f2b- -s -j - echo "\$(date +"%Y/%m/%d %H:%M:%S") UNBAN [Email] = [IP] = unbanned." >> ${iplimit_banned_log_path} + echo "\$(date +"%%Y/%%m/%%d %%H:%%M:%%S") UNBAN [Email] = [IP] = unbanned." >> ${iplimit_banned_log_path} [Init] name = default