パブリックネットワーク上で複製されたEC2サーバーにSSH経由で接続できません。 [閉じる]

パブリックネットワーク上で複製されたEC2サーバーにSSH経由で接続できません。 [閉じる]

AMIイメージを使用して新しいAWS EC2インスタンスを作成し、必要に応じて設定した後、イメージを保存しました(この名前はsvr01)。その後、同じイメージを使用して別のEC2インスタンスを作成しました。svr02)。どちらのインスタンスにもElastic IPがあり、外部ホスティングゾーンにエントリがあり、DNSルックアップとICMPトラフィックが正しく機能します。また、プライベートIPを使用して内部プライベートゾーンにサーバーのDNSレコードを作成し、DNS / ICMPはプライベートゾーン内でうまく機能します。

これは奇妙な部分です。 svr01とsvr02を再起動しましたが、両方が表示されましたが、外部SSHからのみsvr01に接続できるようになりました。 svr02が中断されます。以下はSSH接続試行、非常に詳細な出力です。

me$ ssh -vvv svr02.mydomain.tld
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/me/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to svr02.mydomain.tld [123.123.123.123] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/Users/me/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /Users/me/.ssh/id_rsa type 1
debug1: identity file /Users/me/.ssh/id_rsa-cert type -1
debug1: identity file /Users/me/.ssh/id_dsa type -1
debug1: identity file /Users/me/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH*
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "svr02.mydomain.tld" from file "/Users/me/.ssh/known_hosts"
debug3: load_hostkeys: found key type RSA in file /Users/me/.ssh/known_hosts:21
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],ssh-rsa
debug1: SSH2_MSG_KEXINIT sent

これでsvr01にログインでき、svr01からsvr02にログインできます(外部からログインするときに使用しようとしたのと同じアカウントを使用)。そこで、外部SSHでログインしようとしたときにログを見て、次のことを見つけました。

Feb 23 21:40:49 svr02 sshd[2608]: debug1: Forked child 2647.
Feb 23 21:40:49 svr02 sshd[2647]: Set /proc/self/oom_score_adj to 0
Feb 23 21:40:49 svr02 sshd[2647]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
Feb 23 21:40:49 svr02 sshd[2647]: debug1: inetd sockets after dupping: 3, 3
Feb 23 21:40:49 svr02 sshd[2647]: Connection from 75.172.150.140 port 57827 on 172.31.29.9 port 22
Feb 23 21:40:49 svr02 sshd[2647]: debug1: Client protocol version 2.0; client software version OpenSSH_6.2
Feb 23 21:40:49 svr02 sshd[2647]: debug1: match: OpenSSH_6.2 pat OpenSSH* compat 0x04000000
Feb 23 21:40:49 svr02 sshd[2647]: debug1: Enabling compatibility mode for protocol 2.0
Feb 23 21:40:49 svr02 sshd[2647]: debug1: Local version string SSH-2.0-OpenSSH_6.6.1
Feb 23 21:40:49 svr02 sshd[2647]: debug1: SELinux support disabled [preauth]
Feb 23 21:40:49 svr02 sshd[2647]: debug1: permanently_set_uid: 74/74 [preauth]
Feb 23 21:40:49 svr02 sshd[2647]: debug1: list_hostkey_types: ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519 [preauth]
Feb 23 21:40:49 svr02 sshd[2647]: debug1: SSH2_MSG_KEXINIT sent [preauth]
Feb 23 21:40:49 svr02 sshd[2647]: debug1: SSH2_MSG_KEXINIT received [preauth]
Feb 23 21:40:49 svr02 sshd[2647]: debug1: kex: client->server aes128-ctr [email protected] none [preauth]
Feb 23 21:40:49 svr02 sshd[2647]: debug1: kex: server->client aes128-ctr [email protected] none [preauth]
Feb 23 21:40:49 svr02 sshd[2647]: debug1: kex: diffie-hellman-group-exchange-sha256 need=16 dh_need=16 [preauth]
Feb 23 21:40:49 svr02 sshd[2647]: debug1: kex: diffie-hellman-group-exchange-sha256 need=16 dh_need=16 [preauth]
Feb 23 21:40:51 svr02 sshd[2647]: Connection closed by 75.172.150.140 [preauth]
Feb 23 21:40:51 svr02 sshd[2647]: debug1: do_cleanup [preauth]
Feb 23 21:40:51 svr02 sshd[2647]: debug1: do_cleanup
Feb 23 21:40:51 svr02 sshd[2647]: debug1: Killing privsep child 2648

複製されたイメージなので、同じキーを使うように愚かなことではないかと思いましたが/etc/ssh/ssh_host_rsa_key違います。

セキュリティグループを除外するために、すべてのトラフィックの入出力を制限なく許可するグループに一時的に追加しました。

誰にもアイデアがありますか?

修正する

だから、この投稿を書いて数時間放置してから今すぐログインして問題を解決しました。

ベストアンサー1

おすすめ記事