
最近、1 台のサーバー (RHEL AS 5 を実行) を OpenSSH 4 サーバーから OpenSSH 5.2 サーバーにアップグレードしました。
アップグレード後、顧客はマシンからscpファイルを実行できなくなりました。http://www.ssh.com/ より問題なく、openssh を使用してマシンとの間でファイルを scp できます。
私たちは「公開鍵認証」を使用していますが、マシンへの ssh は可能ですが、scp ファイルは不可能です。
このような非互換性の原因として、何か明らかな原因は知られていますか? そうでない場合、この問題をさらに詳しく調べるにはどうすればよいでしょうか?
クライアント側からのログは次のとおりです。
user@srv/home/user> /usr/local/bin/scp -v [email protected]:/home/cdr/test .
scp:SshAppCommon/sshappcommon.c:133: Allocating global SshRegex context.
scp:Scp2/scp2.c:499: Received error "SSH_FC_OK"., msg: Globbing successful.
scp:Scp2/scp2.c:564: Starting transfer...
scp:/home/cdr/test
scp:SshFCTransfer/sshfc_transfer.c:3018: File list has 2 files.
scp:SshFCTransfer/sshfc_transfer.c:2567: Not yet connected, or connection down, waiting...
scp:SshFileCopy/sshfilecopy.c:940: Connecting to remote host. (host = xxx.xxx.xxx.51, user = cdr, port = NULL)
scp:Scp2/scp2.c:1679: argv[0] = /usr/local/bin/ssh2
scp:Scp2/scp2.c:1679: argv[1] = -l
scp:Scp2/scp2.c:1679: argv[2] = cdr
scp:Scp2/scp2.c:1679: argv[3] = -v
scp:Scp2/scp2.c:1679: argv[4] = -x
scp:Scp2/scp2.c:1679: argv[5] = -a
scp:Scp2/scp2.c:1679: argv[6] = -o
scp:Scp2/scp2.c:1679: argv[7] = clearallforwardings yes
scp:Scp2/scp2.c:1679: argv[8] = -o
scp:Scp2/scp2.c:1679: argv[9] = passwordprompt %U@%H's password:
scp:Scp2/scp2.c:1679: argv[10] = -o
scp:Scp2/scp2.c:1679: argv[11] = nodelay yes
scp:Scp2/scp2.c:1679: argv[12] = -o
scp:Scp2/scp2.c:1679: argv[13] = authenticationnotify yes
scp:Scp2/scp2.c:1679: argv[14] = xxx.xxx.xxx.51
scp:Scp2/scp2.c:1679: argv[15] = -s
scp:Scp2/scp2.c:1679: argv[16] = sftp
debug: Connecting to xxx.xxx.xxx.51, port 22... (SOCKS not used)
debug: Ssh2/ssh2.c:2121: Entering event loop.
debug: Ssh2Client/sshclient.c:1403: Creating transport protocol.
debug: SshAuthMethodClient/sshauthmethodc.c:83: Added "publickey" to usable methods.
debug: SshAuthMethodClient/sshauthmethodc.c:83: Added "password" to usable methods.
debug: Ssh2Client/sshclient.c:1444: Creating userauth protocol.
debug: client supports 2 auth methods: 'publickey,password'
debug: Ssh2Common/sshcommon.c:559: local ip = xxx.xxx.xxx.35, local port = 56985
debug: Ssh2Common/sshcommon.c:561: remote ip = xxx.xxx.xxx.51, remote port = 22
debug: SshConnection/sshconn.c:1930: Wrapping...
debug: Ssh2/ssh2.c:899: Opening /dev/tty for queries.
debug: Remote version: SSH-2.0-OpenSSH_5.2
debug: Ssh2Transport/trcommon.c:1306: Remote version has rekey incompatibility bug.
debug: Ssh2Transport/trcommon.c:1308: Remote version is OpenSSH, KEX guesses disabled.
debug: Ssh2Transport/trcommon.c:1647: lang s to c: `', lang c to s: `'
debug: Ssh2Transport/trcommon.c:1712: c_to_s: cipher aes128-cbc, mac hmac-sha1, compression none
debug: Ssh2Transport/trcommon.c:1715: s_to_c: cipher aes128-cbc, mac hmac-sha1, compression none
debug: Remote host key found from database.
debug: Ssh2Common/sshcommon.c:317: Received SSH_CROSS_STARTUP packet from connection protocol.
debug: Ssh2Common/sshcommon.c:367: Received SSH_CROSS_ALGORITHMS packet from connection protocol.
debug: server offers auth methods 'publickey,password,keyboard-interactive'.
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1535: adding keyfile "/devapp_users/nsdtest/.ssh2/nsdau187" to candidates
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1535: adding keyfile "/devapp_users/nsdtest/.ssh2/id_dsa_1024_a" to candidates
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1535: adding keyfile "/devapp_users/nsdtest/.ssh2/id_dsa_1024_b" to candidates
debug: Constructing and sending signature in publickey authentication.
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:772: ssh_client_auth_pubkey_send_signature: reading /devapp_users/nsdtest/.ssh2/nsdau187
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1751: Public key authentication was successful.
debug: Ssh2Common/sshcommon.c:285: Received SSH_CROSS_AUTHENTICATED packet from connection protocol.
debug: Ssh2/ssh2.c:650: Returning user input stream to original values.
debug: Ssh2Common/sshcommon.c:829: num_channels now 1
scp:SshFCTransfer/sshfc_transfer.c:130: Source file is "raw", and it needs to be parsed.
debug: SshTtyFlags/sshttyflags.c:354: Not a tty. (fd = 0)
scp:SshFCTransfer/sshfc_transfer.c:1319: No connection yet. Waiting...
scp:SshFileXferClient/sshfilexferc.c:981: ssh_file_client_receive_proc: bad VERSION
scp:SshFCTransfer/sshfc_transfer.c:1319: No connection yet. Waiting...
scp:SshFCTransfer/sshfc_transfer.c:1319: No connection yet. Waiting...
scp:SshFCTransfer/sshfc_transfer.c:1319: No connection yet. Waiting...
scp:SshFCTransfer/sshfc_transfer.c:1319: No connection yet. Waiting...
scp:SshFCTransfer/sshfc_transfer.c:1319: No connection yet. Waiting...
[...] same until the user presses Ctrl+C
user@srv/home/user> debug: SshConnection/sshconn.c:405: EOF from channel stream
debug: Ssh2ChannelSession/sshchsession.c:1721: received exit status : 0
debug: Ssh2Common/sshcommon.c:803: num_channels now 0
debug: Got session close with exit_status=0
debug: destroying client struct...
debug: Ssh2Client/sshclient.c:1478: Destroying client.
debug: SshConfig/sshconfig.c:555: Freeing pki. (host_pki != NULL, user_pki = NULL)
debug: SshConnection/sshconn.c:1982: Destroying SshConn object.
debug: Ssh2Client/sshclient.c:1540: Destroying client completed.
debug: SshAuthMethodClient/sshauthmethodc.c:88: Destroying authentication method array.
debug: SshAppCommon/sshappcommon.c:146: Freeing global SshRegex context.
debug: SshConfig/sshconfig.c:555: Freeing pki. (host_pki = NULL, user_pki = NULL)
そして、ここにサーバーログからのエントリがあります
Jun 3 07:22:36 localhost sshd[19898]: Accepted publickey for cdr from xxx.xxx.xx.x port 53119 ssh2
Jun 3 07:22:36 localhost sshd[19900]: subsystem request for sftp
Jun 3 07:22:58 localhost snmpd[8500]: netsnmp_assert index == tmp failed if-mib/data_access/interface.c:467 _access_interface_entry_save_name()
Jun 3 07:23:58 localhost last message repeated 4 times
編集: 「Subsystem sftp internal-sftp」は conf ファイルですでに有効になっており、問題なくサーバーからファイルを sftp できます。
編集: ユーザー名/パスワードを指定してキーなしで試しても機能しません。古いバージョンに戻すと機能するので、今のところはそれを実行します。
ところで、このラインを疑った
debug: SshTtyFlags/sshttyflags.c:354: Not a tty. (fd = 0)
シェルが何かを送信していて、それが ssh コンソールに表示されていて scp が混乱している可能性がありますが、ssh では何も送信されていないようです (.bashrc はクリーンなようです)。また、復号化された scp トラフィックを表示して、何かが誤って送信されているかどうかを確認することはできません。
答え1
「scp ファイルを実行できません」とはどういう意味ですか? 表示されるエラー メッセージは何ですか?
ログ (/var/log/syslog、/var/log/messages、/var/log/daemon.log) をチェックして、SSH サーバーがエラーをスローしているかどうかを確認します。ログには、かなり詳細な内容が記載されているはずです。ログと顧客のエラーがあれば、問題が何であるかを絞り込むことができるはずです。
編集
投稿されたログには、最も可能性の高い問題が示されています。
scp:Scp2/scp2.c:1679: argv[16] = sftp
...
scp:SshFileXferClient/sshfilexferc.c:981: ssh_file_client_receive_proc: 不正なバージョン
このものは、直接 scp ではなく sftp プロトコルを使用しようとしているようです。OpenSSH は、デフォルトでは sftp サブシステムを無効にします。この変更がいつ行われたかはわかりませんが、おそらくそうでしょう。これを sshd_config に追加して、変更があるかどうかを確認してください。
サブシステム sftp 内部 sftp
答え2
潜在的な問題はたくさんあります。まず、サーバーのログを調べて、何か手がかりがないか確認しましたか? アップグレードによって、クライアントが使用できない、または使用するように設定されていない設定が変更された可能性はありますか? たとえば、サーバーで SSH2 が必要になったのに、クライアントが SSH1 のみを使用しているなどです。
ログ ファイルが答えを見つける手がかりになる可能性が高いです。 SCP クライアントがログを記録できる場合は、それも役立つ可能性があります。
答え3
これは、修正された OpenSSH キーの脆弱性と関係がある可能性があります。脆弱なキーはすべてブラックリストに登録され、再作成する必要があります。サーバーのキャッシュされたフィンガープリントを削除できるかどうかを確認してください。これが完了すると、クライアントは新しいフィンガープリントをユーザーに表示し、受け入れるかどうかを尋ねます。SSH が機能する可能性がある理由は、アプリがユーザーに新しいキーを受け入れるかどうかを尋ねたか、アップグレード後に最初の接続が行われた可能性があるためです。
答え4
SSH クライアントの使用中に同じ問題が発生しました。バグ ログには次のように表示されます... FileTransferWin/filetransferwin.c:217: エラー SSH_FC_OK を受信しました。エラー メッセージ 転送するファイルがありません。
何時間にもわたる長い実験の後、SSH は、名前に特殊文字が使用されている (つまり、「Files to (Transfer)」) などのフォルダーからのファイル転送を好まないことがわかりました。フォルダー名を「Files_to_Transfer」に変更した後、正常に動作しました。