Compare commits

..

1 commit

Author SHA1 Message Date
7b835efd46 Add pushing to hrz allowlist 2024-03-31 16:35:02 +02:00

View file

@ -2,7 +2,6 @@
{ {
config, config,
lib, lib,
pkgs,
... ...
}: let }: let
inherit inherit
@ -80,16 +79,15 @@ in {
description = "Post the mail addresses used by mailman to the HRZ allow list"; description = "Post the mail addresses used by mailman to the HRZ allow list";
script = '' script = ''
# Parse addresses # Parse addresses
cut -d '@' -f 1 /var/lib/mailman/data/postfix_lmtp | grep -v '#' | grep "\S" > /tmp/addresses awk '{print $1}' /var/lib/mailman/data/postfix_lmtp | grep -v '#' | grep "\S" > addresses
# Post addresses to HRZ # Post addresses to HRZ
${pkgs.curl}/bin/curl https://www-cgi.hrz.tu-darmstadt.de/mail/whitelist-update.php -F emaildomain=lists.mathebau.de -F password=$(cat /run/secrets/allowlistPass) -F emailliste=@/tmp/addresses -F meldungen=voll curl https://www-cgi.hrz.tu-darmstadt.de/mail/whitelist-update.php -F emaildomain=lists.mathebau.de -F password=$(cat /run/secrets/allowlistPass) -F emailliste=@addresses -F meldungen=voll
# Cleanup # Cleanup
rm /tmp/addresses rm addresses
''; '';
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
User = "mailman"; User = "mailman";
PrivateTmp = true;
}; };
}; };
sops.secrets.allowlistPass = { sops.secrets.allowlistPass = {