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:
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
.
For example host used for remote management will be whitelisted:
The sshguard
service must be started at boot time:
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: