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

Heimdall rejects valid CA-issued certificate configured for JWT finalizer #1899

Closed
3 tasks done
dadrus opened this issue Oct 16, 2024 · 0 comments
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@dadrus
Copy link
Owner

dadrus commented Oct 16, 2024

Preflight checklist

  • I agree to follow this project's Code of Conduct.
  • I have read and am following this repository's Contribution Guidelines."
  • I could not find a solution in the existing issues, docs, nor discussions.

Describe the bug

When configuring a JWT finalizer in heimdall, it requires the key material in a PEM file for creating signatures. If the PEM file contains a certificate issued by a CA, along with a certificate chain of more than two certificates (e.g., the signing certificate, the CA certificate, and a Root CA certificate), heimdall fails to load the PEM file and returns a certificate validation error.

How can the bug be reproduced

  1. Create a PEM file with a key and a longer certificate chain (e.g. by setting up a PKI using OpenSSL)
  2. Create a configuration file for heimdall with a mechanism catalogue consisting of an anonymous authenticator and a jwt finalizer.
  3. Create a default rule, which makes use of both mechanisms from above
  4. Start heimdall with that config file

Relevant log output

2024-10-16T11:32:13+02:00 ERR Failed loading finalizer definitions error="configuration error: configured certificate cannot be used for JWT signing purposes: certificate validation error: for certificate with DN='CN=Test EE 1,O=Test,C=EU' and SN=1: x509: certificate signed by unknown authority"

Relevant configuration

mechanisms:
  authenticators:
    - id: anonymous
      type: anonymous
    - id: deny
      type: unauthorized
  finalizers:
    - id: jwt
      type: jwt
      config:
        signer:
          key_store:
            path: keys.pem

default_rule:
  execute:
    - authenticator: anonymous
    - finalizer: jwt

Version

0.15.0

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

None

Additional Context

There is a workaround available: If the root CA certificate is added to heimdall's trust store, the certificate is accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant