You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Forking causes an error with PKCS#11 crypto module #550
I'm not sure if there is anything Psysh can really do about this but I figured I would report the issue in case anyone else runs into it.
If you use Curl in a Psysh shell twice in a row with SSL you will encounter an error like this:
cURL error 35: A PKCS #11 module returned CKR_DEVICE_ERROR, indicating that a problem has occurred with the token or slot. (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)'
It is an error to try to use a PKCS#11 crypto module in a process before it has been initialized in that process, even if the module was initialized in the parent process. Beginning in NSS 3.12.3, Softoken will detect this error.
I found two workarounds.
1.) Set usePcntl to false in the psysh config file as explained in #511.
2.) set the NSS environment variable NSS_STRICT_NOFORK to DISABLED as explained in the docs linked above, i.e. NSS_STRICT_NOFORK=DISABLED psysh
Reproduction steps:
1.) compile curl with NSS instead of openssl or libressl. It should say something like curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.28.4...
2.) compile php and the curl extension
3.) Install psysh and open a shell
4.) execute the following:
>>> $ch = curl_init()
=> curl resource #930
>>> curl_setopt($ch, CURLOPT_URL, "https://www.example.com/");
=> true
>>> curl_exec($ch)
<!doctype html>...
=> true
>>> curl_exec($ch)
=> false
>>> curl_error($ch)
=> "A PKCS #11 module returned CKR_DEVICE_ERROR, indicating that a problem has occurred with the token or slot."
Activity
bobthecow commentedon May 3, 2020
I just added a troubleshooting section to the wiki to cover resolution for this sort of thing: https://github.com/bobthecow/psysh/wiki/Troubleshooting