|
Lines 198-204
done:
Link Here
|
| 198 |
void |
198 |
void |
| 199 |
pubkey_auth_info(Authctxt *authctxt, const Key *key, const char *fmt, ...) |
199 |
pubkey_auth_info(Authctxt *authctxt, const Key *key, const char *fmt, ...) |
| 200 |
{ |
200 |
{ |
| 201 |
char *fp, *extra; |
201 |
char *fp, *fpt, *extra; |
| 202 |
va_list ap; |
202 |
va_list ap; |
| 203 |
int i; |
203 |
int i; |
| 204 |
|
204 |
|
|
Lines 213-229
pubkey_auth_info(Authctxt *authctxt, const Key *key, const char *fmt, ...)
Link Here
|
| 213 |
|
213 |
|
| 214 |
if (key_is_cert(key)) { |
214 |
if (key_is_cert(key)) { |
| 215 |
fp = key_fingerprint(key->cert->signature_key, |
215 |
fp = key_fingerprint(key->cert->signature_key, |
| 216 |
SSH_FP_MD5, SSH_FP_HEX); |
216 |
options.fpt, SSH_FP_HEX); |
| 217 |
auth_info(authctxt, "%s ID %s (serial %llu) CA %s %s%s%s", |
217 |
fpt = fpt_name(options.fpt); |
|
|
218 |
auth_info(authctxt, "%s ID %s (serial %llu) CA %s [%s]%s%s%s", |
| 218 |
key_type(key), key->cert->key_id, |
219 |
key_type(key), key->cert->key_id, |
| 219 |
(unsigned long long)key->cert->serial, |
220 |
(unsigned long long)key->cert->serial, |
| 220 |
key_type(key->cert->signature_key), fp, |
221 |
key_type(key->cert->signature_key), fpt, fp, |
| 221 |
extra == NULL ? "" : ", ", extra == NULL ? "" : extra); |
222 |
extra == NULL ? "" : ", ", extra == NULL ? "" : extra); |
|
|
223 |
free(fpt); |
| 222 |
free(fp); |
224 |
free(fp); |
| 223 |
} else { |
225 |
} else { |
| 224 |
fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); |
226 |
fp = key_fingerprint(key, options.fpt, SSH_FP_HEX); |
| 225 |
auth_info(authctxt, "%s %s%s%s", key_type(key), fp, |
227 |
fpt = fpt_name(options.fpt); |
|
|
228 |
auth_info(authctxt, "%s [%s]%s%s%s", key_type(key), fpt, fp, |
| 226 |
extra == NULL ? "" : ", ", extra == NULL ? "" : extra); |
229 |
extra == NULL ? "" : ", ", extra == NULL ? "" : extra); |
|
|
230 |
free(fpt); |
| 227 |
free(fp); |
231 |
free(fp); |
| 228 |
} |
232 |
} |
| 229 |
free(extra); |
233 |
free(extra); |
|
Lines 319-325
check_authkeys_file(FILE *f, char *file, Key* key, struct passwd *pw)
Link Here
|
| 319 |
int found_key = 0; |
323 |
int found_key = 0; |
| 320 |
u_long linenum = 0; |
324 |
u_long linenum = 0; |
| 321 |
Key *found; |
325 |
Key *found; |
| 322 |
char *fp; |
326 |
char *fp, *fpt; |
| 323 |
|
327 |
|
| 324 |
found_key = 0; |
328 |
found_key = 0; |
| 325 |
|
329 |
|
|
Lines 365-374
check_authkeys_file(FILE *f, char *file, Key* key, struct passwd *pw)
Link Here
|
| 365 |
continue; |
369 |
continue; |
| 366 |
if (!key_is_cert_authority) |
370 |
if (!key_is_cert_authority) |
| 367 |
continue; |
371 |
continue; |
| 368 |
fp = key_fingerprint(found, SSH_FP_MD5, |
372 |
fp = key_fingerprint(found, options.fpt, |
| 369 |
SSH_FP_HEX); |
373 |
SSH_FP_HEX); |
| 370 |
debug("matching CA found: file %s, line %lu, %s %s", |
374 |
fpt = fpt_name(options.fpt); |
| 371 |
file, linenum, key_type(found), fp); |
375 |
debug("matching CA found: file %s, line %lu, %s [%s]%s", |
|
|
376 |
file, linenum, key_type(found), fpt, fp); |
| 372 |
/* |
377 |
/* |
| 373 |
* If the user has specified a list of principals as |
378 |
* If the user has specified a list of principals as |
| 374 |
* a key option, then prefer that list to matching |
379 |
* a key option, then prefer that list to matching |
|
Lines 380-385
check_authkeys_file(FILE *f, char *file, Key* key, struct passwd *pw)
Link Here
|
| 380 |
reason = "Certificate does not contain an " |
385 |
reason = "Certificate does not contain an " |
| 381 |
"authorized principal"; |
386 |
"authorized principal"; |
| 382 |
fail_reason: |
387 |
fail_reason: |
|
|
388 |
free(fpt); |
| 383 |
free(fp); |
389 |
free(fp); |
| 384 |
error("%s", reason); |
390 |
error("%s", reason); |
| 385 |
auth_debug_add("%s", reason); |
391 |
auth_debug_add("%s", reason); |
|
Lines 390-401
check_authkeys_file(FILE *f, char *file, Key* key, struct passwd *pw)
Link Here
|
| 390 |
&reason) != 0) |
396 |
&reason) != 0) |
| 391 |
goto fail_reason; |
397 |
goto fail_reason; |
| 392 |
if (auth_cert_options(key, pw) != 0) { |
398 |
if (auth_cert_options(key, pw) != 0) { |
|
|
399 |
free(fpt); |
| 393 |
free(fp); |
400 |
free(fp); |
| 394 |
continue; |
401 |
continue; |
| 395 |
} |
402 |
} |
| 396 |
verbose("Accepted certificate ID \"%s\" " |
403 |
verbose("Accepted certificate ID \"%s\" " |
| 397 |
"signed by %s CA %s via %s", key->cert->key_id, |
404 |
"signed by %s CA [%s]%s via %s", key->cert->key_id, |
| 398 |
key_type(found), fp, file); |
405 |
key_type(found), fpt, fp, file); |
|
|
406 |
free(fpt); |
| 399 |
free(fp); |
407 |
free(fp); |
| 400 |
found_key = 1; |
408 |
found_key = 1; |
| 401 |
break; |
409 |
break; |
|
Lines 406-414
check_authkeys_file(FILE *f, char *file, Key* key, struct passwd *pw)
Link Here
|
| 406 |
if (key_is_cert_authority) |
414 |
if (key_is_cert_authority) |
| 407 |
continue; |
415 |
continue; |
| 408 |
found_key = 1; |
416 |
found_key = 1; |
| 409 |
fp = key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX); |
417 |
fp = key_fingerprint(found, options.fpt, SSH_FP_HEX); |
| 410 |
debug("matching key found: file %s, line %lu %s %s", |
418 |
fpt = fpt_name(options.fpt); |
| 411 |
file, linenum, key_type(found), fp); |
419 |
debug("matching key found: file %s, line %lu %s [%s]%s", |
|
|
420 |
file, linenum, key_type(found), fpt, fp); |
| 421 |
free(fpt); |
| 412 |
free(fp); |
422 |
free(fp); |
| 413 |
break; |
423 |
break; |
| 414 |
} |
424 |
} |
|
Lines 424-430
check_authkeys_file(FILE *f, char *file, Key* key, struct passwd *pw)
Link Here
|
| 424 |
static int |
434 |
static int |
| 425 |
user_cert_trusted_ca(struct passwd *pw, Key *key) |
435 |
user_cert_trusted_ca(struct passwd *pw, Key *key) |
| 426 |
{ |
436 |
{ |
| 427 |
char *ca_fp, *principals_file = NULL; |
437 |
char *ca_fp, *ca_fpt, *principals_file = NULL; |
| 428 |
const char *reason; |
438 |
const char *reason; |
| 429 |
int ret = 0; |
439 |
int ret = 0; |
| 430 |
|
440 |
|
|
Lines 432-443
user_cert_trusted_ca(struct passwd *pw, Key *key)
Link Here
|
| 432 |
return 0; |
442 |
return 0; |
| 433 |
|
443 |
|
| 434 |
ca_fp = key_fingerprint(key->cert->signature_key, |
444 |
ca_fp = key_fingerprint(key->cert->signature_key, |
| 435 |
SSH_FP_MD5, SSH_FP_HEX); |
445 |
options.fpt, SSH_FP_HEX); |
|
|
446 |
ca_fpt = fpt_name(options.fpt); |
| 436 |
|
447 |
|
| 437 |
if (key_in_file(key->cert->signature_key, |
448 |
if (key_in_file(key->cert->signature_key, |
| 438 |
options.trusted_user_ca_keys, 1) != 1) { |
449 |
options.trusted_user_ca_keys, 1) != 1) { |
| 439 |
debug2("%s: CA %s %s is not listed in %s", __func__, |
450 |
debug2("%s: CA %s [%s]%s is not listed in %s", __func__, |
| 440 |
key_type(key->cert->signature_key), ca_fp, |
451 |
key_type(key->cert->signature_key), ca_fpt, ca_fp, |
| 441 |
options.trusted_user_ca_keys); |
452 |
options.trusted_user_ca_keys); |
| 442 |
goto out; |
453 |
goto out; |
| 443 |
} |
454 |
} |
|
Lines 462-474
user_cert_trusted_ca(struct passwd *pw, Key *key)
Link Here
|
| 462 |
if (auth_cert_options(key, pw) != 0) |
473 |
if (auth_cert_options(key, pw) != 0) |
| 463 |
goto out; |
474 |
goto out; |
| 464 |
|
475 |
|
| 465 |
verbose("Accepted certificate ID \"%s\" signed by %s CA %s via %s", |
476 |
verbose("Accepted certificate ID \"%s\" signed by %s CA [%s]%s via %s", |
| 466 |
key->cert->key_id, key_type(key->cert->signature_key), ca_fp, |
477 |
key->cert->key_id, key_type(key->cert->signature_key), ca_fpt, ca_fp, |
| 467 |
options.trusted_user_ca_keys); |
478 |
options.trusted_user_ca_keys); |
| 468 |
ret = 1; |
479 |
ret = 1; |
| 469 |
|
480 |
|
| 470 |
out: |
481 |
out: |
| 471 |
free(principals_file); |
482 |
free(principals_file); |
|
|
483 |
free(ca_fpt); |
| 472 |
free(ca_fp); |
484 |
free(ca_fp); |
| 473 |
return ret; |
485 |
return ret; |
| 474 |
} |
486 |
} |