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

feat: Split TLS config into admin and public interfaces #2476

Merged
merged 5 commits into from
Apr 26, 2021

Conversation

svrakitin
Copy link
Contributor

@svrakitin svrakitin commented Apr 16, 2021

Related issue

Closes #1962

Proposed changes

  • Allow different TLS configuration for public and admin interfaces.
  • Keep existing TLS configuration as a fallback if configuration specific to interface is not provided
  • Remove duplication in config by parameterizing accessors with ServeInterface interface param. This is some kind of visitor pattern.
  • Update and add some tests
  • Update config spec

New config keys:

  • serve.public.tls.allow_termination_from
  • serve.public.tls.cert.*
  • serve.admin.tls.enabled
  • serve.admin.tls.allow_termination_from
  • serve.admin.tls.cert.*

Flag --dangerous-force-http disables TLS for both interfaces to keep compatibility.

Checklist

  • I have read the contributing guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security. vulnerability, I
    confirm that I got green light (please contact
    security@ory.sh) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Comments

Probably it is possible to remove duplication even further, but it would increase the size of this PR and it is already rather huge. It should be easier to refactor further by removing dependency on specific interface (admin or public) down the stack.

@aeneasr
Copy link
Member

aeneasr commented Apr 18, 2021

Wow thank you! I will have to give this a good look which I will be able to do this week :)

@aeneasr aeneasr self-requested a review April 18, 2021 07:38
@aeneasr aeneasr self-assigned this Apr 18, 2021
@aeneasr
Copy link
Member

aeneasr commented Apr 23, 2021

Sorry for taking some time on this - it would be great if you could reduce the PR to changes which affect HTTPS only as it will make it easier for me to understand what you did :)

@svrakitin
Copy link
Contributor Author

Sure, no probs.

@svrakitin svrakitin force-pushed the split-public-admin-tls-config branch from d0dbc5a to e47c479 Compare April 23, 2021 09:28
@svrakitin
Copy link
Contributor Author

Updated PR to include only changes related to split.

@svrakitin svrakitin requested a review from aeneasr April 23, 2021 09:29
Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

Thank you, this looks really good - nice job! Just one question, I don't fully understand what tls.strict is for? Is it because you wanted to add the ability in this PR to use TLS for public but not for admin, and needed a place to define this? If so, maybe we need to make --dangerous-force-http only error if there is no TLS set for public, but not so for admin?

driver/config/tls.go Outdated Show resolved Hide resolved
@svrakitin
Copy link
Contributor Author

Yeah, this is just to be able to turn off strict TLS for admin and force TLS only for public. This flag makes the setup more obvious and straightforward for an operator than termination allow-list.

--dangerous-force-http now makes TLS non-strict for both public and admin to keep backward compatible behavior. Effectively this PR deprecates this flag in favor of "*tls.strict" parameters, which can be sourced from the config or env vars.

I updated defaults in config spec to have strict TLS only for public. Let me know if admin should force TLS by default as well.

Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

Just two more minor things then this is good to go!

driver/config/tls.go Outdated Show resolved Hide resolved
driver/config/tls.go Outdated Show resolved Hide resolved
driver/config/tls.go Outdated Show resolved Hide resolved
spec/config.json Outdated Show resolved Hide resolved
@aeneasr
Copy link
Member

aeneasr commented Apr 26, 2021

Note to self: check all the quickstarts and articles to see if this works with this change

@svrakitin svrakitin requested a review from aeneasr April 26, 2021 10:40
@svrakitin
Copy link
Contributor Author

@aeneasr Done, kept tls.enabled just for admin and resolved some conflicts.

Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

Great job man, thank you!

@aeneasr aeneasr merged commit 60704d4 into ory:master Apr 26, 2021
@aeneasr
Copy link
Member

aeneasr commented May 4, 2021

@svrakitin completely forgot that we should add some docs 🤦‍♂️ Could you maybe add a bit of guidance on how to use your new features here: https://www.ory.sh/hydra/docs/production

Would highly appreciate it! :)

@svrakitin
Copy link
Contributor Author

@aeneasr Sure, I will dedicate some time tomorrow for this.

@aeneasr
Copy link
Member

aeneasr commented May 4, 2021

Thank you!!!

mitar pushed a commit to mitar/hydra that referenced this pull request May 13, 2021
Adds the possibility to specify TLS certificates for admin and public endpoints individually. Also improves compatibility for internal networks (e.g. Kubernetes) by removing the need for having TLS termination on admin endpoints. This can be enabled by setting `serve.admin.tls.enabled` to false.


Closes ory#1231
Closes ory#1962
duncan-brown added a commit to np3m/ce-it-infrastructure that referenced this pull request Oct 18, 2021
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.

Split HTTPS handling for public/admin
2 participants