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

OIDC Auth Provider #59

Merged
merged 1 commit into from
Oct 11, 2021
Merged

OIDC Auth Provider #59

merged 1 commit into from
Oct 11, 2021

Conversation

jcrowthe
Copy link
Collaborator

  • Add support for OIDC auth provider
  • Fix a bug where policies were queried more than once
  • Improve error messages on failure to login

- Fix a bug where policies were queried more than once
- Improve error messages on failure to login
@jcrowthe jcrowthe merged commit 44cdcae into master Oct 11, 2021
if (server.listening != true) {
server.listen({
host: '127.0.0.1',
port: 8250,

Choose a reason for hiding this comment

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

Maybe the server port should be configurable in case it could collide with something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TL;DR; Cryptr has been written with the YAGNI principle in mind.

This is unfortunately a complex problem. If the server:port combination used by Cryptr is not also in the approved callback URLs list configured in the OIDC provider, the OIDC provider will cancel the login attempt and produce an error.

By default, Vault CLI uses http:https://127.0.0.1:8250 as its callback URL, and as such, this URL has the highest likelihood of already being in the OIDC provider's allowlist. For this reason this server:port combination is hardcoded here. Should sufficient need arise for customizing this port, a request can be evaluated.

To avoid port conflicts, Cryptr listens on 127.0.0.1:8250 for as short a time as possible. Error handling and retries have been added to ensure Cryptr owns (and is the sole listener on) the port before allowing the OIDC auth flow to proceed. A quick search indicates that few other pieces of software specifically claim this port, so the likelihood of always-on software claiming this port is extremely low.

@jcrowthe jcrowthe mentioned this pull request Apr 1, 2022
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.

None yet

2 participants