Securing machine from any kind of SSH access
Try to locate the that whether you machine is set to accept all SSH connections under the IPTABLES rules.
Try to locate the following entry [if it exists in the list shown]
Just pick the row number of the entry [the first column,say its 4th],and then list it using
# iptables -L INPUT --line-numbers|grep ssh[will list all the rules applied to the incoming traffic over SSH]
Try to locate the following entry [if it exists in the list shown]
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:sshremove the entry as its defined to accept all the incoming traffic over SSH,and this is how to.
Just pick the row number of the entry [the first column,say its 4th],and then list it using
# iptables -L INPUT 4and then delete it using
# iptables -D INPUT 4Now to stop SSH to your machine,just fire the following command.
# iptables -A INPUT -p UDP --dport 22 -j REJECTSave the rules.
# iptables -A INPUT -p TCP --dport 22 -j REJECT
# service iptables saveRestart the service
# service iptables restartAll this could also have been done by just shutting down the SSH service,but the idea was to try hands at IPTABLES
Comments
Post a Comment