diff options
author | Damien Miller <djm@mindrot.org> | 2008-06-30 00:04:03 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2008-06-30 00:04:03 +1000 |
commit | 1028824e5c456dc3d8a57fe5bae539beb4a95432 (patch) | |
tree | aa151e1b321494095a70f8b65b298529386e609c /sshconnect.c | |
parent | 2e9cf4906926fba123d415fdac8465b94bcd38b3 (diff) |
- grunk@cvs.openbsd.org 2008/06/26 11:46:31
[readconf.c readconf.h ssh.1 ssh_config.5 sshconnect.c]
Move SSH Fingerprint Visualization away from sharing the config option
CheckHostIP to an own config option named VisualHostKey.
While there, fix the behaviour that ssh would draw a random art picture
on every newly seen host even when the option was not enabled.
prodded by deraadt@, discussions,
help and ok markus@ djm@ dtucker@
Diffstat (limited to 'sshconnect.c')
-rw-r--r-- | sshconnect.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sshconnect.c b/sshconnect.c index 267670771..9c1550a96 100644 --- a/sshconnect.c +++ b/sshconnect.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect.c,v 1.208 2008/06/12 23:24:58 ian Exp $ */ | 1 | /* $OpenBSD: sshconnect.c,v 1.209 2008/06/26 11:46:31 grunk Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -598,7 +598,6 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, | |||
598 | char msg[1024]; | 598 | char msg[1024]; |
599 | int len, host_line, ip_line; | 599 | int len, host_line, ip_line; |
600 | const char *host_file = NULL, *ip_file = NULL; | 600 | const char *host_file = NULL, *ip_file = NULL; |
601 | int display_randomart; | ||
602 | 601 | ||
603 | /* | 602 | /* |
604 | * Force accepting of the host key for loopback/localhost. The | 603 | * Force accepting of the host key for loopback/localhost. The |
@@ -646,12 +645,6 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, | |||
646 | } | 645 | } |
647 | 646 | ||
648 | /* | 647 | /* |
649 | * check_host_ip may be set to zero in the next step, so if it | ||
650 | * conveys a request to display the random art, save it away. | ||
651 | */ | ||
652 | display_randomart = (options.check_host_ip == SSHCTL_CHECKHOSTIP_FPR); | ||
653 | |||
654 | /* | ||
655 | * Turn off check_host_ip if the connection is to localhost, via proxy | 648 | * Turn off check_host_ip if the connection is to localhost, via proxy |
656 | * command or if we don't have a hostname to compare with | 649 | * command or if we don't have a hostname to compare with |
657 | */ | 650 | */ |
@@ -735,7 +728,7 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, | |||
735 | logit("Warning: Permanently added the %s host " | 728 | logit("Warning: Permanently added the %s host " |
736 | "key for IP address '%.128s' to the list " | 729 | "key for IP address '%.128s' to the list " |
737 | "of known hosts.", type, ip); | 730 | "of known hosts.", type, ip); |
738 | } else if (display_randomart) { | 731 | } else if (options.visual_host_key) { |
739 | fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); | 732 | fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); |
740 | ra = key_fingerprint(host_key, SSH_FP_MD5, | 733 | ra = key_fingerprint(host_key, SSH_FP_MD5, |
741 | SSH_FP_RANDOMART); | 734 | SSH_FP_RANDOMART); |
@@ -793,10 +786,13 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, | |||
793 | snprintf(msg, sizeof(msg), | 786 | snprintf(msg, sizeof(msg), |
794 | "The authenticity of host '%.200s (%s)' can't be " | 787 | "The authenticity of host '%.200s (%s)' can't be " |
795 | "established%s\n" | 788 | "established%s\n" |
796 | "%s key fingerprint is %s.\n%s\n%s" | 789 | "%s key fingerprint is %s.%s%s\n%s" |
797 | "Are you sure you want to continue connecting " | 790 | "Are you sure you want to continue connecting " |
798 | "(yes/no)? ", | 791 | "(yes/no)? ", |
799 | host, ip, msg1, type, fp, ra, msg2); | 792 | host, ip, msg1, type, fp, |
793 | options.visual_host_key ? "\n" : "", | ||
794 | options.visual_host_key ? ra : "", | ||
795 | msg2); | ||
800 | xfree(ra); | 796 | xfree(ra); |
801 | xfree(fp); | 797 | xfree(fp); |
802 | if (!confirm(msg)) | 798 | if (!confirm(msg)) |