|
Lines 922-928
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 922 |
if (readonly || want_cert) |
922 |
if (readonly || want_cert) |
| 923 |
goto fail; |
923 |
goto fail; |
| 924 |
/* The host is new. */ |
924 |
/* The host is new. */ |
| 925 |
if (options.strict_host_key_checking == 1) { |
925 |
if (options.strict_host_key_checking == |
|
|
926 |
SSH_STRICT_HOSTKEY_YES) { |
| 926 |
/* |
927 |
/* |
| 927 |
* User has requested strict host key checking. We |
928 |
* User has requested strict host key checking. We |
| 928 |
* will not add the host key automatically. The only |
929 |
* will not add the host key automatically. The only |
|
Lines 931-937
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 931 |
error("No %s host key is known for %.200s and you " |
932 |
error("No %s host key is known for %.200s and you " |
| 932 |
"have requested strict checking.", type, host); |
933 |
"have requested strict checking.", type, host); |
| 933 |
goto fail; |
934 |
goto fail; |
| 934 |
} else if (options.strict_host_key_checking == 2) { |
935 |
} else if (options.strict_host_key_checking == |
|
|
936 |
SSH_STRICT_HOSTKEY_ASK) { |
| 935 |
char msg1[1024], msg2[1024]; |
937 |
char msg1[1024], msg2[1024]; |
| 936 |
|
938 |
|
| 937 |
if (show_other_keys(host_hostkeys, host_key)) |
939 |
if (show_other_keys(host_hostkeys, host_key)) |
|
Lines 975-982
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 975 |
hostkey_trusted = 1; /* user explicitly confirmed */ |
977 |
hostkey_trusted = 1; /* user explicitly confirmed */ |
| 976 |
} |
978 |
} |
| 977 |
/* |
979 |
/* |
| 978 |
* If not in strict mode, add the key automatically to the |
980 |
* If in "new" or "off" strict mode, add the key automatically |
| 979 |
* local known_hosts file. |
981 |
* to the local known_hosts file. |
| 980 |
*/ |
982 |
*/ |
| 981 |
if (options.check_host_ip && ip_status == HOST_NEW) { |
983 |
if (options.check_host_ip && ip_status == HOST_NEW) { |
| 982 |
snprintf(hostline, sizeof(hostline), "%s,%s", host, ip); |
984 |
snprintf(hostline, sizeof(hostline), "%s,%s", host, ip); |
|
Lines 1018-1024
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 1018 |
* If strict host key checking is in use, the user will have |
1020 |
* If strict host key checking is in use, the user will have |
| 1019 |
* to edit the key manually and we can only abort. |
1021 |
* to edit the key manually and we can only abort. |
| 1020 |
*/ |
1022 |
*/ |
| 1021 |
if (options.strict_host_key_checking) { |
1023 |
if (options.strict_host_key_checking != |
|
|
1024 |
SSH_STRICT_HOSTKEY_OFF) { |
| 1022 |
error("%s host key for %.200s was revoked and you have " |
1025 |
error("%s host key for %.200s was revoked and you have " |
| 1023 |
"requested strict checking.", type, host); |
1026 |
"requested strict checking.", type, host); |
| 1024 |
goto fail; |
1027 |
goto fail; |
|
Lines 1070-1076
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 1070 |
* If strict host key checking is in use, the user will have |
1073 |
* If strict host key checking is in use, the user will have |
| 1071 |
* to edit the key manually and we can only abort. |
1074 |
* to edit the key manually and we can only abort. |
| 1072 |
*/ |
1075 |
*/ |
| 1073 |
if (options.strict_host_key_checking) { |
1076 |
if (options.strict_host_key_checking != |
|
|
1077 |
SSH_STRICT_HOSTKEY_OFF) { |
| 1074 |
error("%s host key for %.200s has changed and you have " |
1078 |
error("%s host key for %.200s has changed and you have " |
| 1075 |
"requested strict checking.", type, host); |
1079 |
"requested strict checking.", type, host); |
| 1076 |
goto fail; |
1080 |
goto fail; |
|
Lines 1157-1171
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 1157 |
"\nMatching host key in %s:%lu", |
1161 |
"\nMatching host key in %s:%lu", |
| 1158 |
host_found->file, host_found->line); |
1162 |
host_found->file, host_found->line); |
| 1159 |
} |
1163 |
} |
| 1160 |
if (options.strict_host_key_checking == 1) { |
1164 |
if (options.strict_host_key_checking == |
| 1161 |
logit("%s", msg); |
1165 |
SSH_STRICT_HOSTKEY_ASK) { |
| 1162 |
error("Exiting, you have requested strict checking."); |
|
|
| 1163 |
goto fail; |
| 1164 |
} else if (options.strict_host_key_checking == 2) { |
| 1165 |
strlcat(msg, "\nAre you sure you want " |
1166 |
strlcat(msg, "\nAre you sure you want " |
| 1166 |
"to continue connecting (yes/no)? ", sizeof(msg)); |
1167 |
"to continue connecting (yes/no)? ", sizeof(msg)); |
| 1167 |
if (!confirm(msg)) |
1168 |
if (!confirm(msg)) |
| 1168 |
goto fail; |
1169 |
goto fail; |
|
|
1170 |
} else if (options.strict_host_key_checking != |
| 1171 |
SSH_STRICT_HOSTKEY_OFF) { |
| 1172 |
logit("%s", msg); |
| 1173 |
error("Exiting, you have requested strict checking."); |
| 1174 |
goto fail; |
| 1169 |
} else { |
1175 |
} else { |
| 1170 |
logit("%s", msg); |
1176 |
logit("%s", msg); |
| 1171 |
} |
1177 |
} |