hashicorp / hashicorp/consul

Consul expects the JWKS URL to be immediately available when adding an ACL auth method

Open
#22,283 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

#### Overview of the Issue

Proposal: Make JWKS URL availability optional during auth method creation
---

#### Reproduction Steps

Right now, if the JWKS endpoint isn't available when creating an ACL JWT auth method, Consul returns a 500. While immediate feedback is useful, I don't think a temporary network issue or an unavailable service should prevent the auth method from being added.

```
Error: status=500 [PUT] https://localhost:8500/v1/acl/auth-method ->

Invalid Auth Method: error checking JWKSURL: fetching keys oidc: get keys failed Get "http://127.0.0.1:4646/.well-known/jwks.json": dial tcp 127.0.0.1:4646: connect: connection refused
```

In my view, Consul should accept the input and only raise errors when the auth method is actually used (e.g., when a JWT is received and needs parsing). It should be totally valid to accept a JWKS URL that’s not yet reachable—as long as the format is correct. A basic URL validation should be enough at input time.

If users really want to verify that the JWKS URL is accessible, maybe we could support an optional flag to enable that behavior. Alternatively, the current behavior could remain default, but with a flag to skip the availability check.

This would be especially helpful when bootstrapping Nomad + Consul clusters. Typically, Consul comes online before Nomad, meaning the Nomad JWKS URL won’t be reachable yet. Since Consul is often used for Nomad auto-join via service discovery, it’s pretty important to avoid this chicken-and-egg scenario.

With Nomad now enforcing Workload Identities in 1.10.x, this feels like a good time to revisit and optimize this behaviour.

### Consul info for both Client and Server

tested using consul version `1.20.5` (server) and the client being just an http request configured by reading the [API docs for /acl/auth-method](https://developer.hashicorp.com/consul/api-docs/acl/auth-methods#create-an-auth-method)

### Log Fragments

```
{"@level":"error","@message":"Request error","@module":"agent.http","@timestamp":"2025-04-19T11:58:11.617613-04:00","error":"Invalid Auth Method: error checking JWKSURL: fetching keys oidc: get keys failed Get \"http://127.0.0.1:4646/.well-known/jwks.json\": dial tcp 127.0.0.1:4646: connect: connection refused","from":"[::1]:38764","method":"PUT","url":"/v1/acl/auth-method"}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.