############################################## # # # Allow SSH in IPTables # # Author: Taylor Bockman # # # # # ############################################## echo "SSH Port:" read sshport echo "Interface: " read interface # Allow incoming SSH sudo iptables -A INPUT -i $interface -p tcp --dport $sshport -m state --state NEW,ESTABLISHED -j ACCEPT -m comment --comment "SSH Incoming" sudo iptables -A OUTPUT -o $interface -p tcp --sport $sshport -m state --state ESTABLISHED -j ACCEPT -m comment --comment "SSH Incoming" # Allow outgoing SSH sudo iptables -A OUTPUT -o $interface -p tcp --dport $sshport -m state --state NEW,ESTABLISHED -j ACCEPT -m comment --comment "SSH Outgoing" sudo iptables -A INPUT -i $interface -p tcp --sport $sshport -m state --state ESTABLISHED -j ACCEPT -m comment --comment "SSH Outgoing" echo "Completed opening up SSH on interface $interface, port $sshport."