9月
9
2006

サイバー攻撃対策w

昨日のエントリにあげた「サイバー攻撃」ですが、うちの鯖は
Telnetポートは閉めてるし、SFTPでの転送は鍵方式なので
問題ないものの、ウザいログが大量に残るのが嫌だなぁ程度に
思っていたところ、本日不正アクセスしてきたヤツのIPアドレスを
調べたら、僕が一番嫌いな国のIPアドレスだったので、
闘志に火がついて対策をする事にしましたw
 

 
1.SSH鯖の設定変更

 修正ファイル:
 /etc/ssh/sshd_config

 修正箇所:(/etc/ssh/sshd_config 内の該当箇所を修正)

1-1.SSH2のみで接続を許可
 #Protocol 2,1
 ↓
 Protocol 2
 
1-2.rootでのログインを禁止
 #PermitRootLogin yes
 ↓
 PermitRootLogin no
 
1-3.パスワードでのログインを禁止(鍵方式によるログインのみ許可)
 #PasswordAuthentication yes
 ↓
 PasswordAuthentication no
 
1-4.パスワードなしでのログインを禁止
 #PermitEmptyPasswords no
 ↓
 PermitEmptyPasswords no

 
2.アクセス制限の設定

 修正ファイル:
 /etc/hosts.allow
 /etc/hosts.deny

 修正箇所:(下記コマンドを実行)

2-1.内部(192.168.1.XXX)からのsshアクセスを許可
 
 > echo “sshd: 192.168.1.” >> /etc/hosts.allow
 
2-2.sshへの全てのアクセスを禁止
 
 > echo “sshd: ALL” >> /etc/hosts.deny

 
3.SSH鯖再起動

 > /etc/rc.d/init.d/sshd restart

 
4.結果
 これまで不正アクセスがあると、「/var/log/secure」に
 こんなログ(↓)が残っていたのですが
 Failed password for xxxx from xxx.xxx.xxx.xxx port xxxx ssh2

 こんな感じ(↓)に変わりました。
 refused connect from xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx)
 
 
【参考にさせて頂いたサイト】
≫Fedoraで自宅サーバー構築 – SSHサーバー構築(OpenSSH)
 
 

 


2024年4月
1234567
891011121314
15161718192021
22232425262728
2930  

Archives

Recommended