Skip to content

Commit

Permalink
Merge pull request #84 from input-output-hk/cad-3436-prom-apikey
Browse files Browse the repository at this point in the history
monitoring-services: add prometheus.basicAuthFile option
  • Loading branch information
jbgi committed Oct 28, 2021
2 parents d382802 + ad8308d commit a7fd862
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions modules/monitoring-services.nix
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,15 @@ in {
"extra receivers added to services.prometheus.alertmanager.configuration.receivers";
};

prometheus.basicAuthFile = mkOption {
type = types.nullOr types.path;
default = null;
description = ''
Basic Auth password file for prometheus, for use in addition to oauth2_proxy.
Syntax is name + ':' + <command>openssl passwd -6</command>
'';
};


prometheus.storageRetentionTime = mkOption {
type = types.str;
Expand Down Expand Up @@ -409,6 +418,11 @@ in {
'';
"/prometheus/".extraConfig = ''
${nginxOAuthConfig}
${optionalString (cfg.prometheus.basicAuthFile != null) ''
satisfy any;
auth_basic "prometheus";
auth_basic_user_file "${cfg.prometheus.basicAuthFile}";
''}
proxy_pass http://localhost:9090/prometheus/;
proxy_set_header Host $host;
proxy_set_header REMOTE_ADDR $remote_addr;
Expand Down
1 change: 1 addition & 0 deletions roles/monitor.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ in {
grafanaCreds
graylogCreds
pagerDuty;
prometheus = static.prometheus or {};
};

services.oauth2_proxy.enable = lib.mkDefault true;
Expand Down

0 comments on commit a7fd862

Please sign in to comment.