CentOS7でSSHにIP制限をかけたいのですが、
下記の設定では別のIPでもあっさりと接続できてしまいます。
何が間違っているのでしょうか。。?
環境:CensOS7
SSHポート:22から2222に変更
許可したいIP:XX.XX.XX.XX
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --permanent --add-port=2222/tcp firewall-cmd --remove-service=ssh --zone=public --permanent firewall-cmd --permanent --zone=public --add-rich-rule="rule family="ipv4" source address="XX.XX.XX.XX" port protocol="tcp" port="2222" accept" firewall-cmd --reload
追記
firewall-cmd --list-all
public (active) target: default icmp-block-inversion: no interfaces: eth0 sources: services: dhcpv6-client http https ports: 2222/tcp protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: rule family="ipv4" source address="XX.XX.XX.XX" port port="2222" protocol="tcp" accept
/etc/firewalld/zones/public.xml
xml
1<?xml version="1.0" encoding="utf-8"?> 2<zone> 3 <short>Public</short> 4 <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description> 5 <service name="dhcpv6-client"/> 6 <service name="http"/> 7 <service name="https"/> 8 <port protocol="tcp" port="2222"/> 9 <rule family="ipv4"> 10 <source address="XX.XX.XX.XX"/> 11 <port protocol="tcp" port="2222"/> 12 <accept/> 13 </rule> 14</zone>
回答1件
あなたの回答
tips
プレビュー