hashicorp / nomad

Nomad is an easy-to-use, flexible, and performant workload orchestrator that can deploy a mix of microservice, batch, containerized, and non-containerized applications. Nomad is easy to operate and scale and has native Consul and Vault integrations.
https://www.nomadproject.io/
Other
14.89k stars 1.95k forks source link

Support for Basic Auth #24313

Open EtienneBruines opened 3 days ago

EtienneBruines commented 3 days ago

Proposal

Support passing the X-Nomad-Token via HTTP Basic Auth to use the Nomad API, by ignoring the username section and parsing the password section as if it were a token.

Use-cases

Not all external systems allow specifying Bearer auth or allow specifying custom HTTP request headers. Basic Auth might be the only way for those systems to specify authentication.

Attempted Solutions

gulducat commented 1 day ago

Heya, thanks for the report!

This is an interesting suggestion, but has at least one potential gotcha I can think of that could break current clusters. Our Go api package supports sending basic auth (old PR #1431), not because Nomad can handle it, but because proxies in front of Nomad can. The risk of Nomad attempting to parse it, too, could result in rejected requests for any proxies that don't strip or mutate the basic auth header before forwarding to Nomad.

I'm curious if you might elaborate on any specific systems that are restricted in this way? We may end up erring on the side of proxy->Nomad safety and keep the concerns separate, especially since you do have a proxy transform at hand.

EtienneBruines commented 1 day ago

We are currently using HaloPSA, which has limited authentication options:

Screenshot_20241030_181513

I understand and appreciate your concerns! Feel free to open or close this issue as-needed, this background info might be useful to some.