anubis : DB pour les secrets

merge-requests/100/head
Pyjacpp 2026-11-01 23:39:00 +01:00
parent bf059ed261
commit 9aa3a3122e
No known key found for this signature in database
GPG Key ID: ED479A5A26930939
1 changed files with 26 additions and 2 deletions

View File

@ -1,6 +1,7 @@
{ {
config, config,
lib, lib,
pkgs,
... ...
}: }:
let let
@ -16,6 +17,7 @@ in
{ {
options.crans.anubis = { options.crans.anubis = {
enable = mkEnableOption "Configuration d’Anubis du Crans."; enable = mkEnableOption "Configuration d’Anubis du Crans.";
useRedis = mkEnableOption "Utilisation de Redis pour sauvegarder les challenges";
instances = mkOption { instances = mkOption {
type = types.attrsOf ( type = types.attrsOf (
types.submodule { types.submodule {
@ -62,6 +64,18 @@ in
CHALLENGE = 200; CHALLENGE = 200;
DENY = 403; DENY = 403;
}; };
logging = {
sink = "stdio";
level = "WARN";
};
store =
let
redCfg = config.services.redis.servers.anubis;
in
{
backend = "valkey";
parameters.url = "redis://${redCfg.bind}:${toString redCfg.port}/0";
};
}; };
extraBots = [ extraBots = [
{ {
@ -94,8 +108,7 @@ in
METRIC_BIND = "/run/anubis/anubis-${name}/metrics.sock"; METRIC_BIND = "/run/anubis/anubis-${name}/metrics.sock";
TARGET = " "; # Subrequest authentification. TARGET = " "; # Subrequest authentification.
COOKIE_DOMAIN = conf.hostname; COOKIE_DOMAIN = conf.hostname;
# TODO: db pour mettre en commun les token. # XXX: Impossible de mettre en commun les challenges inter-sites ?
# Transitoirement on les sépare
COOKIE_PREFIX = "anubis-${conf.hostname}"; COOKIE_PREFIX = "anubis-${conf.hostname}";
REDIRECT_DOMAINS = conf.hostname; REDIRECT_DOMAINS = conf.hostname;
SOCKET_MODE = "0660"; SOCKET_MODE = "0660";
@ -104,5 +117,16 @@ in
}; };
}) cfg.instances; }) cfg.instances;
}; };
services.redis = {
# Meilleure licence que Redis
package = pkgs.valkey;
servers.anubis = {
enable = true;
bind = "127.0.0.1";
port = 6379;
databases = 1;
};
};
}; };
} }