Refuse to open the agent port without TLS unless agent_insecure says so

Without agent_tls the control plane served plaintext h2c on every
interface, and any machine reaching it could register as any node. The
server now refuses to start that way unless agent_insecure: true, and then
binds loopback when agent_listen names only a port.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-04 09:51:37 +02:00
1 parent 0bd5305e9a
commit c522e8b2aa
7 files changed
+97 -4

No files matched your search

+9
View File
@@ -65,6 +65,14 @@ type Server struct {
// cover the client-facing one: that surface is fronted by a publicly
// trusted certificate, while this one is mutual and private.
AgentTLS tlsconf.Config `koanf:"agent_tls"`
// AgentInsecure lets a control plane run its agent port without
// agent_tls: plaintext, and any machine that reaches it may register as
// any node — be given replicas, and so be sent users' prompts — or, in
// the other direction, a machine in the path may tell every agent what
// to run. Refused unless said here, and then the port listens on
// loopback unless agent_listen names an address. For one machine, a
// test, or a network nothing untrusted reaches.
AgentInsecure bool `koanf:"agent_insecure"`
// Monitoring is where the dashboard reads its history from.
Monitoring Monitoring `koanf:"monitoring"`
@@ -592,6 +600,7 @@ func (s Server) Validate() error {
if err := s.AgentTLS.Validate(); err != nil {
return err
}
if s.Auth.Enabled && s.Auth.Store == "" {
return fmt.Errorf("auth.store is required when auth is enabled")
}