|
Jan F. Chadima |
a3ba41 |
diff -up openssh-5.2p1/key.c.nss-keys openssh-5.2p1/key.c
|
|
Jan F. Chadima |
adad2a |
--- openssh-5.2p1/key.c.nss-keys 2008-07-11 09:35:09.000000000 +0200
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/key.c 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
a3ba41 |
@@ -96,6 +96,54 @@ key_new(int type)
|
|
Jan F. Chadima |
a3ba41 |
return k;
|
|
Jan F. Chadima |
a3ba41 |
}
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
a3ba41 |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
a3ba41 |
+Key *
|
|
Jan F. Chadima |
a3ba41 |
+key_new_nss(int type)
|
|
Jan F. Chadima |
a3ba41 |
+{
|
|
Jan F. Chadima |
a3ba41 |
+ Key *k = key_new(type);
|
|
Tomáš Mráz |
c3274c |
+
|
|
Jan F. Chadima |
a3ba41 |
+ k->nss = xcalloc(1, sizeof(*k->nss));
|
|
Jan F. Chadima |
a3ba41 |
+ k->flags = KEY_FLAG_EXT | KEY_FLAG_NSS;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Jan F. Chadima |
a3ba41 |
+ return k;
|
|
Jan F. Chadima |
a3ba41 |
+}
|
|
Tomáš Mráz |
c9833c |
+
|
|
Jan F. Chadima |
a3ba41 |
+Key *
|
|
Jan F. Chadima |
a3ba41 |
+key_new_nss_copy(int type, const Key *c)
|
|
Jan F. Chadima |
a3ba41 |
+{
|
|
Jan F. Chadima |
a3ba41 |
+ Key *k = key_new_nss(type);
|
|
Tomáš Mráz |
c9833c |
+
|
|
Jan F. Chadima |
a3ba41 |
+ switch (k->type) {
|
|
Jan F. Chadima |
a3ba41 |
+ case KEY_RSA:
|
|
Jan F. Chadima |
a3ba41 |
+ if ((BN_copy(k->rsa->n, c->rsa->n) == NULL) ||
|
|
Jan F. Chadima |
a3ba41 |
+ (BN_copy(k->rsa->e, c->rsa->e) == NULL))
|
|
Jan F. Chadima |
a3ba41 |
+ fatal("key_new_nss_copy: BN_copy failed");
|
|
Jan F. Chadima |
a3ba41 |
+ break;
|
|
Jan F. Chadima |
a3ba41 |
+ case KEY_DSA:
|
|
Jan F. Chadima |
a3ba41 |
+ if ((BN_copy(k->dsa->p, c->rsa->p) == NULL) ||
|
|
Jan F. Chadima |
a3ba41 |
+ (BN_copy(k->dsa->q, c->dsa->q) == NULL) ||
|
|
Jan F. Chadima |
a3ba41 |
+ (BN_copy(k->dsa->g, c->dsa->g) == NULL) ||
|
|
Jan F. Chadima |
a3ba41 |
+ (BN_copy(k->dsa->pub_key, c->dsa->pub_key) == NULL))
|
|
Jan F. Chadima |
a3ba41 |
+ fatal("key_new_nss_copy: BN_copy failed");
|
|
Jan F. Chadima |
a3ba41 |
+ break;
|
|
Jan F. Chadima |
a3ba41 |
+ }
|
|
Jan F. Chadima |
a3ba41 |
+
|
|
Jan F. Chadima |
a3ba41 |
+ k->nss->privk = SECKEY_CopyPrivateKey(c->nss->privk);
|
|
Jan F. Chadima |
a3ba41 |
+ if (k->nss->privk == NULL)
|
|
Jan F. Chadima |
a3ba41 |
+ fatal("key_new_nss_copy: SECKEY_CopyPrivateKey failed");
|
|
Tomáš Mráz |
c9833c |
+
|
|
Jan F. Chadima |
a3ba41 |
+ k->nss->pubk = SECKEY_CopyPublicKey(c->nss->pubk);
|
|
Jan F. Chadima |
a3ba41 |
+ if (k->nss->pubk == NULL)
|
|
Jan F. Chadima |
a3ba41 |
+ fatal("key_new_nss_copy: SECKEY_CopyPublicKey failed");
|
|
Tomáš Mráz |
c9833c |
+
|
|
Jan F. Chadima |
a3ba41 |
+ if (c->nss->privk->wincx)
|
|
Jan F. Chadima |
a3ba41 |
+ k->nss->privk->wincx = xstrdup(c->nss->privk->wincx);
|
|
Tomáš Mráz |
c9833c |
+
|
|
Jan F. Chadima |
a3ba41 |
+ return k;
|
|
Jan F. Chadima |
a3ba41 |
+}
|
|
Jan F. Chadima |
a3ba41 |
+#endif
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+
|
|
Jan F. Chadima |
a3ba41 |
Key *
|
|
Jan F. Chadima |
a3ba41 |
key_new_private(int type)
|
|
Jan F. Chadima |
a3ba41 |
{
|
|
Jan F. Chadima |
a3ba41 |
@@ -151,6 +199,19 @@ key_free(Key *k)
|
|
Jan F. Chadima |
a3ba41 |
fatal("key_free: bad key type %d", k->type);
|
|
Jan F. Chadima |
a3ba41 |
break;
|
|
Jan F. Chadima |
a3ba41 |
}
|
|
Jan F. Chadima |
a3ba41 |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
a3ba41 |
+ if (k->flags & KEY_FLAG_NSS) {
|
|
Jan F. Chadima |
a3ba41 |
+ if (k->nss->privk != NULL && k->nss->privk->wincx != NULL) {
|
|
Jan F. Chadima |
a3ba41 |
+ memset(k->nss->privk->wincx, 0,
|
|
Jan F. Chadima |
a3ba41 |
+ strlen(k->nss->privk->wincx));
|
|
Jan F. Chadima |
a3ba41 |
+ xfree(k->nss->privk->wincx);
|
|
Jan F. Chadima |
a3ba41 |
+ k->nss->privk->wincx = NULL;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Jan F. Chadima |
a3ba41 |
+ SECKEY_DestroyPrivateKey(k->nss->privk);
|
|
Jan F. Chadima |
a3ba41 |
+ SECKEY_DestroyPublicKey(k->nss->pubk);
|
|
Jan F. Chadima |
a3ba41 |
+ xfree(k->nss);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Jan F. Chadima |
a3ba41 |
+#endif
|
|
Jan F. Chadima |
a3ba41 |
xfree(k);
|
|
Jan F. Chadima |
a3ba41 |
}
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
adad2a |
diff -up openssh-5.2p1/ssh-dss.c.nss-keys openssh-5.2p1/ssh-dss.c
|
|
Jan F. Chadima |
adad2a |
--- openssh-5.2p1/ssh-dss.c.nss-keys 2006-11-07 13:14:42.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/ssh-dss.c 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
@@ -39,6 +39,10 @@
|
|
Jan F. Chadima |
adad2a |
#include "log.h"
|
|
Jan F. Chadima |
adad2a |
#include "key.h"
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
a3ba41 |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
adad2a |
+#include <cryptohi.h>
|
|
Jan F. Chadima |
a3ba41 |
+#endif
|
|
Tomáš Mráz |
c3274c |
+
|
|
Jan F. Chadima |
adad2a |
#define INTBLOB_LEN 20
|
|
Jan F. Chadima |
adad2a |
#define SIGBLOB_LEN (2*INTBLOB_LEN)
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
adad2a |
@@ -57,6 +61,34 @@ ssh_dss_sign(const Key *key, u_char **si
|
|
Jan F. Chadima |
adad2a |
error("ssh_dss_sign: no DSA key");
|
|
Jan F. Chadima |
adad2a |
return -1;
|
|
Jan F. Chadima |
adad2a |
}
|
|
Jan F. Chadima |
adad2a |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
adad2a |
+ if (key->flags & KEY_FLAG_NSS) {
|
|
Jan F. Chadima |
adad2a |
+ SECItem sigitem;
|
|
Jan F. Chadima |
adad2a |
+ SECItem *rawsig;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Jan F. Chadima |
adad2a |
+ memset(&sigitem, 0, sizeof(sigitem));
|
|
Jan F. Chadima |
adad2a |
+ if (SEC_SignData(&sigitem, (u_char *)data, datalen, key->nss->privk,
|
|
Jan F. Chadima |
adad2a |
+ SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST) != SECSuccess) {
|
|
Jan F. Chadima |
adad2a |
+ error("ssh_dss_sign: sign failed");
|
|
Jan F. Chadima |
adad2a |
+ return -1;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ if ((rawsig=DSAU_DecodeDerSig(&sigitem)) == NULL) {
|
|
Jan F. Chadima |
adad2a |
+ error("ssh_dss_sign: der decode failed");
|
|
Jan F. Chadima |
adad2a |
+ SECITEM_ZfreeItem(&sigitem, PR_FALSE);
|
|
Jan F. Chadima |
adad2a |
+ return -1;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ SECITEM_ZfreeItem(&sigitem, PR_FALSE);
|
|
Jan F. Chadima |
adad2a |
+ if (rawsig->len != SIGBLOB_LEN) {
|
|
Jan F. Chadima |
adad2a |
+ error("ssh_dss_sign: unsupported signature length %d",
|
|
Jan F. Chadima |
adad2a |
+ rawsig->len);
|
|
Jan F. Chadima |
adad2a |
+ SECITEM_ZfreeItem(rawsig, PR_TRUE);
|
|
Jan F. Chadima |
adad2a |
+ return -1;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ memcpy(sigblob, rawsig->data, SIGBLOB_LEN);
|
|
Jan F. Chadima |
adad2a |
+ SECITEM_ZfreeItem(rawsig, PR_TRUE);
|
|
Jan F. Chadima |
adad2a |
+ } else {
|
|
Jan F. Chadima |
adad2a |
+#endif
|
|
Jan F. Chadima |
adad2a |
EVP_DigestInit(&md, evp_md);
|
|
Jan F. Chadima |
adad2a |
EVP_DigestUpdate(&md, data, datalen);
|
|
Jan F. Chadima |
adad2a |
EVP_DigestFinal(&md, digest, &dlen);
|
|
Jan F. Chadima |
adad2a |
@@ -80,7 +112,9 @@ ssh_dss_sign(const Key *key, u_char **si
|
|
Jan F. Chadima |
adad2a |
BN_bn2bin(sig->r, sigblob+ SIGBLOB_LEN - INTBLOB_LEN - rlen);
|
|
Jan F. Chadima |
adad2a |
BN_bn2bin(sig->s, sigblob+ SIGBLOB_LEN - slen);
|
|
Jan F. Chadima |
adad2a |
DSA_SIG_free(sig);
|
|
Jan F. Chadima |
adad2a |
-
|
|
Jan F. Chadima |
a3ba41 |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
a3ba41 |
+#endif
|
|
Jan F. Chadima |
adad2a |
if (datafellows & SSH_BUG_SIGBLOB) {
|
|
Jan F. Chadima |
adad2a |
if (lenp != NULL)
|
|
Jan F. Chadima |
adad2a |
*lenp = SIGBLOB_LEN;
|
|
Jan F. Chadima |
adad2a |
diff -up openssh-5.2p1/ssh-agent.c.nss-keys openssh-5.2p1/ssh-agent.c
|
|
Jan F. Chadima |
adad2a |
--- openssh-5.2p1/ssh-agent.c.nss-keys 2008-07-04 15:10:49.000000000 +0200
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/ssh-agent.c 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
@@ -80,6 +80,10 @@
|
|
Jan F. Chadima |
adad2a |
#include "scard.h"
|
|
Jan F. Chadima |
adad2a |
#endif
|
|
Tomáš Mráz |
c3274c |
|
|
Jan F. Chadima |
a3ba41 |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
adad2a |
+#include "nsskeys.h"
|
|
Jan F. Chadima |
a3ba41 |
+#endif
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
#if defined(HAVE_SYS_PRCTL_H)
|
|
Jan F. Chadima |
adad2a |
#include <sys/prctl.h> /* For prctl() and PR_SET_DUMPABLE */
|
|
Jan F. Chadima |
adad2a |
#endif
|
|
Jan F. Chadima |
adad2a |
@@ -714,6 +718,114 @@ send:
|
|
Jan F. Chadima |
adad2a |
}
|
|
Jan F. Chadima |
adad2a |
#endif /* SMARTCARD */
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
adad2a |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
adad2a |
+static void
|
|
Jan F. Chadima |
adad2a |
+process_add_nss_key (SocketEntry *e)
|
|
Jan F. Chadima |
adad2a |
+{
|
|
Jan F. Chadima |
adad2a |
+ char *tokenname = NULL, *keyname = NULL, *password = NULL;
|
|
Jan F. Chadima |
adad2a |
+ int i, version, success = 0, death = 0, confirm = 0;
|
|
Jan F. Chadima |
adad2a |
+ Key **keys, *k;
|
|
Jan F. Chadima |
adad2a |
+ Identity *id;
|
|
Jan F. Chadima |
adad2a |
+ Idtab *tab;
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ tokenname = buffer_get_string(&e->request, NULL);
|
|
Jan F. Chadima |
adad2a |
+ keyname = buffer_get_string(&e->request, NULL);
|
|
Jan F. Chadima |
adad2a |
+ password = buffer_get_string(&e->request, NULL);
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ while (buffer_len(&e->request)) {
|
|
Jan F. Chadima |
adad2a |
+ switch (buffer_get_char(&e->request)) {
|
|
Jan F. Chadima |
adad2a |
+ case SSH_AGENT_CONSTRAIN_LIFETIME:
|
|
Jan F. Chadima |
adad2a |
+ death = time(NULL) + buffer_get_int(&e->request);
|
|
Jan F. Chadima |
adad2a |
+ break;
|
|
Jan F. Chadima |
adad2a |
+ case SSH_AGENT_CONSTRAIN_CONFIRM:
|
|
Jan F. Chadima |
adad2a |
+ confirm = 1;
|
|
Jan F. Chadima |
adad2a |
+ break;
|
|
Jan F. Chadima |
adad2a |
+ default:
|
|
Jan F. Chadima |
adad2a |
+ break;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ if (lifetime && !death)
|
|
Jan F. Chadima |
adad2a |
+ death = time(NULL) + lifetime;
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ keys = nss_get_keys(tokenname, keyname, password);
|
|
Jan F. Chadima |
adad2a |
+ /* password is owned by keys[0] now */
|
|
Jan F. Chadima |
adad2a |
+ xfree(tokenname);
|
|
Jan F. Chadima |
adad2a |
+ xfree(keyname);
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ if (keys == NULL) {
|
|
Jan F. Chadima |
adad2a |
+ memset(password, 0, strlen(password));
|
|
Jan F. Chadima |
adad2a |
+ xfree(password);
|
|
Jan F. Chadima |
adad2a |
+ error("nss_get_keys failed");
|
|
Jan F. Chadima |
adad2a |
+ goto send;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ for (i = 0; keys[i] != NULL; i++) {
|
|
Jan F. Chadima |
adad2a |
+ k = keys[i];
|
|
Jan F. Chadima |
adad2a |
+ version = k->type == KEY_RSA1 ? 1 : 2;
|
|
Jan F. Chadima |
adad2a |
+ tab = idtab_lookup(version);
|
|
Jan F. Chadima |
adad2a |
+ if (lookup_identity(k, version) == NULL) {
|
|
Jan F. Chadima |
adad2a |
+ id = xmalloc(sizeof(Identity));
|
|
Jan F. Chadima |
adad2a |
+ id->key = k;
|
|
Jan F. Chadima |
adad2a |
+ id->comment = nss_get_key_label(k);
|
|
Jan F. Chadima |
adad2a |
+ id->death = death;
|
|
Jan F. Chadima |
adad2a |
+ id->confirm = confirm;
|
|
Jan F. Chadima |
adad2a |
+ TAILQ_INSERT_TAIL(&tab->idlist, id, next);
|
|
Jan F. Chadima |
adad2a |
+ tab->nentries++;
|
|
Jan F. Chadima |
adad2a |
+ success = 1;
|
|
Jan F. Chadima |
adad2a |
+ } else {
|
|
Jan F. Chadima |
adad2a |
+ key_free(k);
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ keys[i] = NULL;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ xfree(keys);
|
|
Jan F. Chadima |
adad2a |
+send:
|
|
Jan F. Chadima |
adad2a |
+ buffer_put_int(&e->output, 1);
|
|
Jan F. Chadima |
adad2a |
+ buffer_put_char(&e->output,
|
|
Jan F. Chadima |
adad2a |
+ success ? SSH_AGENT_SUCCESS : SSH_AGENT_FAILURE);
|
|
Jan F. Chadima |
adad2a |
+}
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+static void
|
|
Jan F. Chadima |
adad2a |
+process_remove_nss_key(SocketEntry *e)
|
|
Jan F. Chadima |
adad2a |
+{
|
|
Jan F. Chadima |
adad2a |
+ char *tokenname = NULL, *keyname = NULL, *password = NULL;
|
|
Jan F. Chadima |
adad2a |
+ int i, version, success = 0;
|
|
Jan F. Chadima |
adad2a |
+ Key **keys, *k = NULL;
|
|
Jan F. Chadima |
adad2a |
+ Identity *id;
|
|
Jan F. Chadima |
adad2a |
+ Idtab *tab;
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ tokenname = buffer_get_string(&e->request, NULL);
|
|
Jan F. Chadima |
adad2a |
+ keyname = buffer_get_string(&e->request, NULL);
|
|
Jan F. Chadima |
adad2a |
+ password = buffer_get_string(&e->request, NULL);
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ keys = nss_get_keys(tokenname, keyname, password);
|
|
Jan F. Chadima |
adad2a |
+ xfree(tokenname);
|
|
Jan F. Chadima |
adad2a |
+ xfree(keyname);
|
|
Jan F. Chadima |
adad2a |
+ xfree(password);
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ if (keys == NULL || keys[0] == NULL) {
|
|
Jan F. Chadima |
adad2a |
+ error("nss_get_keys failed");
|
|
Jan F. Chadima |
adad2a |
+ goto send;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ for (i = 0; keys[i] != NULL; i++) {
|
|
Jan F. Chadima |
adad2a |
+ k = keys[i];
|
|
Jan F. Chadima |
adad2a |
+ version = k->type == KEY_RSA1 ? 1 : 2;
|
|
Jan F. Chadima |
adad2a |
+ if ((id = lookup_identity(k, version)) != NULL) {
|
|
Jan F. Chadima |
adad2a |
+ tab = idtab_lookup(version);
|
|
Jan F. Chadima |
adad2a |
+ TAILQ_REMOVE(&tab->idlist, id, next);
|
|
Jan F. Chadima |
adad2a |
+ tab->nentries--;
|
|
Jan F. Chadima |
adad2a |
+ free_identity(id);
|
|
Jan F. Chadima |
adad2a |
+ success = 1;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ key_free(k);
|
|
Jan F. Chadima |
adad2a |
+ keys[i] = NULL;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ xfree(keys);
|
|
Jan F. Chadima |
adad2a |
+send:
|
|
Jan F. Chadima |
adad2a |
+ buffer_put_int(&e->output, 1);
|
|
Jan F. Chadima |
adad2a |
+ buffer_put_char(&e->output,
|
|
Jan F. Chadima |
adad2a |
+ success ? SSH_AGENT_SUCCESS : SSH_AGENT_FAILURE);
|
|
Jan F. Chadima |
adad2a |
+}
|
|
Jan F. Chadima |
adad2a |
+#endif /* HAVE_LIBNSS */
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
/* dispatch incoming messages */
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
adad2a |
static void
|
|
Jan F. Chadima |
adad2a |
@@ -806,6 +918,15 @@ process_message(SocketEntry *e)
|
|
Jan F. Chadima |
adad2a |
process_remove_smartcard_key(e);
|
|
Jan F. Chadima |
adad2a |
break;
|
|
Jan F. Chadima |
adad2a |
#endif /* SMARTCARD */
|
|
Jan F. Chadima |
adad2a |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
adad2a |
+ case SSH_AGENTC_ADD_NSS_KEY:
|
|
Jan F. Chadima |
adad2a |
+ case SSH_AGENTC_ADD_NSS_KEY_CONSTRAINED:
|
|
Jan F. Chadima |
adad2a |
+ process_add_nss_key(e);
|
|
Jan F. Chadima |
adad2a |
+ break;
|
|
Jan F. Chadima |
adad2a |
+ case SSH_AGENTC_REMOVE_NSS_KEY:
|
|
Jan F. Chadima |
adad2a |
+ process_remove_nss_key(e);
|
|
Jan F. Chadima |
adad2a |
+ break;
|
|
Jan F. Chadima |
adad2a |
+#endif /* SMARTCARD */
|
|
Jan F. Chadima |
adad2a |
default:
|
|
Jan F. Chadima |
adad2a |
/* Unknown message. Respond with failure. */
|
|
Jan F. Chadima |
adad2a |
error("Unknown message %d", type);
|
|
Jan F. Chadima |
adad2a |
diff -up openssh-5.2p1/authfd.h.nss-keys openssh-5.2p1/authfd.h
|
|
Jan F. Chadima |
adad2a |
--- openssh-5.2p1/authfd.h.nss-keys 2006-08-05 04:39:39.000000000 +0200
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/authfd.h 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
@@ -49,6 +49,12 @@
|
|
Jan F. Chadima |
adad2a |
#define SSH2_AGENTC_ADD_ID_CONSTRAINED 25
|
|
Jan F. Chadima |
adad2a |
#define SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED 26
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
adad2a |
+/* nss */
|
|
Jan F. Chadima |
adad2a |
+#define SSH_AGENTC_ADD_NSS_KEY 30
|
|
Jan F. Chadima |
adad2a |
+#define SSH_AGENTC_REMOVE_NSS_KEY 31
|
|
Jan F. Chadima |
adad2a |
+#define SSH_AGENTC_ADD_NSS_KEY_CONSTRAINED 32
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
#define SSH_AGENT_CONSTRAIN_LIFETIME 1
|
|
Jan F. Chadima |
adad2a |
#define SSH_AGENT_CONSTRAIN_CONFIRM 2
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
adad2a |
@@ -83,6 +89,8 @@ int ssh_remove_all_identities(Authentic
|
|
Jan F. Chadima |
adad2a |
int ssh_lock_agent(AuthenticationConnection *, int, const char *);
|
|
Jan F. Chadima |
adad2a |
int ssh_update_card(AuthenticationConnection *, int, const char *,
|
|
Jan F. Chadima |
adad2a |
const char *, u_int, u_int);
|
|
Jan F. Chadima |
adad2a |
+int ssh_update_nss_key(AuthenticationConnection *, int, const char *,
|
|
Jan F. Chadima |
adad2a |
+ const char *, const char *, u_int, u_int);
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
adad2a |
int
|
|
Jan F. Chadima |
adad2a |
ssh_decrypt_challenge(AuthenticationConnection *, Key *, BIGNUM *, u_char[16],
|
|
Jan F. Chadima |
adad2a |
diff -up openssh-5.2p1/configure.ac.nss-keys openssh-5.2p1/configure.ac
|
|
Jan F. Chadima |
adad2a |
--- openssh-5.2p1/configure.ac.nss-keys 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/configure.ac 2008-11-18 19:12:38.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
@@ -3436,6 +3436,20 @@ AC_ARG_WITH(kerberos5,
|
|
Jan F. Chadima |
adad2a |
]
|
|
Jan F. Chadima |
adad2a |
)
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
adad2a |
+# Check whether user wants NSS support
|
|
Jan F. Chadima |
adad2a |
+LIBNSS_MSG="no"
|
|
Jan F. Chadima |
adad2a |
+AC_ARG_WITH(nss,
|
|
Jan F. Chadima |
adad2a |
+ [ --with-nss Enable NSS support],
|
|
Jan F. Chadima |
adad2a |
+ [ if test "x$withval" != "xno" ; then
|
|
Jan F. Chadima |
adad2a |
+ AC_DEFINE(HAVE_LIBNSS,1,[Define if you want NSS support.])
|
|
Jan F. Chadima |
adad2a |
+ LIBNSS_MSG="yes"
|
|
Jan F. Chadima |
adad2a |
+ CPPFLAGS="$CPPFLAGS -I/usr/include/nss3 -I/usr/include/nspr4"
|
|
Jan F. Chadima |
adad2a |
+ AC_CHECK_HEADERS(pk11pub.h)
|
|
Jan F. Chadima |
adad2a |
+ LIBS="$LIBS -lnss3"
|
|
Jan F. Chadima |
adad2a |
+ fi
|
|
Jan F. Chadima |
adad2a |
+ ])
|
|
Jan F. Chadima |
adad2a |
+AC_SUBST(LIBNSS)
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
# Looking for programs, paths and files
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
adad2a |
PRIVSEP_PATH=/var/empty
|
|
Jan F. Chadima |
adad2a |
@@ -4163,6 +4177,7 @@ echo " TCP Wrappers support
|
|
Jan F. Chadima |
adad2a |
echo " MD5 password support: $MD5_MSG"
|
|
Jan F. Chadima |
adad2a |
echo " libedit support: $LIBEDIT_MSG"
|
|
Jan F. Chadima |
adad2a |
echo " Solaris process contract support: $SPC_MSG"
|
|
Jan F. Chadima |
adad2a |
+echo " NSS support: $LIBNSS_MSG"
|
|
Jan F. Chadima |
adad2a |
echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
|
|
Jan F. Chadima |
adad2a |
echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
|
|
Jan F. Chadima |
adad2a |
echo " BSD Auth support: $BSD_AUTH_MSG"
|
|
Jan F. Chadima |
adad2a |
diff -up /dev/null openssh-5.2p1/README.nss
|
|
Jan F. Chadima |
adad2a |
--- /dev/null 2008-11-17 17:51:52.160001870 +0100
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/README.nss 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
@@ -0,0 +1,36 @@
|
|
Jan F. Chadima |
adad2a |
+How to use NSS tokens with OpenSSH?
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+This version of OpenSSH contains experimental support for authentication using
|
|
Jan F. Chadima |
adad2a |
+keys stored in tokens stored in NSS database. This for example includes any
|
|
Jan F. Chadima |
adad2a |
+PKCS#11 tokens which are installed in your NSS database.
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+As the code is experimental and preliminary only SSH protocol 2 is supported.
|
|
Jan F. Chadima |
adad2a |
+The NSS certificate and token databases are looked for in the ~/.ssh
|
|
Jan F. Chadima |
adad2a |
+directory or in a directory specified by environment variable NSS_DB_PATH.
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+Common operations:
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+(1) tell the ssh client to use the NSS keys:
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ $ ssh -o 'UseNSS yes' otherhost
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ if you want to use a specific token:
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ $ ssh -o 'UseNSS yes' -o 'NSS Token My PKCS11 Token' otherhost
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+(2) or tell the agent to use the NSS keys:
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ $ ssh-add -n
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ if you want to use a specific token:
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ $ ssh-add -n -T 'My PKCS11 Token'
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+(3) extract the public key from token so it can be added to the
|
|
Jan F. Chadima |
adad2a |
+server:
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ $ ssh-keygen -n
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ if you want to use a specific token and/or key:
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ $ ssh-keygen -n -D 'My PKCS11 Token' 'My Key ID'
|
|
Jan F. Chadima |
adad2a |
diff -up openssh-5.2p1/authfd.c.nss-keys openssh-5.2p1/authfd.c
|
|
Jan F. Chadima |
adad2a |
--- openssh-5.2p1/authfd.c.nss-keys 2006-09-01 07:38:36.000000000 +0200
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/authfd.c 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
@@ -626,6 +626,45 @@ ssh_update_card(AuthenticationConnection
|
|
Jan F. Chadima |
adad2a |
return decode_reply(type);
|
|
Jan F. Chadima |
adad2a |
}
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
adad2a |
+int
|
|
Jan F. Chadima |
adad2a |
+ssh_update_nss_key(AuthenticationConnection *auth, int add,
|
|
Jan F. Chadima |
adad2a |
+ const char *tokenname, const char *keyname,
|
|
Jan F. Chadima |
adad2a |
+ const char *pass, u_int life, u_int confirm)
|
|
Jan F. Chadima |
adad2a |
+{
|
|
Jan F. Chadima |
adad2a |
+ Buffer msg;
|
|
Jan F. Chadima |
adad2a |
+ int type, constrained = (life || confirm);
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ if (add) {
|
|
Jan F. Chadima |
adad2a |
+ type = constrained ?
|
|
Jan F. Chadima |
adad2a |
+ SSH_AGENTC_ADD_NSS_KEY_CONSTRAINED :
|
|
Jan F. Chadima |
adad2a |
+ SSH_AGENTC_ADD_NSS_KEY;
|
|
Jan F. Chadima |
adad2a |
+ } else
|
|
Jan F. Chadima |
adad2a |
+ type = SSH_AGENTC_REMOVE_NSS_KEY;
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ buffer_init(&msg;;
|
|
Jan F. Chadima |
adad2a |
+ buffer_put_char(&msg, type);
|
|
Jan F. Chadima |
adad2a |
+ buffer_put_cstring(&msg, tokenname);
|
|
Jan F. Chadima |
adad2a |
+ buffer_put_cstring(&msg, keyname);
|
|
Jan F. Chadima |
adad2a |
+ buffer_put_cstring(&msg, pass);
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ if (constrained) {
|
|
Jan F. Chadima |
adad2a |
+ if (life != 0) {
|
|
Jan F. Chadima |
adad2a |
+ buffer_put_char(&msg, SSH_AGENT_CONSTRAIN_LIFETIME);
|
|
Jan F. Chadima |
adad2a |
+ buffer_put_int(&msg, life);
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ if (confirm != 0)
|
|
Jan F. Chadima |
adad2a |
+ buffer_put_char(&msg, SSH_AGENT_CONSTRAIN_CONFIRM);
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ if (ssh_request_reply(auth, &msg, &msg) == 0) {
|
|
Jan F. Chadima |
adad2a |
+ buffer_free(&msg;;
|
|
Jan F. Chadima |
adad2a |
+ return 0;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ type = buffer_get_char(&msg;;
|
|
Jan F. Chadima |
adad2a |
+ buffer_free(&msg;;
|
|
Jan F. Chadima |
adad2a |
+ return decode_reply(type);
|
|
Jan F. Chadima |
adad2a |
+}
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
/*
|
|
Jan F. Chadima |
adad2a |
* Removes all identities from the agent. This call is not meant to be used
|
|
Jan F. Chadima |
adad2a |
* by normal applications.
|
|
Jan F. Chadima |
adad2a |
diff -up openssh-5.2p1/readconf.h.nss-keys openssh-5.2p1/readconf.h
|
|
Jan F. Chadima |
adad2a |
--- openssh-5.2p1/readconf.h.nss-keys 2008-06-29 16:04:03.000000000 +0200
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/readconf.h 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
@@ -84,6 +84,8 @@ typedef struct {
|
|
Jan F. Chadima |
adad2a |
char *preferred_authentications;
|
|
Jan F. Chadima |
adad2a |
char *bind_address; /* local socket address for connection to sshd */
|
|
Jan F. Chadima |
adad2a |
char *smartcard_device; /* Smartcard reader device */
|
|
Jan F. Chadima |
adad2a |
+ int use_nss; /* Use NSS library for keys */
|
|
Jan F. Chadima |
adad2a |
+ char *nss_token; /* Look for NSS keys on token */
|
|
Jan F. Chadima |
adad2a |
int verify_host_key_dns; /* Verify host key using DNS */
|
|
Jan F. Chadima |
a3ba41 |
|
|
Jan F. Chadima |
adad2a |
int num_identity_files; /* Number of files for RSA/DSA identities. */
|
|
Jan F. Chadima |
a3ba41 |
diff -up /dev/null openssh-5.2p1/nsskeys.c
|
|
Jan F. Chadima |
adad2a |
--- /dev/null 2008-11-17 17:51:52.160001870 +0100
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/nsskeys.c 2008-11-18 19:11:41.000000000 +0100
|
|
Tomáš Mráz |
c3274c |
@@ -0,0 +1,327 @@
|
|
Tomáš Mráz |
c3274c |
+/*
|
|
Tomáš Mráz |
c3274c |
+ * Copyright (c) 2001 Markus Friedl. All rights reserved.
|
|
Tomáš Mráz |
c3274c |
+ * Copyright (c) 2007 Red Hat, Inc. All rights reserved.
|
|
Tomáš Mráz |
c3274c |
+ *
|
|
Tomáš Mráz |
c3274c |
+ * Redistribution and use in source and binary forms, with or without
|
|
Tomáš Mráz |
c3274c |
+ * modification, are permitted provided that the following conditions
|
|
Tomáš Mráz |
c3274c |
+ * are met:
|
|
Tomáš Mráz |
c3274c |
+ * 1. Redistributions of source code must retain the above copyright
|
|
Tomáš Mráz |
c3274c |
+ * notice, this list of conditions and the following disclaimer.
|
|
Tomáš Mráz |
c3274c |
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|
Tomáš Mráz |
c3274c |
+ * notice, this list of conditions and the following disclaimer in the
|
|
Tomáš Mráz |
c3274c |
+ * documentation and/or other materials provided with the distribution.
|
|
Tomáš Mráz |
c3274c |
+ *
|
|
Tomáš Mráz |
c3274c |
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
Tomáš Mráz |
c3274c |
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
Tomáš Mráz |
c3274c |
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
Tomáš Mráz |
c3274c |
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
Tomáš Mráz |
c3274c |
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
Tomáš Mráz |
c3274c |
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Tomáš Mráz |
c3274c |
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Tomáš Mráz |
c3274c |
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Tomáš Mráz |
c3274c |
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
Tomáš Mráz |
c3274c |
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Tomáš Mráz |
c3274c |
+ */
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+#include "includes.h"
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+#include <sys/types.h>
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+#include <stdarg.h>
|
|
Tomáš Mráz |
c3274c |
+#include <string.h>
|
|
Tomáš Mráz |
c3274c |
+#include <unistd.h>
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+#include <openssl/evp.h>
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+#include <nss.h>
|
|
Tomáš Mráz |
c3274c |
+#include <keyhi.h>
|
|
Tomáš Mráz |
c3274c |
+#include <pk11pub.h>
|
|
Tomáš Mráz |
c3274c |
+#include <cert.h>
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+#include "xmalloc.h"
|
|
Tomáš Mráz |
c3274c |
+#include "key.h"
|
|
Tomáš Mráz |
c3274c |
+#include "log.h"
|
|
Tomáš Mráz |
c3274c |
+#include "misc.h"
|
|
Tomáš Mráz |
c3274c |
+#include "nsskeys.h"
|
|
Tomáš Mráz |
c3274c |
+#include "pathnames.h"
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+static char *
|
|
Tomáš Mráz |
c3274c |
+password_cb(PK11SlotInfo *slot, PRBool retry, void *arg)
|
|
Tomáš Mráz |
c3274c |
+{
|
|
Tomáš Mráz |
c3274c |
+ char *password = arg;
|
|
Tomáš Mráz |
c3274c |
+ if (retry || password == NULL)
|
|
Tomáš Mráz |
c3274c |
+ return NULL;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ return PL_strdup(password);
|
|
Tomáš Mráz |
c3274c |
+}
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+int
|
|
Tomáš Mráz |
c3274c |
+nss_init(PK11PasswordFunc pwfn)
|
|
Tomáš Mráz |
c3274c |
+{
|
|
Tomáš Mráz |
c3274c |
+ char *dbpath;
|
|
Tomáš Mráz |
c3274c |
+ char buf[MAXPATHLEN];
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (NSS_IsInitialized())
|
|
Tomáš Mráz |
c3274c |
+ return 0;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if ((dbpath=getenv("NSS_DB_PATH")) == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ struct passwd *pw;
|
|
Tomáš Mráz |
c3274c |
+ if ((pw = getpwuid(getuid())) == NULL ||
|
|
Tomáš Mráz |
c3274c |
+ pw->pw_dir == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ return -1;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ snprintf(buf, sizeof(buf), "%s/%s", pw->pw_dir,
|
|
Tomáš Mráz |
c3274c |
+ _PATH_SSH_USER_DIR);
|
|
Tomáš Mráz |
c3274c |
+ dbpath = buf;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (NSS_Init(dbpath) != SECSuccess)
|
|
Tomáš Mráz |
c3274c |
+ return -1;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (pwfn == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ pwfn = password_cb;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ PK11_SetPasswordFunc(pwfn);
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ return 0;
|
|
Tomáš Mráz |
c3274c |
+}
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+static Key *
|
|
Tomáš Mráz |
c3274c |
+make_key_from_privkey(SECKEYPrivateKey *privk, char *password)
|
|
Tomáš Mráz |
c3274c |
+{
|
|
Tomáš Mráz |
c3274c |
+ Key *k;
|
|
Tomáš Mráz |
c3274c |
+ switch (SECKEY_GetPrivateKeyType(privk)) {
|
|
Tomáš Mráz |
c3274c |
+ case rsaKey:
|
|
Tomáš Mráz |
c3274c |
+ k = key_new_nss(KEY_RSA);
|
|
Tomáš Mráz |
c3274c |
+ break;
|
|
Tomáš Mráz |
c3274c |
+ case dsaKey:
|
|
Tomáš Mráz |
c3274c |
+ k = key_new_nss(KEY_DSA);
|
|
Tomáš Mráz |
c3274c |
+ break;
|
|
Tomáš Mráz |
c3274c |
+ default:
|
|
Tomáš Mráz |
c3274c |
+ return NULL;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ k->nss->pubk = SECKEY_ConvertToPublicKey(privk);
|
|
Tomáš Mráz |
c3274c |
+ if (k->nss->pubk != NULL) {
|
|
Tomáš Mráz |
c3274c |
+ k->nss->privk = SECKEY_CopyPrivateKey(privk);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ if (k->nss->privk != NULL) {
|
|
Tomáš Mráz |
c3274c |
+ if (password != NULL) {
|
|
Tomáš Mráz |
c3274c |
+ k->nss->privk->wincx = xstrdup(password);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ return k;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ key_free(k);
|
|
Tomáš Mráz |
c3274c |
+ return NULL;
|
|
Tomáš Mráz |
c3274c |
+}
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+static Key **
|
|
Tomáš Mráz |
c3274c |
+add_key_to_list(Key *k, Key **keys, size_t *i, size_t *allocated)
|
|
Tomáš Mráz |
c3274c |
+{
|
|
Tomáš Mráz |
c3274c |
+ if (*allocated < *i + 2) {
|
|
Tomáš Mráz |
c3274c |
+ *allocated += 16;
|
|
Tomáš Mráz |
c3274c |
+ keys = xrealloc(keys, *allocated, sizeof(k));
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ keys[*i] = k;
|
|
Tomáš Mráz |
c3274c |
+ (*i)++;
|
|
Tomáš Mráz |
c3274c |
+ keys[*i] = NULL;
|
|
Tomáš Mráz |
c3274c |
+ return keys;
|
|
Tomáš Mráz |
c3274c |
+}
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+static int
|
|
Tomáš Mráz |
c3274c |
+nss_convert_pubkey(Key *k)
|
|
Tomáš Mráz |
c3274c |
+{
|
|
Tomáš Mráz |
c3274c |
+ u_char *n;
|
|
Tomáš Mráz |
c3274c |
+ unsigned int len;
|
|
Tomáš Mráz |
c3274c |
+ char *p;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ switch (k->type) {
|
|
Tomáš Mráz |
c3274c |
+ case KEY_RSA:
|
|
Tomáš Mráz |
c3274c |
+ n = k->nss->pubk->u.rsa.modulus.data;
|
|
Tomáš Mráz |
c3274c |
+ len = k->nss->pubk->u.rsa.modulus.len;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (BN_bin2bn(n, len, k->rsa->n) == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ fatal("nss_convert_pubkey: BN_bin2bn failed");
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ n = k->nss->pubk->u.rsa.publicExponent.data;
|
|
Tomáš Mráz |
c3274c |
+ len = k->nss->pubk->u.rsa.publicExponent.len;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (BN_bin2bn(n, len, k->rsa->e) == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ fatal("nss_convert_pubkey: BN_bin2bn failed");
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ break;
|
|
Tomáš Mráz |
c3274c |
+ case KEY_DSA:
|
|
Tomáš Mráz |
c3274c |
+ n = k->nss->pubk->u.dsa.params.prime.data;
|
|
Tomáš Mráz |
c3274c |
+ len = k->nss->pubk->u.dsa.params.prime.len;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (BN_bin2bn(n, len, k->dsa->p) == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ fatal("nss_convert_pubkey: BN_bin2bn failed");
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ n = k->nss->pubk->u.dsa.params.subPrime.data;
|
|
Tomáš Mráz |
c3274c |
+ len = k->nss->pubk->u.dsa.params.subPrime.len;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (BN_bin2bn(n, len, k->dsa->q) == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ fatal("nss_convert_pubkey: BN_bin2bn failed");
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ n = k->nss->pubk->u.dsa.params.base.data;
|
|
Tomáš Mráz |
c3274c |
+ len = k->nss->pubk->u.dsa.params.base.len;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (BN_bin2bn(n, len, k->dsa->g) == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ fatal("nss_convert_pubkey: BN_bin2bn failed");
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ n = k->nss->pubk->u.dsa.publicValue.data;
|
|
Tomáš Mráz |
c3274c |
+ len = k->nss->pubk->u.dsa.publicValue.len;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (BN_bin2bn(n, len, k->dsa->pub_key) == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ fatal("nss_convert_pubkey: BN_bin2bn failed");
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ break;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Jan F. Chadima |
adad2a |
+ p = key_fingerprint(k, SSH_FP_MD5, SSH_FP_HEX);
|
|
Jan F. Chadima |
adad2a |
+ debug("fingerprint %u %s", key_size(k), p);
|
|
Tomáš Mráz |
c3274c |
+ xfree(p);
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ return 0;
|
|
Tomáš Mráz |
c3274c |
+}
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+static Key **
|
|
Tomáš Mráz |
c3274c |
+nss_find_privkeys(const char *tokenname, const char *keyname,
|
|
Tomáš Mráz |
c3274c |
+ char *password)
|
|
Tomáš Mráz |
c3274c |
+{
|
|
Tomáš Mráz |
c3274c |
+ Key *k = NULL;
|
|
Tomáš Mráz |
c3274c |
+ Key **keys = NULL;
|
|
Tomáš Mráz |
c3274c |
+ PK11SlotList *slots;
|
|
Tomáš Mráz |
c3274c |
+ PK11SlotListElement *sle;
|
|
Tomáš Mráz |
c3274c |
+ size_t allocated = 0;
|
|
Tomáš Mráz |
c3274c |
+ size_t i = 0;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if ((slots=PK11_FindSlotsByNames(NULL, NULL, tokenname, PR_TRUE)) == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ if (tokenname == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ debug("No NSS token found");
|
|
Tomáš Mráz |
c3274c |
+ } else {
|
|
Tomáš Mráz |
c3274c |
+ debug("NSS token not found: %s", tokenname);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ return NULL;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ for (sle = slots->head; sle; sle = sle->next) {
|
|
Tomáš Mráz |
c3274c |
+ SECKEYPrivateKeyList *list;
|
|
Tomáš Mráz |
c3274c |
+ SECKEYPrivateKeyListNode *node;
|
|
Tomáš Mráz |
c3274c |
+ char *tmppass = password;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (PK11_NeedLogin(sle->slot)) {
|
|
Tomáš Mráz |
c3274c |
+ if (password == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ char *prompt;
|
|
Tomáš Mráz |
c3274c |
+ if (asprintf(&prompt, "Enter passphrase for token %s: ",
|
|
Tomáš Mráz |
c3274c |
+ PK11_GetTokenName(sle->slot)) < 0)
|
|
Tomáš Mráz |
c3274c |
+ fatal("password_cb: asprintf failed");
|
|
Tomáš Mráz |
c3274c |
+ tmppass = read_passphrase(prompt, RP_ALLOW_STDIN);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ PK11_Authenticate(sle->slot, PR_TRUE, tmppass);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ debug("Looking for: %s:%s", tokenname, keyname);
|
|
Tomáš Mráz |
c3274c |
+ list = PK11_ListPrivKeysInSlot(sle->slot, (char *)keyname,
|
|
Tomáš Mráz |
c3274c |
+ tmppass);
|
|
Tomáš Mráz |
c3274c |
+ if (list == NULL && keyname != NULL) {
|
|
Tomáš Mráz |
c3274c |
+ char *fooname;
|
|
Tomáš Mráz |
c3274c |
+ /* NSS bug workaround */
|
|
Tomáš Mráz |
c3274c |
+ if (asprintf(&fooname, "%s~", keyname) < 0) {
|
|
Tomáš Mráz |
c3274c |
+ error("nss_find_privkey: asprintf failed");
|
|
Tomáš Mráz |
c3274c |
+ PK11_FreeSlotList(slots);
|
|
Tomáš Mráz |
c3274c |
+ return NULL;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ list = PK11_ListPrivKeysInSlot(sle->slot, fooname,
|
|
Tomáš Mráz |
c3274c |
+ tmppass);
|
|
Tomáš Mráz |
c3274c |
+ free(fooname);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ if (list == NULL && keyname != NULL) {
|
|
Tomáš Mráz |
c3274c |
+ CERTCertificate *cert;
|
|
Tomáš Mráz |
c3274c |
+ SECKEYPrivateKey *privk;
|
|
Tomáš Mráz |
c3274c |
+ cert = CERT_FindCertByNickname(CERT_GetDefaultCertDB(),
|
|
Tomáš Mráz |
c3274c |
+ (char *)keyname);
|
|
Tomáš Mráz |
c3274c |
+ if (cert == NULL)
|
|
Tomáš Mráz |
c3274c |
+ goto cleanup;
|
|
Tomáš Mráz |
c3274c |
+ privk = PK11_FindPrivateKeyFromCert(sle->slot, cert, tmppass);
|
|
Tomáš Mráz |
c3274c |
+ CERT_DestroyCertificate(cert);
|
|
Tomáš Mráz |
c3274c |
+ if (privk == NULL)
|
|
Tomáš Mráz |
c3274c |
+ goto cleanup;
|
|
Tomáš Mráz |
c3274c |
+ if ((k=make_key_from_privkey(privk, tmppass)) != NULL) {
|
|
Tomáš Mráz |
c3274c |
+ nss_convert_pubkey(k);
|
|
Tomáš Mráz |
c3274c |
+ keys = add_key_to_list(k, keys, &i, &allocated);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ SECKEY_DestroyPrivateKey(privk);
|
|
Tomáš Mráz |
c3274c |
+ } else {
|
|
Tomáš Mráz |
c3274c |
+ if (list == NULL)
|
|
Tomáš Mráz |
c3274c |
+ goto cleanup;
|
|
Tomáš Mráz |
c3274c |
+ for (node=PRIVKEY_LIST_HEAD(list); !PRIVKEY_LIST_END(node, list);
|
|
Tomáš Mráz |
c3274c |
+ node=PRIVKEY_LIST_NEXT(node))
|
|
Tomáš Mráz |
c3274c |
+ if ((k=make_key_from_privkey(node->key, tmppass)) != NULL) {
|
|
Tomáš Mráz |
c3274c |
+ nss_convert_pubkey(k);
|
|
Tomáš Mráz |
c3274c |
+ keys = add_key_to_list(k, keys, &i, &allocated);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ SECKEY_DestroyPrivateKeyList(list);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+cleanup:
|
|
Tomáš Mráz |
c3274c |
+ if (password == NULL && tmppass != NULL) {
|
|
Tomáš Mráz |
c3274c |
+ memset(tmppass, 0, strlen(tmppass));
|
|
Tomáš Mráz |
c3274c |
+ xfree(tmppass);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ PK11_FreeSlotList(slots);
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ return keys;
|
|
Tomáš Mráz |
c3274c |
+}
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+Key **
|
|
Tomáš Mráz |
c3274c |
+nss_get_keys(const char *tokenname, const char *keyname,
|
|
Tomáš Mráz |
c3274c |
+ char *password)
|
|
Tomáš Mráz |
c3274c |
+{
|
|
Tomáš Mráz |
c3274c |
+ Key **keys;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (nss_init(NULL) == -1) {
|
|
Tomáš Mráz |
c3274c |
+ error("Failed to initialize NSS library");
|
|
Tomáš Mráz |
c3274c |
+ return NULL;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ keys = nss_find_privkeys(tokenname, keyname, password);
|
|
Tomáš Mráz |
c3274c |
+ if (keys == NULL && keyname != NULL) {
|
|
Tomáš Mráz |
c3274c |
+ error("Cannot find key in nss, token removed");
|
|
Tomáš Mráz |
c3274c |
+ return NULL;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+#if 0
|
|
Tomáš Mráz |
c3274c |
+ keys = xcalloc(3, sizeof(Key *));
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (k->type == KEY_RSA) {
|
|
Tomáš Mráz |
c3274c |
+ n = key_new_nss_copy(KEY_RSA1, k);
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ keys[0] = n;
|
|
Tomáš Mráz |
c3274c |
+ keys[1] = k;
|
|
Tomáš Mráz |
c3274c |
+ keys[2] = NULL;
|
|
Tomáš Mráz |
c3274c |
+ } else {
|
|
Tomáš Mráz |
c3274c |
+ keys[0] = k;
|
|
Tomáš Mráz |
c3274c |
+ keys[1] = NULL;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+#endif
|
|
Tomáš Mráz |
c3274c |
+ return keys;
|
|
Tomáš Mráz |
c3274c |
+}
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+char *
|
|
Tomáš Mráz |
c3274c |
+nss_get_key_label(Key *key)
|
|
Tomáš Mráz |
c3274c |
+{
|
|
Tomáš Mráz |
c3274c |
+ char *label, *nickname;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ nickname = PK11_GetPrivateKeyNickname(key->nss->privk);
|
|
Tomáš Mráz |
c3274c |
+ label = xstrdup(nickname);
|
|
Tomáš Mráz |
c3274c |
+ PORT_Free(nickname);
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ return label;
|
|
Tomáš Mráz |
c3274c |
+}
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+#endif /* HAVE_LIBNSS */
|
|
Jan F. Chadima |
adad2a |
diff -up openssh-5.2p1/ssh.c.nss-keys openssh-5.2p1/ssh.c
|
|
Jan F. Chadima |
adad2a |
--- openssh-5.2p1/ssh.c.nss-keys 2008-07-04 04:53:50.000000000 +0200
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/ssh.c 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
@@ -104,6 +104,9 @@
|
|
Jan F. Chadima |
adad2a |
#ifdef SMARTCARD
|
|
Jan F. Chadima |
adad2a |
#include "scard.h"
|
|
Jan F. Chadima |
adad2a |
#endif
|
|
Jan F. Chadima |
adad2a |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
adad2a |
+#include "nsskeys.h"
|
|
Jan F. Chadima |
adad2a |
+#endif
|
|
Jan F. Chadima |
adad2a |
|
|
Jan F. Chadima |
adad2a |
extern char *__progname;
|
|
Jan F. Chadima |
adad2a |
|
|
Jan F. Chadima |
adad2a |
@@ -1235,9 +1238,11 @@ load_public_identity_files(void)
|
|
Jan F. Chadima |
adad2a |
int i = 0;
|
|
Jan F. Chadima |
adad2a |
Key *public;
|
|
Jan F. Chadima |
adad2a |
struct passwd *pw;
|
|
Jan F. Chadima |
adad2a |
-#ifdef SMARTCARD
|
|
Jan F. Chadima |
adad2a |
+#if defined(SMARTCARD) || defined(HAVE_LIBNSS)
|
|
Jan F. Chadima |
adad2a |
Key **keys;
|
|
Jan F. Chadima |
adad2a |
+#endif
|
|
Jan F. Chadima |
adad2a |
|
|
Jan F. Chadima |
adad2a |
+#ifdef SMARTCARD
|
|
Jan F. Chadima |
adad2a |
if (options.smartcard_device != NULL &&
|
|
Jan F. Chadima |
adad2a |
options.num_identity_files < SSH_MAX_IDENTITY_FILES &&
|
|
Jan F. Chadima |
adad2a |
(keys = sc_get_keys(options.smartcard_device, NULL)) != NULL) {
|
|
Jan F. Chadima |
adad2a |
@@ -1260,6 +1265,27 @@ load_public_identity_files(void)
|
|
Jan F. Chadima |
adad2a |
xfree(keys);
|
|
Jan F. Chadima |
adad2a |
}
|
|
Jan F. Chadima |
adad2a |
#endif /* SMARTCARD */
|
|
Jan F. Chadima |
adad2a |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
adad2a |
+ if (options.use_nss &&
|
|
Jan F. Chadima |
adad2a |
+ options.num_identity_files < SSH_MAX_IDENTITY_FILES &&
|
|
Jan F. Chadima |
adad2a |
+ (keys = nss_get_keys(options.nss_token, NULL, NULL)) != NULL) {
|
|
Jan F. Chadima |
adad2a |
+ int count;
|
|
Jan F. Chadima |
adad2a |
+ for (count = 0; keys[count] != NULL; count++) {
|
|
Jan F. Chadima |
adad2a |
+ memmove(&options.identity_files[1], &options.identity_files[0],
|
|
Jan F. Chadima |
adad2a |
+ sizeof(char *) * (SSH_MAX_IDENTITY_FILES - 1));
|
|
Jan F. Chadima |
adad2a |
+ memmove(&options.identity_keys[1], &options.identity_keys[0],
|
|
Jan F. Chadima |
adad2a |
+ sizeof(Key *) * (SSH_MAX_IDENTITY_FILES - 1));
|
|
Jan F. Chadima |
adad2a |
+ options.num_identity_files++;
|
|
Jan F. Chadima |
adad2a |
+ options.identity_keys[0] = keys[count];
|
|
Jan F. Chadima |
adad2a |
+ options.identity_files[0] = nss_get_key_label(keys[count]);
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ if (options.num_identity_files > SSH_MAX_IDENTITY_FILES)
|
|
Jan F. Chadima |
adad2a |
+ options.num_identity_files = SSH_MAX_IDENTITY_FILES;
|
|
Jan F. Chadima |
adad2a |
+ i += count;
|
|
Jan F. Chadima |
adad2a |
+ xfree(keys);
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+#endif /* HAVE_LIBNSS */
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
if ((pw = getpwuid(original_real_uid)) == NULL)
|
|
Jan F. Chadima |
adad2a |
fatal("load_public_identity_files: getpwuid failed");
|
|
Jan F. Chadima |
adad2a |
pwname = xstrdup(pw->pw_name);
|
|
Jan F. Chadima |
a3ba41 |
diff -up /dev/null openssh-5.2p1/nsskeys.h
|
|
Jan F. Chadima |
adad2a |
--- /dev/null 2008-11-17 17:51:52.160001870 +0100
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/nsskeys.h 2008-11-18 19:11:41.000000000 +0100
|
|
Tomáš Mráz |
c3274c |
@@ -0,0 +1,39 @@
|
|
Tomáš Mráz |
c3274c |
+/*
|
|
Tomáš Mráz |
c3274c |
+ * Copyright (c) 2001 Markus Friedl. All rights reserved.
|
|
Tomáš Mráz |
c3274c |
+ * Copyright (c) 2007 Red Hat, Inc. All rights reserved.
|
|
Tomáš Mráz |
c3274c |
+ *
|
|
Tomáš Mráz |
c3274c |
+ * Redistribution and use in source and binary forms, with or without
|
|
Tomáš Mráz |
c3274c |
+ * modification, are permitted provided that the following conditions
|
|
Tomáš Mráz |
c3274c |
+ * are met:
|
|
Tomáš Mráz |
c3274c |
+ * 1. Redistributions of source code must retain the above copyright
|
|
Tomáš Mráz |
c3274c |
+ * notice, this list of conditions and the following disclaimer.
|
|
Tomáš Mráz |
c3274c |
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|
Tomáš Mráz |
c3274c |
+ * notice, this list of conditions and the following disclaimer in the
|
|
Tomáš Mráz |
c3274c |
+ * documentation and/or other materials provided with the distribution.
|
|
Tomáš Mráz |
c3274c |
+ *
|
|
Tomáš Mráz |
c3274c |
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
Tomáš Mráz |
c3274c |
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
Tomáš Mráz |
c3274c |
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
Tomáš Mráz |
c3274c |
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
Tomáš Mráz |
c3274c |
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
Tomáš Mráz |
c3274c |
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Tomáš Mráz |
c3274c |
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Tomáš Mráz |
c3274c |
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Tomáš Mráz |
c3274c |
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
Tomáš Mráz |
c3274c |
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Tomáš Mráz |
c3274c |
+ */
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+#ifndef NSSKEYS_H
|
|
Tomáš Mráz |
c3274c |
+#define NSSKEYS_H
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Tomáš Mráz |
c3274c |
+#include <pk11func.h>
|
|
Tomáš Mráz |
c3274c |
+#include <prtypes.h>
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+int nss_init(PK11PasswordFunc);
|
|
Tomáš Mráz |
c3274c |
+Key **nss_get_keys(const char *, const char *, char *);
|
|
Tomáš Mráz |
c3274c |
+char *nss_get_key_label(Key *);
|
|
Tomáš Mráz |
c3274c |
+/*void sc_close(void);*/
|
|
Tomáš Mráz |
c3274c |
+/*int sc_put_key(Key *, const char *);*/
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+#endif
|
|
Tomáš Mráz |
c3274c |
+#endif
|
|
Jan F. Chadima |
adad2a |
diff -up openssh-5.2p1/Makefile.in.nss-keys openssh-5.2p1/Makefile.in
|
|
Jan F. Chadima |
adad2a |
--- openssh-5.2p1/Makefile.in.nss-keys 2008-07-08 16:21:12.000000000 +0200
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/Makefile.in 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
@@ -71,7 +71,7 @@ LIBSSH_OBJS=acss.o authfd.o authfile.o b
|
|
Jan F. Chadima |
adad2a |
atomicio.o key.o dispatch.o kex.o mac.o uidswap.o uuencode.o misc.o \
|
|
Jan F. Chadima |
adad2a |
monitor_fdpass.o rijndael.o ssh-dss.o ssh-rsa.o dh.o kexdh.o \
|
|
Jan F. Chadima |
adad2a |
kexgex.o kexdhc.o kexgexc.o scard.o msg.o progressmeter.o dns.o \
|
|
Jan F. Chadima |
adad2a |
- entropy.o scard-opensc.o gss-genr.o umac.o jpake.o schnorr.o
|
|
Jan F. Chadima |
adad2a |
+ entropy.o scard-opensc.o gss-genr.o umac.o jpake.o schnorr.o nsskeys.o
|
|
Jan F. Chadima |
adad2a |
|
|
Jan F. Chadima |
adad2a |
SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
|
|
Jan F. Chadima |
adad2a |
sshconnect.o sshconnect1.o sshconnect2.o mux.o
|
|
Jan F. Chadima |
adad2a |
diff -up openssh-5.2p1/key.h.nss-keys openssh-5.2p1/key.h
|
|
Jan F. Chadima |
adad2a |
--- openssh-5.2p1/key.h.nss-keys 2008-06-12 20:40:35.000000000 +0200
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/key.h 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
@@ -29,11 +29,17 @@
|
|
Jan F. Chadima |
adad2a |
#include <openssl/rsa.h>
|
|
Jan F. Chadima |
adad2a |
#include <openssl/dsa.h>
|
|
Jan F. Chadima |
adad2a |
|
|
Tomáš Mráz |
c9833c |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
adad2a |
+#include <nss.h>
|
|
Jan F. Chadima |
adad2a |
+#include <keyhi.h>
|
|
Tomáš Mráz |
c9833c |
+#endif
|
|
Tomáš Mráz |
c3274c |
+
|
|
Jan F. Chadima |
adad2a |
typedef struct Key Key;
|
|
Jan F. Chadima |
adad2a |
enum types {
|
|
Jan F. Chadima |
adad2a |
KEY_RSA1,
|
|
Jan F. Chadima |
adad2a |
KEY_RSA,
|
|
Jan F. Chadima |
adad2a |
KEY_DSA,
|
|
Jan F. Chadima |
adad2a |
+ KEY_NSS,
|
|
Jan F. Chadima |
adad2a |
KEY_UNSPEC
|
|
Jan F. Chadima |
adad2a |
};
|
|
Jan F. Chadima |
adad2a |
enum fp_type {
|
|
Jan F. Chadima |
adad2a |
@@ -48,16 +54,30 @@ enum fp_rep {
|
|
Tomáš Mráz |
c9833c |
|
|
Jan F. Chadima |
adad2a |
/* key is stored in external hardware */
|
|
Jan F. Chadima |
adad2a |
#define KEY_FLAG_EXT 0x0001
|
|
Jan F. Chadima |
adad2a |
+#define KEY_FLAG_NSS 0x0002
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
adad2a |
+typedef struct NSSKey NSSKey;
|
|
Jan F. Chadima |
adad2a |
+struct NSSKey {
|
|
Jan F. Chadima |
adad2a |
+ SECKEYPrivateKey *privk;
|
|
Jan F. Chadima |
adad2a |
+ SECKEYPublicKey *pubk;
|
|
Jan F. Chadima |
adad2a |
+};
|
|
Jan F. Chadima |
adad2a |
+#endif
|
|
Jan F. Chadima |
adad2a |
|
|
Jan F. Chadima |
adad2a |
struct Key {
|
|
Jan F. Chadima |
adad2a |
int type;
|
|
Jan F. Chadima |
adad2a |
int flags;
|
|
Jan F. Chadima |
adad2a |
RSA *rsa;
|
|
Jan F. Chadima |
adad2a |
DSA *dsa;
|
|
Jan F. Chadima |
adad2a |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
adad2a |
+ NSSKey *nss;
|
|
Jan F. Chadima |
adad2a |
+#endif
|
|
Jan F. Chadima |
adad2a |
};
|
|
Jan F. Chadima |
adad2a |
|
|
Jan F. Chadima |
adad2a |
Key *key_new(int);
|
|
Jan F. Chadima |
adad2a |
Key *key_new_private(int);
|
|
Jan F. Chadima |
adad2a |
+Key *key_new_nss(int);
|
|
Jan F. Chadima |
adad2a |
+Key *key_new_nss_copy(int, const Key *);
|
|
Jan F. Chadima |
adad2a |
void key_free(Key *);
|
|
Jan F. Chadima |
adad2a |
Key *key_demote(const Key *);
|
|
Jan F. Chadima |
adad2a |
int key_equal(const Key *, const Key *);
|
|
Jan F. Chadima |
a3ba41 |
diff -up openssh-5.2p1/ssh-add.c.nss-keys openssh-5.2p1/ssh-add.c
|
|
Jan F. Chadima |
a3ba41 |
--- openssh-5.2p1/ssh-add.c.nss-keys 2008-02-28 09:13:52.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/ssh-add.c 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
@@ -44,6 +44,14 @@
|
|
Tomáš Mráz |
c3274c |
#include <openssl/evp.h>
|
|
Tomáš Mráz |
ec5276 |
#include "openbsd-compat/openssl-compat.h"
|
|
Tomáš Mráz |
c3274c |
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Tomáš Mráz |
c3274c |
+#include <nss.h>
|
|
Tomáš Mráz |
c3274c |
+#include <secmod.h>
|
|
Tomáš Mráz |
c3274c |
+#include <pk11pub.h>
|
|
Tomáš Mráz |
c3274c |
+#include <keyhi.h>
|
|
Tomáš Mráz |
c3274c |
+#include <cert.h>
|
|
Tomáš Mráz |
c3274c |
+#endif
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
#include <fcntl.h>
|
|
Tomáš Mráz |
c3274c |
#include <pwd.h>
|
|
Tomáš Mráz |
c3274c |
#include <stdarg.h>
|
|
Jan F. Chadima |
adad2a |
@@ -57,6 +65,7 @@
|
|
Tomáš Mráz |
c3274c |
#include "rsa.h"
|
|
Tomáš Mráz |
c3274c |
#include "log.h"
|
|
Tomáš Mráz |
c3274c |
#include "key.h"
|
|
Tomáš Mráz |
c3274c |
+#include "nsskeys.h"
|
|
Tomáš Mráz |
c3274c |
#include "buffer.h"
|
|
Tomáš Mráz |
c3274c |
#include "authfd.h"
|
|
Tomáš Mráz |
c3274c |
#include "authfile.h"
|
|
Jan F. Chadima |
adad2a |
@@ -307,6 +316,117 @@ do_file(AuthenticationConnection *ac, in
|
|
Tomáš Mráz |
c3274c |
return 0;
|
|
Tomáš Mráz |
c3274c |
}
|
|
Tomáš Mráz |
c3274c |
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Tomáš Mráz |
c3274c |
+static char *
|
|
Tomáš Mráz |
c3274c |
+password_cb(PK11SlotInfo *slot, PRBool retry, void *arg)
|
|
Tomáš Mráz |
c3274c |
+{
|
|
Tomáš Mráz |
c3274c |
+ char **passcache = arg;
|
|
Tomáš Mráz |
c3274c |
+ char *password, *p2 = NULL;
|
|
Tomáš Mráz |
c3274c |
+ char *prompt;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (retry)
|
|
Tomáš Mráz |
c3274c |
+ return NULL;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (asprintf(&prompt, "Enter passphrase for token %s: ",
|
|
Tomáš Mráz |
c3274c |
+ PK11_GetTokenName(slot)) < 0)
|
|
Tomáš Mráz |
c3274c |
+ fatal("password_cb: asprintf failed");
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ password = read_passphrase(prompt, RP_ALLOW_STDIN);
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (password != NULL && (p2=PL_strdup(password)) == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ memset(password, 0, strlen(password));
|
|
Tomáš Mráz |
c3274c |
+ fatal("password_cb: PL_strdup failed");
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (passcache != NULL) {
|
|
Tomáš Mráz |
c3274c |
+ if (*passcache != NULL) {
|
|
Tomáš Mráz |
c3274c |
+ memset(*passcache, 0, strlen(*passcache));
|
|
Tomáš Mráz |
c3274c |
+ xfree(*passcache);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ *passcache = password;
|
|
Tomáš Mráz |
c3274c |
+ } else {
|
|
Tomáš Mráz |
c3274c |
+ memset(password, 0, strlen(password));
|
|
Tomáš Mráz |
c3274c |
+ xfree(password);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ return p2;
|
|
Tomáš Mráz |
c3274c |
+}
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+static int
|
|
Tomáš Mráz |
c3274c |
+add_slot_keys(AuthenticationConnection *ac, PK11SlotInfo *slot, int add)
|
|
Tomáš Mráz |
c3274c |
+{
|
|
Tomáš Mráz |
c3274c |
+ SECKEYPrivateKeyList *list;
|
|
Tomáš Mráz |
c3274c |
+ SECKEYPrivateKeyListNode *node;
|
|
Tomáš Mráz |
c3274c |
+ char *passcache = NULL;
|
|
Tomáš Mráz |
c3274c |
+ char *tokenname;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ int count = 0;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (PK11_NeedLogin(slot))
|
|
Tomáš Mráz |
c3274c |
+ PK11_Authenticate(slot, PR_TRUE, &passcache);
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if ((list=PK11_ListPrivKeysInSlot(slot, NULL, NULL)) == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ return 0;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ tokenname = PK11_GetTokenName(slot);
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ for (node=PRIVKEY_LIST_HEAD(list); !PRIVKEY_LIST_END(node, list);
|
|
Tomáš Mráz |
c3274c |
+ node=PRIVKEY_LIST_NEXT(node)) {
|
|
Tomáš Mráz |
c3274c |
+ char *keyname;
|
|
Tomáš Mráz |
c3274c |
+ SECKEYPublicKey *pub;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ keyname = PK11_GetPrivateKeyNickname(node->key);
|
|
Tomáš Mráz |
c3274c |
+ if (keyname == NULL || *keyname == '\0') {
|
|
Tomáš Mráz |
c3274c |
+ /* no nickname to refer to */
|
|
Tomáš Mráz |
c3274c |
+ CERTCertificate *cert;
|
|
Tomáš Mráz |
c3274c |
+ char *kn;
|
|
Tomáš Mráz |
c3274c |
+ cert = PK11_GetCertFromPrivateKey(node->key);
|
|
Tomáš Mráz |
c3274c |
+ if (cert == NULL)
|
|
Tomáš Mráz |
c3274c |
+ continue;
|
|
Tomáš Mráz |
c3274c |
+ kn = strchr(cert->nickname, ':');
|
|
Tomáš Mráz |
c3274c |
+ if (kn == NULL)
|
|
Tomáš Mráz |
c3274c |
+ kn = cert->nickname;
|
|
Tomáš Mráz |
c3274c |
+ else
|
|
Tomáš Mráz |
c3274c |
+ kn++;
|
|
Tomáš Mráz |
c3274c |
+ keyname = PORT_Strdup(kn);
|
|
Tomáš Mráz |
c3274c |
+ CERT_DestroyCertificate(cert);
|
|
Tomáš Mráz |
c3274c |
+ if (keyname == NULL)
|
|
Tomáš Mráz |
c3274c |
+ continue;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ pub = SECKEY_ConvertToPublicKey(node->key);
|
|
Tomáš Mráz |
c3274c |
+ if (pub == NULL) {
|
|
Tomáš Mráz |
c3274c |
+ fprintf(stderr, "No public key for: %s:%s\n",
|
|
Tomáš Mráz |
c3274c |
+ tokenname, keyname);
|
|
Tomáš Mráz |
c3274c |
+ continue; /* not possible to obtain public key */
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ SECKEY_DestroyPublicKey(pub);
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (ssh_update_nss_key(ac, add, tokenname, keyname,
|
|
Tomáš Mráz |
c3274c |
+ passcache?passcache:"", lifetime, confirm)) {
|
|
Tomáš Mráz |
c3274c |
+ fprintf(stderr, "Key %s: %s:%s\n",
|
|
Tomáš Mráz |
c3274c |
+ add?"added":"removed", tokenname, keyname);
|
|
Tomáš Mráz |
c3274c |
+ count++;
|
|
Tomáš Mráz |
c3274c |
+ } else {
|
|
Tomáš Mráz |
c3274c |
+ fprintf(stderr, "Could not %s key: %s:%s\n",
|
|
Tomáš Mráz |
c3274c |
+ add?"add":"remove", tokenname, keyname);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ PORT_Free(keyname);
|
|
Tomáš Mráz |
c3274c |
+ count++;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (passcache != NULL) {
|
|
Tomáš Mráz |
c3274c |
+ memset(passcache, 0, strlen(passcache));
|
|
Tomáš Mráz |
c3274c |
+ xfree(passcache);
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ SECKEY_DestroyPrivateKeyList(list);
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ return count;
|
|
Tomáš Mráz |
c3274c |
+}
|
|
Tomáš Mráz |
c3274c |
+#endif
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
static void
|
|
Tomáš Mráz |
c3274c |
usage(void)
|
|
Tomáš Mráz |
c3274c |
{
|
|
Jan F. Chadima |
adad2a |
@@ -334,6 +454,10 @@ main(int argc, char **argv)
|
|
Tomáš Mráz |
c3274c |
AuthenticationConnection *ac = NULL;
|
|
Tomáš Mráz |
c3274c |
char *sc_reader_id = NULL;
|
|
Tomáš Mráz |
c3274c |
int i, ch, deleting = 0, ret = 0;
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Tomáš Mráz |
c3274c |
+ char *token_id = NULL;
|
|
Tomáš Mráz |
c3274c |
+ int use_nss = 0;
|
|
Tomáš Mráz |
c3274c |
+#endif
|
|
Tomáš Mráz |
c3274c |
|
|
Tomáš Mráz |
c3274c |
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
|
|
Tomáš Mráz |
c3274c |
sanitise_stdfd();
|
|
Jan F. Chadima |
adad2a |
@@ -351,7 +475,7 @@ main(int argc, char **argv)
|
|
Tomáš Mráz |
c3274c |
"Could not open a connection to your authentication agent.\n");
|
|
Tomáš Mráz |
c3274c |
exit(2);
|
|
Tomáš Mráz |
c3274c |
}
|
|
Tomáš Mráz |
c3274c |
- while ((ch = getopt(argc, argv, "lLcdDxXe:s:t:")) != -1) {
|
|
Tomáš Mráz |
c3274c |
+ while ((ch = getopt(argc, argv, "lLcdDnxXe:s:t:T:")) != -1) {
|
|
Tomáš Mráz |
c3274c |
switch (ch) {
|
|
Tomáš Mráz |
c3274c |
case 'l':
|
|
Tomáš Mráz |
c3274c |
case 'L':
|
|
Jan F. Chadima |
adad2a |
@@ -373,6 +497,11 @@ main(int argc, char **argv)
|
|
Tomáš Mráz |
c3274c |
if (delete_all(ac) == -1)
|
|
Tomáš Mráz |
c3274c |
ret = 1;
|
|
Tomáš Mráz |
c3274c |
goto done;
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Tomáš Mráz |
c3274c |
+ case 'n':
|
|
Tomáš Mráz |
c3274c |
+ use_nss = 1;
|
|
Tomáš Mráz |
c3274c |
+ break;
|
|
Tomáš Mráz |
c3274c |
+#endif
|
|
Tomáš Mráz |
c3274c |
case 's':
|
|
Tomáš Mráz |
c3274c |
sc_reader_id = optarg;
|
|
Tomáš Mráz |
c3274c |
break;
|
|
Jan F. Chadima |
adad2a |
@@ -387,6 +516,11 @@ main(int argc, char **argv)
|
|
Tomáš Mráz |
c3274c |
goto done;
|
|
Tomáš Mráz |
c3274c |
}
|
|
Tomáš Mráz |
c3274c |
break;
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Tomáš Mráz |
c3274c |
+ case 'T':
|
|
Tomáš Mráz |
c9833c |
+ token_id = optarg;
|
|
Tomáš Mráz |
c9833c |
+ break;
|
|
Tomáš Mráz |
c3274c |
+#endif
|
|
Tomáš Mráz |
c9833c |
default:
|
|
Tomáš Mráz |
c9833c |
usage();
|
|
Tomáš Mráz |
c9833c |
ret = 1;
|
|
Jan F. Chadima |
adad2a |
@@ -400,6 +534,40 @@ main(int argc, char **argv)
|
|
Tomáš Mráz |
c9833c |
ret = 1;
|
|
Tomáš Mráz |
c9833c |
goto done;
|
|
Tomáš Mráz |
c3274c |
}
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
adad2a |
+ if (use_nss) {
|
|
Jan F. Chadima |
adad2a |
+ PK11SlotList *slots;
|
|
Jan F. Chadima |
adad2a |
+ PK11SlotListElement *sle;
|
|
Jan F. Chadima |
adad2a |
+ int count = 0;
|
|
Jan F. Chadima |
adad2a |
+ if (nss_init(password_cb) == -1) {
|
|
Jan F. Chadima |
adad2a |
+ fprintf(stderr, "Failed to initialize NSS library\n");
|
|
Jan F. Chadima |
adad2a |
+ ret = 1;
|
|
Jan F. Chadima |
adad2a |
+ goto done;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ if ((slots=PK11_GetAllTokens(CKM_INVALID_MECHANISM, PR_FALSE, PR_FALSE,
|
|
Jan F. Chadima |
adad2a |
+ NULL)) == NULL) {
|
|
Jan F. Chadima |
adad2a |
+ fprintf(stderr, "No tokens found\n");
|
|
Jan F. Chadima |
adad2a |
+ ret = 1;
|
|
Jan F. Chadima |
adad2a |
+ goto nss_done;
|
|
Tomáš Mráz |
c9833c |
+ }
|
|
Jan F. Chadima |
a3ba41 |
+
|
|
Jan F. Chadima |
adad2a |
+ for (sle = slots->head; sle; sle = sle->next) {
|
|
Jan F. Chadima |
adad2a |
+ int rv;
|
|
Jan F. Chadima |
adad2a |
+ if ((rv=add_slot_keys(ac, sle->slot, !deleting)) == -1) {
|
|
Jan F. Chadima |
adad2a |
+ ret = 1;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ count += rv;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+ if (count == 0) {
|
|
Jan F. Chadima |
adad2a |
+ ret = 1;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+nss_done:
|
|
Jan F. Chadima |
adad2a |
+ NSS_Shutdown();
|
|
Jan F. Chadima |
adad2a |
+ clear_pass();
|
|
Jan F. Chadima |
adad2a |
+ goto done;
|
|
Jan F. Chadima |
adad2a |
+ }
|
|
Jan F. Chadima |
adad2a |
+#endif
|
|
Jan F. Chadima |
adad2a |
if (argc == 0) {
|
|
Jan F. Chadima |
adad2a |
char buf[MAXPATHLEN];
|
|
Jan F. Chadima |
adad2a |
struct passwd *pw;
|
|
Jan F. Chadima |
adad2a |
diff -up openssh-5.2p1/ssh-rsa.c.nss-keys openssh-5.2p1/ssh-rsa.c
|
|
Jan F. Chadima |
adad2a |
--- openssh-5.2p1/ssh-rsa.c.nss-keys 2006-09-01 07:38:37.000000000 +0200
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/ssh-rsa.c 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
@@ -32,6 +32,10 @@
|
|
Jan F. Chadima |
adad2a |
#include "compat.h"
|
|
Jan F. Chadima |
adad2a |
#include "ssh.h"
|
|
Tomáš Mráz |
c3274c |
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Tomáš Mráz |
c3274c |
+#include <cryptohi.h>
|
|
Tomáš Mráz |
c3274c |
+#endif
|
|
Tomáš Mráz |
c3274c |
+
|
|
Jan F. Chadima |
adad2a |
static int openssh_RSA_verify(int, u_char *, u_int, u_char *, u_int, RSA *);
|
|
Tomáš Mráz |
c3274c |
|
|
Jan F. Chadima |
adad2a |
/* RSASSA-PKCS1-v1_5 (PKCS #1 v2.0 signature) with SHA1 */
|
|
Jan F. Chadima |
adad2a |
@@ -50,6 +54,38 @@ ssh_rsa_sign(const Key *key, u_char **si
|
|
Jan F. Chadima |
adad2a |
error("ssh_rsa_sign: no RSA key");
|
|
Tomáš Mráz |
c3274c |
return -1;
|
|
Tomáš Mráz |
c3274c |
}
|
|
Jan F. Chadima |
adad2a |
+
|
|
Jan F. Chadima |
adad2a |
+ slen = RSA_size(key->rsa);
|
|
Jan F. Chadima |
adad2a |
+ sig = xmalloc(slen);
|
|
Jan F. Chadima |
adad2a |
+
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Tomáš Mráz |
c3274c |
+ if (key->flags & KEY_FLAG_NSS) {
|
|
Tomáš Mráz |
c3274c |
+ SECItem sigitem;
|
|
Jan F. Chadima |
adad2a |
+ SECOidTag alg;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ memset(&sigitem, 0, sizeof(sigitem));
|
|
Jan F. Chadima |
adad2a |
+ alg = (datafellows & SSH_BUG_RSASIGMD5) ?
|
|
Jan F. Chadima |
adad2a |
+ SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION :
|
|
Jan F. Chadima |
adad2a |
+ SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION;
|
|
Jan F. Chadima |
adad2a |
+
|
|
Tomáš Mráz |
c3274c |
+ if (SEC_SignData(&sigitem, (u_char *)data, datalen, key->nss->privk,
|
|
Jan F. Chadima |
adad2a |
+ alg) != SECSuccess) {
|
|
Jan F. Chadima |
adad2a |
+ error("ssh_rsa_sign: sign failed");
|
|
Tomáš Mráz |
c3274c |
+ return -1;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Jan F. Chadima |
adad2a |
+ if (sigitem.len > slen) {
|
|
Jan F. Chadima |
adad2a |
+ error("ssh_rsa_sign: slen %u slen2 %u", slen, sigitem.len);
|
|
Jan F. Chadima |
adad2a |
+ xfree(sig);
|
|
Tomáš Mráz |
c3274c |
+ SECITEM_ZfreeItem(&sigitem, PR_FALSE);
|
|
Tomáš Mráz |
c3274c |
+ return -1;
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Jan F. Chadima |
adad2a |
+ if (sigitem.len < slen) {
|
|
Jan F. Chadima |
adad2a |
+ memset(sig, 0, slen - sigitem.len);
|
|
Jan F. Chadima |
a3ba41 |
+ }
|
|
Jan F. Chadima |
adad2a |
+ memcpy(sig+slen-sigitem.len, sigitem.data, sigitem.len);
|
|
Jan F. Chadima |
adad2a |
+ SECITEM_ZfreeItem(&sigitem, PR_FALSE);
|
|
Tomáš Mráz |
c3274c |
+ } else {
|
|
Tomáš Mráz |
c3274c |
+#endif
|
|
Jan F. Chadima |
adad2a |
nid = (datafellows & SSH_BUG_RSASIGMD5) ? NID_md5 : NID_sha1;
|
|
Jan F. Chadima |
adad2a |
if ((evp_md = EVP_get_digestbynid(nid)) == NULL) {
|
|
Jan F. Chadima |
adad2a |
error("ssh_rsa_sign: EVP_get_digestbynid %d failed", nid);
|
|
Jan F. Chadima |
adad2a |
@@ -59,9 +95,6 @@ ssh_rsa_sign(const Key *key, u_char **si
|
|
Tomáš Mráz |
c3274c |
EVP_DigestUpdate(&md, data, datalen);
|
|
Tomáš Mráz |
c3274c |
EVP_DigestFinal(&md, digest, &dlen);
|
|
Jan F. Chadima |
adad2a |
|
|
Jan F. Chadima |
adad2a |
- slen = RSA_size(key->rsa);
|
|
Jan F. Chadima |
adad2a |
- sig = xmalloc(slen);
|
|
Tomáš Mráz |
c3274c |
-
|
|
Jan F. Chadima |
adad2a |
ok = RSA_sign(nid, digest, dlen, sig, &len, key->rsa);
|
|
Jan F. Chadima |
adad2a |
memset(digest, 'd', sizeof(digest));
|
|
Jan F. Chadima |
adad2a |
|
|
Jan F. Chadima |
adad2a |
@@ -83,6 +116,9 @@ ssh_rsa_sign(const Key *key, u_char **si
|
|
Jan F. Chadima |
adad2a |
xfree(sig);
|
|
Jan F. Chadima |
adad2a |
return -1;
|
|
Jan F. Chadima |
adad2a |
}
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+#endif
|
|
Jan F. Chadima |
adad2a |
/* encode signature */
|
|
Jan F. Chadima |
adad2a |
buffer_init(&b);
|
|
Jan F. Chadima |
adad2a |
buffer_put_cstring(&b, "ssh-rsa");
|
|
Jan F. Chadima |
a3ba41 |
diff -up openssh-5.2p1/ssh-keygen.c.nss-keys openssh-5.2p1/ssh-keygen.c
|
|
Jan F. Chadima |
adad2a |
--- openssh-5.2p1/ssh-keygen.c.nss-keys 2008-07-14 03:28:29.000000000 +0200
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/ssh-keygen.c 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
@@ -53,6 +53,11 @@
|
|
Tomáš Mráz |
c3274c |
#include "scard.h"
|
|
Tomáš Mráz |
c3274c |
#endif
|
|
Tomáš Mráz |
c3274c |
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Tomáš Mráz |
c3274c |
+#include <nss.h>
|
|
Tomáš Mráz |
c3274c |
+#include "nsskeys.h"
|
|
Tomáš Mráz |
c3274c |
+#endif
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
/* Number of bits in the RSA/DSA key. This value can be set on the command line. */
|
|
Tomáš Mráz |
c3274c |
#define DEFAULT_BITS 2048
|
|
Tomáš Mráz |
c3274c |
#define DEFAULT_BITS_DSA 1024
|
|
Jan F. Chadima |
adad2a |
@@ -501,6 +506,26 @@ do_download(struct passwd *pw, const cha
|
|
Tomáš Mráz |
c3274c |
}
|
|
Tomáš Mráz |
c3274c |
#endif /* SMARTCARD */
|
|
Tomáš Mráz |
c3274c |
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Tomáš Mráz |
c3274c |
+static void
|
|
Tomáš Mráz |
c3274c |
+do_nss_download(struct passwd *pw, const char *tokenname, const char *keyname)
|
|
Tomáš Mráz |
c3274c |
+{
|
|
Tomáš Mráz |
c3274c |
+ Key **keys = NULL;
|
|
Tomáš Mráz |
c3274c |
+ int i;
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ keys = nss_get_keys(tokenname, keyname, NULL);
|
|
Tomáš Mráz |
c3274c |
+ if (keys == NULL)
|
|
Tomáš Mráz |
c3274c |
+ fatal("cannot find public key in NSS");
|
|
Tomáš Mráz |
c3274c |
+ for (i = 0; keys[i]; i++) {
|
|
Tomáš Mráz |
c3274c |
+ key_write(keys[i], stdout);
|
|
Tomáš Mráz |
c3274c |
+ key_free(keys[i]);
|
|
Tomáš Mráz |
c3274c |
+ fprintf(stdout, "\n");
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
+ xfree(keys);
|
|
Tomáš Mráz |
c3274c |
+ exit(0);
|
|
Tomáš Mráz |
c3274c |
+}
|
|
Tomáš Mráz |
c3274c |
+#endif /* HAVE_LIBNSS */
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
static void
|
|
Tomáš Mráz |
c3274c |
do_fingerprint(struct passwd *pw)
|
|
Tomáš Mráz |
c3274c |
{
|
|
Jan F. Chadima |
adad2a |
@@ -1083,7 +1108,8 @@ main(int argc, char **argv)
|
|
Tomáš Mráz |
c3274c |
Key *private, *public;
|
|
Tomáš Mráz |
c3274c |
struct passwd *pw;
|
|
Tomáš Mráz |
c3274c |
struct stat st;
|
|
Tomáš Mráz |
c3274c |
- int opt, type, fd, download = 0;
|
|
Tomáš Mráz |
c3274c |
+ int opt, type, fd, download = 1;
|
|
Tomáš Mráz |
c3274c |
+ int use_nss = 0;
|
|
Tomáš Mráz |
c3274c |
u_int32_t memory = 0, generator_wanted = 0, trials = 100;
|
|
Tomáš Mráz |
c3274c |
int do_gen_candidates = 0, do_screen_candidates = 0;
|
|
Tomáš Mráz |
ec5276 |
BIGNUM *start = NULL;
|
|
Jan F. Chadima |
adad2a |
@@ -1116,7 +1142,7 @@ main(int argc, char **argv)
|
|
Tomáš Mráz |
c3274c |
}
|
|
Tomáš Mráz |
c3274c |
|
|
Tomáš Mráz |
c9833c |
while ((opt = getopt(argc, argv,
|
|
Tomáš Mráz |
c3274c |
- "degiqpclBHvxXyF:b:f:t:U:D:P:N:C:r:g:R:T:G:M:S:a:W:")) != -1) {
|
|
Tomáš Mráz |
c3274c |
+ "degiqpclnBHvxXyF:b:f:t:U:D:P:N:C:r:g:R:T:G:M:S:a:W:")) != -1) {
|
|
Tomáš Mráz |
c3274c |
switch (opt) {
|
|
Tomáš Mráz |
c3274c |
case 'b':
|
|
Tomáš Mráz |
c3274c |
bits = (u_int32_t)strtonum(optarg, 768, 32768, &errstr);
|
|
Jan F. Chadima |
adad2a |
@@ -1156,6 +1182,10 @@ main(int argc, char **argv)
|
|
Tomáš Mráz |
c3274c |
case 'g':
|
|
Tomáš Mráz |
c3274c |
print_generic = 1;
|
|
Tomáš Mráz |
c3274c |
break;
|
|
Tomáš Mráz |
c3274c |
+ case 'n':
|
|
Tomáš Mráz |
c3274c |
+ use_nss = 1;
|
|
Tomáš Mráz |
c3274c |
+ download = 1;
|
|
Tomáš Mráz |
c3274c |
+ break;
|
|
Tomáš Mráz |
c3274c |
case 'P':
|
|
Tomáš Mráz |
c3274c |
identity_passphrase = optarg;
|
|
Tomáš Mráz |
c3274c |
break;
|
|
Jan F. Chadima |
adad2a |
@@ -1187,10 +1217,10 @@ main(int argc, char **argv)
|
|
Tomáš Mráz |
c3274c |
case 't':
|
|
Tomáš Mráz |
c3274c |
key_type_name = optarg;
|
|
Tomáš Mráz |
c3274c |
break;
|
|
Tomáš Mráz |
c3274c |
- case 'D':
|
|
Tomáš Mráz |
c3274c |
- download = 1;
|
|
Tomáš Mráz |
c3274c |
- /*FALLTHROUGH*/
|
|
Tomáš Mráz |
c3274c |
case 'U':
|
|
Tomáš Mráz |
c3274c |
+ download = 0;
|
|
Tomáš Mráz |
c3274c |
+ /*FALLTHROUGH*/
|
|
Tomáš Mráz |
c3274c |
+ case 'D':
|
|
Tomáš Mráz |
c3274c |
reader_id = optarg;
|
|
Tomáš Mráz |
c3274c |
break;
|
|
Tomáš Mráz |
c3274c |
case 'v':
|
|
Jan F. Chadima |
adad2a |
@@ -1299,6 +1329,17 @@ main(int argc, char **argv)
|
|
Tomáš Mráz |
c3274c |
exit(0);
|
|
Tomáš Mráz |
c3274c |
}
|
|
Tomáš Mráz |
c3274c |
}
|
|
Tomáš Mráz |
c3274c |
+
|
|
Tomáš Mráz |
c3274c |
+ if (use_nss) {
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Tomáš Mráz |
c3274c |
+ if (download)
|
|
Tomáš Mráz |
c3274c |
+ do_nss_download(pw, reader_id, identity_file);
|
|
Tomáš Mráz |
c3274c |
+ else
|
|
Tomáš Mráz |
c3274c |
+ fatal("no support for NSS key upload.");
|
|
Tomáš Mráz |
c3274c |
+#else
|
|
Tomáš Mráz |
c3274c |
+ fatal("no support for NSS keys.");
|
|
Tomáš Mráz |
c3274c |
+#endif
|
|
Tomáš Mráz |
c3274c |
+ }
|
|
Tomáš Mráz |
c3274c |
if (reader_id != NULL) {
|
|
Tomáš Mráz |
c3274c |
#ifdef SMARTCARD
|
|
Tomáš Mráz |
c3274c |
if (download)
|
|
Jan F. Chadima |
adad2a |
diff -up openssh-5.2p1/readconf.c.nss-keys openssh-5.2p1/readconf.c
|
|
Jan F. Chadima |
adad2a |
--- openssh-5.2p1/readconf.c.nss-keys 2008-06-29 16:04:03.000000000 +0200
|
|
Jan F. Chadima |
adad2a |
+++ openssh-5.2p1/readconf.c 2008-11-18 19:11:41.000000000 +0100
|
|
Jan F. Chadima |
adad2a |
@@ -124,6 +124,7 @@ typedef enum {
|
|
Jan F. Chadima |
adad2a |
oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias,
|
|
Jan F. Chadima |
adad2a |
oDynamicForward, oPreferredAuthentications, oHostbasedAuthentication,
|
|
Jan F. Chadima |
adad2a |
oHostKeyAlgorithms, oBindAddress, oSmartcardDevice,
|
|
Jan F. Chadima |
adad2a |
+ oUseNSS, oNSSToken,
|
|
Jan F. Chadima |
adad2a |
oClearAllForwardings, oNoHostAuthenticationForLocalhost,
|
|
Jan F. Chadima |
adad2a |
oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout,
|
|
Jan F. Chadima |
adad2a |
oAddressFamily, oGssAuthentication, oGssDelegateCreds,
|
|
Jan F. Chadima |
adad2a |
@@ -210,6 +211,13 @@ static struct {
|
|
Jan F. Chadima |
adad2a |
#else
|
|
Jan F. Chadima |
adad2a |
{ "smartcarddevice", oUnsupported },
|
|
Jan F. Chadima |
adad2a |
#endif
|
|
Tomáš Mráz |
c3274c |
+#ifdef HAVE_LIBNSS
|
|
Jan F. Chadima |
adad2a |
+ { "usenss", oUseNSS },
|
|
Jan F. Chadima |
adad2a |
+ { "nsstoken", oNSSToken },
|
|
Jan F. Chadima |
adad2a |
+#else
|
|
Jan F. Chadima |
adad2a |
+ { "usenss", oUnsupported },
|
|
Jan F. Chadima |
adad2a |
+ { "nsstoken", oNSSToken },
|
|
Tomáš Mráz |
c3274c |
+#endif
|
|
Jan F. Chadima |
adad2a |
{ "clearallforwardings", oClearAllForwardings },
|
|
Jan F. Chadima |
adad2a |
{ "enablesshkeysign", oEnableSSHKeysign },
|
|
Jan F. Chadima |
adad2a |
{ "verifyhostkeydns", oVerifyHostKeyDNS },
|
|
Jan F. Chadima |
adad2a |
@@ -603,6 +611,14 @@ parse_string:
|
|
Jan F. Chadima |
adad2a |
charptr = &options->smartcard_device;
|
|
Jan F. Chadima |
adad2a |
goto parse_string;
|
|
Tomáš Mráz |
c3274c |
|
|
Jan F. Chadima |
adad2a |
+ case oUseNSS:
|
|
Jan F. Chadima |
adad2a |
+ intptr = &options->use_nss;
|
|
Jan F. Chadima |
adad2a |
+ goto parse_flag;
|
|
Jan F. Chadima |
a3ba41 |
+
|
|
Jan F. Chadima |
adad2a |
+ case oNSSToken:
|
|
Jan F. Chadima |
adad2a |
+ charptr = &options->nss_token;
|
|
Jan F. Chadima |
adad2a |
+ goto parse_command;
|
|
Jan F. Chadima |
a3ba41 |
+
|
|
Jan F. Chadima |
adad2a |
case oProxyCommand:
|
|
Jan F. Chadima |
adad2a |
charptr = &options->proxy_command;
|
|
Jan F. Chadima |
adad2a |
parse_command:
|
|
Jan F. Chadima |
adad2a |
@@ -1055,6 +1071,8 @@ initialize_options(Options * options)
|
|
Jan F. Chadima |
adad2a |
options->preferred_authentications = NULL;
|
|
Jan F. Chadima |
adad2a |
options->bind_address = NULL;
|
|
Jan F. Chadima |
adad2a |
options->smartcard_device = NULL;
|
|
Jan F. Chadima |
adad2a |
+ options->use_nss = -1;
|
|
Jan F. Chadima |
adad2a |
+ options->nss_token = NULL;
|
|
Jan F. Chadima |
adad2a |
options->enable_ssh_keysign = - 1;
|
|
Jan F. Chadima |
adad2a |
options->no_host_authentication_for_localhost = - 1;
|
|
Jan F. Chadima |
adad2a |
options->identities_only = - 1;
|
|
Jan F. Chadima |
adad2a |
@@ -1184,6 +1202,8 @@ fill_default_options(Options * options)
|
|
Jan F. Chadima |
adad2a |
options->no_host_authentication_for_localhost = 0;
|
|
Jan F. Chadima |
adad2a |
if (options->identities_only == -1)
|
|
Jan F. Chadima |
adad2a |
options->identities_only = 0;
|
|
Jan F. Chadima |
adad2a |
+ if (options->use_nss == -1)
|
|
Jan F. Chadima |
adad2a |
+ options->use_nss = 0;
|
|
Jan F. Chadima |
adad2a |
if (options->enable_ssh_keysign == -1)
|
|
Jan F. Chadima |
adad2a |
options->enable_ssh_keysign = 0;
|
|
Jan F. Chadima |
adad2a |
if (options->rekey_limit == -1)
|