|
Lines 920-928
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 920 |
"of known hosts.", type, ip); |
920 |
"of known hosts.", type, ip); |
| 921 |
} else if (options.visual_host_key) { |
921 |
} else if (options.visual_host_key) { |
| 922 |
fp = sshkey_fingerprint(host_key, |
922 |
fp = sshkey_fingerprint(host_key, |
| 923 |
options.fingerprint_hash, SSH_FP_DEFAULT); |
923 |
options.fingerprint_hash[0], SSH_FP_DEFAULT); |
| 924 |
ra = sshkey_fingerprint(host_key, |
924 |
ra = sshkey_fingerprint(host_key, |
| 925 |
options.fingerprint_hash, SSH_FP_RANDOMART); |
925 |
options.fingerprint_hash[0], SSH_FP_RANDOMART); |
| 926 |
if (fp == NULL || ra == NULL) |
926 |
if (fp == NULL || ra == NULL) |
| 927 |
fatal("%s: sshkey_fingerprint fail", __func__); |
927 |
fatal("%s: sshkey_fingerprint fail", __func__); |
| 928 |
logit("Host key fingerprint is %s\n%s\n", fp, ra); |
928 |
logit("Host key fingerprint is %s\n%s\n", fp, ra); |
|
Lines 964-975
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 964 |
else |
964 |
else |
| 965 |
snprintf(msg1, sizeof(msg1), "."); |
965 |
snprintf(msg1, sizeof(msg1), "."); |
| 966 |
/* The default */ |
966 |
/* The default */ |
| 967 |
fp = sshkey_fingerprint(host_key, |
|
|
| 968 |
options.fingerprint_hash, SSH_FP_DEFAULT); |
| 969 |
ra = sshkey_fingerprint(host_key, |
| 970 |
options.fingerprint_hash, SSH_FP_RANDOMART); |
| 971 |
if (fp == NULL || ra == NULL) |
| 972 |
fatal("%s: sshkey_fingerprint fail", __func__); |
| 973 |
msg2[0] = '\0'; |
967 |
msg2[0] = '\0'; |
| 974 |
if (options.verify_host_key_dns) { |
968 |
if (options.verify_host_key_dns) { |
| 975 |
if (matching_host_key_dns) |
969 |
if (matching_host_key_dns) |
|
Lines 983-998
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 983 |
} |
977 |
} |
| 984 |
snprintf(msg, sizeof(msg), |
978 |
snprintf(msg, sizeof(msg), |
| 985 |
"The authenticity of host '%.200s (%s)' can't be " |
979 |
"The authenticity of host '%.200s (%s)' can't be " |
| 986 |
"established%s\n" |
980 |
"established%s\n", host, ip, msg1); |
| 987 |
"%s key fingerprint is %s.%s%s\n%s" |
981 |
for (i = 0; i < options.num_fingerprint_hash; i++) { |
|
|
982 |
fp = sshkey_fingerprint(host_key, |
| 983 |
options.fingerprint_hash[i], SSH_FP_DEFAULT); |
| 984 |
ra = sshkey_fingerprint(host_key, |
| 985 |
options.fingerprint_hash[i], SSH_FP_RANDOMART); |
| 986 |
if (fp == NULL || ra == NULL) |
| 987 |
fatal("%s: sshkey_fingerprint fail", __func__); |
| 988 |
len = strlen(msg); |
| 989 |
snprintf(msg+len, sizeof(msg)-len, |
| 990 |
"%s key fingerprint is %s.%s%s\n%s", |
| 991 |
type, fp, |
| 992 |
options.visual_host_key ? "\n" : "", |
| 993 |
options.visual_host_key ? ra : "", |
| 994 |
msg2); |
| 995 |
free(ra); |
| 996 |
free(fp); |
| 997 |
} |
| 998 |
len = strlen(msg); |
| 999 |
snprintf(msg+len, sizeof(msg)-len, |
| 988 |
"Are you sure you want to continue connecting " |
1000 |
"Are you sure you want to continue connecting " |
| 989 |
"(yes/no)? ", |
1001 |
"(yes/no)? "); |
| 990 |
host, ip, msg1, type, fp, |
|
|
| 991 |
options.visual_host_key ? "\n" : "", |
| 992 |
options.visual_host_key ? ra : "", |
| 993 |
msg2); |
| 994 |
free(ra); |
| 995 |
free(fp); |
| 996 |
if (!confirm(msg)) |
1002 |
if (!confirm(msg)) |
| 997 |
goto fail; |
1003 |
goto fail; |
| 998 |
hostkey_trusted = 1; /* user explicitly confirmed */ |
1004 |
hostkey_trusted = 1; /* user explicitly confirmed */ |
|
Lines 1241-1247
verify_host_key(char *host, struct sockaddr *hostaddr, Key *host_key)
Link Here
|
| 1241 |
struct sshkey *plain = NULL; |
1247 |
struct sshkey *plain = NULL; |
| 1242 |
|
1248 |
|
| 1243 |
if ((fp = sshkey_fingerprint(host_key, |
1249 |
if ((fp = sshkey_fingerprint(host_key, |
| 1244 |
options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL) { |
1250 |
options.fingerprint_hash[0], SSH_FP_DEFAULT)) == NULL) { |
| 1245 |
error("%s: fingerprint host key: %s", __func__, ssh_err(r)); |
1251 |
error("%s: fingerprint host key: %s", __func__, ssh_err(r)); |
| 1246 |
r = -1; |
1252 |
r = -1; |
| 1247 |
goto out; |
1253 |
goto out; |
|
Lines 1405-1413
show_other_keys(struct hostkeys *hostkeys, Key *key)
Link Here
|
| 1405 |
if (!lookup_key_in_hostkeys_by_type(hostkeys, type[i], &found)) |
1411 |
if (!lookup_key_in_hostkeys_by_type(hostkeys, type[i], &found)) |
| 1406 |
continue; |
1412 |
continue; |
| 1407 |
fp = sshkey_fingerprint(found->key, |
1413 |
fp = sshkey_fingerprint(found->key, |
| 1408 |
options.fingerprint_hash, SSH_FP_DEFAULT); |
1414 |
options.fingerprint_hash[0], SSH_FP_DEFAULT); |
| 1409 |
ra = sshkey_fingerprint(found->key, |
1415 |
ra = sshkey_fingerprint(found->key, |
| 1410 |
options.fingerprint_hash, SSH_FP_RANDOMART); |
1416 |
options.fingerprint_hash[0], SSH_FP_RANDOMART); |
| 1411 |
if (fp == NULL || ra == NULL) |
1417 |
if (fp == NULL || ra == NULL) |
| 1412 |
fatal("%s: sshkey_fingerprint fail", __func__); |
1418 |
fatal("%s: sshkey_fingerprint fail", __func__); |
| 1413 |
logit("WARNING: %s key found for host %s\n" |
1419 |
logit("WARNING: %s key found for host %s\n" |
|
Lines 1430-1436
warn_changed_key(Key *host_key)
Link Here
|
| 1430 |
{ |
1436 |
{ |
| 1431 |
char *fp; |
1437 |
char *fp; |
| 1432 |
|
1438 |
|
| 1433 |
fp = sshkey_fingerprint(host_key, options.fingerprint_hash, |
1439 |
fp = sshkey_fingerprint(host_key, options.fingerprint_hash[0], |
| 1434 |
SSH_FP_DEFAULT); |
1440 |
SSH_FP_DEFAULT); |
| 1435 |
if (fp == NULL) |
1441 |
if (fp == NULL) |
| 1436 |
fatal("%s: sshkey_fingerprint fail", __func__); |
1442 |
fatal("%s: sshkey_fingerprint fail", __func__); |