#684665 fail2ban: make the mail more helpful if whois is not installed

Package:
fail2ban
Source:
fail2ban
Submitter:
"Philip Hands"
Date:
2026-09-07 15:37:04 UTC
Severity:
wishlist
Tags:
#684665#5
Date:
2012-08-12 16:25:51 UTC
From:
To:
If one doesn't have whois installed, then one gets mails of the form:

=-=-=-=-
  The IP 11.22.33.44 has just been banned by Fail2Ban after
  3 attempts against FreeSwitch.

  Here are more information about 11.22.33.44:

  Regards,

  Fail2Ban
=-=-=-=-

you could make the mail more useful bu replacing the

  /usr/bin/whois <IP>

bit in /etc/fail2ban/action.d/sendmail-whois-lines.conf with something like this:

  /usr/bin/whois <IP> || echo "  [You need to install whois for this bit to work]"

although that will erroniously add the message if whois exists but returns
an error, so you might want to go for the more correct, but longer:

  [ -e /usr/bin/whois ] && { /usr/bin/whois <IP> ; true ; } || echo "  [You need to install whois for this bit to work]"

Oh, and while you're at it, that should read "here _is_ more information
about ..."  (rather than "here _are_ ...").

Cheers, Phil.