8000 TLS re-encrypt vs passthrough incl. security pros/cons and best practices · Issue #48002 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

TLS re-encrypt vs passthrough incl. security pros/cons and best practices #48002

Description

@ahus1
  • This could be a new section in the guide.
  • When to use reencrypt vs passthrough.
  • Security best practice: If you are using re-encrypt, block all other traffic to Keycloak. Double-check if this is already in the docs.
    • There is a note "To ensure that proxy headers are used only from proxies you trust, set the proxy-trusted-addresses" but it doesn't reveal much about the why.
    • There is also something in the "Enabling client certificate lookup" section pointing at this, and which is more details. Maybe that part should be moved to a common section.
  • URL filtering is only possible with re-encrypt
  • Several of the sections are either for re-encrypt (everything about headers), while others are only for passthrough setups (the PROXY protocol), maybe they can be grouped.

Activity

  1. changed the title [-](create issue) TLS re-encrypt vs passthrough incl. security pros/cons and best practices. Mostly around "if you are using re-encrypt, block all other traffic to Keycloak". Double-check if this is already in the docs. Could be a new section of the reverse proxy guide.[/-] [+]TLS re-encrypt vs passthrough incl. security pros/cons and best practices[/+] on Apr 13, 2026
  2. added theissue type on Apr 13, 2026
  3. ahus1 commented on Apr 13, 2026

    @ahus1
    MemberAuthor

    @pruivo - I've extended this, please review. Thanks!

  4. pruivo commented on Apr 13, 2026

    @pruivo
    Member

    @ahus1 I think it is missing the most important question: when to use reencrypt vs passthrough.

  5. shawkins commented on Apr 13, 2026

    @shawkins
    Contributor

    If you are using re-encrypt, block all other traffic to Keycloak. Double-check if this is already in the docs.

    Relates to #35858 - in particular the user there wants to have both front-end and back-end traffic use mtls.

    Also relates to #47453 - we don't do a good job currently of distinguishing proxy from non-proxy traffic.

    @ahus1 I think it is missing the most important question: when to use reencrypt vs passthrough.

    Our biggest issue with passthrough is with certificate management. We don't expose how to configure multiple certs / sni, so everything needs to use the same server certificate. When you want more than one hostname, then you have to use reencrypt or edge termination. Or organizationally certificate management of user facing certs may be required to be done at the proxy level.

  6. self-assigned this
    on Apr 13, 2026
  7. ahus1 commented on Apr 13, 2026

    @ahus1
    MemberAuthor

    I think it is missing the most important question: when to use reencrypt vs passthrough.

    Thanks, updated.

  8. ahus1 commented on Apr 13, 2026

    @ahus1
    MemberAuthor

    @shawkins - this might be more focused on what we support and what is secure. For example, we might might restrict it to "if you using a proxy you must not use backchannels"

    While this sounds very restrictive, it is IMHO the secure and therefore the right way:

    • If you use passthrough, you want to use the PROXY protocol to forward the original client's IP address. Once you use the PROXY protocol, you won't be able to accept HTTP traffic
    • If you use reencrypt, you trust the headers that the proxy sends you. Once you do that, you do not want to accept traffic from anyone else. Especially if you then set up mTLS between the proxy and Keycloak.

    As you pointed out some people might want it, but we're missing some functionality to enable that. While this adds complexity, it might also be more secure to go with a simpler setup.

    Let's start simple and secure.

  9. shawkins commented on Apr 13, 2026

    @shawkins
    Contributor

    Let's start simple and secure.

    I certainly understand that the perspective here is from documenting what we currently support. I just wanted to link to existing / related issues as your work could also influence the direction things take.

    If you use passthrough, you want to use the PROXY protocol to forward the original client's IP address. Once you use the PROXY protocol, you won't be able to accept HTTP traffic

    That is the currenct situation, but may change due to quarkusio/quarkus#46345 (but I'll probably have to submit the fix for that one) or #47453

  10. ahus1 commented on Apr 13, 2026

    @ahus1
    MemberAuthor

    @pruivo - given issue quarkusio/quarkus#46345, this means that the PROXY protocol can't be used when you want to be able to use any readiness endpoint.

    So either

    • One skips the PROXY protocol and have the readiness endpoint that talks HTTP, and then you don't see the client IP addresses on the Keycloak side.
    • One skips the readiness endpoint, and then use the PROXY protocol. Or you would wrap the readiness endpoint with a minimal proxy that translates a HTTP request to a PROXY request?

    I would consider both setups broken, and wouldn't recommend any of them until quarkusio/quarkus#46345 is fixed.

    So this then leaves only the reencrypt setup?

  11. shawkins commented on Apr 13, 2026

    @shawkins
    Contributor

    any readiness endpoint

    To clarify you mean the readiness endpoint we're running on the main interface (lb-check), not the readiness on the management interface?

  12. added a commit that references this issue on Apr 14, 2026
    8e4cc4d
  13. added a commit that references this issue on Apr 17, 2026
    69ed451
  14. added a commit that references this issue on Jul 20, 2026
    3fdee36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Fields

No fields configured for task.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

0