2001-09-18 05:06:21 +00:00
|
|
|
How to use smartcards with OpenSSH?
|
|
|
|
|
2003-06-10 08:55:22 +00:00
|
|
|
OpenSSH contains experimental support for authentication using
|
2003-11-21 12:48:55 +00:00
|
|
|
Cyberflex smartcards and TODOS card readers, in addition to the cards
|
2003-06-10 11:09:09 +00:00
|
|
|
with PKCS#15 structure supported by OpenSC. To enable this you
|
2003-06-10 08:55:22 +00:00
|
|
|
need to:
|
2001-09-25 00:21:28 +00:00
|
|
|
|
2003-06-10 11:09:09 +00:00
|
|
|
Using libsectok:
|
2001-09-25 00:21:28 +00:00
|
|
|
|
2003-06-10 11:09:09 +00:00
|
|
|
(1) enable sectok support in OpenSSH:
|
|
|
|
|
|
|
|
$ ./configure --with-sectok
|
2001-09-18 05:06:21 +00:00
|
|
|
|
2003-06-10 08:55:22 +00:00
|
|
|
(2) If you have used a previous version of ssh with your card, you
|
|
|
|
must remove the old applet and keys.
|
2001-09-18 05:06:21 +00:00
|
|
|
|
|
|
|
$ sectok
|
|
|
|
sectok> login -d
|
2003-06-10 08:55:22 +00:00
|
|
|
sectok> junload Ssh.bin
|
|
|
|
sectok> delete 0012
|
|
|
|
sectok> delete sh
|
2001-09-18 05:06:21 +00:00
|
|
|
sectok> quit
|
|
|
|
|
2003-06-10 08:55:22 +00:00
|
|
|
(3) load the Java Cardlet to the Cyberflex card and set card passphrase:
|
2001-09-18 05:06:21 +00:00
|
|
|
|
|
|
|
$ sectok
|
|
|
|
sectok> login -d
|
2003-06-10 08:55:22 +00:00
|
|
|
sectok> jload /usr/libdata/ssh/Ssh.bin
|
2001-09-18 05:06:21 +00:00
|
|
|
sectok> setpass
|
2003-11-21 12:48:55 +00:00
|
|
|
Enter new AUT0 passphrase:
|
|
|
|
Re-enter passphrase:
|
2001-09-18 05:06:21 +00:00
|
|
|
sectok> quit
|
|
|
|
|
|
|
|
Do not forget the passphrase. There is no way to
|
|
|
|
recover if you do.
|
|
|
|
|
|
|
|
IMPORTANT WARNING: If you attempt to login with the
|
|
|
|
wrong passphrase three times in a row, you will
|
|
|
|
destroy your card.
|
|
|
|
|
2003-06-10 08:55:22 +00:00
|
|
|
(4) load a RSA key to the card:
|
2002-04-23 12:48:46 +00:00
|
|
|
|
2003-06-10 08:55:22 +00:00
|
|
|
$ ssh-keygen -f /path/to/rsakey -U 1
|
|
|
|
(where 1 is the reader number, you can also try 0)
|
2002-04-23 12:48:46 +00:00
|
|
|
|
2003-06-10 08:55:22 +00:00
|
|
|
In spite of the name, this does not generate a key.
|
|
|
|
It just loads an already existing key on to the card.
|
2002-04-23 12:48:46 +00:00
|
|
|
|
2003-06-10 11:09:09 +00:00
|
|
|
(5) Optional: If you don't want to use a card passphrase, change the
|
2003-06-10 08:55:22 +00:00
|
|
|
acl on the private key file:
|
2001-09-18 05:06:21 +00:00
|
|
|
|
2003-06-10 08:55:22 +00:00
|
|
|
$ sectok
|
|
|
|
sectok> login -d
|
2003-11-21 12:48:55 +00:00
|
|
|
sectok> acl 0012 world: w
|
|
|
|
world: w
|
|
|
|
AUT0: w inval
|
2003-06-10 08:55:22 +00:00
|
|
|
sectok> quit
|
2001-09-18 05:06:21 +00:00
|
|
|
|
2003-06-10 08:55:22 +00:00
|
|
|
If you do this, anyone who has access to your card
|
|
|
|
can assume your identity. This is not recommended.
|
2001-09-18 05:06:21 +00:00
|
|
|
|
2003-06-10 11:09:09 +00:00
|
|
|
|
|
|
|
Using OpenSC:
|
|
|
|
|
|
|
|
(1) install OpenSC:
|
|
|
|
|
|
|
|
Sources and instructions are available from
|
|
|
|
http://www.opensc.org/
|
|
|
|
|
|
|
|
(2) enable OpenSC support in OpenSSH:
|
|
|
|
|
|
|
|
$ ./configure --with-opensc[=/path/to/opensc] [options]
|
|
|
|
|
|
|
|
(3) load a RSA key to the card:
|
|
|
|
|
|
|
|
Not supported yet.
|
|
|
|
|
|
|
|
|
|
|
|
Common operations:
|
|
|
|
|
|
|
|
(1) tell the ssh client to use the card reader:
|
|
|
|
|
|
|
|
$ ssh -I 1 otherhost
|
|
|
|
|
|
|
|
(2) or tell the agent (don't forget to restart) to use the smartcard:
|
|
|
|
|
|
|
|
$ ssh-add -s 1
|
|
|
|
|
|
|
|
|
2001-09-18 05:06:21 +00:00
|
|
|
-markus,
|
2003-06-10 08:55:22 +00:00
|
|
|
Tue Jul 17 23:54:51 CEST 2001
|
|
|
|
|
2003-11-21 12:48:55 +00:00
|
|
|
$OpenBSD: README.smartcard,v 1.9 2003/11/21 11:57:02 djm Exp $
|