Skip to content

Commit

Permalink
monitoring-services: add prometheus.basicAuthFile option
Browse files Browse the repository at this point in the history
This allows http basic auth access to prometheus, in addition to oauth2.
  • Loading branch information
yorickvP committed Oct 26, 2021
1 parent d382802 commit 16bf7cc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions modules/monitoring-services.nix
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

0 comments on commit 16bf7cc

Please sign in to comment.