|
Lines 199-204
static int key_blobtype = MM_NOKEY;
Link Here
|
| 199 |
static char *hostbased_cuser = NULL; |
199 |
static char *hostbased_cuser = NULL; |
| 200 |
static char *hostbased_chost = NULL; |
200 |
static char *hostbased_chost = NULL; |
| 201 |
static char *auth_method = "unknown"; |
201 |
static char *auth_method = "unknown"; |
|
|
202 |
static char *auth_submethod = NULL; |
| 202 |
static u_int session_id2_len = 0; |
203 |
static u_int session_id2_len = 0; |
| 203 |
static u_char *session_id2 = NULL; |
204 |
static u_char *session_id2 = NULL; |
| 204 |
static pid_t monitor_child_pid; |
205 |
static pid_t monitor_child_pid; |
|
Lines 353-358
monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
Link Here
|
| 353 |
{ |
354 |
{ |
| 354 |
struct mon_table *ent; |
355 |
struct mon_table *ent; |
| 355 |
int authenticated = 0; |
356 |
int authenticated = 0; |
|
|
357 |
char **req_auth; |
| 356 |
|
358 |
|
| 357 |
debug3("preauth child monitor started"); |
359 |
debug3("preauth child monitor started"); |
| 358 |
|
360 |
|
|
Lines 367-378
monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
Link Here
|
| 367 |
|
369 |
|
| 368 |
if (compat20) { |
370 |
if (compat20) { |
| 369 |
mon_dispatch = mon_dispatch_proto20; |
371 |
mon_dispatch = mon_dispatch_proto20; |
|
|
372 |
req_auth = &options.required_auth2; |
| 370 |
|
373 |
|
| 371 |
/* Permit requests for moduli and signatures */ |
374 |
/* Permit requests for moduli and signatures */ |
| 372 |
monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1); |
375 |
monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1); |
| 373 |
monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1); |
376 |
monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1); |
| 374 |
} else { |
377 |
} else { |
| 375 |
mon_dispatch = mon_dispatch_proto15; |
378 |
mon_dispatch = mon_dispatch_proto15; |
|
|
379 |
req_auth = &options.required_auth1; |
| 376 |
|
380 |
|
| 377 |
monitor_permit(mon_dispatch, MONITOR_REQ_SESSKEY, 1); |
381 |
monitor_permit(mon_dispatch, MONITOR_REQ_SESSKEY, 1); |
| 378 |
} |
382 |
} |
|
Lines 380-385
monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
Link Here
|
| 380 |
/* The first few requests do not require asynchronous access */ |
384 |
/* The first few requests do not require asynchronous access */ |
| 381 |
while (!authenticated) { |
385 |
while (!authenticated) { |
| 382 |
auth_method = "unknown"; |
386 |
auth_method = "unknown"; |
|
|
387 |
auth_submethod = NULL; |
| 383 |
authenticated = (monitor_read(pmonitor, mon_dispatch, &ent) == 1); |
388 |
authenticated = (monitor_read(pmonitor, mon_dispatch, &ent) == 1); |
| 384 |
if (authenticated) { |
389 |
if (authenticated) { |
| 385 |
if (!(ent->flags & MON_AUTHDECIDE)) |
390 |
if (!(ent->flags & MON_AUTHDECIDE)) |
|
Lines 401-410
monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
Link Here
|
| 401 |
} |
406 |
} |
| 402 |
#endif |
407 |
#endif |
| 403 |
} |
408 |
} |
|
|
409 |
/* Loop until the required authmethods are done */ |
| 410 |
if (authenticated && *req_auth != NULL) { |
| 411 |
if (auth_remove_from_list(req_auth, auth_method) == 0) |
| 412 |
fatal("INTERNAL ERROR: authenticated method " |
| 413 |
"\"%s\" not in required list \"%s\"", |
| 414 |
auth_method, *req_auth); |
| 415 |
debug2("monitor_child_preauth: required list now: %s", |
| 416 |
*req_auth == NULL ? "DONE" : *req_auth); |
| 417 |
} |
| 404 |
|
418 |
|
| 405 |
if (ent->flags & (MON_AUTHDECIDE|MON_ALOG)) { |
419 |
if (ent->flags & (MON_AUTHDECIDE|MON_ALOG)) { |
| 406 |
auth_log(authctxt, authenticated, auth_method, |
420 |
auth_log(authctxt, authenticated, auth_method, |
| 407 |
compat20 ? " ssh2" : ""); |
421 |
auth_submethod, compat20 ? " ssh2" : ""); |
| 408 |
if (!authenticated) |
422 |
if (!authenticated) |
| 409 |
authctxt->failures++; |
423 |
authctxt->failures++; |
| 410 |
} |
424 |
} |
|
Lines 417-422
monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
Link Here
|
| 417 |
} |
431 |
} |
| 418 |
} |
432 |
} |
| 419 |
#endif |
433 |
#endif |
|
|
434 |
if (*req_auth != NULL) |
| 435 |
authenticated = 0; |
| 420 |
} |
436 |
} |
| 421 |
|
437 |
|
| 422 |
/* Drain any buffered messages from the child */ |
438 |
/* Drain any buffered messages from the child */ |
|
Lines 860-865
mm_answer_authpassword(int sock, Buffer *m)
Link Here
|
| 860 |
auth_method = "none"; |
876 |
auth_method = "none"; |
| 861 |
else |
877 |
else |
| 862 |
auth_method = "password"; |
878 |
auth_method = "password"; |
|
|
879 |
auth_submethod = NULL; |
| 863 |
|
880 |
|
| 864 |
/* Causes monitor loop to terminate if authenticated */ |
881 |
/* Causes monitor loop to terminate if authenticated */ |
| 865 |
return (authenticated); |
882 |
return (authenticated); |
|
Lines 919-924
mm_answer_bsdauthrespond(int sock, Buffer *m)
Link Here
|
| 919 |
mm_request_send(sock, MONITOR_ANS_BSDAUTHRESPOND, m); |
936 |
mm_request_send(sock, MONITOR_ANS_BSDAUTHRESPOND, m); |
| 920 |
|
937 |
|
| 921 |
auth_method = "bsdauth"; |
938 |
auth_method = "bsdauth"; |
|
|
939 |
auth_submethod = NULL; |
| 922 |
|
940 |
|
| 923 |
return (authok != 0); |
941 |
return (authok != 0); |
| 924 |
} |
942 |
} |
|
Lines 968-973
mm_answer_skeyrespond(int sock, Buffer *m)
Link Here
|
| 968 |
mm_request_send(sock, MONITOR_ANS_SKEYRESPOND, m); |
986 |
mm_request_send(sock, MONITOR_ANS_SKEYRESPOND, m); |
| 969 |
|
987 |
|
| 970 |
auth_method = "skey"; |
988 |
auth_method = "skey"; |
|
|
989 |
auth_submethod = NULL; |
| 971 |
|
990 |
|
| 972 |
return (authok != 0); |
991 |
return (authok != 0); |
| 973 |
} |
992 |
} |
|
Lines 1057-1063
mm_answer_pam_query(int sock, Buffer *m)
Link Here
|
| 1057 |
xfree(prompts); |
1076 |
xfree(prompts); |
| 1058 |
if (echo_on != NULL) |
1077 |
if (echo_on != NULL) |
| 1059 |
xfree(echo_on); |
1078 |
xfree(echo_on); |
| 1060 |
auth_method = "keyboard-interactive/pam"; |
1079 |
auth_method = "keyboard-interactive"; |
|
|
1080 |
auth_submethod = "pam"; |
| 1061 |
mm_request_send(sock, MONITOR_ANS_PAM_QUERY, m); |
1081 |
mm_request_send(sock, MONITOR_ANS_PAM_QUERY, m); |
| 1062 |
return (0); |
1082 |
return (0); |
| 1063 |
} |
1083 |
} |
|
Lines 1086-1092
mm_answer_pam_respond(int sock, Buffer *m)
Link Here
|
| 1086 |
buffer_clear(m); |
1106 |
buffer_clear(m); |
| 1087 |
buffer_put_int(m, ret); |
1107 |
buffer_put_int(m, ret); |
| 1088 |
mm_request_send(sock, MONITOR_ANS_PAM_RESPOND, m); |
1108 |
mm_request_send(sock, MONITOR_ANS_PAM_RESPOND, m); |
| 1089 |
auth_method = "keyboard-interactive/pam"; |
1109 |
auth_method = "keyboard-interactive"; |
|
|
1110 |
auth_submethod = "pam"; |
| 1090 |
if (ret == 0) |
1111 |
if (ret == 0) |
| 1091 |
sshpam_authok = sshpam_ctxt; |
1112 |
sshpam_authok = sshpam_ctxt; |
| 1092 |
return (0); |
1113 |
return (0); |
|
Lines 1100-1106
mm_answer_pam_free_ctx(int sock, Buffer *m)
Link Here
|
| 1100 |
(sshpam_device.free_ctx)(sshpam_ctxt); |
1121 |
(sshpam_device.free_ctx)(sshpam_ctxt); |
| 1101 |
buffer_clear(m); |
1122 |
buffer_clear(m); |
| 1102 |
mm_request_send(sock, MONITOR_ANS_PAM_FREE_CTX, m); |
1123 |
mm_request_send(sock, MONITOR_ANS_PAM_FREE_CTX, m); |
| 1103 |
auth_method = "keyboard-interactive/pam"; |
1124 |
auth_method = "keyboard-interactive"; |
|
|
1125 |
auth_submethod = "pam"; |
| 1104 |
return (sshpam_authok == sshpam_ctxt); |
1126 |
return (sshpam_authok == sshpam_ctxt); |
| 1105 |
} |
1127 |
} |
| 1106 |
#endif |
1128 |
#endif |
|
Lines 1136-1141
mm_answer_keyallowed(int sock, Buffer *m)
Link Here
|
| 1136 |
allowed = options.pubkey_authentication && |
1158 |
allowed = options.pubkey_authentication && |
| 1137 |
user_key_allowed(authctxt->pw, key); |
1159 |
user_key_allowed(authctxt->pw, key); |
| 1138 |
auth_method = "publickey"; |
1160 |
auth_method = "publickey"; |
|
|
1161 |
auth_submethod = NULL; |
| 1139 |
if (options.pubkey_authentication && allowed != 1) |
1162 |
if (options.pubkey_authentication && allowed != 1) |
| 1140 |
auth_clear_options(); |
1163 |
auth_clear_options(); |
| 1141 |
break; |
1164 |
break; |
|
Lines 1144-1149
mm_answer_keyallowed(int sock, Buffer *m)
Link Here
|
| 1144 |
hostbased_key_allowed(authctxt->pw, |
1167 |
hostbased_key_allowed(authctxt->pw, |
| 1145 |
cuser, chost, key); |
1168 |
cuser, chost, key); |
| 1146 |
auth_method = "hostbased"; |
1169 |
auth_method = "hostbased"; |
|
|
1170 |
auth_submethod = NULL; |
| 1147 |
break; |
1171 |
break; |
| 1148 |
case MM_RSAHOSTKEY: |
1172 |
case MM_RSAHOSTKEY: |
| 1149 |
key->type = KEY_RSA1; /* XXX */ |
1173 |
key->type = KEY_RSA1; /* XXX */ |
|
Lines 1153-1158
mm_answer_keyallowed(int sock, Buffer *m)
Link Here
|
| 1153 |
if (options.rhosts_rsa_authentication && allowed != 1) |
1177 |
if (options.rhosts_rsa_authentication && allowed != 1) |
| 1154 |
auth_clear_options(); |
1178 |
auth_clear_options(); |
| 1155 |
auth_method = "rsa"; |
1179 |
auth_method = "rsa"; |
|
|
1180 |
auth_submethod = NULL; |
| 1156 |
break; |
1181 |
break; |
| 1157 |
default: |
1182 |
default: |
| 1158 |
fatal("%s: unknown key type %d", __func__, type); |
1183 |
fatal("%s: unknown key type %d", __func__, type); |
|
Lines 1174-1180
mm_answer_keyallowed(int sock, Buffer *m)
Link Here
|
| 1174 |
hostbased_chost = chost; |
1199 |
hostbased_chost = chost; |
| 1175 |
} else { |
1200 |
} else { |
| 1176 |
/* Log failed attempt */ |
1201 |
/* Log failed attempt */ |
| 1177 |
auth_log(authctxt, 0, auth_method, compat20 ? " ssh2" : ""); |
1202 |
auth_log(authctxt, 0, auth_method, auth_submethod, |
|
|
1203 |
compat20 ? " ssh2" : ""); |
| 1178 |
xfree(blob); |
1204 |
xfree(blob); |
| 1179 |
xfree(cuser); |
1205 |
xfree(cuser); |
| 1180 |
xfree(chost); |
1206 |
xfree(chost); |
|
Lines 1353-1358
mm_answer_keyverify(int sock, Buffer *m)
Link Here
|
| 1353 |
xfree(data); |
1379 |
xfree(data); |
| 1354 |
|
1380 |
|
| 1355 |
auth_method = key_blobtype == MM_USERKEY ? "publickey" : "hostbased"; |
1381 |
auth_method = key_blobtype == MM_USERKEY ? "publickey" : "hostbased"; |
|
|
1382 |
auth_submethod = NULL; |
| 1356 |
|
1383 |
|
| 1357 |
monitor_reset_key_state(); |
1384 |
monitor_reset_key_state(); |
| 1358 |
|
1385 |
|
|
Lines 1542-1547
mm_answer_rsa_keyallowed(int sock, Buffer *m)
Link Here
|
| 1542 |
debug3("%s entering", __func__); |
1569 |
debug3("%s entering", __func__); |
| 1543 |
|
1570 |
|
| 1544 |
auth_method = "rsa"; |
1571 |
auth_method = "rsa"; |
|
|
1572 |
auth_submethod = NULL; |
| 1545 |
if (options.rsa_authentication && authctxt->valid) { |
1573 |
if (options.rsa_authentication && authctxt->valid) { |
| 1546 |
if ((client_n = BN_new()) == NULL) |
1574 |
if ((client_n = BN_new()) == NULL) |
| 1547 |
fatal("%s: BN_new", __func__); |
1575 |
fatal("%s: BN_new", __func__); |
|
Lines 1647-1652
mm_answer_rsa_response(int sock, Buffer *m)
Link Here
|
| 1647 |
xfree(response); |
1675 |
xfree(response); |
| 1648 |
|
1676 |
|
| 1649 |
auth_method = key_blobtype == MM_RSAUSERKEY ? "rsa" : "rhosts-rsa"; |
1677 |
auth_method = key_blobtype == MM_RSAUSERKEY ? "rsa" : "rhosts-rsa"; |
|
|
1678 |
auth_submethod = NULL; |
| 1650 |
|
1679 |
|
| 1651 |
/* reset state */ |
1680 |
/* reset state */ |
| 1652 |
BN_clear_free(ssh1_challenge); |
1681 |
BN_clear_free(ssh1_challenge); |
|
Lines 2096-2101
mm_answer_gss_userok(int sock, Buffer *m)
Link Here
|
| 2096 |
mm_request_send(sock, MONITOR_ANS_GSSUSEROK, m); |
2125 |
mm_request_send(sock, MONITOR_ANS_GSSUSEROK, m); |
| 2097 |
|
2126 |
|
| 2098 |
auth_method = "gssapi-with-mic"; |
2127 |
auth_method = "gssapi-with-mic"; |
|
|
2128 |
auth_submethod = NULL; |
| 2099 |
|
2129 |
|
| 2100 |
/* Monitor loop will terminate if authenticated */ |
2130 |
/* Monitor loop will terminate if authenticated */ |
| 2101 |
return (authenticated); |
2131 |
return (authenticated); |
|
Lines 2300-2305
mm_answer_jpake_check_confirm(int sock, Buffer *m)
Link Here
|
| 2300 |
monitor_permit(mon_dispatch, MONITOR_REQ_JPAKE_STEP1, 1); |
2330 |
monitor_permit(mon_dispatch, MONITOR_REQ_JPAKE_STEP1, 1); |
| 2301 |
|
2331 |
|
| 2302 |
auth_method = "jpake-01@openssh.com"; |
2332 |
auth_method = "jpake-01@openssh.com"; |
|
|
2333 |
auth_submethod = NULL; |
| 2303 |
return authenticated; |
2334 |
return authenticated; |
| 2304 |
} |
2335 |
} |
| 2305 |
|
2336 |
|