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
15k stars 1.96k forks source link

security: bind HTTP and HTTPS to different ports #2606

Open schmichael opened 7 years ago

schmichael commented 7 years ago

Use Case

There are use cases where having HTTP and HTTPS with http_verify_clients simultaneously available is useful, for example:

ELB Health Checks

via @weargoggles on https://github.com/hashicorp/nomad/pull/2587#issuecomment-298153009

ELB can run its health check with a different port and protocol to the one it uses as the backend. So:

I want to be able to do the same thing in Nomad; forward TCP connections (leaving TLS to Nomad) based on the health determined by a plain HTTP check.

I am using Consul to bootstrap and advertise. The configuration in the Consul health check you mention works perfectly for me, and it would work even if the 'skip verification' option was not set, because the certificates I'm using are valid. Perhaps that should be configurable; but I don't know that it can be controlled by verify_https_client because it's Consul being configured there.

Cons

The obvious con is that the HTTP port must be secured using external tooling and the network must be trusted for any use over HTTP.

Alternative: Allow subset of operations for unauthenticated clients

https_verify_clients could request but not require client certificates and allow a subset of operations (perhaps only a healthcheck endpoint) for requests without certificates.

While this is technically the best solution it introduces extra security checks throughout our API and may add complexity to eventual ACLs.

Implementation

TBD

weargoggles commented 7 years ago

I've tried running with the client verification config now in nomad master, but because I can't health-check nomad servers from a load balancer with it enabled, it's not viable right now.

I've worked around this by binding the Nomad HTTP listener to the loopback address, switching off TLS for HTTP, and offloading TLS verification to https://github.com/square/ghostunnel . Happy to write it up in more detail if anybody else needs it.

schmichael commented 7 years ago

@weargoggles Sorry you're blocked from using client verification. Two questions:

weargoggles commented 7 years ago