From ed6f0663c217f04b2c07344e49cbb8d70504346b Mon Sep 17 00:00:00 2001 From: Will Browne Date: Mon, 24 Aug 2020 16:48:55 +0200 Subject: [PATCH] Alerting: Store sensitive settings encrypted for Sensu notifier (#27131) * encrypt password * update docs --- docs/sources/administration/provisioning.md | 14 +++--- pkg/services/alerting/notifiers/sensu.go | 56 +++++++++++++-------- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/docs/sources/administration/provisioning.md b/docs/sources/administration/provisioning.md index d35b91297fb..560d68554e3 100644 --- a/docs/sources/administration/provisioning.md +++ b/docs/sources/administration/provisioning.md @@ -466,13 +466,13 @@ The following sections detail the supported settings and secure settings for eac #### Alert notification `sensu` -| Name | -| -------- | -| url | -| source | -| handler | -| username | -| password | +| Name | Secure setting | +| -------- | - | +| url | | +| source | | +| handler | | +| username | | +| password | yes | #### Alert notification `prometheus-alertmanager` diff --git a/pkg/services/alerting/notifiers/sensu.go b/pkg/services/alerting/notifiers/sensu.go index b4c9d83a2d2..6397d15581e 100644 --- a/pkg/services/alerting/notifiers/sensu.go +++ b/pkg/services/alerting/notifiers/sensu.go @@ -19,27 +19,39 @@ func init() { Heading: "Sensu settings", Factory: NewSensuNotifier, OptionsTemplate: ` -

Sensu settings

-
- Url - -
-
- Source - -
-
- Handler - -
-
- Username - -
-
- Password - -
+

Sensu settings

+
+ Url + +
+
+ Source + +
+
+ Handler + +
+
+ Username + +
+
+ +
+ + +
+
+ + reset +
+
`, Options: []alerting.NotifierOption{ { @@ -92,7 +104,7 @@ func NewSensuNotifier(model *models.AlertNotification) (alerting.Notifier, error URL: url, User: model.Settings.Get("username").MustString(), Source: model.Settings.Get("source").MustString(), - Password: model.Settings.Get("password").MustString(), + Password: model.DecryptedValue("password", model.Settings.Get("password").MustString()), Handler: model.Settings.Get("handler").MustString(), log: log.New("alerting.notifier.sensu"), }, nil