SSH가 IP 주소에 대해 known_host 항목을 추가하는 이유는 무엇입니까? the list of known hosts. debug1:

nms.example.org라는 호스트가 있습니다. 내 /etc/ssh/ssh_known_hostsRSA 키가있는 호스트에 대한 항목이 있습니다. 이 항목과 다른 모든 항목은 구성 관리 시스템에서 관리합니다.

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가 여전히 호스트 IP 를 사용하여 사용자 별 known_hosts에 키를 추가해야한다고 생각 합니까?

$ 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의 키를 사용자 프로필에 추가합니까?

컴퓨터를 다시 설치할 때 구성 관리 시스템이 호스트 키 수집 및 모든 시스템에 대한 배포를 처리하기 때문에 매우 자극적입니다. 그러나 사용 당 알려진 known_host 파일의 IP와 관련된 충돌하는 키가 남아있어 스크립트 연결을 방해하는 연결 시도시 경고가 발생합니다.

$ 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 값을 캐싱하지 못하게하려면 어떻게해야합니까? 아니면이 성가신 행동으로 살아야하는 보안상의 이유가 있습니까? 몇 대의 서버가 다소 동적 인 IP 주소를 가지고 있기 때문에 이것은 또한 실망입니다. 구성 관리가 DNS 업데이트를 처리합니다. 그러나 이들은 사용자 별 known_host 파일을 채우는 IP 당 호스트 키를 남겨 둡니다.



답변

나는 그것이 일을하는 것이라고 생각한다 CheckHostIP.

이 플래그가 “yes”로 설정되면 ssh (1)은 known_hosts파일 에서 호스트 IP 주소를 추가로 확인 합니다. 이를 통해 ssh는 DNS 스푸핑으로 인해 호스트 키가 변경되었는지 감지 할 수 있습니다. 옵션이 “no”로 설정되어 있으면 점검이 실행되지 않습니다. 기본값은“예”입니다.

이 옵션을 잘못 구성하거나 공격하는 경우 약간 더 나은 진단을받을 수 있지만 실제로 내가 생각할 수있는 방식으로 보안을 향상 시키지는 않습니다.

끄면 CheckHostIPSSH (OpenSSH 6.7p1 기준)는 이름으로 새 호스트에 연결할 때 IP 주소를 기록하지 않습니다. 따라서 이것을 다음에 추가하십시오 .ssh/config.

CheckHostIP no

Host특정 호스트 (특히 동적 IP 주소가있는 호스트)에 대해서만 끄려면 섹션에 추가 할 수 있습니다 .


답변