open-nomad/testutil
Michael Schurter c82b14b0c4 core: add limits to unauthorized connections
Introduce limits to prevent unauthorized users from exhausting all
ephemeral ports on agents:

 * `{https,rpc}_handshake_timeout`
 * `{http,rpc}_max_conns_per_client`

The handshake timeout closes connections that have not completed the TLS
handshake by the deadline (5s by default). For RPC connections this
timeout also separately applies to first byte being read so RPC
connections with TLS enabled have `rpc_handshake_time * 2` as their
deadline.

The connection limit per client prevents a single remote TCP peer from
exhausting all ephemeral ports. The default is 100, but can be lowered
to a minimum of 26. Since streaming RPC connections create a new TCP
connection (until MultiplexV2 is used), 20 connections are reserved for
Raft and non-streaming RPCs to prevent connection exhaustion due to
streaming RPCs.

All limits are configurable and may be disabled by setting them to `0`.

This also includes a fix that closes connections that attempt to create
TLS RPC connections recursively. While only users with valid mTLS
certificates could perform such an operation, it was added as a
safeguard to prevent programming errors before they could cause resource
exhaustion.
2020-01-30 10:38:25 -08:00
..
net.go core: add limits to unauthorized connections 2020-01-30 10:38:25 -08:00
responsewriter.go tests: fix races caused by sharing a buffer 2018-10-16 16:56:55 -07:00
server.go tests: swap lib/freeport for tweaked helper/freeport 2019-12-09 08:37:32 -06:00
slow.go Skip QEMU graceful shutdown test except on Travis 2018-01-31 15:47:26 -08:00
vault.go tests: swap lib/freeport for tweaked helper/freeport 2019-12-09 08:37:32 -06:00
wait.go acl: check ACL against object namespace 2019-10-08 12:59:22 -04:00
wait_test.go nomad: testing remove peer 2015-06-04 13:02:39 +02:00