To guard against standard attacks by brute force, the program
sshguard and a firewall like pf are put together in use.
This is particularly useful when passwords are used as means of
authentication.
- Follow-up: Blacklistd
Build information
Ensure the following options:
1 | |
sshguard
The attack detection is done by parsing log files looking for failed
authentication or dubious messages in /var/log/auth.log,
/var/log/maillog, … and inserting if necessary entries in the
firewall (here using pf). It’s possible to whitelist hosts or network
by listing them in sshguard.whitelist.
1 2 3 | |
For example host used for remote management will be whitelisted:
1 2 | |
The sshguard service must be started at boot time:
1 | |
Firewall
The following lines are to be inserted in the /etc/pf.conf
file, they allow the creation of two tables, one myhosts used to
achieve a white list at the firewall level for ssh connctions, the
other sshguard (beware the name is hardcoded) is used by sshguard to
create its blacklist:
1 2 3 4 5 6 7 8 9 10 | |