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

Add OIDC config primitives #49

Merged
merged 66 commits into from
Oct 22, 2024

Conversation

GeorgeJahad
Copy link
Collaborator

Add OIDC config primitives:

configure_oidc_provider, configure_oidc_client, configure_oidc_user

@GeorgeJahad GeorgeJahad requested a review from suprjinx October 10, 2024 02:50
README.md Outdated Show resolved Hide resolved

def oidc_provider
::Vault::Client.new(
address: "http://oidc_provider:8300",
Copy link
Contributor

@dave-gantenbein dave-gantenbein Oct 10, 2024

Choose a reason for hiding this comment

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

Is this static string what you want here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed to config param in astral.yml

README.md Outdated
his username/password.

On success, the provider returns an OIDC token, which includes the
user's email addr.
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe don't abbreviate "addr" in the doc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

README.md Outdated
You should do this on your host machine, not in docker. This will
allow a browser window to open on your host. When it does, select
"username" option with user test/test. (That is the username/pw
configured by the rails tests.)
Copy link
Collaborator

Choose a reason for hiding this comment

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

configured at start up

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

private
WEBAPP_NAME = "identity/oidc/client/astral"

def oidc_provider
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think naming this vault_client might make downstream usage a little clearer? since the class is OidcProvider (abstraction) but rubber is meeting road here (vault specifically is the provider).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

oidc_provider_addr: http://oidc_provider:8300
initial_user_name: test
initial_user_password: test
initial_user_email: [email protected]
Copy link
Collaborator

Choose a reason for hiding this comment

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

you could eliminate one repetition of this config by putting these dev/test values in shared and the blank overrides in production

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -72,4 +73,8 @@

# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
# config.generators.apply_rubocop_autocorrect_after_generate!

def get_oidc_config
Copy link
Collaborator

Choose a reason for hiding this comment

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

similar, if this is the default impl and noop is the production case, you reduce one repetition

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@GeorgeJahad
Copy link
Collaborator Author

@suprjinx I've addressed all your comments.

@GeorgeJahad GeorgeJahad requested a review from suprjinx October 17, 2024 23:04
@GeorgeJahad
Copy link
Collaborator Author

@suprjinx It is ready to review again.

I had to modify the cert gen rake task to include the "Subject Alternative Name", because I was getting this error when configuring the provider:

2024-10-18T23:46:39.748Z [ERROR] auth.oidc.auth_oidc_f5b65f30: error checking oidc discovery URL: error="error creating provider with given values: NewProvider: unable to create provider: Get \"https://oidc_provider:9443/v1/identity/oidc/provider/astral/.well-known/openid-configuration\": tls: failed to verify certificate: x509: certificate relies on legacy Common Name field, use SANs instead"

README.md Outdated
OidcProvider.new.configure creates an OIDC provider
and user on a separate dedicated Vault instance. The user created has
a username/password/email address, that can be accessed with OIDC auth
from in the principal Vault instance.
Copy link
Collaborator

Choose a reason for hiding this comment

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

"from in"

@@ -3,15 +3,21 @@ require "rake"
# Rake tasks for making a vault cert
namespace :configure do
desc "Make the server cert for vault"
task :ssl do
task :ssl, [ :cert_name ] do |t, args|
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like your approach :-). I'll have adopt this in #53

suprjinx
suprjinx previously approved these changes Oct 21, 2024
@GeorgeJahad GeorgeJahad merged commit ceb8619 into G-Research:main Oct 22, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants