-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not load pkcs11 Engine #809
Comments
Does this happen on Mint only or Ubuntu too? The error message points to a misconfiguration of OpenSSL as far as I can see, but then openfortivpn works just fine on Ubuntu Bionic for me. |
I think in #464 (comment) @rmuehl has mentioned this behavior, but I think he was referring to Mac OSX where he said that he had no idea yet |
I tried again on a vanilla install of Ubuntu 18.04; same behavior as on Mint 19.3.
|
I really can't help much here. I do not use openfortivpn with a smartcard, which is probably why it "works just fine on Ubuntu Bionic for me". |
This sample code compiles but fails on Ubuntu 20.04 LTS:
The error message is identical:
If we can get it to work, perhaps we can get openfortivpn to work too.... |
Perhaps openssl does not load engine from config file can help. You probably need to get this to work:
|
Thanks Dimitri. Don't need the openssl config file; just the libengine-pkcs11-openssl package turned out to be missing. It now prompts for PIN and fails on SSL even though "openssl s_client -connect" negotiates successfully using TLS1.3. laptop:~# /opt/fortivpn/bin/openfortivpn --min-tls=1.3 I suppose another issue. |
Ah, good to learn package Otherwise, the above looks like a different issue. Perhaps the RSA certificates on the smartcard are considered obsolete/unsecure by Ubuntu 20.04 and higher. See for example #682 (comment). Try |
Thanks for your help and dedication. Yes, may help if the package name was in the README, just like the relevant packages were mentioned for compiling. The man page makes reference to an engine but I didn't connect that in Ubuntu it's referenced more like a library package or what library was needed. I'm on Mint 19, which uses packages from Ubuntu 18.04. I can't tell from the output if this is an issue with negotiating TLS (would seem unlikely) or that the server is rejecting the PIV certificate.
The server TLS certificate has a signature algorithm of SHA-256. The certificate on the PIV is also SHA-256. I've tried with and without defining ciphers to use when connecting:
Shouldn't the output print that the connection to the server is successfully established over TLS before prompting for the PIV PIN? |
This 141F0006 error might be related to certificate padding:
But then you seem to be using TLS 1.2, not TLS 1.3. Hard to tell without having a smartcard to test myself. |
Alright, so I did try a live boot on Ubuntu 20.04, which has libpkcs11-helper1 1.26-1 in the repository.
I can authenticate in Firefox (which uses opensc-pkcs11.so), but am prompted for my PIN about 8 times in the process. Of course, connecting in a browser isn't a solution as it returns "The SSL-VPN portal has been enabled for tunnel mode use only. FortiClient is required to connect." I was able to run "pkcs11-tool --read-object --id 02 --type cert | openssl x509 -inform der -text -noout" to verify that the correct certificate selected for openfortivpn is the same as the one used in the browser and is the authorized cert. |
The error message is emitted by run_tunnel() in ret = auth_log_in(&tunnel);
if (ret != 1) {
log_error("Could not authenticate to gateway. Please check the password, client certificate, etc.\n");
log_debug("%s %d\n", err_http_str(ret), ret); As you can see, the call to auth_log_in() in ret = get_value_from_response(res, "tokeninfo=", token, 128);
if (ret != 1) {
// No SVPNCOOKIE and no tokeninfo, return error.
ret = ERR_HTTP_NO_COOKIE; Could you perhaps build openfortivpn yourself and add a few debug statements in get_value_from_response()? |
This does not look like a problem with the pkcs11 engine. It seems that the vpn gateway is denying your certificate. You should debug this on the fortigate. |
Will close as my involvement with the project using FortiVPN just needed at the beginning of the month, so nowhere to test. |
Compiled 1.15.0 from source on Mint 19.3 / Ubuntu Bionic without issue. Created /etc/openfortivpn/config containing:
user-cert = pkcs11:
and the usual host and port.
When running openfortivpn, it exits with:
ERROR: Could not load pkcs11 Engine: error:2606A074:engine routines:ENGINE_by_id:no such engine
Other values after pkcs11: were tried, but the issue seems to be lack of pkcs11 support or isn't including a critical library such as opensc-pkcs11.so.
I'm successfully using the smartcard on the same machine with OpenSSH, OpenConnect, Firefox, and p11tool though.
The text was updated successfully, but these errors were encountered: