Score:0

Why is this SSH handshake failing?

ธง sa

The server logs this

2021-12-07 21:57:29.889029102  Server listening on 0.0.0.0 port 2222.
2021-12-07 21:57:29.889033114  Server listening on :: port 2222.
2021-12-07 21:57:30.635958078  Connection from 172.17.0.1 port 56406 on 172.17.0.3 port 2222 rdomain ""
2021-12-07 21:57:30.636572922  kex_exchange_identification: Connection closed by remote host
2021-12-07 21:57:30.637124145  Connection closed by 172.17.0.1 port 56406
2021-12-07 21:57:30.653516584  Connection from 172.17.0.1 port 56408 on 172.17.0.3 port 2222 rdomain ""
2021-12-07 21:57:30.656432406  Unable to negotiate with 172.17.0.1 port 56408: no matching host key type found. Their offer: ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 [preauth]

This shows the client offers ecdsa-sha2-nistp384

The server configuration is as follows

> cat /etc/ssh/sshd_config | grep -v "#" | grep -v -e '^$'
AuthorizedKeysFile  .ssh/authorized_keys
PasswordAuthentication yes
AllowTcpForwarding no
GatewayPorts no
X11Forwarding no
PidFile /config/sshd.pid
Subsystem   sftp    /usr/lib/ssh/sftp-server -u 022
Ciphers aes128-ctr,aes192-ctr,aes256-ctr
HostKeyAlgorithms ecdsa-sha2-nistp384
KexAlgorithms diffie-hellman-group-exchange-sha1
MACs hmac-sha2-512,hmac-sha2-256,hmac-sha1
LogLevel VERBOSE

This shows that HostKeyAlgorithms ecdsa-sha2-nistp384 is enabled on the server. Why can't they perform the handshake?

vn flag
บนเซิร์ฟเวอร์มี `/etc/ssh/ssh_host_ecdsa_key` อยู่หรือไม่ เป็น 384 บิต (`ssh-keygen -l -f /etc/ssh/ssh_host_ecdsa_key`) หรือไม่ ไม่ใช่กลุ่ม / เข้าถึงได้ทั่วโลก (`ls -l /etc/ssh/ssh_host_ecdsa_key`)
Brandon Xavier avatar
us flag
คุณอาจต้องการลองเพิ่มคำฟุ่มเฟือยในฝั่งไคลเอ็นต์เพื่อดูรายละเอียดที่แท้จริงของสิ่งที่เกิดขึ้น ตัวอย่างเช่น: `sftp -vvv your-regular-options . .`. ยิ่งคุณเพิ่ม 'v' มากเท่าไหร่คุณก็ยิ่งได้รับรายละเอียดมากขึ้นเท่านั้น - แม้ว่าจากประสบการณ์ของฉันมากกว่า 2 หรือ 3 นั้นมากเกินไป
sa flag
@MarkWagner คุณพูดถูก คีย์มีขนาด 256 บิตเท่านั้น ดังนั้นหากฉันต้องการให้เซิร์ฟเวอร์นี้รองรับคีย์บิต 256/384/521 ฉันต้องมีคีย์แยกกันสามคีย์ในไดเร็กทอรี `/etc/ssh` หรือไม่ มีหลักการตั้งชื่อที่ฉันต้องปฏิบัติตามหรือไม่?
vn flag
`/etc/ssh/ssh_host_ecdsa_key` `/etc/ssh/ssh_host_ed25519_key` และ `/etc/ssh/ssh_host_rsa_key` เป็นชื่อเริ่มต้น แต่คุณสามารถเรียกคีย์อะไรก็ได้ที่คุณต้องการ และเพิ่มลงในไฟล์ `sshd_config` โดยใช้ `HostKey blah `.

โพสต์คำตอบ

คนส่วนใหญ่ไม่เข้าใจว่าการถามคำถามมากมายจะปลดล็อกการเรียนรู้และปรับปรุงความสัมพันธ์ระหว่างบุคคล ตัวอย่างเช่น ในการศึกษาของ Alison แม้ว่าผู้คนจะจำได้อย่างแม่นยำว่ามีคำถามกี่ข้อที่ถูกถามในการสนทนา แต่พวกเขาไม่เข้าใจความเชื่อมโยงระหว่างคำถามและความชอบ จากการศึกษาทั้ง 4 เรื่องที่ผู้เข้าร่วมมีส่วนร่วมในการสนทนาด้วยตนเองหรืออ่านบันทึกการสนทนาของผู้อื่น ผู้คนมักไม่ตระหนักว่าการถามคำถามจะมีอิทธิพลหรือมีอิทธิพลต่อระดับมิตรภาพระหว่างผู้สนทนา