nyarlathotep: cleanup after deployment #55

Merged
Gonne merged 22 commits from Gonne/nixConfig:nyarlathotep into main 2025-03-24 19:38:06 +00:00
Showing only changes of commit 889b867c66 - Show all commits

View file

@ -1,3 +1,4 @@
/* /*
* Building: We patch our version of stalwart and thus need to built it locally. * Building: We patch our version of stalwart and thus need to built it locally.
* Be aware that this needs some hours, about 20Gb RAM and a few Gb free space in /tmp. * Be aware that this needs some hours, about 20Gb RAM and a few Gb free space in /tmp.
@ -300,9 +301,9 @@ in {
# This line gets the available mailboxes from stalwart's Rest API, searches for their addresses and collects them to a file for submission. # This line gets the available mailboxes from stalwart's Rest API, searches for their addresses and collects them to a file for submission.
# The regex searches for alphanumerics combined with some special characters as local paths and the right domain. # The regex searches for alphanumerics combined with some special characters as local paths and the right domain.
# Exclude @domain.tld which is not a valid mail address but used for catch-all accounts. # Exclude @domain.tld which is not a valid mail address but used for catch-all accounts.
${pkgs.curl}/bin/curl -s --header "authorization: Basic $(<${cfg.stalwartAdmin})" http://localhost/api/principal | ${pkgs.gnugrep}/bin/grep -o -e "[A-Za-z0-9.!#\$%&'*+-/=?^_{|}~]*@${domain}" | grep -v "@${domain}" | tee /tmp/addresses ${pkgs.curl}/bin/curl -s --header "authorization: Basic $(<${cfg.stalwartAdmin})" http://localhost/api/principal | ${pkgs.gnugrep}/bin/grep -o -e "[A-Za-z0-9.!#\$%&*+-/=?^_{|}~]*@${domain}" | grep -v "@${domain}" | tee /tmp/addresses
Gonne marked this conversation as resolved

The HRZ doesn't allow ' either so we don't loose anything (see the mails from the cert team, or read
our discussion in chat if you want to see the world burn)

The HRZ doesn't allow `'` either so we don't loose anything (see the mails from the cert team, or read our discussion in chat if you want to see the world burn)
# This line searches for available redirects and adds them to the submission file. # This line searches for available redirects and adds them to the submission file.
${pkgs.gnugrep}/bin/grep -o -e "[A-Za-z0-9.!#\$%&'*+-/=?^_{|}~]*@${domain}" /tmp/virt_aliases >> /tmp/addresses # This doesn't catch all RFC conform local parts. Improve if you need. ${pkgs.gnugrep}/bin/grep -o -e "[A-Za-z0-9.!#\$%&*+-/=?^_{|}~]*@${domain}" /tmp/virt_aliases >> /tmp/addresses # This doesn't catch all RFC conform local parts. Improve if you need.
Gonne marked this conversation as resolved

See above. This parses a sieve script! That includes ' in its syntax so this would break anyway if we allowed ' in E-Mail addresses. Maybe we should parse the alias file instead. That has its own problems though.
We can discuss this in a separate issue.

See above. This parses a sieve script! That includes `'` in its syntax so this would break anyway if we allowed `'` in E-Mail addresses. Maybe we should parse the alias file instead. That has its own problems though. We can discuss this in a separate issue.
# Post local-parts to HRZ, see https://www-cgi.hrz.tu-darmstadt.de/mail/index.php?bereich=whitelist_upload # Post local-parts to HRZ, see https://www-cgi.hrz.tu-darmstadt.de/mail/index.php?bereich=whitelist_upload
${pkgs.curl}/bin/curl -s https://www-cgi.hrz.tu-darmstadt.de/mail/whitelist-update.php -F emaildomain=${domain} -F password=$(cat ${allowlistPass}) -F emailliste=@/tmp/addresses -F meldungen=voll ${pkgs.curl}/bin/curl -s https://www-cgi.hrz.tu-darmstadt.de/mail/whitelist-update.php -F emaildomain=${domain} -F password=$(cat ${allowlistPass}) -F emailliste=@/tmp/addresses -F meldungen=voll
# Cleanup submission file # Cleanup submission file