Latest posts by Michael Pietroforte (see all)
- Result of the 4sysops 2016 topic poll - Tue, Apr 5 2016
- New free eBooks for SysAdmins and DevOps – VMware NSX, Windows 10, SQL Server 2016 - Mon, Mar 14 2016
- Introducing the 4sysops IT pro network - Tue, Mar 1 2016
iptables is a tool for packet filtering and NAT. You can use it to setup a firewall with shell scripts. A shell script with just a few lines is enough to block an IP address attempting to establish too many connection within a certain time frame.
PAM (Pluggable Authentication Modules) is an API used by many Unix systems for authentication. Marius described how to use PAM to block the IP address of an attacker after three failed logon attempts on a ssh server.
fail2ban can be used to update firewall rules based on log files scans. Marius demonstrated how to secure an ssh server with fail2ban using iptables.
The last two options are certainly more sophisticated than the mere iptables solution. Unfortunately, it takes more time to configure them as you might have to install the tools first.
My favorite solution is fail2ban since you can use it with almost any application, plus there are packages for most Linux distributions. PAM is more difficult to setup as you probably will have to install it from sources.
Marius described the installation and configuration of all three options in detail: