elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.48k stars 8.04k forks source link

[Synthetics] ssl.certificate_authorities accepts only string not array #183300

Open devcorpio opened 1 month ago

devcorpio commented 1 month ago

Context

Kibana API returns an error when pushing (with the Synthetics agent) an HTTP monitor with the ssl.certificate_authorities set as an array.

Error: Invalid value "["/etc/ca.crt"]" supplied to "ssl.certificate_authorities"

Problem

The documentation states that ssl.certificate_authoritiesalso accepts array values. Despite so, at the moment it only accepts string. This is contrary to the documented example which shows an array as a valid option and also contrary to the HB documentation which states the following:

"By default, you can specify a list of files that heartbeat will read, but you can also embed a certificate directly in the YAML configuration:"

heartbeat.yaml:

heartbeat.monitors:
- type: http
  name: Todos Lightweight
  id: todos-lightweight
  enabled: true
  urls: "https://elastic.github.io/synthetics-demo/"
  schedule: '@every 3m'
  timeout: 16s
  ssl:
    certificate_authorities: ['/etc/ca.crt']

Kibana endpoint:

https://YOUR_KIBANA_URL/s/default/api/synthetics/project/THE_NAME_OF_YOUR_PROJECT_MONITOR/monitors/_bulk_update

CURL example

curl -X PUT -H "Authorization: ApiKey YOUR_SYNTHETICS_API_KEY_HERE" -H "kbn-xsrf:true" -H "x-elastic-internal-origin:elastic-synthetics" -H "user-agent: Elastic/Synthetics 1.9.1"  -H "Content-Type: application/json" -d '{"monitors":[{"enabled":true,"locations":["australia-southeast1-a"],"tags":[""],"type":"http","name":"Todos Lightweight","id":"todos-lightweight","urls":"https://elastic.github.io/synthetics-demo/","schedule":3,"timeout":"16s","ssl":{"certificate_authorities":["/etc/ca.crt"]},"privateLocations":[],"params":{"url":"https://elastic.github.io/synthetics-demo/"},"hash":"h+mK8sg7CnBNbNJXRFjRo54rE85eu7jOlt4MmT6SnQY="}]}' "https://YOUR_KIBANA_URL/s/default/api/synthetics/project/THE_NAME_OF_YOUR_PROJECT_MONITOR/monitors/_bulk_update"

You will see below the associated SDH

elasticmachine commented 1 month ago

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)