Can not create JWT auth method with TLS enabled on Nomad
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 39
Description
#### Feature Description
Hello,
I have a small cluster running, setup with TLS. In order to use the Workload Identities in Nomad and do proper ACL things I need to setup this JWT Auth Method between consul and nomad. I use self-signed certificates.
When I supply this configuration:
```json
{
"JWKSUrl": "https://10.0.1.3:4646/.well-known/jwks.json",
"JWKSCACert": "REDACTED",
"JWTSupportedAlgs": ["RS256"],
"BoundAudiences": ["consul.io"],
"ClaimMappings": {
"nomad_namespace": "nomad_namespace",
"nomad_job_id": "nomad_job_id",
"nomad_task": "nomad_task",
"nomad_service": "nomad_service"
}
}
```
I get this error:
`Failed to create new auth method: Unexpected response code: 500 (Invalid Auth Method: error checking JWKSURL: fetching keys oidc: get keys failed Get "https://10.0.1.3:4646/.well-known/jwks.json": remote error: tls: certificate required)`
I searched and tried a lot, and there seems to not be a way to supply a client certificate and key to this auth method to make it able to access the needed JWKS.
My suggestion:
Add 2 more fields to supply a client certificate and a client key, or even a .p12 file.
(I am not entirely sure if we would need the key here as well though)
```json
...
"JWKSClientCert": "...",
"JWKSClientKey": "...",
...
```
Or maybe its just not at all documented since I don't see people having issues with this apparently. One workaround of course is to proxy it but that shouldn't be necessary...
#### Use Case(s)
Its basically impossible to run Jobs with proper security measures. Consul ACLs cant be used with services running on nomad in a connect service mesh when Consul ACLs are setup without a general key in the Agent and with a default deny rule.
Contributor guide
Research direction
Start by tracing the JWT auth method's JWKS URL fetch and the configuration represented by JWKSUrl and JWKSCACert. Check existing tests around JWT auth methods and TLS, then define coverage for fetching JWKS from a server requiring a client certificate. Done means a self-signed, mTLS-protected Nomad JWKS endpoint can be used to create the auth method with the new client-certificate settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- authentication, security
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100