• 締切済み

Linux3.2 サーバーsecure logファイルについて

Linux3.2を見よう見まねで、中古パソコンにセットしてます。 接続環境 パソコン:IBM NETVISTA 回線so-netADSL ルータ Aterm WD701cv DMZ設定 以上の様な内容で、Linux3.2の/var/log/secureログを見ると apacheのトムキャット経由で、次のようなアクセスが、サーバーに頻繁に有るように残りますがこれは正常な状態か?不正な状態か教えていただきたいと思います。初歩的疑問で申し訳ありません。付けてファイアーウオールの勉強はどの辺から行けば良いかもお知らせいただけると助かります。ログの一部です。 Feb 2 06:41:18 anbaii sshd[9604]: error: Could not get shadow information for NOUSER Feb 2 06:41:18 anbaii sshd[9604]: Failed password for invalid user daniel from 221.8.71.36 port 49691 ssh2 Feb 2 06:41:19 anbaii sshd[9607]: Invalid user william from 221.8.71.36 Feb 2 06:41:19 anbaii sshd[9607]: error: Could not get shadow information for NOUSER Feb 2 06:41:19 anbaii sshd[9607]: Failed password for invalid user william from 221.8.71.36 port 49744 ssh2 Feb 2 06:41:20 anbaii sshd[9610]: Invalid user anthony from 221.8.71.36 Feb 2 06:41:20 anbaii sshd[9610]: error: Could not get shadow information for NOUSER Feb 2 06:41:20 anbaii sshd[9610]: Failed password for invalid user anthony from 221.8.71.36 port 49802 ssh2

みんなの回答

  • Wr5
  • ベストアンサー率53% (2177/4070)
回答No.1

ふつ~にsshブルートフォースアタック受けているだけに見えますが…。 http://www.google.co.jp/search?hl=ja&q=ssh+%E3%83%96%E3%83%AB%E3%83%BC%E3%83%88%E3%83%95%E3%82%A9%E3%83%BC%E3%82%B9&btnG=Google+%E6%A4%9C%E7%B4%A2&lr=lang_ja&aq=f&oq= 221.8.71.36はそのときのあなたのサーバのIPなんでしょうか? # 中国に割り当てのIPらしいので違うと思いますが… http://221.8.71.36/ でアクセスしたらApacheのページが表示されるから、「apacheのトムキャット経由で」と言っているのでしょうか? 管理の甘いサーバが乗っ取られて踏み台にされているだけ…かと思われます。 デフォルトページが表示される。って程度の管理の様ですし。 # 乗っ取られた後でセットされた可能性もありますが。 sshブルートフォースに対する対策は…検索すると見つかるでしょう。 ウチでは公開鍵認証とAllowUsersで制限していますが、ログがうるさくなるのでポートを変更しました。

関連するQ&A

  • リナックスで攻撃?されているログ

    勉強用に立ち上げたサーバーの/var/log/secureに下のようなメッセージがぶわ~っと出力されていたんですが、 これは攻撃を受けていると見てよいのでしょうか? 一つ一つポートをかえてきているようで、とはいってもたまたまヒットしてもパスワードまでは分からないと思うのですが、 何となく不気味です。。。 67427 Feb 4 23:47:22 username sshd[3466]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=217-168-44-137.static.cablecom.ch user=root 67428 Feb 4 23:47:25 username sshd[3466]: Failed password for root from 217.168.44.137 port 41281 ssh2 67429 Feb 4 23:47:25 username sshd[3467]: Received disconnect from 217.168.44.137: 11: Bye Bye 67430 Feb 4 23:47:27 username sshd[3468]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=217-168-44-137.static.cablecom.ch user=root 67431 Feb 4 23:47:29 username sshd[3468]: Failed password for root from 217.168.44.137 port 41641 ssh2 67432 Feb 4 23:47:29 username sshd[3469]: Received disconnect from 217.168.44.137: 11: Bye Bye 知識のある方ご教授いただければと思います。

  • /var/log/secureの時間表記について

    fedora8を使って、/var/log/secureで分からないことがあります。 Jun 1 19:19:06 localhost sshd[19307]: Invalid user stud from 219.94.169.111 Jun 1 10:19:06 localhost sshd[19308]: input_userauth_request: invalid user stud Jun 1 19:19:06 localhost sshd[19307]: pam_unix(sshd:auth): check pass; user unknown Jun 1 19:19:09 localhost sshd[19307]: Failed password for invalid user stud from 219.94.169.111 port 60107 ssh2 Jun 1 10:19:09 localhost sshd[19308]: Received disconnect from 219.94.169.111: 11: Bye Bye 上記のログで、なぜ一部の時間が9時間狂ってしまうのかがわかりません。原因がわかる方、ぜひ回答をお願いします。

  • linuxコマンド(時間の抽出について)

    ログに時間が記載されています。 現在時刻から5分以内のものをgrep等のコマンドを利用し抽出することは可能でしょうか? (シェルを利用する形になりますか?) よろしくお願いします。 例:secure_log May 30 20:41:14 linux sshd[26963]: Received disconnect from 10.0.0.1: 2: disconnected by server request May 30 20:51:40 linux sshd[27001]: Accepted password for linux from 10.0.0.1 port 3579 ssh2 May 30 20:53:42 linux sshd[27003]: Received disconnect from 10.0.0.1: 2: disconnected by server request May 31 08:39:10 linux sshd[27501]: Accepted password for linux from 10.32.27.98 port 1099 ss h2

  • ログデータが3行1セットで必ず出力される

    お世話になります。 logsurferというログ監視ソフトを使ってログデータファイルから使用したい分だけデータを切り出したいです、最初は一つだけのPCのログを監視して、トラブルがありませんでした。 今から二つPCのログを監視しますので、元のソースがデータを判断してから切り出しところがトラブルが発生する事をありました。 トラブルは前のログデータを来てからソースの判断の時間はログの時間により遅くて間に合わないから、判断しずにのまま、次のログデータを上書かされました。 前のソース: #!/usr/bin/perl ###################read testlog################################# open(LOGFILE,'/var/log/testlog'); @logarray=(0,<LOGFILE>); close(LOGFILE); while (defined($logarray[$i])){ if((index($logarray[$i],"sshd") ne -1) and (index($logarray[$i],"Failed") ne -1)){ #print $i," "; $tty=0; $lastfail=$i; }elsif((index($logarray[$i],"failure") ne -1) and (index($logarray[$i],"tty=tty") ne -1)){ $tty=1; $lastfail=$i; } #print index($logarray[$i],sshd)," "; #print index($logarray[$i],Failed),"\n"; $i++; } #print "1 ",$lastfail,"\n"; open OUT,">rensyu4.txt"; print OUT $logarray[$lastfail]; close OUT; 今の発想はログデータがそのまま別のファイルの書き込んで、そして、そのファイルから三行ずつ切り出して判断してから別のファイルに書き込みたいです。 今のソース: #!/usr/bin/perl ###################read testlog################################# open(LOGFILE,"/var/log/testlog"); open(OUT,">testlog.txt"); my $last_data; while (<LOGFILE>){ print OUT $_ if ($last_data ne $_); $last_data=$_; } close OUT; close(LOGFILE); open(TESTLOG,"testlog.txt"); @logarray=(0,<TESTLOG>); close(TESTLOG); while (defined($logarray[$i])){ if((index($logarray[$i],"sshd") ne -1) and (index($logarray[$i],"Failed") ne -1)){ #print $i," "; $tty=0; $lastfail=$i; }elsif((index($logarray[$i],"failure") ne -1) and (index($logarray[$i],"tty=tty") ne -1)){ $tty=1; $lastfail=$i; } #print index($logarray[$i],sshd)," "; #print index($logarray[$i],Failed),"\n"; $i++; } #print "1 ",$lastfail,"\n"; open OUT,">rensyu4.txt"; print OUT $logarray[$lastfail]; close OUT; ログデータ: May 13 17:55:57 fc4-03 sshd[1403]: error: Could not get shadow information for plan May 13 17:55:57 fc4-03 sshd[1403]: Failed password for plan from ::ffff:10.42.42.131 port 3040 ssh2 May 13 17:55:58 fc4-03 last message repeated 2 times May 13 17:56:03 fc4-03 sshd[1406]: error: Could not get shadow information for ougun May 13 17:56:03 fc4-03 sshd[1406]: Failed password for ougun from ::ffff:10.42.42.130 port 1398 ssh2 May 13 17:56:08 fc4-03 last message repeated 2 times May 13 17:56:09 fc4-03 sshd[1412]: error: Could not get shadow information for plan May 13 17:56:09 fc4-03 sshd[1412]: Failed password for plan from ::ffff:10.42.42.131 port 3041 ssh2 May 13 17:56:09 fc4-03 last message repeated 2 times May 13 17:56:19 fc4-03 sshd[1415]: error: Could not get shadow information for ougun May 13 17:56:19 fc4-03 sshd[1415]: Failed password for ougun from ::ffff:10.42.42.130 port 1399 ssh2 May 13 17:56:19 fc4-03 last message repeated 2 times ログデータファイルから三行1セットで切り出したいです。 どなたか教えて頂けると助かります、宜しくお願いします。

  • OpenSSHのアップグレード

    お世話になります。 OpenSSHの脆弱性を修正する新しいパッケージが出たため アップグレード作業を行ってみました。 turbopkgの使える環境だったためturbopkgでアップグレードしたのですが アップグレード完了後sshdを再起動しクライアントPCから SSHでリモート接続したところ、 接続はできるのですがパスワード認証で弾かれてしまいます。 この時コンソールからは同じユーザーで普通にログインすることができました。 /var/log/messages を見たところ Failed Password for ユーザー名 from クライアントPCのIP port 4605 というメッセージが記録されていました。 アップデート対象サーバーの以前のOpenSSHのバージョンは3.4です。 SSHでリモート接続ができるようになるには どのようなことをすればよろしいのでしょうか。 ご存知の方はご教授いただければと思います。

  • SSHをLDAPで認証

    SSHをLDAPを使って認証させたいのですが、上手くいきません・・・ /etc/passwdに登録してあるユーザはログイン可能なのですが、LDAPに登録してあるユーザではログインできません。以下、ログイン不能時のログです。 ※LDAPのログには、何も記述されていないので、そもそもSSHからLDAPサーバにアクセスできていないように思うのです。しかしながら、どうして良いか全く分からないため、皆様の知恵をお借りしたく。 --------log--------- Illegal user test from 127.0.0.1 May 11 10:13:07 Proxy sshd[23596]: PAM unable to dlopen(/lib/security/pam_ldap.so) May 11 10:13:07 Proxy sshd[23596]: PAM [dlerror: /lib/security/pam_ldap.so: undefined symbol: ber_pvt_opt_on] May 11 10:13:07 Proxy sshd[23596]: PAM adding faulty module: /lib/security/pam_ldap.so May 11 10:13:36 Proxy sshd[23596]: Failed password for illegal user test from 127.0.0.1 port 35168 ssh2 --------------------- /etc/pam.d/sshdに関しては、pam_ldapのソース内にあったものをそのまま流用しています。 ■基本情報 OS:Redhat 2.4.21-4.EL openldap-2.3.21 pam_ldap-182 nss_ldap-250 LDAPクライアント、サーバとも同一サーバ。

  • rootでのsshログインを許可したいのですが、何故か出来ません。

    rootでのsshログインを許可したいのですが、何故か出来ません。 sshサーバ環境 CentOS release 5.5 (Final) OpenSSH_4.3p2 sshサーバの「/etc/ssh/sshd_config」の内容は以下の通りです。 #「/etc/ssh/sshd_config」 Protocol 2,1 ListenAddress 0.0.0.0 SyslogFacility AUTHPRIV PermitRootLogin yes RSAAuthentication yes PubkeyAuthentication yes IgnoreRhosts yes PermitEmptyPasswords no PasswordAuthentication yes ChallengeResponseAuthentication no GSSAPIAuthentication yes GSSAPICleanupCredentials yes UsePAM yes AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL X11Forwarding yes Subsystem sftp /usr/libexec/openssh/sftp-server #---------- なお、その他の項目はコメントアウトされています。 調べてみますと「PermitRootLogin」をyesにしてsshdを再起動(/etc/rc.d/init.d/sshd restart)すれば良いとありますが、それでもrootでsshログインが出来ません。なお、一般ユーザではsshでログイン可能です。 sshdサーバでの「/var/log/secure」では、以下のようにあります。 Aug 27 16:52:22 hogehoge sshd[2543]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=xxx.com user=root Aug 27 16:52:25 hogehoge sshd[2543]: Failed password for root from xxx.xxx.xxx.xxx port 37192 ssh2 原因として何が考えられますでしょうか。

  • 不正アクセス対処法

    最近、頻繁に下記のようにアクセスされています。 相手は何かツールを使っているのでしょうか? 効果的な対処法を教えてください。 - SSHD Begin ------------------------ Failed logins from these: adm/password from ***.***.***.***: 2 Time(s) apache/password from ***.***.***.***: 1 Time(s) nobody/password from ***.***.***.***: 1 Time(s) operator/password from ***.***.***.***: 1 Time(s) root/password from ***.***.***.***: 59 Time(s) root/password from ***.**.***.**: 3 Time(s) root/password from **.***.***.***: 3 Time(s) **Unmatched Entries** Illegal user test from **.***.***.*** Illegal user guest from **.***.***.*** Illegal user admin from **.***.***.*** Illegal user admin from **.***.***.*** Illegal user user from **.***.***.*** Illegal user test from **.***.***.*** Illegal user patrick from ***.***.***.*** Illegal user patrick from ***.***.***.*** Illegal user rolo from ***.***.***.*** Illegal user iceuser from ***.***.***.*** Illegal user horde from ***.***.***.*** Illegal user cyrus from ***.***.***.*** Illegal user www from ***.***.***.***        .        .        . - SSHD End -------------------------

  • SSHに繋がらない

    SSHから接続できず、ユーザー認証でエラーになってしまいます。 何かわかる方がいらっしゃいましたら、どうか少し教えて頂けないでしょうか。 OSはCentOS 6.2 です。 -------------------------------------------------------------------- ■サーバー -------------------------------------------------------------------- ★設定 # vi /etc/ssh/sshd_conf > Port 22 > Protocol 2 > AllowTcpForwarding yes > GatewayPorts no > MaxAuthTries 6 > MaxSessions 10 > > ServerKeyBits 1024 > StrictModes yes > > SyslogFacility AUTHPRIV > LogLevel DEBUG3 > > PubkeyAuthentication yes > PasswordAuthentication no > PermitEmptyPasswords no > AuthorizedKeysFile .ssh/authorized_keys > > PermitRootLogin without-password > UsePrivilegeSeparation yes > > Subsystem sftp /usr/libexec/openssh/sftp-server > X11Forwarding no ★鍵を作成 # su user1 $ ssh-keygen -t rsa -b 1024 $ Generating public/private rsa key pair. $ Enter file in which to save the key (/user1/.ssh/id_rsa): $ Enter passphrase (empty for no passphrase): $ Enter same passphrase again: $ Your identification has been saved in /user1/.ssh/id_rsa. $ Your public key has been saved in /user1/.ssh/id_rsa.pub. $ The key fingerprint is: $ 50:4f:72:d4:0a:d6:d2:24:98:96:7b:xx:xx:xx:xx:xx user1@myhost.com $ The key's randomart image is: ★鍵の名前を変更 $ cd /home/user1/.ssh/ $ cp id_rsa.pub authorised_keys $ rm id_rsa.pub ★パーミッション確認 $ drwxr-xr-x. root root /etc/ssh $ -rw------- root root /etc/ssh/sshd_conf $ drwxr-xr-x. user1 user1 /home/user1 $ drwxr-xr-x user1 user1 /home/user1/.ssh $ -rw-r--r-- user1 user1 /home/user1/.ssh/authorised_keys ★再起動 # service sshd restart # Stopping sshd: OK ] # Starting sshd: OK ] -------------------------------------------------------------------- ■クライアント -------------------------------------------------------------------- Windows7 teraterm ポート:22 SSHバージョン:SSH2 ユーザー名・パスフレーズを入力し、「RSA/DSA鍵を使う」に上記で作った「id_rsa」プライベート鍵をセット。 エラーメッセージ:「SSH2自動ログインエラー:ユーザー認証が失敗しました」 -------------------------------------------------------------------- ■ ログ(/var/log/secure)抜粋 -------------------------------------------------------------------- Aug 6 17:57:26 localhost sshd[21819]: debug1: temporarily_use_uid: 0/0 (e=0/0) Aug 6 17:57:26 localhost sshd[21819]: debug1: trying public key file /user1/.ssh/authorized_keys Aug 6 17:57:26 localhost sshd[21819]: debug1: restore_uid: 0/0 Aug 6 17:57:26 localhost sshd[21819]: debug1: temporarily_use_uid: 0/0 (e=0/0) Aug 6 17:57:26 localhost sshd[21819]: debug1: trying public key file /user1/.ssh/authorized_keys Aug 6 17:57:26 localhost sshd[21819]: debug1: restore_uid: 0/0 Aug 6 17:57:26 localhost sshd[21819]: Failed publickey for user1 from yyy.yyy.yyy.yyy port 58193 ssh2 Aug 6 17:57:26 localhost sshd[21819]: debug3: mm_answer_keyallowed: key 0x7fc196d47cf0 is not allowed Aug 6 17:57:26 localhost sshd[21819]: debug3: mm_request_send entering: type 22 Aug 6 17:57:26 localhost sshd[21819]: debug3: mm_request_receive entering Aug 6 17:57:26 localhost sshd[21820]: debug2: userauth_pubkey: authenticated 0 pkalg ssh-rsa Aug 6 17:57:26 localhost sshd[21820]: debug3: Wrote 68 bytes for a total of 2633 Aug 6 17:57:26 localhost sshd[21820]: Connection closed by yyy.yyy.yyy.yyy ※yyy.yyy.yyy.yyyは、teratermでアクセスしたIPです。 -------------------------------------------------------------------- ■備考 -------------------------------------------------------------------- 「nmap localhost」は「22/tcp open ssh」ですが、 グローバルIPで「nmap xxx.xxx.xxx.xxx」すると、22番がリストに出ませんでした。 ルーター、iptables、ともにポートは開けています。 (念のため、「iptables」と「system-config-firewall」は停止しています。) ログを見ると、sshdまで到達しているように見えるのですが・・・。

  • sshd error: Bind to port 22 on 0.0.0.0 failed: Address already in use.

    外部ネットワークからsshでアクセスした際に結局接続できず、 port 22: Connection time out. のようになります。 サーバー側は、CentOS5.2でシステムログのSecureを見ると、次のようになります。 hosta sshd Server listening on :: port 22 hosta sshd error: Bind to port 22 on 0.0.0.0 failed: Address already in use. 内部ネットワーク内からはsshできました。 ルーターの設定がおかしいのでしょうか?

専門家に質問してみよう