saga: Add Keycloak login to Grafana

This commit is contained in:
Erwin Boskma 2024-02-29 23:14:56 +01:00
parent 488d6fe6df
commit 36a422f94b
Signed by: erwin
SSH key fingerprint: SHA256:/Wk1WZdLg+vQHs3in9qq7PsIp8SMzwGSk/RLZ5zPuZk
3 changed files with 25 additions and 2 deletions

View file

@ -87,6 +87,9 @@
metrics_key = { metrics_key = {
owner = config.systemd.services.prometheus.serviceConfig.User; owner = config.systemd.services.prometheus.serviceConfig.User;
}; };
grafana-oauth2-secret = {
owner = config.systemd.services.grafana.serviceConfig.User;
};
}; };
system.stateVersion = "24.05"; system.stateVersion = "24.05";

View file

@ -1,13 +1,32 @@
{ config, ... }:
{ {
services.grafana = { services.grafana = {
enable = true; enable = true;
settings = { settings = {
log = {
level = "info";
};
server = { server = {
domain = "saga.datarift.nl"; domain = "saga.datarift.nl";
enforce_domain = true; enforce_domain = true;
http_addr = "0.0.0.0"; http_addr = "0.0.0.0";
root_url = "https://saga.datarift.nl"; root_url = "https://saga.datarift.nl";
}; };
"auth.generic_oauth" = {
enabled = true;
name = "Keycloak";
allow_sign_up = true;
client_id = "grafana";
client_secret = "$__file{${config.sops.secrets.grafana-oauth2-secret.path}}";
use_refresh_token = true;
scopes = "openid profile email offline_access roles";
auth_url = "https://id.datarift.nl/realms/datarift/protocol/openid-connect/auth";
token_url = "https://id.datarift.nl/realms/datarift/protocol/openid-connect/token";
api_url = "https://id.datarift.nl/realms/datarift/protocol/openid-connect/userinfo";
signout_redirect_url = "https://id.datarift.nl/realms/datarift/protocol/openid-connect/logout?post_logout_redirect_uri=https%3A%2F%2Fsaga.datarift.nl%2Flogin";
role_attribute_path = "contains(resource_access.grafana.roles[*], 'grafanaadmin') && 'GrafanaAdmin' || contains(resource_access.grafana.roles[*], 'admin') && 'Admin' || contains(resource_access.grafana.roles[*], 'editor') && 'Editor' || 'Viewer'";
allow_assign_grafana_admin = true;
};
}; };
}; };
} }

View file

@ -1,6 +1,7 @@
metrics_cert: ENC[AES256_GCM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xiIGaeKD5DNXiCLg2IeFMX0TAkxIR1BY+1z89w=,iv:XNrRSwipAbpQFnXG94zke28gTL22zNf/HfGriChaRgA=,tag:6tsqNc68wHujtlmV4plwPQ==,type:str]
sops: sops:
kms: [] kms: []
gcp_kms: [] gcp_kms: []
@ -34,8 +35,8 @@ sops:
K1FHaGVOQlo2cjBTQ3ZIYXZ5ZzNsNlEKLZWrUkNXTv8ECwXz1aPdnrpMs6r9Q+yI K1FHaGVOQlo2cjBTQ3ZIYXZ5ZzNsNlEKLZWrUkNXTv8ECwXz1aPdnrpMs6r9Q+yI
k5rFkaa+ylIk4OqouKRxxlNFdgcdqqYdZEqLrfuLnamzr6LNaoL1dQ== k5rFkaa+ylIk4OqouKRxxlNFdgcdqqYdZEqLrfuLnamzr6LNaoL1dQ==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----
lastmodified: "2024-02-29T10:40:34Z" lastmodified: "2024-02-29T15:40:45Z"
mac: ENC[AES256_GCM,data:mofYtl2tbmOhe12j1murXcx4GAosmE4ezZZ1Uby8F0TS6Ob2J+13SBS1jwhEkU8S9ylVgx0jSET2weoEHfYS+d0/RDd9bjdXrnI8DeIA46D3wNNssYID9RAuPE18Dc98eVMOOBwH/hT46Bj630l0Rm8H/HB+fwcOFR5ahcvm2Pw=,iv:p2+aTSaOqL1jQpUt9+FBf8QgcwA13haKXLrGV4wdH84=,tag:ecgweBQiXOyiRVY9yBwDIw==,type:str] mac: ENC[AES256_GCM,data:+gH5ZcPlJ1ESdo93Td9BfuMKB1la18ER8OnA65/WERL5bjFai0GRjLxUGOLiJF5ApIj1JMfoqd08awvS8xUVM/4zccYXTeHtngVw2Ra9q3wcvFK4VzQ7kIO0btd6+YSdGGFpWLwBvErsn1yUs67sl69qr4qz0BxMrFn3zac3aQU=,iv:4fxThNrDrOsNNSykVVEmAHfl2VpcZVA58E5lZ+krEpE=,tag:RFigNQQzcZBMiCky5nL3Wg==,type:str]
pgp: [] pgp: []
unencrypted_suffix: _unencrypted unencrypted_suffix: _unencrypted
version: 3.8.1 version: 3.8.1