open-nomad/client/state
Tim Gross 11216d09af
client: send node secret with every client-to-server RPC (#16799)
In Nomad 1.5.3 we fixed a security bug that allowed bypass of ACL checks if the
request came thru a client node first. But this fix broke (knowingly) the
identification of many client-to-server RPCs. These will be now measured as if
they were anonymous. The reason for this is that many client-to-server RPCs do
not send the node secret and instead rely on the protection of mTLS.

This changeset ensures that the node secret is being sent with every
client-to-server RPC request. In a future version of Nomad we can add
enforcement on the server side, but this was left out of this changeset to
reduce risks to the safe upgrade path.

Sending the node secret as an auth token introduces a new problem during initial
introduction of a client. Clients send many RPCs concurrently with
`Node.Register`, but until the node is registered the node secret is unknown to
the server and will be rejected as invalid. This causes permission denied
errors.

To fix that, this changeset introduces a gate on having successfully made a
`Node.Register` RPC before any other RPCs can be sent (except for `Status.Ping`,
which we need earlier but which also ignores the error because that handler
doesn't do an authorization check). This ensures that we only send requests with
a node secret already known to the server. This also makes client startup a
little easier to reason about because we know `Node.Register` must succeed
first, and it should make for a good place to hook in future plans for secure
introduction of nodes. The tradeoff is that an existing client that has running
allocs will take slightly longer (a second or two) to transition to ready after
a restart, because the transition in `Node.UpdateStatus` is gated at the server
by first submitting `Node.UpdateAlloc` with client alloc updates.
2023-06-22 11:06:49 -04:00
..
testdata CSI: allow for concurrent plugin allocations (#12078) 2022-02-23 15:23:07 -05:00
08types.go [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
12types.go [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
db_bolt.go client: send node secret with every client-to-server RPC (#16799) 2023-06-22 11:06:49 -04:00
db_error.go client: send node secret with every client-to-server RPC (#16799) 2023-06-22 11:06:49 -04:00
db_mem.go client: send node secret with every client-to-server RPC (#16799) 2023-06-22 11:06:49 -04:00
db_noop.go client: send node secret with every client-to-server RPC (#16799) 2023-06-22 11:06:49 -04:00
db_test.go [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
interface.go client: send node secret with every client-to-server RPC (#16799) 2023-06-22 11:06:49 -04:00
upgrade.go Revert "hashicorp/go-msgpack v2 (#16810)" (#17047) 2023-05-01 17:18:34 -04:00
upgrade_int_test.go allocrunner: provide factory function so we can build mock ARs (#17161) 2023-05-12 13:29:44 -04:00
upgrade_test.go [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00