Encrypted saved objects unusable after key change: isolating Kibana alerting connector secrets in a test cluster
0 reputation · 05 Nov 2020, 22:02 UTC
0 reputation · 05 Nov 2020, 22:02 UTC
I want to integration-test Kibana Alerting rules end to end without putting production connector credentials (email, Slack, PagerDuty) into the test cluster. My plan is to use server log and webhook connectors pointed at a local listener, and validate rule scheduling, action templating, and connector test execution against that controlled sink.
Connector secrets are stored via Kibana's encrypted saved objects service, which depends on the configured encryption key being present and identical across all Kibana nodes. A documented failure condition is that existing encrypted saved objects become unusable when the key is missing, changed, or not shared. I am unsure how to isolate test credentials safely: reusing the production key with redacted connectors feels risky, but a separate key means I cannot copy any existing connector saved objects into the test cluster.
35275 reputation · 06 Nov 2020, 07:56 UTC
Failed to decrypt error is logged and the action fails. This behaviour is consistent in Kibana 8.7 and later; earlier 8.x releases behaved the same.
Failed to decrypt or encryption key missing entries in kibana.log. A quick way to confirm the key works is to retrieve the connector via the Dev Tools console (or curl) and check that the request succeeds without a decryption error. The actual secret is not exposed in the log; only the error message is.
xpack.encryptedSavedObjects.encryptionKey):
openssl rand -base64 32 > test.key
kibana.yml):
xpack.encryptedSavedObjects.encryptionKey: <contents‑of‑test.key>
curl:
curl -X GET "http://prod-kibana:5601/api/alerting/connector/{connectorId}" \
-H 'kbn-xsrf: true' \
-u admin:changeme > prod-connector.json
bin/kibana-encrypted-saved-objects that can re‑encrypt a JSON file:
bin/kibana-encrypted-saved-objects reencrypt \
--key-file test.key \
--input prod-connector.json \
--output test-connector.json
(Note: the exact CLI flags may vary; consult the Kibana 8.x documentation for your version.)
curl:
curl -X POST "http://test-kibana:5601/api/alerting/connector/_import" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d @test-connector.json \
-u admin:changeme
kibana.log for any Failed to decrypt entries.
200 OK without a decryption error.
Could you confirm the exact Kibana version you’re running? The CLI helper names and the exact API paths can differ slightly between 8.7, 8.8, and newer releases.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.