diff --git a/x-pack/elastic-agent/CHANGELOG.next.asciidoc b/x-pack/elastic-agent/CHANGELOG.next.asciidoc index 476f6aaf3aa9..956a0fd1d560 100644 --- a/x-pack/elastic-agent/CHANGELOG.next.asciidoc +++ b/x-pack/elastic-agent/CHANGELOG.next.asciidoc @@ -46,6 +46,7 @@ - Verify communication to Kibana before updating Fleet client. {pull}24489[24489] - Fix nil pointer when null is generated as list item. {issue}23734[23734] - Add support for filestream input. {pull}24820[24820] +- Add check for URL set when cert and cert key. {pull}24904[24904] ==== New features diff --git a/x-pack/elastic-agent/pkg/agent/cmd/enroll_cmd.go b/x-pack/elastic-agent/pkg/agent/cmd/enroll_cmd.go index 84f801a515bf..aa81392a6285 100644 --- a/x-pack/elastic-agent/pkg/agent/cmd/enroll_cmd.go +++ b/x-pack/elastic-agent/pkg/agent/cmd/enroll_cmd.go @@ -294,6 +294,10 @@ func (c *enrollCmd) prepareFleetTLS() error { c.options.URL = fmt.Sprintf("https://%s:%d", hostname, port) c.options.CAs = []string{string(ca.Crt())} } + // running with custom Cert and CertKey; URL is required to be set + if c.options.URL == "" { + return errors.New("url is required when a certificate is provided") + } return nil }