I am using local https protocol and a fake certificate.
When using django-openid-auth
, it gives me this error:
OpenID failed
OpenID discovery error: Error fetching XRDS document: (60, 'server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none')
How can I fix this?
In my experience, in most cases the validators are picky on self-signed certificates.
In general, when using "fake" certificates you should always take the extra step and create a fake CA and sign the fake cert with the CA. If nothing else, this makes your testing be more like a real life scenario.
Here are brief instructions on how to do this with OpenSSL:
openssl req -x509 -new -out ca.crt -keyout ca.key -days 3650
openssl req -out server.csr -pubkey -new -keyout server.secure.key
openssl rsa -in server.secure.key -out server.key
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 1825
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAserial ca.srl -out server.crt -days 1825
)Whenever you have problems with any SSL (not just HTTPS) - use raw openssl
to debug by doing
openssl s_verify -connect <hostname>:<portnumber> <options>
e.g.
openssl s_verify -connect localhost:443 -CAfile myfakeca.pem
This usually saves you a lot of trouble figuring out problems with your actual certificates that actually have nothing to do with your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With