Just use redis password directly

This commit is contained in:
niten 2023-09-27 12:11:07 -07:00
parent 811f1de248
commit 8a8d894f00
2 changed files with 10 additions and 12 deletions

View File

@ -405,7 +405,6 @@ in {
]; ];
capabilities.SYS_ADMIN = true; capabilities.SYS_ADMIN = true;
depends_on = [ "antivirus" "redis" ]; depends_on = [ "antivirus" "redis" ];
volumes = [ "${redisPasswdFile}:/run/redis.passwd" ];
}; };
nixos = { nixos = {
useSystemd = true; useSystemd = true;
@ -424,7 +423,7 @@ in {
host = "antivirus"; host = "antivirus";
port = antivirusPort; port = antivirusPort;
}; };
redis.password-file = "/run/redis.passwd"; redis.password = readFile redisPasswdFile;
}; };
}; };
}; };

View File

@ -38,7 +38,7 @@ in {
}; };
}; };
redis.password-file = mkOption { redis.password = mkOption {
type = str; type = str;
description = "Password with which to connect to Redis."; description = "Password with which to connect to Redis.";
}; };
@ -51,8 +51,7 @@ in {
port = cfg.ports.metrics; port = cfg.ports.metrics;
}; };
services.rspamd = let redisPasswd = readFile cfg.redis.password-file; services.rspamd = {
in {
enable = true; enable = true;
locals = { locals = {
@ -65,7 +64,7 @@ in {
type = "clamav"; type = "clamav";
log_clean = true; log_clean = true;
servers = "${cfg.antivirus.host}:${toString cfg.antivirus.port}"; servers = "${cfg.antivirus.host}:${toString cfg.antivirus.port}";
password = "${redisPasswd}"; password = "${cfg.redis.password}";
scan_mime_parts = false; # scan mail as a whole unit, not parts. seems to be needed to work at all scan_mime_parts = false; # scan mail as a whole unit, not parts. seems to be needed to work at all
} }
''; '';
@ -86,7 +85,7 @@ in {
"dmark.conf".text = '' "dmark.conf".text = ''
dmarc = { dmarc = {
servers = "redis"; servers = "redis";
password = "${redisPasswd}"; password = "${cfg.redis.password}";
} }
''; '';
@ -94,7 +93,7 @@ in {
enabled = true; enabled = true;
servers = "redis"; servers = "redis";
password = "${redisPasswd}"; password = "${cfg.redis.password}";
timeout = 10.0; timeout = 10.0;
@ -111,7 +110,7 @@ in {
} }
backend "redis" { backend "redis" {
servers = "redis"; servers = "redis";
password = "${redisPasswd}"; password = "${cfg.redis.password}";
} }
symbol = "IP_REPUTATION"; symbol = "IP_REPUTATION";
@ -121,7 +120,7 @@ in {
} }
backend "redis" { backend "redis" {
servers = "redis"; servers = "redis";
password = "${redisPasswd}"; password = "${cfg.redis.password}";
} }
symbol = "SPF_REPUTATION"; symbol = "SPF_REPUTATION";
@ -131,7 +130,7 @@ in {
} }
backend "redis" { backend "redis" {
servers = "redis"; servers = "redis";
password = "${redisPasswd}"; password = "${cfg.redis.password}";
} }
symbol = "DKIM_REPUTATION"; # Also adjusts scores for DKIM_ALLOW, DKIM_REJECT symbol = "DKIM_REPUTATION"; # Also adjusts scores for DKIM_ALLOW, DKIM_REJECT
@ -142,7 +141,7 @@ in {
} }
backend "redis" { backend "redis" {
servers = "redis"; servers = "redis";
password = "${redisPasswd}"; password = "${cfg.redis.password}";
} }
symbol = "GENERIC_REPUTATION"; symbol = "GENERIC_REPUTATION";