VPS 上で CentOS 版 FileMaker Server を運用している。セキュリティー対策の一環として、ICMP(Internet Control Message Protocol)を拒否設定にすることにした。これで ping の応答を受け付けなくなるので、サーバーの存在を隠せる。
環境:
・Time4VPS「Linux 8」(CPU: 2 x 2.60 GHz、RAM: 8192 MB、Storage: 80 GB、Bandwidth: 8 TB、Port speed: 100 Mbps、Virtualization: KVM)、CentOS 7.8
・macOS Catalina Version 10.15.6(英語環境)から SSH 接続
(0)現在の IP アドレスに対して ping を打ってみる。
1 2 3 4 5 |
$ ping xxx.xx.xxx.xxx 64 bytes from xxx.xx.xxx.xxx: icmp_seq=0 ttl=45 time=400.347 ms 64 bytes from xxx.xx.xxx.xxx: icmp_seq=1 ttl=45 time=290.873 ms 64 bytes from xxx.xx.xxx.xxx: icmp_seq=2 ttl=45 time=544.085 ms ... |
やはり応答がある。
(1)firewalld が動いているかどうかを確認する。
1 2 3 |
# firewall-cmd --list-all --zone=public public (active) [以下省略] |
動いていた。
(2)以下のコマンドで ICMP を拒否設定にする。
1 2 3 4 5 |
# firewall-cmd --set-target=DROP --permanent success # firewall-cmd --reload success |
(3)再度 ping を打ってみる。
1 2 3 4 5 6 7 |
$ ping xxx.xx.xxx.xxx PING xxx.xx.xxx.xxx (xxx.xx.xxx.xxx): 56 data bytes Request timeout for icmp_seq 0 Request timeout for icmp_seq 1 Request timeout for icmp_seq 2 Request timeout for icmp_seq 3 ... |
ping の応答がなくなるようになった。
参考:
Linux/firewalld で ping を応答しないように設定する(target=REJECT/DROPの違い) | SEの道標
https://milestone-of-se.nesuke.com/sv-basic/linux-basic/drop-ping-on-linux/
CentOS8 の firewalld で ICMP だけをブロックする – らくがきちょう
https://sig9.hatenablog.com/entry/2020/11/04/000000
*
標準テキスト CentOS 8 構築・運用・管理パーフェクトガイド [CentOS Stream対応] | 大竹 龍史, 山本 道子, 河原木 忠司 | コンピュータ・IT | Kindleストア | Amazon
https://amzn.to/3eHwpbh