Skip to content

Commit

Permalink
[Elastic Agent] Add check for URL set when cert and cert key. (elasti…
Browse files Browse the repository at this point in the history
…c#24904)

* Add check for URL set when cert and cert key.

* Add changelog.
  • Loading branch information
blakerouse authored Apr 5, 2021
1 parent 623e4ab commit 5e5e407
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions x-pack/elastic-agent/CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions x-pack/elastic-agent/pkg/agent/cmd/enroll_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,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
}

Expand Down

0 comments on commit 5e5e407

Please sign in to comment.