feat: add oidc from sops for grafana
This commit is contained in:
parent
f295f0fc48
commit
6af9101a13
2 changed files with 31 additions and 8 deletions
|
|
@ -1,5 +1,10 @@
|
||||||
{ pkgs, config, lib, namespace, ... }:
|
{
|
||||||
let
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
namespace,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
|
|
||||||
|
|
@ -7,8 +12,7 @@ let
|
||||||
|
|
||||||
db_user = "grafana";
|
db_user = "grafana";
|
||||||
db_name = "grafana";
|
db_name = "grafana";
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options.${namespace}.services.observability.grafana = {
|
options.${namespace}.services.observability.grafana = {
|
||||||
enable = mkEnableOption "enable Grafana";
|
enable = mkEnableOption "enable Grafana";
|
||||||
};
|
};
|
||||||
|
|
@ -35,8 +39,8 @@ in
|
||||||
"auth.generic_oauth" = {
|
"auth.generic_oauth" = {
|
||||||
enable = true;
|
enable = true;
|
||||||
name = "Zitadel";
|
name = "Zitadel";
|
||||||
client_id = "334170712283611395";
|
client_id = "$__file{${config.sops.secrets."grafana/oidc_id".path}}";
|
||||||
client_secret = "AFjypmURdladmQn1gz2Ke0Ta5LQXapnuKkALVZ43riCL4qWicgV2Z6RlwpoWBZg1";
|
client_secret = "$__file{${config.sops.secrets."grafana/oidc_secret".path}}";
|
||||||
scopes = "openid email profile offline_access urn:zitadel:iam:org:project:roles";
|
scopes = "openid email profile offline_access urn:zitadel:iam:org:project:roles";
|
||||||
email_attribute_path = "email";
|
email_attribute_path = "email";
|
||||||
login_attribute_path = "username";
|
login_attribute_path = "username";
|
||||||
|
|
@ -126,5 +130,18 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.etc."/grafana/dashboards/default.json".source = ./dashboards/default.json;
|
environment.etc."/grafana/dashboards/default.json".source = ./dashboards/default.json;
|
||||||
|
|
||||||
|
sops = {
|
||||||
|
secrets = {
|
||||||
|
"grafana/oidc_id" = {
|
||||||
|
owner = "grafana";
|
||||||
|
group = "grafana";
|
||||||
|
};
|
||||||
|
"grafana/oidc_secret" = {
|
||||||
|
owner = "grafana";
|
||||||
|
group = "grafana";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,12 @@
|
||||||
grantTypes = ["authorizationCode"];
|
grantTypes = ["authorizationCode"];
|
||||||
responseTypes = ["code"];
|
responseTypes = ["code"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
grafana = {
|
||||||
|
redirectUris = ["http://localhost:9001/login/generic_oauth"];
|
||||||
|
grantTypes = ["authorizationCode"];
|
||||||
|
responseTypes = ["code"];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue