スポンサーサイト

2023.04.20 Thursday
0

    一定期間更新がないため広告を表示しています

    category:- | by:スポンサードリンク | - | - | -

    特定のipアドレスを iptables で遮断する

    2017.05.03 Wednesday 20:16
    0
      特定のipアドレスを iptables で遮断する
      centosの secureログでかくなりすぎてなにだ?と思ったら
      中国のサーバーから rootでのログインこころみる回数が数秒おきにおこっていて
      そのログイン失敗ログがあふれていたためでした
      よってipアドレスを iptables で遮断するときの作業メモ


      実際に来てたログ
      17:28:39 localhost sshd[50155]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
      17:28:41 localhost sshd[50155]: Failed password for root from 61.177.172.26 port 38041 ssh2
      17:28:41 localhost sshd[50155]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
      17:28:43 localhost sshd[50155]: Failed password for root from 61.177.172.26 port 38041 ssh2
      17:28:43 localhost sshd[50155]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"

      ★★ログ
      ★★事前の状態確認
      [root@xxxxxserver etc]# iptables -L
      Chain INPUT (policy ACCEPT)
      target prot opt source destination

      ★★ipアドレス、第1,2,3オクテットまで指定ありで 第4オクテットをすべて禁止した
      つまり61.177.172.〜 配下全部NGに変更した
      [root@xxxxxserver etc]# iptables -I INPUT -s 61.177.172.0/24 -j DROP

      ★★状態確認
      [root@xxxxxserver etc]# iptables -L
      Chain INPUT (policy ACCEPT)
      target prot opt source destination
      DROP all -- 61.177.172.0/24 anywhere ★1行目 今回追加
      DROP all -- 61.177.0.0/16 anywhere ★2行目 前回追加

      ★★状態確認
      [root@xxxxxserver etc]# iptables -L
      Chain INPUT (policy ACCEPT)
      target prot opt source destination
      DROP all -- 61.177.172.0/24 anywhere

      ★★ iptableコマンドでとりけすときは、追加された行ナンバーをしていする
      [root@xxxxxserver etc]# iptables -D INPUT 1
      category:コマンド | by:ittoocomments(0)trackbacks(0) | -

      ad
      Calender
       123456
      78910111213
      14151617181920
      21222324252627
      28293031   
      << May 2017 >>
      Selected entry
      PR
      Category
      Archives
      Recommend
      Link
      Profile
      Search
      Others
      Mobile
      qrcode
      Powered
      無料ブログ作成サービス JUGEM