OpenVPN+Rutoken S+неэкспортируемая пара: не принимает пароль токена
Добрый день.
Проблема после установки на сервер и генерации сертификата в openssl 1.1.1k.
Соединение прекрасно устанавливается, если сертификат и ключ доступны и прописаны в клиентском конфиге openvpn.
Однако после импорта pfx пары в токен и соответсвующей правки конфига токен не принимает правильный пароль и после двух-трех попыток вываливается с ошибкой.
Интересно, что на этой же машине прекрасно отрабатывает конфиг и токен с сертификатами, сделанными на openssl 1.1.0
Где копать?
Версия rtPKCS11.dll 4.9.1.0
Версия openvpn 2.5.5.0
Конфиг для работы без токена:
proto udp
dev tun
persist-key
persist-tun
cipher AES-256-CBC
auth SHA1
tls-client
client
resolv-retry infinite
nobind
remote Х.Х.Х.Х 1194
verb 3
ca ca.crt
remote-cert-tls server
tls-auth ta.key 1
cert client1.crt
key client1.key
pkcs11-pin-cache 300
float
keepalive 10 120
Лог работы без токена:
2022-04-11 15:13:40 OpenVPN 2.5.5 Windows-MSVC [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Dec 15 2021
2022-04-11 15:13:40 Windows version 10.0 (Windows 10 or greater) 64bit
2022-04-11 15:13:40 library versions: OpenSSL 1.1.1l 24 Aug 2021, LZO 2.10
2022-04-11 15:13:40 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
2022-04-11 15:13:40 Need hold release from management interface, waiting...
2022-04-11 15:13:40 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
2022-04-11 15:13:40 MANAGEMENT: CMD 'state on'
2022-04-11 15:13:40 MANAGEMENT: CMD 'log all on'
2022-04-11 15:13:40 MANAGEMENT: CMD 'echo all on'
2022-04-11 15:13:40 MANAGEMENT: CMD 'bytecount 5'
2022-04-11 15:13:40 MANAGEMENT: CMD 'hold off'
2022-04-11 15:13:40 MANAGEMENT: CMD 'hold release'
2022-04-11 15:13:40 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2022-04-11 15:13:40 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2022-04-11 15:13:40 TCP/UDP: Preserving recently used remote address: [AF_INET]Х.Х.Х.Х:1194
2022-04-11 15:13:40 Socket Buffers: R=[65536->65536] S=[65536->65536]
2022-04-11 15:13:40 UDP link local: (not bound)
2022-04-11 15:13:40 UDP link remote: [AF_INET]Х.Х.Х.Х:1194
2022-04-11 15:13:40 MANAGEMENT: >STATE:1649679220,WAIT,,,,,,
2022-04-11 15:13:40 MANAGEMENT: >STATE:1649679220,AUTH,,,,,,
2022-04-11 15:13:40 TLS: Initial packet from [AF_INET]Х.Х.Х.Х:1194, sid=2a64e72c 93f8c592
2022-04-11 15:13:40 VERIFY OK: depth=1, CN=Easy-RSA CA
2022-04-11 15:13:40 VERIFY KU OK
2022-04-11 15:13:40 Validating certificate extended key usage
2022-04-11 15:13:40 ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication
2022-04-11 15:13:40 VERIFY EKU OK
2022-04-11 15:13:40 VERIFY OK: depth=0, CN=ovpn-serv
2022-04-11 15:13:40 Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 2048 bit RSA, signature: RSA-SHA256
2022-04-11 15:13:40 [ovpn-serv] Peer Connection Initiated with [AF_INET]Х.Х.Х.Х:1194
2022-04-11 15:13:40 PUSH: Received control message: 'PUSH_REPLY,sndbuf 393216,rcvbuf 393216,route 10.8.0.0 255.255.255.0,topology net30,ping 10,ping-restart 60,route 10.168.103.0 255.255.255.0,ifconfig 10.8.0.6 10.8.0.5,peer-id 0,cipher AES-256-GCM'
2022-04-11 15:13:40 OPTIONS IMPORT: timers and/or timeouts modified
2022-04-11 15:13:40 OPTIONS IMPORT: --sndbuf/--rcvbuf options modified
2022-04-11 15:13:40 Socket Buffers: R=[65536->393216] S=[65536->393216]
2022-04-11 15:13:40 OPTIONS IMPORT: --ifconfig/up options modified
2022-04-11 15:13:40 OPTIONS IMPORT: route options modified
2022-04-11 15:13:40 OPTIONS IMPORT: peer-id set
2022-04-11 15:13:40 OPTIONS IMPORT: adjusting link_mtu to 1624
2022-04-11 15:13:40 OPTIONS IMPORT: data channel crypto options modified
2022-04-11 15:13:40 Data Channel: using negotiated cipher 'AES-256-GCM'
2022-04-11 15:13:40 Outgoing Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
2022-04-11 15:13:40 Incoming Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
2022-04-11 15:13:40 interactive service msg_channel=612
2022-04-11 15:13:40 open_tun
2022-04-11 15:13:40 tap-windows6 device [OpenVPN TAP-Windows6] opened
2022-04-11 15:13:40 TAP-Windows Driver Version 9.24
2022-04-11 15:13:40 Notified TAP-Windows driver to set a DHCP IP/netmask of 10.8.0.6/255.255.255.252 on interface {3C99C393-A79C-41F9-87D0-BFB1E37B704F} [DHCP-serv: 10.8.0.5, lease-time: 31536000]
2022-04-11 15:13:40 Successful ARP Flush on interface [8] {3C99C393-A79C-41F9-87D0-BFB1E37B704F}
2022-04-11 15:13:40 MANAGEMENT: >STATE:1649679220,ASSIGN_IP,,10.8.0.6,,,,
2022-04-11 15:13:40 IPv4 MTU set to 1500 on interface 8 using service
2022-04-11 15:13:45 TEST ROUTES: 2/2 succeeded len=2 ret=1 a=0 u/d=up
2022-04-11 15:13:45 MANAGEMENT: >STATE:1649679225,ADD_ROUTES,,,,,,
2022-04-11 15:13:45 C:\Windows\system32\route.exe ADD 10.8.0.0 MASK 255.255.255.0 10.8.0.5
2022-04-11 15:13:45 Route addition via service succeeded
2022-04-11 15:13:45 C:\Windows\system32\route.exe ADD 10.168.103.0 MASK 255.255.255.0 10.8.0.5
2022-04-11 15:13:45 Route addition via service succeeded
2022-04-11 15:13:45 Initialization Sequence Completed
2022-04-11 15:13:45 MANAGEMENT: >STATE:1649679225,CONNECTED,SUCCESS,10.8.0.6,Х.Х.Х.Х,1194,,
Конфиг для работы с токеном:
proto udp
dev tun
persist-key
persist-tun
cipher AES-256-CBC
auth SHA1
tls-client
client
resolv-retry infinite
nobind
remote Х.Х.Х.Х 1194
verb 3
ca ca.crt
remote-cert-tls server
tls-auth ta.key 1
pkcs11-providers c:\\windows\\system32\\rtPKCS11.dll
pkcs11-id 'Aktiv\x20Co\x2E/Rutoken\x20S/2cc64ac5/Rutoken\x20S\x20\x3Cno\x20label\x3E/62633163633037322D643561632D343961372D383762382D3964306130316637663364305F45'
pkcs11-pin-cache 300
float
keepalive 10 120
Лог работы с токеном:
2022-04-11 15:19:49 OpenVPN 2.5.5 Windows-MSVC [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Dec 15 2021
2022-04-11 15:19:49 Windows version 10.0 (Windows 10 or greater) 64bit
2022-04-11 15:19:49 library versions: OpenSSL 1.1.1l 24 Aug 2021, LZO 2.10
2022-04-11 15:19:49 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
2022-04-11 15:19:49 Need hold release from management interface, waiting...
2022-04-11 15:19:49 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
2022-04-11 15:19:49 MANAGEMENT: CMD 'state on'
2022-04-11 15:19:49 MANAGEMENT: CMD 'log all on'
2022-04-11 15:19:49 MANAGEMENT: CMD 'echo all on'
2022-04-11 15:19:49 MANAGEMENT: CMD 'bytecount 5'
2022-04-11 15:19:49 MANAGEMENT: CMD 'hold off'
2022-04-11 15:19:49 MANAGEMENT: CMD 'hold release'
2022-04-11 15:19:49 PKCS#11: Adding PKCS#11 provider 'c:\windows\system32\rtPKCS11.dll'
2022-04-11 15:19:49 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2022-04-11 15:19:49 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2022-04-11 15:19:49 TCP/UDP: Preserving recently used remote address: [AF_INET]Х.Х.Х.Х:1194
2022-04-11 15:19:49 Socket Buffers: R=[65536->65536] S=[65536->65536]
2022-04-11 15:19:49 UDP link local: (not bound)
2022-04-11 15:19:49 UDP link remote: [AF_INET]Х.Х.Х.Х:1194
2022-04-11 15:19:49 MANAGEMENT: >STATE:1649679589,WAIT,,,,,,
2022-04-11 15:19:49 MANAGEMENT: >STATE:1649679589,AUTH,,,,,,
2022-04-11 15:19:49 TLS: Initial packet from [AF_INET]Х.Х.Х.Х:1194, sid=ff5e9ddc 01a1704c
2022-04-11 15:19:50 VERIFY OK: depth=1, CN=Easy-RSA CA
2022-04-11 15:19:50 VERIFY KU OK
2022-04-11 15:19:50 Validating certificate extended key usage
2022-04-11 15:19:50 ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication
2022-04-11 15:19:50 VERIFY EKU OK
2022-04-11 15:19:50 VERIFY OK: depth=0, CN=ovpn-serv
2022-04-11 15:19:54 MANAGEMENT: CMD 'password [...]'
2022-04-11 15:20:12 MANAGEMENT: CMD 'password [...]'
2022-04-11 15:20:12 PKCS#11: Cannot perform signature 112:'CKR_MECHANISM_INVALID'
2022-04-11 15:20:12 OpenSSL: error:141F0006:SSL routines:tls_construct_cert_verify:EVP lib
2022-04-11 15:20:12 TLS_ERROR: BIO read tls_read_plaintext error
2022-04-11 15:20:12 TLS Error: TLS object -> incoming plaintext read error
2022-04-11 15:20:12 TLS Error: TLS handshake failed
2022-04-11 15:20:12 SIGUSR1[soft,tls-error] received, process restarting
2022-04-11 15:20:12 MANAGEMENT: >STATE:1649679612,RECONNECTING,tls-error,,,,,
2022-04-11 15:20:12 Restart pause, 5 second(s)
2022-04-11 15:20:17 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2022-04-11 15:20:17 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2022-04-11 15:20:17 TCP/UDP: Preserving recently used remote address: [AF_INET]Х.Х.Х.Х:1194
2022-04-11 15:20:17 Socket Buffers: R=[65536->65536] S=[65536->65536]
2022-04-11 15:20:17 UDP link local: (not bound)
2022-04-11 15:20:17 UDP link remote: [AF_INET]Х.Х.Х.Х:1194
2022-04-11 15:20:17 MANAGEMENT: >STATE:1649679617,WAIT,,,,,,
2022-04-11 15:20:17 MANAGEMENT: >STATE:1649679617,AUTH,,,,,,
2022-04-11 15:20:17 TLS: Initial packet from [AF_INET]Х.Х.Х.Х:1194, sid=eeebdcdc f1cd5ac7
2022-04-11 15:20:17 VERIFY OK: depth=1, CN=Easy-RSA CA
2022-04-11 15:20:17 VERIFY KU OK
2022-04-11 15:20:17 Validating certificate extended key usage
2022-04-11 15:20:17 ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication
2022-04-11 15:20:17 VERIFY EKU OK
2022-04-11 15:20:17 VERIFY OK: depth=0, CN=ovpn-serv
2022-04-11 15:20:19 PKCS#11: Cannot perform signature 1:'CKR_CANCEL'
2022-04-11 15:20:19 OpenSSL: error:141F0006:SSL routines:tls_construct_cert_verify:EVP lib
2022-04-11 15:20:19 TLS_ERROR: BIO read tls_read_plaintext error
2022-04-11 15:20:19 TLS Error: TLS object -> incoming plaintext read error
2022-04-11 15:20:19 TLS Error: TLS handshake failed
2022-04-11 15:20:19 SIGTERM[hard,tls-error] received, process exiting
2022-04-11 15:20:19 MANAGEMENT: >STATE:1649679619,EXITING,tls-error,,,,,