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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
48 deletions
+54
-48
docs/sources/administration/provisioning.md
+5
-5
pkg/services/alerting/notifiers/threema.go
+49
-43
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
#### Alert notification `threema`
| Name |
| ------------ |
| gateway_id |
| recipient_id |
| api_secret |
| Name |
Secure setting |
| ------------ |
- |
| gateway_id |
|
| recipient_id |
|
| api_secret |
yes |
#### Alert notification `webhook`
...
...
pkg/services/alerting/notifiers/threema.go
View file @
daaa3e57
...
...
@@ -25,48 +25,54 @@ func init() {
"The Threema Gateway ID can be set up at https://gateway.threema.ch/."
,
Factory
:
NewThreemaNotifier
,
OptionsTemplate
:
`
<h3 class="page-heading">Threema Gateway settings</h3>
<p>
Notifications can be configured for any Threema Gateway ID of type
"Basic". End-to-End IDs are not currently supported.
</p>
<p>
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>.
</p>
<div class="gf-form">
<span class="gf-form-label width-14">Gateway ID</span>
<input type="text" required maxlength="8" pattern="\*[0-9A-Z]{7}"
class="gf-form-input max-width-14"
ng-model="ctrl.model.settings.gateway_id"
placeholder="*3MAGWID">
</input>
<info-popover mode="right-normal">
Your 8 character Threema Gateway ID (starting with a *)
</info-popover>
</div>
<div class="gf-form">
<span class="gf-form-label width-14">Recipient ID</span>
<input type="text" required maxlength="8" pattern="[0-9A-Z]{8}"
class="gf-form-input max-width-14"
ng-model="ctrl.model.settings.recipient_id"
placeholder="YOUR3MID">
</input>
<info-popover mode="right-normal">
The 8 character Threema ID that should receive the alerts
</info-popover>
</div>
<div class="gf-form">
<span class="gf-form-label width-14">API Secret</span>
<input type="text" required
class="gf-form-input max-width-24"
ng-model="ctrl.model.settings.api_secret">
</input>
<info-popover mode="right-normal">
Your Threema Gateway API secret
</info-popover>
</div>
`
,
<h3 class="page-heading">Threema Gateway settings</h3>
<p>
Notifications can be configured for any Threema Gateway ID of type
"Basic". End-to-End IDs are not currently supported.
</p>
<p>
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>.
</p>
<div class="gf-form max-width-30">
<span class="gf-form-label width-8">Gateway ID</span>
<input type="text" required maxlength="8" pattern="\*[0-9A-Z]{7}"
class="gf-form-input max-width-30"
ng-model="ctrl.model.settings.gateway_id"
placeholder="*3MAGWID">
</input>
<info-popover mode="right-absolute">
Your 8 character Threema Gateway ID (starting with a *)
</info-popover>
</div>
<div class="gf-form max-width-30">
<span class="gf-form-label width-8">Recipient ID</span>
<input type="text" required maxlength="8" pattern="[0-9A-Z]{8}"
class="gf-form-input max-width-30"
ng-model="ctrl.model.settings.recipient_id"
placeholder="YOUR3MID">
</input>
<info-popover mode="right-absolute">
The 8 character Threema ID that should receive the alerts
</info-popover>
</div>
<div class="gf-form max-width-30">
<label class="gf-form-label width-8">API Secret</label>
<div class="gf-form gf-form--grow" ng-if="!ctrl.model.secureFields.api_secret">
<input type="text"
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>
</div>
<div class="gf-form" ng-if="ctrl.model.secureFields.api_secret">
<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>
`
,
Options
:
[]
alerting
.
NotifierOption
{
{
Label
:
"Gateway ID"
,
...
...
@@ -118,7 +124,7 @@ func NewThreemaNotifier(model *models.AlertNotification) (alerting.Notifier, err
gatewayID
:=
model
.
Settings
.
Get
(
"gateway_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
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