version 1.203, 2007/12/27 14:22:08 |
version 1.204, 2008/06/11 21:01:35 |
|
|
Key *file_key; |
Key *file_key; |
const char *type = key_type(host_key); |
const char *type = key_type(host_key); |
char *ip = NULL, *host = NULL; |
char *ip = NULL, *host = NULL; |
char hostline[1000], *hostp, *fp; |
char hostline[1000], *hostp, *fp, *ra; |
HostStatus host_status; |
HostStatus host_status; |
HostStatus ip_status; |
HostStatus ip_status; |
int r, local = 0, host_ip_differ = 0; |
int r, local = 0, host_ip_differ = 0; |
|
|
logit("Warning: Permanently added the %s host " |
logit("Warning: Permanently added the %s host " |
"key for IP address '%.128s' to the list " |
"key for IP address '%.128s' to the list " |
"of known hosts.", type, ip); |
"of known hosts.", type, ip); |
|
} else if (options.check_host_ip == SSHCTL_CHECKHOSTIP_FPR) { |
|
fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); |
|
ra = key_fingerprint(host_key, SSH_FP_MD5, |
|
SSH_FP_RANDOMART); |
|
logit("Host key fingerprint is %s\n%s\n", fp, ra); |
|
xfree(ra); |
|
xfree(fp); |
} |
} |
break; |
break; |
case HOST_NEW: |
case HOST_NEW: |
|
|
snprintf(msg1, sizeof(msg1), "."); |
snprintf(msg1, sizeof(msg1), "."); |
/* The default */ |
/* The default */ |
fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); |
fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); |
|
ra = key_fingerprint(host_key, SSH_FP_MD5, |
|
SSH_FP_RANDOMART); |
msg2[0] = '\0'; |
msg2[0] = '\0'; |
if (options.verify_host_key_dns) { |
if (options.verify_host_key_dns) { |
if (matching_host_key_dns) |
if (matching_host_key_dns) |
|
|
snprintf(msg, sizeof(msg), |
snprintf(msg, sizeof(msg), |
"The authenticity of host '%.200s (%s)' can't be " |
"The authenticity of host '%.200s (%s)' can't be " |
"established%s\n" |
"established%s\n" |
"%s key fingerprint is %s.\n%s" |
"%s key fingerprint is %s.\n%s\n%s" |
"Are you sure you want to continue connecting " |
"Are you sure you want to continue connecting " |
"(yes/no)? ", |
"(yes/no)? ", |
host, ip, msg1, type, fp, msg2); |
host, ip, msg1, type, fp, ra, msg2); |
|
xfree(ra); |
xfree(fp); |
xfree(fp); |
if (!confirm(msg)) |
if (!confirm(msg)) |
goto fail; |
goto fail; |
|
|
show_key_from_file(const char *file, const char *host, int keytype) |
show_key_from_file(const char *file, const char *host, int keytype) |
{ |
{ |
Key *found; |
Key *found; |
char *fp; |
char *fp, *ra; |
int line, ret; |
int line, ret; |
|
|
found = key_new(keytype); |
found = key_new(keytype); |
if ((ret = lookup_key_in_hostfile_by_type(file, host, |
if ((ret = lookup_key_in_hostfile_by_type(file, host, |
keytype, found, &line))) { |
keytype, found, &line))) { |
fp = key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX); |
fp = key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX); |
|
ra = key_fingerprint(found, SSH_FP_MD5, SSH_FP_RANDOMART); |
logit("WARNING: %s key found for host %s\n" |
logit("WARNING: %s key found for host %s\n" |
"in %s:%d\n" |
"in %s:%d\n" |
"%s key fingerprint %s.", |
"%s key fingerprint %s.\n%s\n", |
key_type(found), host, file, line, |
key_type(found), host, file, line, |
key_type(found), fp); |
key_type(found), fp, ra); |
|
xfree(ra); |
xfree(fp); |
xfree(fp); |
} |
} |
key_free(found); |
key_free(found); |