Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
daaa3e57
Unverified
Commit
daaa3e57
authored
Aug 24, 2020
by
Will Browne
Committed by
GitHub
Aug 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Alerting: Store sensitive settings encrypted for Threema notifier (#27160)
* encrypt API secret * update docs
parent
30d6405c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
22 deletions
+28
-22
docs/sources/administration/provisioning.md
+5
-5
pkg/services/alerting/notifiers/threema.go
+23
-17
No files found.
docs/sources/administration/provisioning.md
View file @
daaa3e57
...
@@ -528,11 +528,11 @@ The following sections detail the supported settings and secure settings for eac
...
@@ -528,11 +528,11 @@ The following sections detail the supported settings and secure settings for eac
#### Alert notification `threema`
#### Alert notification `threema`
| Name |
| Name |
Secure setting |
| ------------ |
| ------------ |
- |
| gateway_id |
| gateway_id |
|
| recipient_id |
| recipient_id |
|
| api_secret |
| api_secret |
yes |
#### Alert notification `webhook`
#### Alert notification `webhook`
...
...
pkg/services/alerting/notifiers/threema.go
View file @
daaa3e57
...
@@ -34,37 +34,43 @@ func init() {
...
@@ -34,37 +34,43 @@ func init() {
The Threema Gateway ID can be set up at
The Threema Gateway ID can be set up at
<a href="https://gateway.threema.ch/" target="_blank" rel="noopener noreferrer">https://gateway.threema.ch/</a>.
<a href="https://gateway.threema.ch/" target="_blank" rel="noopener noreferrer">https://gateway.threema.ch/</a>.
</p>
</p>
<div class="gf-form
">
<div class="gf-form max-width-30
">
<span class="gf-form-label width-14
">Gateway ID</span>
<span class="gf-form-label width-8
">Gateway ID</span>
<input type="text" required maxlength="8" pattern="\*[0-9A-Z]{7}"
<input type="text" required maxlength="8" pattern="\*[0-9A-Z]{7}"
class="gf-form-input max-width-14
"
class="gf-form-input max-width-30
"
ng-model="ctrl.model.settings.gateway_id"
ng-model="ctrl.model.settings.gateway_id"
placeholder="*3MAGWID">
placeholder="*3MAGWID">
</input>
</input>
<info-popover mode="right-normal
">
<info-popover mode="right-absolute
">
Your 8 character Threema Gateway ID (starting with a *)
Your 8 character Threema Gateway ID (starting with a *)
</info-popover>
</info-popover>
</div>
</div>
<div class="gf-form
">
<div class="gf-form max-width-30
">
<span class="gf-form-label width-14
">Recipient ID</span>
<span class="gf-form-label width-8
">Recipient ID</span>
<input type="text" required maxlength="8" pattern="[0-9A-Z]{8}"
<input type="text" required maxlength="8" pattern="[0-9A-Z]{8}"
class="gf-form-input max-width-14
"
class="gf-form-input max-width-30
"
ng-model="ctrl.model.settings.recipient_id"
ng-model="ctrl.model.settings.recipient_id"
placeholder="YOUR3MID">
placeholder="YOUR3MID">
</input>
</input>
<info-popover mode="right-normal
">
<info-popover mode="right-absolute
">
The 8 character Threema ID that should receive the alerts
The 8 character Threema ID that should receive the alerts
</info-popover>
</info-popover>
</div>
</div>
<div class="gf-form">
<div class="gf-form max-width-30">
<span class="gf-form-label width-14">API Secret</span>
<label class="gf-form-label width-8">API Secret</label>
<input type="text" required
<div class="gf-form gf-form--grow" ng-if="!ctrl.model.secureFields.api_secret">
class="gf-form-input max-width-24"
<input type="text"
ng-model="ctrl.model.settings.api_secret">
required
class="gf-form-input max-width-30"
ng-init="ctrl.model.secureSettings.api_secret = ctrl.model.settings.api_secret || null; ctrl.model.settings.api_secret = null;"
ng-model="ctrl.model.secureSettings.api_secret"
data-placement="right">
</input>
</input>
<info-popover mode="right-normal">
</div>
Your Threema Gateway API secret
<div class="gf-form" ng-if="ctrl.model.secureFields.api_secret">
</info-popover>
<input type="text" class="gf-form-input max-width-18" disabled="disabled" value="configured" />
<a class="btn btn-secondary gf-form-btn" href="#" ng-click="ctrl.model.secureFields.api_secret = false">reset</a>
</div>
</div>
</div>
`
,
`
,
Options
:
[]
alerting
.
NotifierOption
{
Options
:
[]
alerting
.
NotifierOption
{
...
@@ -118,7 +124,7 @@ func NewThreemaNotifier(model *models.AlertNotification) (alerting.Notifier, err
...
@@ -118,7 +124,7 @@ func NewThreemaNotifier(model *models.AlertNotification) (alerting.Notifier, err
gatewayID
:=
model
.
Settings
.
Get
(
"gateway_id"
)
.
MustString
()
gatewayID
:=
model
.
Settings
.
Get
(
"gateway_id"
)
.
MustString
()
recipientID
:=
model
.
Settings
.
Get
(
"recipient_id"
)
.
MustString
()
recipientID
:=
model
.
Settings
.
Get
(
"recipient_id"
)
.
MustString
()
apiSecret
:=
model
.
Settings
.
Get
(
"api_secret"
)
.
MustString
(
)
apiSecret
:=
model
.
DecryptedValue
(
"api_secret"
,
model
.
Settings
.
Get
(
"api_secret"
)
.
MustString
()
)
// Validation
// Validation
if
gatewayID
==
""
{
if
gatewayID
==
""
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment