Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Replaced "echo" with "printf" in actions. Fix #1839673
  • Loading branch information
lostcontrol committed Mar 4, 2008
1 parent 331ae71 commit 0afa6fb
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 32 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -37,6 +37,7 @@ ver. 0.8.2 (2008/??/??) - stable
fail2ban.conf.
- Added Mac OS/X startup script. Thanks to Bill Heaton.
- Absorbed some Debian patches. Thanks to Yaroslav Halchenko.
- Replaced "echo" with "printf" in actions. Fix #1839673

ver. 0.8.1 (2007/08/14) - stable
----------
Expand Down
6 changes: 3 additions & 3 deletions config/action.d/dummy.conf
Expand Up @@ -12,7 +12,7 @@
# Values: CMD
#
actionstart = touch /tmp/fail2ban.dummy
echo "<init>" >> /tmp/fail2ban.dummy
printf %%b "<init>\n" >> /tmp/fail2ban.dummy

# Option: actionstop
# Notes.: command executed once at the end of Fail2Ban
Expand All @@ -34,7 +34,7 @@ actioncheck =
# <time> unix timestamp of the ban time
# Values: CMD
#
actionban = echo "+<ip>" >> /tmp/fail2ban.dummy
actionban = printf %%b "+<ip>\n" >> /tmp/fail2ban.dummy

# Option: actionunban
# Notes.: command executed when unbanning an IP. Take care that the
Expand All @@ -44,7 +44,7 @@ actionban = echo "+<ip>" >> /tmp/fail2ban.dummy
# <time> unix timestamp of the ban time
# Values: CMD
#
actionunban = echo "-<ip>" >> /tmp/fail2ban.dummy
actionunban = printf %%b "-<ip>\n" >> /tmp/fail2ban.dummy

[Init]

Expand Down
2 changes: 1 addition & 1 deletion config/action.d/hostsdeny.conf
Expand Up @@ -34,7 +34,7 @@ actioncheck =
# Values: CMD
#
actionban = IP=<ip> &&
echo "ALL: $IP" >> <file>
printf %%b "ALL: $IP\n" >> <file>

# Option: actionunban
# Notes.: command executed when unbanning an IP. Take care that the
Expand Down
10 changes: 5 additions & 5 deletions config/action.d/mail-buffered.conf
Expand Up @@ -11,7 +11,7 @@
# Notes.: command executed once at the start of Fail2Ban.
# Values: CMD
#
actionstart = echo -en "Hi,\n
actionstart = printf %%b "Hi,\n
The jail <name> has been started successfully.\n
Output will be buffered until <lines> lines are available.\n
Regards,\n
Expand All @@ -22,14 +22,14 @@ actionstart = echo -en "Hi,\n
# Values: CMD
#
actionstop = if [ -f <tmpfile> ]; then
echo -en "Hi,\n
printf %%b "Hi,\n
These hosts have been banned by Fail2Ban.\n
`cat <tmpfile>`
Regards,\n
Fail2Ban"|mail -s "[Fail2Ban] <name>: Summary" <dest>
rm <tmpfile>
fi
echo -en "Hi,\n
printf %%b "Hi,\n
The jail <name> has been stopped.\n
Regards,\n
Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped" <dest>
Expand All @@ -48,10 +48,10 @@ actioncheck =
# <time> unix timestamp of the ban time
# Values: CMD
#
actionban = echo `date`": <ip> (<failures> failures)" >> <tmpfile>
actionban = printf %%b "`date`: <ip> (<failures> failures)\n" >> <tmpfile>
LINE=$( wc -l <tmpfile> | awk '{ print $1 }' )
if [ $LINE -eq <lines> ]; then
echo -en "Hi,\n
printf %%b "Hi,\n
These hosts have been banned by Fail2Ban.\n
`cat <tmpfile>`
\nRegards,\n
Expand Down
6 changes: 3 additions & 3 deletions config/action.d/mail-whois-lines.conf
Expand Up @@ -11,7 +11,7 @@
# Notes.: command executed once at the start of Fail2Ban.
# Values: CMD
#
actionstart = echo -en "Hi,\n
actionstart = printf %%b "Hi,\n
The jail <name> has been started successfully.\n
Regards,\n
Fail2Ban"|mail -s "[Fail2Ban] <name>: started" <dest>
Expand All @@ -20,7 +20,7 @@ actionstart = echo -en "Hi,\n
# Notes.: command executed once at the end of Fail2Ban
# Values: CMD
#
actionstop = echo -en "Hi,\n
actionstop = printf %%b "Hi,\n
The jail <name> has been stopped.\n
Regards,\n
Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped" <dest>
Expand All @@ -40,7 +40,7 @@ actioncheck =
# <bantime> unix timestamp of the ban time
# Values: CMD
#
actionban = echo -en "Hi,\n
actionban = printf %%b "Hi,\n
The IP <ip> has just been banned by Fail2Ban after
<failures> attempts against <name>.\n\n
Here are more information about <ip>:\n
Expand Down
6 changes: 3 additions & 3 deletions config/action.d/mail-whois.conf
Expand Up @@ -11,7 +11,7 @@
# Notes.: command executed once at the start of Fail2Ban.
# Values: CMD
#
actionstart = echo -en "Hi,\n
actionstart = printf %%b "Hi,\n
The jail <name> has been started successfully.\n
Regards,\n
Fail2Ban"|mail -s "[Fail2Ban] <name>: started" <dest>
Expand All @@ -20,7 +20,7 @@ actionstart = echo -en "Hi,\n
# Notes.: command executed once at the end of Fail2Ban
# Values: CMD
#
actionstop = echo -en "Hi,\n
actionstop = printf %%b "Hi,\n
The jail <name> has been stopped.\n
Regards,\n
Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped" <dest>
Expand All @@ -39,7 +39,7 @@ actioncheck =
# <time> unix timestamp of the ban time
# Values: CMD
#
actionban = echo -en "Hi,\n
actionban = printf %%b "Hi,\n
The IP <ip> has just been banned by Fail2Ban after
<failures> attempts against <name>.\n\n
Here are more information about <ip>:\n
Expand Down
6 changes: 3 additions & 3 deletions config/action.d/mail.conf
Expand Up @@ -11,7 +11,7 @@
# Notes.: command executed once at the start of Fail2Ban.
# Values: CMD
#
actionstart = echo -en "Hi,\n
actionstart = printf %%b "Hi,\n
The jail <name> has been started successfully.\n
Regards,\n
Fail2Ban"|mail -s "[Fail2Ban] <name>: started" <dest>
Expand All @@ -20,7 +20,7 @@ actionstart = echo -en "Hi,\n
# Notes.: command executed once at the end of Fail2Ban
# Values: CMD
#
actionstop = echo -en "Hi,\n
actionstop = printf %%b "Hi,\n
The jail <name> has been stopped.\n
Regards,\n
Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped" <dest>
Expand All @@ -39,7 +39,7 @@ actioncheck =
# <time> unix timestamp of the ban time
# Values: CMD
#
actionban = echo -en "Hi,\n
actionban = printf %%b "Hi,\n
The IP <ip> has just been banned by Fail2Ban after
<failures> attempts against <name>.\n
Regards,\n
Expand Down
10 changes: 5 additions & 5 deletions config/action.d/sendmail-buffered.conf
Expand Up @@ -11,7 +11,7 @@
# Notes.: command executed once at the start of Fail2Ban.
# Values: CMD
#
actionstart = echo -en "Subject: [Fail2Ban] <name>: started
actionstart = printf %%b "Subject: [Fail2Ban] <name>: started
From: Fail2Ban <<sender>>
To: <dest>\n
Hi,\n
Expand All @@ -25,7 +25,7 @@ actionstart = echo -en "Subject: [Fail2Ban] <name>: started
# Values: CMD
#
actionstop = if [ -f <tmpfile> ]; then
echo -en "Subject: [Fail2Ban] <name>: summary
printf %%b "Subject: [Fail2Ban] <name>: summary
From: Fail2Ban <<sender>>
To: <dest>\n
Hi,\n
Expand All @@ -35,7 +35,7 @@ actionstop = if [ -f <tmpfile> ]; then
Fail2Ban" | /usr/sbin/sendmail -f <sender> <dest>
rm <tmpfile>
fi
echo -en "Subject: [Fail2Ban] <name>: stopped
printf %%b "Subject: [Fail2Ban] <name>: stopped
From: Fail2Ban <<sender>>
To: <dest>\n
Hi,\n
Expand All @@ -57,10 +57,10 @@ actioncheck =
# <time> unix timestamp of the ban time
# Values: CMD
#
actionban = echo `date`": <ip> (<failures> failures)" >> <tmpfile>
actionban = printf %%b "`date`: <ip> (<failures> failures)\n" >> <tmpfile>
LINE=$( wc -l <tmpfile> | awk '{ print $1 }' )
if [ $LINE -eq <lines> ]; then
echo -en "Subject: [Fail2Ban] <name>: summary
printf %%b "Subject: [Fail2Ban] <name>: summary
From: Fail2Ban <<sender>>
To: <dest>\n
Hi,\n
Expand Down
6 changes: 3 additions & 3 deletions config/action.d/sendmail-whois-lines.conf
Expand Up @@ -11,7 +11,7 @@
# Notes.: command executed once at the start of Fail2Ban.
# Values: CMD
#
actionstart = echo -en "Subject: [Fail2Ban] <name>: started
actionstart = printf %%b "Subject: [Fail2Ban] <name>: started
From: Fail2Ban <<sender>>
To: <dest>\n
Hi,\n
Expand All @@ -23,7 +23,7 @@ actionstart = echo -en "Subject: [Fail2Ban] <name>: started
# Notes.: command executed once at the end of Fail2Ban
# Values: CMD
#
actionstop = echo -en "Subject: [Fail2Ban] <name>: stopped
actionstop = printf %%b "Subject: [Fail2Ban] <name>: stopped
From: Fail2Ban <<sender>>
To: <dest>\n
Hi,\n
Expand All @@ -45,7 +45,7 @@ actioncheck =
# <time> unix timestamp of the ban time
# Values: CMD
#
actionban = echo -en "Subject: [Fail2Ban] <name>: banned <ip>
actionban = printf %%b "Subject: [Fail2Ban] <name>: banned <ip>
From: Fail2Ban <<sender>>
To: <dest>\n
Hi,\n
Expand Down
6 changes: 3 additions & 3 deletions config/action.d/sendmail-whois.conf
Expand Up @@ -11,7 +11,7 @@
# Notes.: command executed once at the start of Fail2Ban.
# Values: CMD
#
actionstart = echo -en "Subject: [Fail2Ban] <name>: started
actionstart = printf %%b "Subject: [Fail2Ban] <name>: started
From: Fail2Ban <<sender>>
To: <dest>\n
Hi,\n
Expand All @@ -23,7 +23,7 @@ actionstart = echo -en "Subject: [Fail2Ban] <name>: started
# Notes.: command executed once at the end of Fail2Ban
# Values: CMD
#
actionstop = echo -en "Subject: [Fail2Ban] <name>: stopped
actionstop = printf %%b "Subject: [Fail2Ban] <name>: stopped
From: Fail2Ban <<sender>>
To: <dest>\n
Hi,\n
Expand All @@ -45,7 +45,7 @@ actioncheck =
# <time> unix timestamp of the ban time
# Values: CMD
#
actionban = echo -en "Subject: [Fail2Ban] <name>: banned <ip>
actionban = printf %%b "Subject: [Fail2Ban] <name>: banned <ip>
From: Fail2Ban <<sender>>
To: <dest>\n
Hi,\n
Expand Down
6 changes: 3 additions & 3 deletions config/action.d/sendmail.conf
Expand Up @@ -11,7 +11,7 @@
# Notes.: command executed once at the start of Fail2Ban.
# Values: CMD
#
actionstart = echo -en "Subject: [Fail2Ban] <name>: started
actionstart = printf %%b "Subject: [Fail2Ban] <name>: started
From: Fail2Ban <<sender>>
To: <dest>\n
Hi,\n
Expand All @@ -23,7 +23,7 @@ actionstart = echo -en "Subject: [Fail2Ban] <name>: started
# Notes.: command executed once at the end of Fail2Ban
# Values: CMD
#
actionstop = echo -en "Subject: [Fail2Ban] <name>: stopped
actionstop = printf %%b "Subject: [Fail2Ban] <name>: stopped
From: Fail2Ban <<sender>>
To: <dest>\n
Hi,\n
Expand All @@ -45,7 +45,7 @@ actioncheck =
# <time> unix timestamp of the ban time
# Values: CMD
#
actionban = echo -en "Subject: [Fail2Ban] <name>: banned <ip>
actionban = printf %%b "Subject: [Fail2Ban] <name>: banned <ip>
From: Fail2Ban <<sender>>
To: <dest>\n
Hi,\n
Expand Down

0 comments on commit 0afa6fb

Please sign in to comment.