Skip to content
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

Load cacerts in sso #3073

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Load cacerts in sso #3073

wants to merge 3 commits into from

Conversation

arbulu89
Copy link
Contributor

@arbulu89 arbulu89 commented Oct 16, 2024

Description

Load CA certificates for Assent to enable https connection in SSO.
Otherwise, we get the imfamous {:tls_alert, {:unknown_ca, ~c"TLS client: In state wait_cert_cr at ssl_handshake.erl:2133 generated CLIENT ALERT: Fatal - Unknown CA\n"}} error.

Besides that, I have improved a bit the SSO login page to prompt a basic error message if the configuration fails.
We could've gone with the standard 500 error, but it looks less obvious. Either way, you need to access the server logs to see the exact error (which can be of different reason).

This is how it looks like:
image

PD: To test it locally, add the next lines to your local dev.local.exs file:

:ok = :public_key.cacerts_load()
[_ | _] = cacerts = :public_key.cacerts_get()

config :assent, http_adapter: {Assent.HTTPAdapter.Httpc, [ssl: [cacerts: cacerts]]}

How was this tested?

Tested with some test and specially manually, using our demo IDP environment.

Did you update the documentation?

No, but we should consider adding maybe some troubleshooting section.
Besides, once we decide how to load the CA certificates, specially in helm, we will need to document this is it requires user intervention (which will be the case almost certainly)

@arbulu89 arbulu89 added the enhancement New feature or request label Oct 16, 2024
@arbulu89 arbulu89 added the env Create an ephimeral environment for the pr branch label Oct 16, 2024
Copy link
Contributor

@gagandeepb gagandeepb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comment for later/sync consideration/conversation: What are your thoughts about having some "smoke" tests (e.g. on CI) for config hardening by running existing ssl config against something like badssl.com ? It provides a lot of positive as well as negative test cases that the config should account for, that can possibly be asserted for/against.

@arbulu89
Copy link
Contributor Author

General comment for later/sync consideration/conversation: What are your thoughts about having some "smoke" tests (e.g. on CI) for config hardening by running existing ssl config against something like badssl.com ? It provides a lot of positive as well as negative test cases that the config should account for, that can possibly be asserted for/against.

It looks interesting. Let's chat about it offline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request env Create an ephimeral environment for the pr branch
Development

Successfully merging this pull request may close these issues.

2 participants