不正アクセス対策
logwatchから送られるメールを毎日確認することが、最低限のサーバー管理者の責任ですよね。
以前、サーバ管理者としてなんやらと、知らないおじさんにメールで怒られたことがある私は少し気を使って、ログは見てますw
以前のMYサーバーは、sshの22番ポートは閉じていました。
ですので、sshからの不正なアタックは一切ありませんでした。
しかし、ラックスペース(クラウドサーバ)はデフォルトで、22番ポートが空いていたのでそのままにしていました。
ちょこちょこ、不正アクセスもありましたが気にしていませんでした。
しかし、、、
昨日のログ
--------------------- pam_unix Begin ------------------------
sshd:
Authentication Failures:
unknown (ip-174-142-75-230.static.privatedns.com): 19002 Time(s)
root (ip-174-142-75-230.static.privatedns.com): 2995 Time(s)
unknown (66.63.2d.static.xlhost.com): 151 Time(s)
unknown (61.151.246.140): 93 Time(s)
root (66.63.2d.static.xlhost.com): 66 Time(s)
mysql (ip-174-142-75-230.static.privatedns.com): 44 Time(s)
apache (ip-174-142-75-230.static.privatedns.com): 33 Time(s)
news (ip-174-142-75-230.static.privatedns.com): 29 Time(s)
daemon (ip-174-142-75-230.static.privatedns.com): 28 Time(s)
nobody (ip-174-142-75-230.static.privatedns.com): 28 Time(s)
games (ip-174-142-75-230.static.privatedns.com): 27 Time(s)
ftp (ip-174-142-75-230.static.privatedns.com): 26 Time(s)
bin (ip-174-142-75-230.static.privatedns.com): 24 Time(s)
operator (ip-174-142-75-230.static.privatedns.com): 15 Time(s)
root (61.151.246.140): 7 Time(s)
mail (ip-174-142-75-230.static.privatedns.com): 5 Time(s)
mysql (61.151.246.140): 5 Time(s)
svn (61.151.246.140): 5 Time(s)
halt (ip-174-142-75-230.static.privatedns.com): 4 Time(s)
adm (ip-174-142-75-230.static.privatedns.com): 3 Time(s)
gopher (ip-174-142-75-230.static.privatedns.com): 3 Time(s)
mysql (66.63.2d.static.xlhost.com): 3 Time(s)
ftp (66.63.2d.static.xlhost.com): 1 Time(s)
lp (ip-174-142-75-230.static.privatedns.com): 1 Time(s)
mailnull (ip-174-142-75-230.static.privatedns.com): 1 Time(s)
smmsp (ip-174-142-75-230.static.privatedns.com): 1 Time(s)
sync (ip-174-142-75-230.static.privatedns.com): 1 Time(s)
uucp (ip-174-142-75-230.static.privatedns.com): 1 Time(s)
Invalid Users:
Unknown Account: 19246 Time(s)
Bad User: $changeme$: 7 Time(s)
Bad User: !@#$%: 5 Time(s)
Bad User: !@#$%^: 5 Time(s)
Bad User: !@#$%^&: 5 Time(s)
Bad User: !@#$%^&*: 5 Time(s)
Bad User: *: 5 Time(s)
Bad User: @#$%^&: 5 Time(s)
Bad User: : 3 Time(s)
Bad User: ';lkjhgfdsa: 3 Time(s)
Bad User: ][poiuytrewq: 3 Time(s)
Bad User: !7350r13r0: 2 Time(s)
Bad User: !front1er: 2 Time(s)
Bad User: #no641t3mp: 2 Time(s)
Bad User: @d4h0st: 2 Time(s)
Bad User: @dm!n: 2 Time(s)
Bad User: @dm1n: 2 Time(s)
Bad User: @dmin: 2 Time(s)
Bad User: @l!@s: 2 Time(s)
Bad User: @l1@s: 2 Time(s)
Bad User: [fyl.rbyj: 2 Time(s)
Bad User: [jhjijnjrfr: 2 Time(s)
Bad User: `123: 2 Time(s)
Bad User: !hasenfratz: 1 Time(s)
Bad User: !rc: 1 Time(s)
Bad User: !rcd: 1 Time(s)
Bad User: $postgres$: 1 Time(s)
Bad User: -=\-=\=-0: 1 Time(s)
Bad User: @: 1 Time(s)
Bad User: @01: 1 Time(s)
Bad User: @dm1n1str@t0r: 1 Time(s)
Bad User: @m3r1c@: 1 Time(s)
Bad User: @n0nym0us: 1 Time(s)
Bad User: @r0und: 1 Time(s)
Bad User: @thl0n: 1 Time(s)
Bad User: ]': 1 Time(s)
Bad User: `1234567890-=\qwertyuiop[]: 1 Time(s)
19002件の不正アクセスって、ちょっと勘弁してくださいよ。
パスワードは、ハッシュ値を使っているので、割られることはないでしょうが、ちょっと気持ち悪いですね。
ですので、ポート変更をおこないます。
設定変更
sshポート番号22を変更します。
ポート番号は、正直なんでもいいのですがウェルノウン・ポートではなくレジスタードポート番号を使いましょう。
↓一覧
http://fula.jp/blog/index.php?mode=html&cat=port2
ファイアーフォールの設定
sshで使うポートを開けましょう。
http://d.hatena.ne.jp/rackspace/20100130/1264824044
設定後
明日が楽しみです!