ฉันมีโฮสต์ชื่อ nms.example.org ในของ/etc/ssh/ssh_known_hosts
ฉันฉันมีรายการสำหรับโฮสต์ด้วยคีย์ RSA รายการนี้และรายการอื่น ๆ ทั้งหมดได้รับการจัดการโดยระบบการจัดการการกำหนดค่าของฉัน
nms.example.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDZqfmVPs/XqTS...
นอกจากนี้ฉันมีรายการในของฉัน/etc/ssh/ssh_config
สำหรับโฮสต์เฉพาะการตั้งค่านามแฝงของคีย์โฮสต์ ซึ่งถ้าฉันเข้าใจทุกอย่างอย่างถูกต้องนั่นหมายความว่าnms.example.org
ควรมีความสำคัญเท่านั้น
Host nms.example.org nms.example nms
HostKeyAlias nms.example.org
HostName nms.example.org
ทำไมเมื่อฉันเชื่อมต่อจากไคลเอนต์ ssh ยังคงคิดว่ามันจำเป็นต้องเพิ่มคีย์ให้กับ known_hosts ต่อผู้ใช้ของฉันด้วยIPของโฮสต์?
$ ssh nms -v
OpenSSH_6.0p1 Debian-4+deb7u4, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /home/zoredache/.ssh/config
debug1: /home/zoredache/.ssh/config line 61: Applying options for *
debug1: /home/zoredache/.ssh/config line 71: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 84: Applying options for nms
debug1: /etc/ssh/ssh_config line 363: Applying options for *
debug1: Connecting to nms.example.org [104.236.190.144] port 22.
debug1: Connection established.
debug1: identity file /home/zoredache/.ssh/zoredache-20140204.id_rsa type 1
...
debug1: Server host key: RSA 6b:5f:b6:e9:13:c3:b7:39:1e:ec:74:05:33:64:4d:5e
debug1: using hostkeyalias: nms.example.org
debug1: Host 'nms.example.org' is known and matches the RSA host key.
debug1: Found key in /etc/ssh/ssh_known_hosts:104
Warning: Permanently added the RSA host key for IP address '192.0.2.144' to the list of known hosts.
debug1: ssh_rsa_verify: signature correct
...
SSH รู้ว่าโฮสต์ของฉันใช้ได้ (ดูHost 'nms.example.org' is known and matches the RSA host key
:) เหตุใดจึงเพิ่มคีย์สำหรับ IP ไปยังโปรไฟล์ผู้ใช้
นี่เป็นสิ่งที่น่ารำคาญอย่างยิ่งเพราะเมื่อฉันติดตั้งเครื่องใหม่ระบบจัดการการกำหนดค่าของฉันจะจัดการรวบรวมและแจกจ่ายกุญแจโฮสต์ให้กับทุกระบบได้ดี แต่จะมีสิ่งเหล่านี้เหลืออยู่ในคีย์ที่ขัดแย้งกันซึ่งเชื่อมโยงกับ IP ในการใช้งานไฟล์รู้จัก _host ต่อการเตือนการพยายามเชื่อมต่อที่ป้องกันสคริปต์จากการเชื่อมต่อ
$ ssh nms -v
OpenSSH_6.0p1 Debian-4+deb7u4, OpenSSL 1.0.1e 11 Feb 2013
...
debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u4
debug1: using hostkeyalias: nms.example.org
...
debug1: Server host key: RSA 6b:5f:b6:e9:13:c3:b7:39:1e:ec:74:05:33:64:4d:5e
debug1: using hostkeyalias: nms.example.org
debug1: Host 'nms.example.org' is known and matches the RSA host key.
debug1: Found key in /etc/ssh/ssh_known_hosts:104
Warning: the RSA host key for 'nms.example.org' differs from the key for the IP address '192.0.2.144'
Offending key for IP in /home/zoredache/.ssh/known_hosts:25
Matching host key in /etc/ssh/ssh_known_hosts:104
Are you sure you want to continue connecting (yes/no)?
ฉันจะป้องกัน ssh จากการแคชค่าต่อไอพีนี้ในแต่ละผู้ใช้ known_hosts ได้อย่างไร? หรือมีเหตุผลด้านความปลอดภัยที่ว่าทำไมฉันต้องอยู่กับพฤติกรรมที่น่ารำคาญนี้ สิ่งนี้ทำให้ฉันผิดหวังเพราะเซิร์ฟเวอร์สองแห่งมีที่อยู่ IP ค่อนข้างไดนามิก การจัดการการกำหนดค่าของฉันจัดการการปรับปรุง DNS แต่ฉันได้รับสิ่งเหล่านี้ที่เหลือต่อคีย์โฮสต์ต่อ IP เติมไฟล์ known_host ต่อผู้ใช้ของฉัน