|
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 352-358
void
Link Here
|
| 352 |
monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor) |
353 |
monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor) |
| 353 |
{ |
354 |
{ |
| 354 |
struct mon_table *ent; |
355 |
struct mon_table *ent; |
| 355 |
int authenticated = 0; |
356 |
int no_increment, 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; |
| 388 |
no_increment = 1; |
| 383 |
authenticated = (monitor_read(pmonitor, mon_dispatch, &ent) == 1); |
389 |
authenticated = (monitor_read(pmonitor, mon_dispatch, &ent) == 1); |
| 384 |
if (authenticated) { |
390 |
if (authenticated) { |
| 385 |
if (!(ent->flags & MON_AUTHDECIDE)) |
391 |
if (!(ent->flags & MON_AUTHDECIDE)) |
|
Lines 401-411
monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
Link Here
|
| 401 |
} |
407 |
} |
| 402 |
#endif |
408 |
#endif |
| 403 |
} |
409 |
} |
|
|
410 |
/* Loop until the required authmethods are done */ |
| 411 |
if (authenticated && *req_auth != NULL) { |
| 412 |
if (auth_remove_from_list(req_auth, auth_method) != 1) |
| 413 |
fatal("INTERNAL ERROR: authenticated method " |
| 414 |
"\"%s\" not in required list \"%s\"", |
| 415 |
auth_method, *req_auth); |
| 416 |
debug2("monitor_child_preauth: required list now: %s", |
| 417 |
*req_auth == NULL ? "DONE" : *req_auth); |
| 418 |
if (*req_auth != NULL) |
| 419 |
authenticated = 0; |
| 420 |
no_increment = 1; |
| 421 |
} |
| 404 |
|
422 |
|
| 405 |
if (ent->flags & (MON_AUTHDECIDE|MON_ALOG)) { |
423 |
if (ent->flags & (MON_AUTHDECIDE|MON_ALOG)) { |
| 406 |
auth_log(authctxt, authenticated, auth_method, |
424 |
auth_log(authctxt, authenticated, auth_method, |
| 407 |
compat20 ? " ssh2" : ""); |
425 |
auth_submethod, compat20 ? " ssh2" : ""); |
| 408 |
if (!authenticated) |
426 |
if (!authenticated && !no_increment) |
| 409 |
authctxt->failures++; |
427 |
authctxt->failures++; |
| 410 |
} |
428 |
} |
| 411 |
#ifdef JPAKE |
429 |
#ifdef JPAKE |
|
Lines 862-867
mm_answer_authpassword(int sock, Buffer *m)
Link Here
|
| 862 |
auth_method = "none"; |
880 |
auth_method = "none"; |
| 863 |
else |
881 |
else |
| 864 |
auth_method = "password"; |
882 |
auth_method = "password"; |
|
|
883 |
auth_submethod = NULL; |
| 865 |
|
884 |
|
| 866 |
/* Causes monitor loop to terminate if authenticated */ |
885 |
/* Causes monitor loop to terminate if authenticated */ |
| 867 |
return (authenticated); |
886 |
return (authenticated); |
|
Lines 921-926
mm_answer_bsdauthrespond(int sock, Buffer *m)
Link Here
|
| 921 |
mm_request_send(sock, MONITOR_ANS_BSDAUTHRESPOND, m); |
940 |
mm_request_send(sock, MONITOR_ANS_BSDAUTHRESPOND, m); |
| 922 |
|
941 |
|
| 923 |
auth_method = "bsdauth"; |
942 |
auth_method = "bsdauth"; |
|
|
943 |
auth_submethod = NULL; |
| 924 |
|
944 |
|
| 925 |
return (authok != 0); |
945 |
return (authok != 0); |
| 926 |
} |
946 |
} |
|
Lines 970-975
mm_answer_skeyrespond(int sock, Buffer *m)
Link Here
|
| 970 |
mm_request_send(sock, MONITOR_ANS_SKEYRESPOND, m); |
990 |
mm_request_send(sock, MONITOR_ANS_SKEYRESPOND, m); |
| 971 |
|
991 |
|
| 972 |
auth_method = "skey"; |
992 |
auth_method = "skey"; |
|
|
993 |
auth_submethod = NULL; |
| 973 |
|
994 |
|
| 974 |
return (authok != 0); |
995 |
return (authok != 0); |
| 975 |
} |
996 |
} |
|
Lines 1059-1065
mm_answer_pam_query(int sock, Buffer *m)
Link Here
|
| 1059 |
xfree(prompts); |
1080 |
xfree(prompts); |
| 1060 |
if (echo_on != NULL) |
1081 |
if (echo_on != NULL) |
| 1061 |
xfree(echo_on); |
1082 |
xfree(echo_on); |
| 1062 |
auth_method = "keyboard-interactive/pam"; |
1083 |
auth_method = "keyboard-interactive"; |
|
|
1084 |
auth_submethod = "pam"; |
| 1063 |
mm_request_send(sock, MONITOR_ANS_PAM_QUERY, m); |
1085 |
mm_request_send(sock, MONITOR_ANS_PAM_QUERY, m); |
| 1064 |
return (0); |
1086 |
return (0); |
| 1065 |
} |
1087 |
} |
|
Lines 1088-1094
mm_answer_pam_respond(int sock, Buffer *m)
Link Here
|
| 1088 |
buffer_clear(m); |
1110 |
buffer_clear(m); |
| 1089 |
buffer_put_int(m, ret); |
1111 |
buffer_put_int(m, ret); |
| 1090 |
mm_request_send(sock, MONITOR_ANS_PAM_RESPOND, m); |
1112 |
mm_request_send(sock, MONITOR_ANS_PAM_RESPOND, m); |
| 1091 |
auth_method = "keyboard-interactive/pam"; |
1113 |
auth_method = "keyboard-interactive"; |
|
|
1114 |
auth_submethod = "pam"; |
| 1092 |
if (ret == 0) |
1115 |
if (ret == 0) |
| 1093 |
sshpam_authok = sshpam_ctxt; |
1116 |
sshpam_authok = sshpam_ctxt; |
| 1094 |
return (0); |
1117 |
return (0); |
|
Lines 1102-1108
mm_answer_pam_free_ctx(int sock, Buffer *m)
Link Here
|
| 1102 |
(sshpam_device.free_ctx)(sshpam_ctxt); |
1125 |
(sshpam_device.free_ctx)(sshpam_ctxt); |
| 1103 |
buffer_clear(m); |
1126 |
buffer_clear(m); |
| 1104 |
mm_request_send(sock, MONITOR_ANS_PAM_FREE_CTX, m); |
1127 |
mm_request_send(sock, MONITOR_ANS_PAM_FREE_CTX, m); |
| 1105 |
auth_method = "keyboard-interactive/pam"; |
1128 |
auth_method = "keyboard-interactive"; |
|
|
1129 |
auth_submethod = "pam"; |
| 1106 |
return (sshpam_authok == sshpam_ctxt); |
1130 |
return (sshpam_authok == sshpam_ctxt); |
| 1107 |
} |
1131 |
} |
| 1108 |
#endif |
1132 |
#endif |
|
Lines 1138-1143
mm_answer_keyallowed(int sock, Buffer *m)
Link Here
|
| 1138 |
allowed = options.pubkey_authentication && |
1162 |
allowed = options.pubkey_authentication && |
| 1139 |
user_key_allowed(authctxt->pw, key); |
1163 |
user_key_allowed(authctxt->pw, key); |
| 1140 |
auth_method = "publickey"; |
1164 |
auth_method = "publickey"; |
|
|
1165 |
auth_submethod = NULL; |
| 1141 |
if (options.pubkey_authentication && allowed != 1) |
1166 |
if (options.pubkey_authentication && allowed != 1) |
| 1142 |
auth_clear_options(); |
1167 |
auth_clear_options(); |
| 1143 |
break; |
1168 |
break; |
|
Lines 1146-1151
mm_answer_keyallowed(int sock, Buffer *m)
Link Here
|
| 1146 |
hostbased_key_allowed(authctxt->pw, |
1171 |
hostbased_key_allowed(authctxt->pw, |
| 1147 |
cuser, chost, key); |
1172 |
cuser, chost, key); |
| 1148 |
auth_method = "hostbased"; |
1173 |
auth_method = "hostbased"; |
|
|
1174 |
auth_submethod = NULL; |
| 1149 |
break; |
1175 |
break; |
| 1150 |
case MM_RSAHOSTKEY: |
1176 |
case MM_RSAHOSTKEY: |
| 1151 |
key->type = KEY_RSA1; /* XXX */ |
1177 |
key->type = KEY_RSA1; /* XXX */ |
|
Lines 1155-1160
mm_answer_keyallowed(int sock, Buffer *m)
Link Here
|
| 1155 |
if (options.rhosts_rsa_authentication && allowed != 1) |
1181 |
if (options.rhosts_rsa_authentication && allowed != 1) |
| 1156 |
auth_clear_options(); |
1182 |
auth_clear_options(); |
| 1157 |
auth_method = "rsa"; |
1183 |
auth_method = "rsa"; |
|
|
1184 |
auth_submethod = NULL; |
| 1158 |
break; |
1185 |
break; |
| 1159 |
default: |
1186 |
default: |
| 1160 |
fatal("%s: unknown key type %d", __func__, type); |
1187 |
fatal("%s: unknown key type %d", __func__, type); |
|
Lines 1176-1182
mm_answer_keyallowed(int sock, Buffer *m)
Link Here
|
| 1176 |
hostbased_chost = chost; |
1203 |
hostbased_chost = chost; |
| 1177 |
} else { |
1204 |
} else { |
| 1178 |
/* Log failed attempt */ |
1205 |
/* Log failed attempt */ |
| 1179 |
auth_log(authctxt, 0, auth_method, compat20 ? " ssh2" : ""); |
1206 |
auth_log(authctxt, 0, auth_method, auth_submethod, |
|
|
1207 |
compat20 ? " ssh2" : ""); |
| 1180 |
xfree(blob); |
1208 |
xfree(blob); |
| 1181 |
xfree(cuser); |
1209 |
xfree(cuser); |
| 1182 |
xfree(chost); |
1210 |
xfree(chost); |
|
Lines 1355-1360
mm_answer_keyverify(int sock, Buffer *m)
Link Here
|
| 1355 |
xfree(data); |
1383 |
xfree(data); |
| 1356 |
|
1384 |
|
| 1357 |
auth_method = key_blobtype == MM_USERKEY ? "publickey" : "hostbased"; |
1385 |
auth_method = key_blobtype == MM_USERKEY ? "publickey" : "hostbased"; |
|
|
1386 |
auth_submethod = NULL; |
| 1358 |
|
1387 |
|
| 1359 |
monitor_reset_key_state(); |
1388 |
monitor_reset_key_state(); |
| 1360 |
|
1389 |
|
|
Lines 1544-1549
mm_answer_rsa_keyallowed(int sock, Buffer *m)
Link Here
|
| 1544 |
debug3("%s entering", __func__); |
1573 |
debug3("%s entering", __func__); |
| 1545 |
|
1574 |
|
| 1546 |
auth_method = "rsa"; |
1575 |
auth_method = "rsa"; |
|
|
1576 |
auth_submethod = NULL; |
| 1547 |
if (options.rsa_authentication && authctxt->valid) { |
1577 |
if (options.rsa_authentication && authctxt->valid) { |
| 1548 |
if ((client_n = BN_new()) == NULL) |
1578 |
if ((client_n = BN_new()) == NULL) |
| 1549 |
fatal("%s: BN_new", __func__); |
1579 |
fatal("%s: BN_new", __func__); |
|
Lines 1649-1654
mm_answer_rsa_response(int sock, Buffer *m)
Link Here
|
| 1649 |
xfree(response); |
1679 |
xfree(response); |
| 1650 |
|
1680 |
|
| 1651 |
auth_method = key_blobtype == MM_RSAUSERKEY ? "rsa" : "rhosts-rsa"; |
1681 |
auth_method = key_blobtype == MM_RSAUSERKEY ? "rsa" : "rhosts-rsa"; |
|
|
1682 |
auth_submethod = NULL; |
| 1652 |
|
1683 |
|
| 1653 |
/* reset state */ |
1684 |
/* reset state */ |
| 1654 |
BN_clear_free(ssh1_challenge); |
1685 |
BN_clear_free(ssh1_challenge); |
|
Lines 2098-2103
mm_answer_gss_userok(int sock, Buffer *m)
Link Here
|
| 2098 |
mm_request_send(sock, MONITOR_ANS_GSSUSEROK, m); |
2129 |
mm_request_send(sock, MONITOR_ANS_GSSUSEROK, m); |
| 2099 |
|
2130 |
|
| 2100 |
auth_method = "gssapi-with-mic"; |
2131 |
auth_method = "gssapi-with-mic"; |
|
|
2132 |
auth_submethod = NULL; |
| 2101 |
|
2133 |
|
| 2102 |
/* Monitor loop will terminate if authenticated */ |
2134 |
/* Monitor loop will terminate if authenticated */ |
| 2103 |
return (authenticated); |
2135 |
return (authenticated); |
|
Lines 2302-2307
mm_answer_jpake_check_confirm(int sock, Buffer *m)
Link Here
|
| 2302 |
monitor_permit(mon_dispatch, MONITOR_REQ_JPAKE_STEP1, 1); |
2334 |
monitor_permit(mon_dispatch, MONITOR_REQ_JPAKE_STEP1, 1); |
| 2303 |
|
2335 |
|
| 2304 |
auth_method = "jpake-01@openssh.com"; |
2336 |
auth_method = "jpake-01@openssh.com"; |
|
|
2337 |
auth_submethod = NULL; |
| 2305 |
return authenticated; |
2338 |
return authenticated; |
| 2306 |
} |
2339 |
} |
| 2307 |
|
2340 |
|