1
0
Fork 0
knowledge-base/KB/Linux/Server/sshguard-iptables/sshguard-iptables

15 lines
409 B
Bash

#!/usr/bin/env bash
echo "Applying iptables rules for sshguard";
# IPv4
iptables -N sshguard;
iptables -A INPUT -m multiport -p tcp --destination-ports 22,2222 -j sshguard;
iptables-save > /etc/iptables/iptables.rules;
# IPv6
ip6tables -N sshguard;
ip6tables -A INPUT -m multiport -p tcp --destination-ports 22,2222 -j sshguard;
ip6tables-save > /etc/iptables/ip6tables.rules;
systemctl restart sshguard;