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
net.nim's newContext proc does not pass along the value of verifymode to scanSSLCertificates. scanSSLCertificates has an optional parameter which controls whether or not it looks at the environment variables SSL_CERT_DIR and SSL_CERT_FILE, however scanSSLCertificates is never called with this parameter set. This means that newContext doesn't actually look at environment variables SSL_CERT_DIR or SSL_CERT_FILE.
I believe this is a simple fix and I can submit a PR for this. I may need some assistance with how to best accomplish this in the code though.
Example
First we try without a certificate
import net
import httpclient
var client =newHttpClient(sslContext =newContext(verifyMode =CVerifyPeerUseEnvVars))
echo client.getContent("https://self-signed.badssl.com")
## nim r -d:ssl test_ssl.nim
Now we download the certificate and store it in a file
echo| openssl s_client -showcerts -connect self-signed.badssl.com:443 2>/dev/null | openssl x509 -outform pem > /tmp/test.crt
# Test to make sure it works
curl --cacert /tmp/test.crt https://self-signed.badssl.com
Now we try to point to this file with our environment variable
exportSSL_CERT_FILE=/tmp/test.crt
curl https://self-signed.badssl.com # This works! That means openSSL knows about our environment variablenimr-d:ssl test_ssl.nim # this does not work =(
This was introduced with this merge (I think) 5b85444
root@b95ab39b616e:/build/fixture/test-tap-repo# nim -v
Nim Compiler Version 1.6.0 [Linux: amd64]
Compiled at 2021-10-19
Copyright (c) 2006-2021 by Andreas Rumpf
git hash: 727c6378d2464090564dbcd9bc8b9ac648467e38
active boot switches: -d:release -d:danger
The text was updated successfully, but these errors were encountered:
net.nim's
newContext
proc does not pass along the value of verifymode toscanSSLCertificates
.scanSSLCertificates
has an optional parameter which controls whether or not it looks at the environment variablesSSL_CERT_DIR
andSSL_CERT_FILE
, howeverscanSSLCertificates
is never called with this parameter set. This means thatnewContext
doesn't actually look at environment variablesSSL_CERT_DIR
orSSL_CERT_FILE
.I believe this is a simple fix and I can submit a PR for this. I may need some assistance with how to best accomplish this in the code though.
Example
First we try without a certificate
Now we download the certificate and store it in a file
Now we try to point to this file with our environment variable
Current Output
Expected Output
Possible Solution
Submitted a pull request here: #19247
Additional Information
This was introduced with this merge (I think) 5b85444
The text was updated successfully, but these errors were encountered: