admin
Comments Off on limit ssh to specific hosts with firewalld (firewall-cmd)
and posted in Security And Hacking

Here is a little reminder on how to limit ssh (or any port really) to a specific IP using firewalld:

<code>
systemctl start firewalld.service
systemctl enable firewalld.service
firewall-cmd –zone=”trusted” –add-source=<external IP 1>
firewall-cmd –zone=”trusted” –add-source=<external IP 1> –permanent
firewall-cmd –zone=”trusted” –add-source=<external IP 2>
firewall-cmd –zone=”trusted” –add-source=<external IP 2> –permanent
firewall-cmd –zone=”trusted” –add-service=ssh
firewall-cmd –zone=”trusted” –add-service=ssh –permanent
firewall-cmd –zone=”trusted” –list-all
firewall-cmd –zone=public –remove-service=ssh
firewall-cmd –zone=public –remove-service=ssh –permanent
</code>

Comments are closed.