-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Insecure Algorithm error when running TLS-based Authentication Example for OPA v0.46.1 #5521
Comments
Hey @jjthom87, and thanks for reporting that! 👍 If no one beats me to it, I'll take a look tomorrow. |
Hi Jared, we need to make a number of updates to this part of the docs as they are quite old, thanks for highlighting it. The issue you are seeing is that go (& so OPA) now rejects SHA1 signed certs as being insecure (and rightly so). I think this happened in go 1.18. It seems we haven't updated these docs since then. You can see by running To get you up and running, I think these steps to create the PKI for the demo should work: (I add
This works for me. Can you confirm that allows you to progress? In the meantime, I'll work on a few updates to the docs here. |
I confirm that this works. Thank you for your assistance here! |
Fixes #5521 The fix is adding `-sha256` to use SHA 256 digests for certificates rather than SHA1. Since go 1.18, SHA1 is rejected by go TLS. This PR also updates the tutorial to use ECDSA keys, reduces the lifetimes of the certs used and updates the sample logs to match what OPA and curl show today. Signed-off-by: Charlie Egan <[email protected]>
Fixes #5521 The fix is adding `-sha256` to use SHA 256 digests for certificates rather than SHA1. Since go 1.18, SHA1 is rejected by go TLS. This PR also updates the tutorial to use ECDSA keys, reduces the lifetimes of the certs used and updates the sample logs to match what OPA and curl show today. Signed-off-by: Charlie Egan <[email protected]> Signed-off-by: Charlie Egan <[email protected]> Co-authored-by: Charlie Egan <[email protected]>
Short description
At the first curl step for the OPA TLS-based Authentication example,
curl --key client-key.pem \ --cert client-cert.pem \ --cacert ca.pem \ --resolve opa.example.com:8181:127.0.0.1 \ https://opa.example.com:8181/v1/data
I am getting this error when using OPA version 0.46.1:
2023/01/03 09:38:54 http: TLS handshake error from 127.0.0.1:62333: tls: failed to verify client certificate: x509: certificate signed by unknown authority (possibly because of "x509: cannot verify signature: insecure algorithm SHA1-RSA (temporarily override with GODEBUG=x509sha1=1)" while trying to verify candidate authority certificate "my-ca")
Attempt to Fix
I tried to fix the error based on the comment from this issue, but using the -sha256 flag when creating the root, client, and server certificates did not work.
openssl req -x509 -sha256 -new -nodes -key ca-key.pem -days 1000 -out ca.pem -subj "/CN=my-ca"
openssl req -sha256 -new -key client-key.pem -out csr.pem -subj "/CN=my-client"
openssl req -sha256 -new -key client-key-2.pem -out csr.pem -subj "/CN=my-client-2"
openssl req -sha256 -new -key server-key.pem -out csr.pem -subj "/CN=my-server" -config req.cnf
Expected behavior
When using OPA Version 0.32.0, I get the expected result
{"result":{}}
The text was updated successfully, but these errors were encountered: