As noted elsewhere, fail2ban
is responsible for banning IP Addresses
associated with disable user actions. This causes active sessions associated
with the disabled username/IP Address pair to timeout and eventually
terminate. New Splunk alerts should trigger causing further IP Addresses to
be logged (and banned) until all (or nearly all) sessions for IP Addresses
associated with the disabled user account are terminated.
NOTE: As of v0.2.0, brick
has the ability to perform session termination
using the official ezproxy
binary's kill
subcommand. This support can be
used alongside fail2ban
or in place of it.
The directions in this doc assume that you wish to either use both methods to
control user sessions or that you will use fail2ban
exclusively for this
purpose.
- your EZproxy server is a Debian-based Linux system.
- substitute with the appropriate package manager for your Linux
distribution (e.g., replace
apt-get
withyum
).
- substitute with the appropriate package manager for your Linux
distribution (e.g., replace
- your EZproxy server is not a Windows system.
- Note: Windows is not a supported platform at this time.
- your EZproxy server does not already have
fail2ban
installed - you are going to test these (and all other setup instructions) in a test
environment first before deploying to production
- sorry, had to say it!
- your EZproxy server has a local Postfix (or other SMTP server) installation
configured to accept mail on localhost and forward to a central relay or
remote SMTP server
- if this isn't the case, you will need to modify the
fail2ban
configuration files provided by this project to use another mail server
- if this isn't the case, you will need to modify the
- Install
fail2ban
and dependencies - Modify copies of the config files provided by this project
- Deploy your copies of the config files (modified and not)
- Restart
fail2ban
to confirm there are no configuration errors- potential immediate error output to screen
- potential error output caught by systemd
sudo systemctl status fail2ban
- Review
/var/log/fail2ban.log
for potential issues
-
Install
fail2ban
and dependencies by: -
sudo apt-get update
-
sudo apt-get install fail2ban geoip-bin geoip-database geoip-database-extra sqlite3
sqlite3
is not strictly required, but may be used when troubleshooting in order to interact with the SQLite database used byfail2ban
Modify contrib/fail2ban/jail.local
file provided by this project:
- update
ignoreip
with a space-separated list of IP Addresses that should not be banned byfail2ban
- this is a different setting, entirely separate from
brick
's built-in support to ignore specific IP Addresses - this setting should be seen as a safety net; while
brick
can be configured to ignore individual IP Addresses, it does not currently support ignoring an entire range
- this is a different setting, entirely separate from
- update
logpath
if you have opted to change the reported users log file path from the default of/var/log/brick/users.brick-reported.log
- update
bantime
to match the EZproxyMaxLifetime
setting + some padding- e.g.,
MaxLifetime
setting is30
, so we use2100
(seconds) to indicate 35 minutes (for 30 minutesMaxLifetime
+5 minutes padding)
- e.g.,
- update
destemail
to reflect the email address that should receive email alerts- suggestion: set this to your ticketing system's intake email address
- update
sender
to reflect the fully-qualified email address/alias that bounce notifications should be sent to (if there is a problem delivering mail todestemail
) - update
sendername
to whatever name you wish to havefail2ban
notifications use- e.g.,
fail2ban on EZproxy server
- e.g.,
Review the contrib/fail2ban/action.d/sendmail-geoip-lines.local
file and
make any desired changes to the email template (e.g, add Redmine ticket
routing keywords).
Deploy your copies of the config files (modified and not) provided by this project:
contrib/fail2ban/jail.local
contrib/fail2ban/action.d/sendmail-common.local
contrib/fail2ban/action.d/sendmail-geoip-lines.local
contrib/fail2ban/filter.d/brick.local
WARNING: If you already have a fail2ban
instance on your EZproxy server
you will need to merge the new settings with the previous; dropping in the new
contrib/fail2ban/jail.local
file is intended as a safe action, but at
present at least one setting (action_mgl
) will conflict with local settings.
See GH-28 for additional information.
Restart fail2ban
to confirm there are no configuration errors.
Caution:
- Keep a SSH session going in case you forget to whitelist your sysadmin workstation's IP and somehow trip a rule somewhere that would match your IP
- Make sure you inserted critical/related IP Addresses and ranges in the
ignoreip
config setting mentioned earlier
Review /var/log/fail2ban.log
for any errors, warnings or other details of
note.