summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-03-22 03:51:06 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-03-22 03:51:06 +0000
commitba72d30aa541015c4e17c21cc1328c7db399d26a (patch)
tree48d275fba1025501485f2f67a6a3b6140a4e63ba
parent266ec63eb36e2d3154ead355ce67cdee5c9394a3 (diff)
- rees@cvs.openbsd.org 2002/03/21 22:44:05
[authfd.c authfd.h ssh-add.c ssh-agent.c ssh.c] Add PIN-protection for secret key.
-rw-r--r--ChangeLog5
-rw-r--r--authfd.c5
-rw-r--r--authfd.h4
-rw-r--r--ssh-add.c10
-rw-r--r--ssh-agent.c14
-rw-r--r--ssh.c4
6 files changed, 28 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 5e4d14907..3f6fdf0d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -139,6 +139,9 @@
139 - rees@cvs.openbsd.org 2002/03/21 21:54:34 139 - rees@cvs.openbsd.org 2002/03/21 21:54:34
140 [scard.c scard.h ssh-keygen.c] 140 [scard.c scard.h ssh-keygen.c]
141 Add PIN-protection for secret key. 141 Add PIN-protection for secret key.
142 - rees@cvs.openbsd.org 2002/03/21 22:44:05
143 [authfd.c authfd.h ssh-add.c ssh-agent.c ssh.c]
144 Add PIN-protection for secret key.
142 145
14320020317 14620020317
144 - (tim) [configure.ac] Assume path given with --with-pid-dir=PATH is wanted, 147 - (tim) [configure.ac] Assume path given with --with-pid-dir=PATH is wanted,
@@ -7985,4 +7988,4 @@
7985 - Wrote replacements for strlcpy and mkdtemp 7988 - Wrote replacements for strlcpy and mkdtemp
7986 - Released 1.0pre1 7989 - Released 1.0pre1
7987 7990
7988$Id: ChangeLog,v 1.1964 2002/03/22 03:47:38 mouring Exp $ 7991$Id: ChangeLog,v 1.1965 2002/03/22 03:51:06 mouring Exp $
diff --git a/authfd.c b/authfd.c
index fa764358f..f3050d64d 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.48 2002/02/24 19:14:59 markus Exp $"); 38RCSID("$OpenBSD: authfd.c,v 1.49 2002/03/21 22:44:05 rees Exp $");
39 39
40#include <openssl/evp.h> 40#include <openssl/evp.h>
41 41
@@ -532,7 +532,7 @@ ssh_remove_identity(AuthenticationConnection *auth, Key *key)
532} 532}
533 533
534int 534int
535ssh_update_card(AuthenticationConnection *auth, int add, const char *reader_id) 535ssh_update_card(AuthenticationConnection *auth, int add, const char *reader_id, const char *pin)
536{ 536{
537 Buffer msg; 537 Buffer msg;
538 int type; 538 int type;
@@ -541,6 +541,7 @@ ssh_update_card(AuthenticationConnection *auth, int add, const char *reader_id)
541 buffer_put_char(&msg, add ? SSH_AGENTC_ADD_SMARTCARD_KEY : 541 buffer_put_char(&msg, add ? SSH_AGENTC_ADD_SMARTCARD_KEY :
542 SSH_AGENTC_REMOVE_SMARTCARD_KEY); 542 SSH_AGENTC_REMOVE_SMARTCARD_KEY);
543 buffer_put_cstring(&msg, reader_id); 543 buffer_put_cstring(&msg, reader_id);
544 buffer_put_cstring(&msg, pin);
544 if (ssh_request_reply(auth, &msg, &msg) == 0) { 545 if (ssh_request_reply(auth, &msg, &msg) == 0) {
545 buffer_free(&msg); 546 buffer_free(&msg);
546 return 0; 547 return 0;
diff --git a/authfd.h b/authfd.h
index 0f2ca7a2e..e8a0ec88f 100644
--- a/authfd.h
+++ b/authfd.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfd.h,v 1.23 2002/03/04 17:27:39 stevesk Exp $ */ 1/* $OpenBSD: authfd.h,v 1.24 2002/03/21 22:44:05 rees Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -67,7 +67,7 @@ Key *ssh_get_next_identity(AuthenticationConnection *, char **, int);
67int ssh_add_identity(AuthenticationConnection *, Key *, const char *); 67int ssh_add_identity(AuthenticationConnection *, Key *, const char *);
68int ssh_remove_identity(AuthenticationConnection *, Key *); 68int ssh_remove_identity(AuthenticationConnection *, Key *);
69int ssh_remove_all_identities(AuthenticationConnection *, int); 69int ssh_remove_all_identities(AuthenticationConnection *, int);
70int ssh_update_card(AuthenticationConnection *, int, const char *); 70int ssh_update_card(AuthenticationConnection *, int, const char *, const char *);
71 71
72int 72int
73ssh_decrypt_challenge(AuthenticationConnection *, Key *, BIGNUM *, u_char[16], 73ssh_decrypt_challenge(AuthenticationConnection *, Key *, BIGNUM *, u_char[16],
diff --git a/ssh-add.c b/ssh-add.c
index baf2b3de7..d24d761a8 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.52 2002/03/21 10:21:20 markus Exp $"); 38RCSID("$OpenBSD: ssh-add.c,v 1.53 2002/03/21 22:44:05 rees Exp $");
39 39
40#include <openssl/evp.h> 40#include <openssl/evp.h>
41 41
@@ -176,7 +176,13 @@ add_file(AuthenticationConnection *ac, const char *filename)
176static int 176static int
177update_card(AuthenticationConnection *ac, int add, const char *id) 177update_card(AuthenticationConnection *ac, int add, const char *id)
178{ 178{
179 if (ssh_update_card(ac, add, id)) { 179 char *pin;
180
181 pin = read_passphrase("Enter passphrase for smartcard: ", RP_ALLOW_STDIN);
182 if (pin == NULL)
183 return -1;
184
185 if (ssh_update_card(ac, add, id, pin)) {
180 fprintf(stderr, "Card %s: %s\n", 186 fprintf(stderr, "Card %s: %s\n",
181 add ? "added" : "removed", id); 187 add ? "added" : "removed", id);
182 return 0; 188 return 0;
diff --git a/ssh-agent.c b/ssh-agent.c
index 555396fc5..1874eb152 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -34,7 +34,7 @@
34 */ 34 */
35 35
36#include "includes.h" 36#include "includes.h"
37RCSID("$OpenBSD: ssh-agent.c,v 1.82 2002/03/04 17:27:39 stevesk Exp $"); 37RCSID("$OpenBSD: ssh-agent.c,v 1.83 2002/03/21 22:44:05 rees Exp $");
38 38
39#if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H) 39#if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H)
40#include <sys/queue.h> 40#include <sys/queue.h>
@@ -454,12 +454,14 @@ process_add_smartcard_key (SocketEntry *e)
454{ 454{
455 Idtab *tab; 455 Idtab *tab;
456 Key *n = NULL, *k = NULL; 456 Key *n = NULL, *k = NULL;
457 char *sc_reader_id = NULL; 457 char *sc_reader_id = NULL, *pin;
458 int success = 0; 458 int success = 0;
459 459
460 sc_reader_id = buffer_get_string(&e->input, NULL); 460 sc_reader_id = buffer_get_string(&e->input, NULL);
461 k = sc_get_key(sc_reader_id); 461 pin = buffer_get_string(&e->input, NULL);
462 k = sc_get_key(sc_reader_id, pin);
462 xfree(sc_reader_id); 463 xfree(sc_reader_id);
464 xfree(pin);
463 465
464 if (k == NULL) { 466 if (k == NULL) {
465 error("sc_get_pubkey failed"); 467 error("sc_get_pubkey failed");
@@ -505,11 +507,13 @@ process_remove_smartcard_key(SocketEntry *e)
505{ 507{
506 Key *k = NULL; 508 Key *k = NULL;
507 int success = 0; 509 int success = 0;
508 char *sc_reader_id = NULL; 510 char *sc_reader_id = NULL, *pin;
509 511
510 sc_reader_id = buffer_get_string(&e->input, NULL); 512 sc_reader_id = buffer_get_string(&e->input, NULL);
511 k = sc_get_key(sc_reader_id); 513 pin = buffer_get_string(&e->input, NULL);
514 k = sc_get_key(sc_reader_id, pin);
512 xfree(sc_reader_id); 515 xfree(sc_reader_id);
516 xfree(pin);
513 517
514 if (k == NULL) { 518 if (k == NULL) {
515 error("sc_get_pubkey failed"); 519 error("sc_get_pubkey failed");
diff --git a/ssh.c b/ssh.c
index 7c57ca790..ae2e85480 100644
--- a/ssh.c
+++ b/ssh.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: ssh.c,v 1.165 2002/03/19 10:49:35 markus Exp $"); 42RCSID("$OpenBSD: ssh.c,v 1.166 2002/03/21 22:44:05 rees Exp $");
43 43
44#include <openssl/evp.h> 44#include <openssl/evp.h>
45#include <openssl/err.h> 45#include <openssl/err.h>
@@ -1193,7 +1193,7 @@ load_public_identity_files(void)
1193#ifdef SMARTCARD 1193#ifdef SMARTCARD
1194 if (options.smartcard_device != NULL && 1194 if (options.smartcard_device != NULL &&
1195 options.num_identity_files + 1 < SSH_MAX_IDENTITY_FILES && 1195 options.num_identity_files + 1 < SSH_MAX_IDENTITY_FILES &&
1196 (public = sc_get_key(options.smartcard_device)) != NULL ) { 1196 (public = sc_get_key(options.smartcard_device, NULL)) != NULL ) {
1197 Key *new; 1197 Key *new;
1198 1198
1199 if (options.num_identity_files + 2 > SSH_MAX_IDENTITY_FILES) 1199 if (options.num_identity_files + 2 > SSH_MAX_IDENTITY_FILES)