From 9aa3a3122ea4af23461d086f9f26408b5eeb32ff Mon Sep 17 00:00:00 2001 From: Pyjacpp Date: Sun, 1 Nov 2026 23:39:00 +0100 Subject: [PATCH] =?UTF-8?q?anubis=E2=80=AF:=20DB=20pour=20les=20secrets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/crans/anubis.nix | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/modules/crans/anubis.nix b/modules/crans/anubis.nix index e14355e..09ed2de 100644 --- a/modules/crans/anubis.nix +++ b/modules/crans/anubis.nix @@ -1,6 +1,7 @@ { config, lib, + pkgs, ... }: let @@ -16,6 +17,7 @@ in { options.crans.anubis = { enable = mkEnableOption "Configuration d’Anubis du Crans."; + useRedis = mkEnableOption "Utilisation de Redis pour sauvegarder les challenges"; instances = mkOption { type = types.attrsOf ( types.submodule { @@ -62,6 +64,18 @@ in CHALLENGE = 200; 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 = [ { @@ -94,8 +108,7 @@ in METRIC_BIND = "/run/anubis/anubis-${name}/metrics.sock"; TARGET = " "; # Subrequest authentification. COOKIE_DOMAIN = conf.hostname; - # TODO: db pour mettre en commun les token. - # Transitoirement on les sépare + # XXX: Impossible de mettre en commun les challenges inter-sites ? COOKIE_PREFIX = "anubis-${conf.hostname}"; REDIRECT_DOMAINS = conf.hostname; SOCKET_MODE = "0660"; @@ -104,5 +117,16 @@ in }; }) cfg.instances; }; + + services.redis = { + # Meilleure licence que Redis + package = pkgs.valkey; + servers.anubis = { + enable = true; + bind = "127.0.0.1"; + port = 6379; + databases = 1; + }; + }; }; }