RuToken ECP mac ssh auth
Продолжение эпопеи. Теперь вообще нечто непонятное происходит. Действовал по инструкциям двумя способами. Способ первый:
bash-3.2# pkcs15-init --erase-card
Using reader with a card: Aktiv Rutoken ECP 00 00
bash-3.2# pkcs15-init --create-pkcs15 --so-pin "87654321" --pin "12345678" --so-puk ""
Using reader with a card: Aktiv Rutoken ECP 00 00
bash-3.2# pkcs15-init --store-pin --label "User PIN" --auth-id 02 --pin "12345678" --so-pin "87654321" --puk ""
Using reader with a card: Aktiv Rutoken ECP 00 00
bash-3.2# pkcs15-init -G rsa/2048 --auth-id 02 --id 42 --pin "12345678" --so-pin "87654321"
Using reader with a card: Aktiv Rutoken ECP 00 00
bash-3.2# pkcs15-tool --read-ssh-key 42
Using reader with a card: Aktiv Rutoken ECP 00 00
ssh-rsa blah-blah-blah.
запихнул открытый ключ в authorized_keys2, пытаюсь залогиниться:
ssh -v -I /Library/OpenSC/lib/opensc-pkcs11.so puppet
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/darkstar/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to puppet [46.229.164.216] port 22.
debug1: Connection established.
debug1: manufacturerID <OpenSC (www.opensc-project.org)> cryptokiVersion 2.20 libraryDescription <Smart card PKCS#11 API> libraryVersion 0.0
debug1: label <Rutoken ECP (User PIN)> manufacturerID <Aktiv Co.> model <PKCS#15> serial <000000002F7279E> flags 0x40d
debug1: have 1 keys
<skip>
debug1: Offering RSA public key: /Library/OpenSC/lib/opensc-pkcs11.so
debug1: Server accepts key: pkalg ssh-rsa blen 279
Enter PIN for 'Rutoken ECP (User PIN)':
C_Sign failed: 5
ssh_rsa_sign: RSA_sign failed: unknown err
Ладно, может я чего-то не понял. Пробую через librtpkcs11ecp.so
bash-3.2# pkcs15-init --create-pkcs15 --so-pin "87654321" --pin "12345678" --so-puk ""
Using reader with a card: Aktiv Rutoken ECP 00 00
bash-3.2# pkcs15-init --store-pin --label "User PIN" --auth-id 02 --pin "12345678" --so-pin "87654321" --puk ""
Using reader with a card: Aktiv Rutoken ECP 00 00
bash-3.2# pkcs11-tool --module /usr/lib/librtpkcs11ecp.so --keypairgen --key-type rsa:2048 -l --id 45
Using slot 0 with a present token (0x0)
Logging in to "Rutoken ECP <no label>".
Please enter User PIN:
Key pair generated:
Private Key Object; RSA
label:
ID: 45
Usage: decrypt, sign, unwrap
warning: PKCS11 function C_GetAttributeValue(ALWAYS_AUTHENTICATE) failed: rv = CKR_ATTRIBUTE_TYPE_INVALID (0x12)
Public Key Object; RSA 2048 bits
label:
ID: 45
Usage: encrypt, verify, wrap
bash-3.2# ssh-keygen -D /usr/lib/librtpkcs11ecp.so -I 0:45
ключ получил, запихнул новый в authorized_keys2
теперь другое:
localhost:~ darkstar$ ssh -v -I /usr/lib/librtpkcs11ecp.so puppet
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/darkstar/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to puppet [46.229.164.216] port 22.
debug1: Connection established.
debug1: manufacturerID <Aktiv Co.> cryptokiVersion 2.20 libraryDescription <Rutoken ECP PKCS #11 library> libraryVersion 1.1
debug1: label <Rutoken ECP <no label>> manufacturerID <Aktiv Co.> model <Rutoken ECP> serial <2f7279eb> flags 0x88040d
debug1: have 1 keys
<skip>
debug1: Offering RSA public key: /usr/lib/librtpkcs11ecp.so
debug1: Server accepts key: pkalg ssh-rsa blen 279
Enter PIN for 'Rutoken ECP <no label>':
C_Sign failed: 48
ssh_rsa_sign: RSA_sign failed: unknown err
Что я делаю не так?
ЗЫ
mac os x 10.9
OpenSC 0.13.0
librtpkcs11ecp v.1.1.3.0 от 27.08.2013