diff --git a/internal/cli/server.go b/internal/cli/server.go index adc9c7d..3391417 100644 --- a/internal/cli/server.go +++ b/internal/cli/server.go @@ -792,7 +792,8 @@ func agentListenAddr(cfg config.Server) (string, error) { if cfg.AgentTLS.Enabled() { return cfg.AgentListen, nil } - if !cfg.AgentInsecure { + // agent_tls.insecure says the same, in the older place. + if !cfg.AgentInsecure && !cfg.AgentTLS.Insecure { return "", errAgentInsecure } if host, port, err := net.SplitHostPort(cfg.AgentListen); err == nil && host == "" { diff --git a/internal/cli/server_agent_test.go b/internal/cli/server_agent_test.go index 47e8fb6..9574fd0 100644 --- a/internal/cli/server_agent_test.go +++ b/internal/cli/server_agent_test.go @@ -22,6 +22,10 @@ func TestTheAgentPortOpensWithoutTLSOnlyWhenToldAndThenOnLoopback(t *testing.T) } cfg.AgentInsecure = false cfg.AgentListen = ":7443" + cfg.AgentTLS = tlsconf.Config{Insecure: true} + if a, err := agentListenAddr(cfg); err != nil || a != "127.0.0.1:7443" { + t.Errorf("agent_tls.insecure: %s %v", a, err) + } cfg.AgentTLS = tlsconf.Config{CA: "ca.pem", Cert: "s.pem", Key: "s-key.pem"} if a, err := agentListenAddr(cfg); err != nil || a != ":7443" { t.Errorf("with TLS: %s %v", a, err)