@@ -43,14 +43,10 @@ is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM'
4343case $chain in
4444 SSH) port=22; protocol=TCP ;;
4545 FTP) port=21; protocol=TCP ;;
46- MAIL) port=25 ; protocol=TCP ;;
46+ MAIL) port=' 25,465,587,2525,110,995,143,993 ' ; protocol=TCP ;;
4747 DNS) port=53; protocol=UDP ;;
48- HTTP) port=80; protocol=TCP ;;
49- HTTPS) port=443; protocol=TCP ;;
50- POP3) port=110; protocol=TCP ;;
51- IMAP) port=143; protocol=TCP ;;
52- MYSQL) port=3306; protocol=TCP ;;
53- POSTGRES) port=5432; protocol=TCP ;;
48+ WEB) port=' 80,443' ; protocol=TCP ;;
49+ DB) port=' 3306,5432' ; protocol=TCP ;;
5450 VESTA) port=8083; protocol=TCP ;;
5551 * ) check_args ' 2' " $# " ' CHAIN PORT' ;;
5652esac
5955$iptables -N fail2ban-$chain 2> /dev/null
6056if [ $? -eq 0 ]; then
6157 $iptables -A fail2ban-$chain -j RETURN
62- $iptables -I INPUT -p $protocol --dport $port -j fail2ban-$chain
58+
59+ # Adding multiport module
60+ if [[ " $port " =~ ,| -| : ]] ; then
61+ port_str=" -m multiport --dports $port "
62+ else
63+ port_str=" --dport $port "
64+ fi
65+ $iptables -I INPUT -p $protocol $port_str -j fail2ban-$chain
6366fi
6467
6568# Preserving chain
0 commit comments