summaryrefslogtreecommitdiff
path: root/authfd.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2010-02-27 07:55:05 +1100
committerDamien Miller <djm@mindrot.org>2010-02-27 07:55:05 +1100
commit0a80ca190a39943029719facf7edb990def7ae62 (patch)
treee423e30d8412de67170b8240ba919df10ed8e391 /authfd.c
parentd27d85d5320bb946d4bb734dcf45a8d20bad6020 (diff)
- OpenBSD CVS Sync
- djm@cvs.openbsd.org 2010/02/26 20:29:54 [PROTOCOL PROTOCOL.agent PROTOCOL.certkeys addrmatch.c auth-options.c] [auth-options.h auth.h auth2-pubkey.c authfd.c dns.c dns.h hostfile.c] [hostfile.h kex.h kexdhs.c kexgexs.c key.c key.h match.h monitor.c] [myproposal.h servconf.c servconf.h ssh-add.c ssh-agent.c ssh-dss.c] [ssh-keygen.1 ssh-keygen.c ssh-rsa.c ssh.1 ssh.c ssh2.h sshconnect.c] [sshconnect2.c sshd.8 sshd.c sshd_config.5] Add support for certificate key types for users and hosts. OpenSSH certificate key types are not X.509 certificates, but a much simpler format that encodes a public key, identity information and some validity constraints and signs it with a CA key. CA keys are regular SSH keys. This certificate style avoids the attack surface of X.509 certificates and is very easy to deploy. Certified host keys allow automatic acceptance of new host keys when a CA certificate is marked as sh/known_hosts. see VERIFYING HOST KEYS in ssh(1) for details. Certified user keys allow authentication of users when the signing CA key is marked as trusted in authorized_keys. See "AUTHORIZED_KEYS FILE FORMAT" in sshd(8) for details. Certificates are minted using ssh-keygen(1), documentation is in the "CERTIFICATES" section of that manpage. Documentation on the format of certificates is in the file PROTOCOL.certkeys feedback and ok markus@
Diffstat (limited to 'authfd.c')
-rw-r--r--authfd.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/authfd.c b/authfd.c
index 78a53c7a6..28a8cf2d7 100644
--- a/authfd.c
+++ b/authfd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfd.c,v 1.81 2009/08/27 17:44:52 djm Exp $ */ 1/* $OpenBSD: authfd.c,v 1.82 2010/02/26 20:29:54 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -483,6 +483,16 @@ ssh_encode_identity_ssh2(Buffer *b, Key *key, const char *comment)
483 buffer_put_bignum2(b, key->rsa->p); 483 buffer_put_bignum2(b, key->rsa->p);
484 buffer_put_bignum2(b, key->rsa->q); 484 buffer_put_bignum2(b, key->rsa->q);
485 break; 485 break;
486 case KEY_RSA_CERT:
487 if (key->cert == NULL || buffer_len(&key->cert->certblob) == 0)
488 fatal("%s: no cert/certblob", __func__);
489 buffer_put_string(b, buffer_ptr(&key->cert->certblob),
490 buffer_len(&key->cert->certblob));
491 buffer_put_bignum2(b, key->rsa->d);
492 buffer_put_bignum2(b, key->rsa->iqmp);
493 buffer_put_bignum2(b, key->rsa->p);
494 buffer_put_bignum2(b, key->rsa->q);
495 break;
486 case KEY_DSA: 496 case KEY_DSA:
487 buffer_put_bignum2(b, key->dsa->p); 497 buffer_put_bignum2(b, key->dsa->p);
488 buffer_put_bignum2(b, key->dsa->q); 498 buffer_put_bignum2(b, key->dsa->q);
@@ -490,6 +500,13 @@ ssh_encode_identity_ssh2(Buffer *b, Key *key, const char *comment)
490 buffer_put_bignum2(b, key->dsa->pub_key); 500 buffer_put_bignum2(b, key->dsa->pub_key);
491 buffer_put_bignum2(b, key->dsa->priv_key); 501 buffer_put_bignum2(b, key->dsa->priv_key);
492 break; 502 break;
503 case KEY_DSA_CERT:
504 if (key->cert == NULL || buffer_len(&key->cert->certblob) == 0)
505 fatal("%s: no cert/certblob", __func__);
506 buffer_put_string(b, buffer_ptr(&key->cert->certblob),
507 buffer_len(&key->cert->certblob));
508 buffer_put_bignum2(b, key->dsa->priv_key);
509 break;
493 } 510 }
494 buffer_put_cstring(b, comment); 511 buffer_put_cstring(b, comment);
495} 512}
@@ -517,7 +534,9 @@ ssh_add_identity_constrained(AuthenticationConnection *auth, Key *key,
517 ssh_encode_identity_rsa1(&msg, key->rsa, comment); 534 ssh_encode_identity_rsa1(&msg, key->rsa, comment);
518 break; 535 break;
519 case KEY_RSA: 536 case KEY_RSA:
537 case KEY_RSA_CERT:
520 case KEY_DSA: 538 case KEY_DSA:
539 case KEY_DSA_CERT:
521 type = constrained ? 540 type = constrained ?
522 SSH2_AGENTC_ADD_ID_CONSTRAINED : 541 SSH2_AGENTC_ADD_ID_CONSTRAINED :
523 SSH2_AGENTC_ADD_IDENTITY; 542 SSH2_AGENTC_ADD_IDENTITY;
@@ -565,7 +584,8 @@ ssh_remove_identity(AuthenticationConnection *auth, Key *key)
565 buffer_put_int(&msg, BN_num_bits(key->rsa->n)); 584 buffer_put_int(&msg, BN_num_bits(key->rsa->n));
566 buffer_put_bignum(&msg, key->rsa->e); 585 buffer_put_bignum(&msg, key->rsa->e);
567 buffer_put_bignum(&msg, key->rsa->n); 586 buffer_put_bignum(&msg, key->rsa->n);
568 } else if (key->type == KEY_DSA || key->type == KEY_RSA) { 587 } else if (key_type_plain(key->type) == KEY_DSA ||
588 key_type_plain(key->type) == KEY_RSA) {
569 key_to_blob(key, &blob, &blen); 589 key_to_blob(key, &blob, &blen);
570 buffer_put_char(&msg, SSH2_AGENTC_REMOVE_IDENTITY); 590 buffer_put_char(&msg, SSH2_AGENTC_REMOVE_IDENTITY);
571 buffer_put_string(&msg, blob, blen); 591 buffer_put_string(&msg, blob, blen);