複数の連続SSHセッションが原因で、「ssh_exchange_identification:読み取り:ピアによる接続のリセット」エラーが発生します。

複数の連続SSHセッションが原因で、「ssh_exchange_identification:読み取り:ピアによる接続のリセット」エラーが発生します。

rsync両方のコンピュータの特定のディレクトリにある特定のファイル形式を部分的に同期するための多くのコマンドを含むスクリプトがあります。どちらもUbuntuを持っています。

最初の数十のrsyncコマンドはスムーズに実行されますが、エラーが発生します。

rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.2]
ssh_exchange_identification: read: Connection reset by peer
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(235) [Receiver=3.1.2]
ssh_exchange_identification: read: Connection reset by peer
...

この問題は、短い時間内に複数の SSH 転送が原因で発生したようです。実際、sleep 6010個のrsyncコマンドごとに一度にいくつかのコマンドを入力すると、スクリプトは完全に実行されます。

この問題の原因が何であるかを知っている人はいますか?/etc/ssh/sshd_config両方のコンピュータ(および)MaxStartups MaxAuthTriesでいくつかの設定を変更してみましたが、MaxSessions問題は解決しません。たとえば、MaxStartups同時に確立された認証されていないSSH接続の数を制限することはこの質問とは無関係だと思いますが、私のスクリプトは順番に実行される一連のrsyncコマンドで構成されています(各セッションは次のセッションが終了する前に閉じられます)。開いた)。特定の時間内に SSH 接続数を制限する設定が見つかりません。

/var/log/auth.log有用な情報が含まれていないようです(最後に成功した接続と以前に失敗した接続に対応する出力のみが表示され、IPやその他の個人情報はマスクされます)。

Oct 15 15:58:15 localhostname systemd-logind[773]: New session 152 of user username.
Oct 15 15:58:25 localhostname sshd[31252]: Received disconnect from xxx.xxx.xxx.xxx port 2709:11: disconnected by user
Oct 15 15:58:25 localhostname sshd[31252]: Disconnected from user username xxx.xxx.xxx.xxx port 2709
Oct 15 15:58:25 localhostname sshd[31199]: pam_unix(sshd:session): session closed for user username
Oct 15 15:58:25 localhostname systemd-logind[773]: Session 152 logged out. Waiting for processes to exit.
Oct 15 15:58:25 localhostname systemd-logind[773]: Removed session 152.
Oct 15 15:58:25 localhostname sshd[31255]: Connection reset by xxx.xxx.xxx.xxx port 12951 [preauth]
Oct 15 15:58:25 localhostname sshd[31257]: Connection reset by xxx.xxx.xxx.xxx port 35552 [preauth]
Oct 15 15:58:25 localhostname sshd[31259]: Connection reset by xxx.xxx.xxx.xxx port 60391 [preauth]

どんな意見でも送っていただきありがとうございます。

ベストアンサー1

クライアントからサーバーへのTCP接続は、作成直後にリセットされるように見え、クライアントとサーバーの両方が相手方によって接続がリセットされたことを報告します。

この場合、ファイアウォールや一種のマルウェア/侵入検知ソフトウェアがこれらのTCP接続を妨げていると思われます。短時間に複数の接続が開いている場合にのみ発生する場合、これは制限速度の1つの形式であるか、保護ソフトウェアが探しているアクションの種類になる可能性があります。

おすすめ記事