summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--authfd.c13
-rw-r--r--authfd.h12
-rw-r--r--ssh-add.c4
-rw-r--r--ssh-agent.c27
5 files changed, 38 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 20ba05d8d..d2dca1b9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@
5 - todd@cvs.openbsd.org 2002/06/14 21:35:00 5 - todd@cvs.openbsd.org 2002/06/14 21:35:00
6 [monitor_wrap.c] 6 [monitor_wrap.c]
7 spelling; from Brian Poole <raj@cerias.purdue.edu> 7 spelling; from Brian Poole <raj@cerias.purdue.edu>
8 - markus@cvs.openbsd.org 2002/06/15 00:01:36
9 [authfd.c authfd.h ssh-add.c ssh-agent.c]
10 break agent key lifetime protocol and allow other contraints for key
11 usage.
8 12
920020613 1320020613
10 - (bal) typo of setgroup for cygwin. Patch by vinschen@redhat.com 14 - (bal) typo of setgroup for cygwin. Patch by vinschen@redhat.com
@@ -933,4 +937,4 @@
933 - (stevesk) entropy.c: typo in debug message 937 - (stevesk) entropy.c: typo in debug message
934 - (djm) ssh-keygen -i needs seeded RNG; report from markus@ 938 - (djm) ssh-keygen -i needs seeded RNG; report from markus@
935 939
936$Id: ChangeLog,v 1.2218 2002/06/21 00:01:18 mouring Exp $ 940$Id: ChangeLog,v 1.2219 2002/06/21 00:04:48 mouring Exp $
diff --git a/authfd.c b/authfd.c
index 0f84e321c..b16bc470b 100644
--- a/authfd.c
+++ b/authfd.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: authfd.c,v 1.51 2002/06/05 21:55:44 markus Exp $"); 38RCSID("$OpenBSD: authfd.c,v 1.52 2002/06/15 00:01:36 markus Exp $");
39 39
40#include <openssl/evp.h> 40#include <openssl/evp.h>
41 41
@@ -552,7 +552,7 @@ ssh_remove_identity(AuthenticationConnection *auth, Key *key)
552} 552}
553 553
554int 554int
555ssh_lifetime_identity(AuthenticationConnection *auth, Key *key, u_int life) 555ssh_contrain_identity(AuthenticationConnection *auth, Key *key, u_int life)
556{ 556{
557 Buffer msg; 557 Buffer msg;
558 int type; 558 int type;
@@ -562,21 +562,22 @@ ssh_lifetime_identity(AuthenticationConnection *auth, Key *key, u_int life)
562 buffer_init(&msg); 562 buffer_init(&msg);
563 563
564 if (key->type == KEY_RSA1) { 564 if (key->type == KEY_RSA1) {
565 buffer_put_char(&msg, SSH_AGENTC_LIFETIME_IDENTITY1); 565 buffer_put_char(&msg, SSH_AGENTC_CONTRAIN_IDENTITY1);
566 buffer_put_int(&msg, life);
567 buffer_put_int(&msg, BN_num_bits(key->rsa->n)); 566 buffer_put_int(&msg, BN_num_bits(key->rsa->n));
568 buffer_put_bignum(&msg, key->rsa->e); 567 buffer_put_bignum(&msg, key->rsa->e);
569 buffer_put_bignum(&msg, key->rsa->n); 568 buffer_put_bignum(&msg, key->rsa->n);
570 } else if (key->type == KEY_DSA || key->type == KEY_RSA) { 569 } else if (key->type == KEY_DSA || key->type == KEY_RSA) {
571 key_to_blob(key, &blob, &blen); 570 key_to_blob(key, &blob, &blen);
572 buffer_put_char(&msg, SSH_AGENTC_LIFETIME_IDENTITY); 571 buffer_put_char(&msg, SSH_AGENTC_CONTRAIN_IDENTITY);
573 buffer_put_int(&msg, life);
574 buffer_put_string(&msg, blob, blen); 572 buffer_put_string(&msg, blob, blen);
575 xfree(blob); 573 xfree(blob);
576 } else { 574 } else {
577 buffer_free(&msg); 575 buffer_free(&msg);
578 return 0; 576 return 0;
579 } 577 }
578 buffer_put_char(&msg, SSH_AGENT_CONTRAIN_LIFETIME);
579 buffer_put_int(&msg, life);
580
580 if (ssh_request_reply(auth, &msg, &msg) == 0) { 581 if (ssh_request_reply(auth, &msg, &msg) == 0) {
581 buffer_free(&msg); 582 buffer_free(&msg);
582 return 0; 583 return 0;
diff --git a/authfd.h b/authfd.h
index 263e4b97d..e3ef6ff5e 100644
--- a/authfd.h
+++ b/authfd.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfd.h,v 1.26 2002/06/05 21:55:44 markus Exp $ */ 1/* $OpenBSD: authfd.h,v 1.27 2002/06/15 00:01:36 markus Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -46,9 +46,11 @@
46#define SSH_AGENTC_LOCK 22 46#define SSH_AGENTC_LOCK 22
47#define SSH_AGENTC_UNLOCK 23 47#define SSH_AGENTC_UNLOCK 23
48 48
49/* set key lifetime */ 49/* constrain key usage */
50#define SSH_AGENTC_LIFETIME_IDENTITY1 24 50#define SSH_AGENTC_CONTRAIN_IDENTITY1 24
51#define SSH_AGENTC_LIFETIME_IDENTITY 25 51#define SSH_AGENTC_CONTRAIN_IDENTITY 25
52
53#define SSH_AGENT_CONTRAIN_LIFETIME 1
52 54
53/* extended failure messages */ 55/* extended failure messages */
54#define SSH2_AGENT_FAILURE 30 56#define SSH2_AGENT_FAILURE 30
@@ -73,7 +75,7 @@ int ssh_get_num_identities(AuthenticationConnection *, int);
73Key *ssh_get_first_identity(AuthenticationConnection *, char **, int); 75Key *ssh_get_first_identity(AuthenticationConnection *, char **, int);
74Key *ssh_get_next_identity(AuthenticationConnection *, char **, int); 76Key *ssh_get_next_identity(AuthenticationConnection *, char **, int);
75int ssh_add_identity(AuthenticationConnection *, Key *, const char *); 77int ssh_add_identity(AuthenticationConnection *, Key *, const char *);
76int ssh_lifetime_identity(AuthenticationConnection *, Key *, u_int); 78int ssh_contrain_identity(AuthenticationConnection *, Key *, u_int);
77int ssh_remove_identity(AuthenticationConnection *, Key *); 79int ssh_remove_identity(AuthenticationConnection *, Key *);
78int ssh_remove_all_identities(AuthenticationConnection *, int); 80int ssh_remove_all_identities(AuthenticationConnection *, int);
79int ssh_lock_agent(AuthenticationConnection *, int, const char *); 81int ssh_lock_agent(AuthenticationConnection *, int, const char *);
diff --git a/ssh-add.c b/ssh-add.c
index 30d635400..cfd622d77 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: ssh-add.c,v 1.57 2002/06/10 17:36:23 stevesk Exp $"); 38RCSID("$OpenBSD: ssh-add.c,v 1.58 2002/06/15 00:01:36 markus Exp $");
39 39
40#include <openssl/evp.h> 40#include <openssl/evp.h>
41 41
@@ -171,7 +171,7 @@ add_file(AuthenticationConnection *ac, const char *filename)
171 fprintf(stderr, "Could not add identity: %s\n", filename); 171 fprintf(stderr, "Could not add identity: %s\n", filename);
172 172
173 if (ret == 0 && lifetime != 0) { 173 if (ret == 0 && lifetime != 0) {
174 if (ssh_lifetime_identity(ac, private, lifetime)) { 174 if (ssh_contrain_identity(ac, private, lifetime)) {
175 fprintf(stderr, 175 fprintf(stderr,
176 "Lifetime set to %d seconds for: %s (%s)\n", 176 "Lifetime set to %d seconds for: %s (%s)\n",
177 lifetime, filename, comment); 177 lifetime, filename, comment);
diff --git a/ssh-agent.c b/ssh-agent.c
index b89ead6e5..4a288199f 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -35,7 +35,7 @@
35 35
36#include "includes.h" 36#include "includes.h"
37#include "openbsd-compat/fake-queue.h" 37#include "openbsd-compat/fake-queue.h"
38RCSID("$OpenBSD: ssh-agent.c,v 1.91 2002/06/11 05:46:20 mpech Exp $"); 38RCSID("$OpenBSD: ssh-agent.c,v 1.92 2002/06/15 00:01:36 markus Exp $");
39 39
40#include <openssl/evp.h> 40#include <openssl/evp.h>
41#include <openssl/md5.h> 41#include <openssl/md5.h>
@@ -470,15 +470,13 @@ send:
470} 470}
471 471
472static void 472static void
473process_lifetime_identity(SocketEntry *e, int version) 473process_contrain_identity(SocketEntry *e, int version)
474{ 474{
475 Key *key = NULL; 475 Key *key = NULL;
476 u_char *blob; 476 u_char *blob;
477 u_int blen, bits, death; 477 u_int blen, bits, death = 0;
478 int success = 0; 478 int success = 0;
479 479
480 death = time(NULL) + buffer_get_int(&e->request);
481
482 switch (version) { 480 switch (version) {
483 case 1: 481 case 1:
484 key = key_new(KEY_RSA1); 482 key = key_new(KEY_RSA1);
@@ -493,9 +491,18 @@ process_lifetime_identity(SocketEntry *e, int version)
493 xfree(blob); 491 xfree(blob);
494 break; 492 break;
495 } 493 }
494 while (buffer_len(&e->request)) {
495 switch (buffer_get_char(&e->request)) {
496 case SSH_AGENT_CONTRAIN_LIFETIME:
497 death = time(NULL) + buffer_get_int(&e->request);
498 break;
499 default:
500 break;
501 }
502 }
496 if (key != NULL) { 503 if (key != NULL) {
497 Identity *id = lookup_identity(key, version); 504 Identity *id = lookup_identity(key, version);
498 if (id != NULL && id->death == 0) { 505 if (id != NULL && id->death == 0 && death != 0) {
499 id->death = death; 506 id->death = death;
500 success = 1; 507 success = 1;
501 } 508 }
@@ -707,8 +714,8 @@ process_message(SocketEntry *e)
707 case SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES: 714 case SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES:
708 process_remove_all_identities(e, 1); 715 process_remove_all_identities(e, 1);
709 break; 716 break;
710 case SSH_AGENTC_LIFETIME_IDENTITY1: 717 case SSH_AGENTC_CONTRAIN_IDENTITY1:
711 process_lifetime_identity(e, 1); 718 process_contrain_identity(e, 1);
712 break; 719 break;
713 /* ssh2 */ 720 /* ssh2 */
714 case SSH2_AGENTC_SIGN_REQUEST: 721 case SSH2_AGENTC_SIGN_REQUEST:
@@ -726,8 +733,8 @@ process_message(SocketEntry *e)
726 case SSH2_AGENTC_REMOVE_ALL_IDENTITIES: 733 case SSH2_AGENTC_REMOVE_ALL_IDENTITIES:
727 process_remove_all_identities(e, 2); 734 process_remove_all_identities(e, 2);
728 break; 735 break;
729 case SSH_AGENTC_LIFETIME_IDENTITY: 736 case SSH_AGENTC_CONTRAIN_IDENTITY:
730 process_lifetime_identity(e, 2); 737 process_contrain_identity(e, 2);
731 break; 738 break;
732#ifdef SMARTCARD 739#ifdef SMARTCARD
733 case SSH_AGENTC_ADD_SMARTCARD_KEY: 740 case SSH_AGENTC_ADD_SMARTCARD_KEY: