diff --git a/agent/config/builder.go b/agent/config/builder.go index d072429e1d..af59e9b5b4 100644 --- a/agent/config/builder.go +++ b/agent/config/builder.go @@ -455,6 +455,14 @@ func (b *builder) build() (rt RuntimeConfig, err error) { sidecarMaxPort := b.portVal("ports.sidecar_max_port", c.Ports.SidecarMaxPort) exposeMinPort := b.portVal("ports.expose_min_port", c.Ports.ExposeMinPort) exposeMaxPort := b.portVal("ports.expose_max_port", c.Ports.ExposeMaxPort) + if serverPort <= 0 { + return RuntimeConfig{}, fmt.Errorf( + "server-port must be greater than zero") + } + if serfPortLAN <= 0 { + return RuntimeConfig{}, fmt.Errorf( + "serf-lan-port must be greater than zero") + } if proxyMaxPort < proxyMinPort { return RuntimeConfig{}, fmt.Errorf( "proxy_min_port must be less than proxy_max_port. To disable, set both to zero.")