lobon (Mailman-VM) #30

Merged
Gonne merged 5 commits from Gonne/nixConfig:lobon into main 2024-10-12 14:10:02 +00:00
Owner

Mailman in einer eigenen VM. Die Mailinglisten enden jetzt auf @lists.mathebau.de.

Ausstehend zum Live-Betrieb sind noch:

  • Entsprechende Weiterleitung von Eihort
  • Reverse-Proxy in Cthulhu umstellen
  • Backups der Mailinglisten einrichten
  • HRZ Allowlisting einrichten

Basiert auf #26.

Mailman in einer eigenen VM. Die Mailinglisten enden jetzt auf @lists.mathebau.de. Ausstehend zum Live-Betrieb sind noch: - [x] Entsprechende Weiterleitung von Eihort - [x] Reverse-Proxy in Cthulhu umstellen - [x] Backups der Mailinglisten einrichten - [x] HRZ Allowlisting einrichten Basiert auf https://gitea.mathebau.de/Fachschaft/nixConfig/pulls/26.
Gonne added 2 commits 2024-02-06 14:50:02 +00:00
Gonne reviewed 2024-02-06 14:53:22 +00:00
@ -0,0 +53,4 @@
environment.persistence.${config.impermanence.name} = {
directories = [
"/var/lib/acme" # Persist TLS keys and account
Author
Owner

TODO: Backups?

TODO: Backups?
Author
Owner

Done for mailman data. The certificates can be regenerated on hardware failure.

Done for mailman data. The certificates can be regenerated on hardware failure.
Gonne marked this conversation as resolved
Gonne force-pushed lobon from 1bd62a3d9f to 1b8909b6b4 2024-03-29 07:28:04 +00:00 Compare
Gonne force-pushed lobon from 1b8909b6b4 to 41c99daad0 2024-03-30 06:54:49 +00:00 Compare
Gonne added 1 commit 2024-03-31 14:26:45 +00:00
Gonne force-pushed lobon from 9bd6258cfe to 2ba64b55c1 2024-03-31 14:28:50 +00:00 Compare
Gonne force-pushed lobon from 2ba64b55c1 to 7b835efd46 2024-03-31 14:35:25 +00:00 Compare
Gonne force-pushed lobon from 7b835efd46 to 8f7ab3e36b 2024-03-31 15:12:09 +00:00 Compare
Gonne force-pushed lobon from 8f7ab3e36b to a89dab0dbd 2024-03-31 15:40:58 +00:00 Compare
Gonne force-pushed lobon from a89dab0dbd to 2673d101fb 2024-03-31 15:56:26 +00:00 Compare
Gonne force-pushed lobon from 2673d101fb to 5250a0fc93 2024-03-31 18:29:08 +00:00 Compare
Gonne changed title from WIP: lobon (Mailman-VM) to lobon (Mailman-VM) 2024-03-31 21:24:23 +00:00
Author
Owner

Seems to work now.

Seems to work now.
Gonne force-pushed lobon from 5250a0fc93 to 6009971ff5 2024-04-01 07:31:23 +00:00 Compare
Gonne force-pushed lobon from 6009971ff5 to 3a1e670c28 2024-04-01 13:41:54 +00:00 Compare
Gonne force-pushed lobon from 3a1e670c28 to eaf90b9a4a 2024-04-01 14:29:16 +00:00 Compare
Gonne force-pushed lobon from eaf90b9a4a to 4d965ba394 2024-04-01 14:31:35 +00:00 Compare
Gonne requested review from Server-Minions 2024-04-02 16:24:39 +00:00
Gonne added the
Kind/Feature
Priority
Medium
labels 2024-04-02 16:48:15 +00:00
Gonne force-pushed lobon from 4d965ba394 to dcc055891f 2024-04-02 18:24:31 +00:00 Compare
Author
Owner

Gonne force-pushed lobon from 4d965ba394 to dcc055891f

I decided to include all of mailman's persistent state in the backups to include archives.

> Gonne force-pushed lobon from 4d965ba394 to dcc055891f I decided to include all of mailman's persistent state in the backups to include archives.
Gonne force-pushed lobon from dcc055891f to 354488c38d 2024-04-03 13:45:19 +00:00 Compare
Gonne force-pushed lobon from 354488c38d to 45a20b7f52 2024-04-03 14:00:00 +00:00 Compare
nerf reviewed 2024-04-04 14:01:42 +00:00
@ -0,0 +1,39 @@
allowlistPass: ENC[AES256_GCM,data:bb9jXSvWeDnZqqiY/IarwA==,iv:qeFAYvXYdh2uEleg8kpCd77u4PTbwM8ydEkbMhyPz1I=,tag:1/eysyZb2mJ0mYHXIrpihw==,type:str]
Owner

See comment on the other sops file.

See comment on the other sops file.
nerf marked this conversation as resolved
@ -0,0 +1,39 @@
backupKey: ENC[AES256_GCM,data:/PErHUVZDTyqK+GKI2inDoEBQpSmezeBTgXWnrthc8IPtUFn4Ur2CkDo+MqfiAlSn9vT2ksHmyS5qmoGANG01e1Cm50qpt/BdoC2hh15jOVuc0uUBNOq7f5YBVeYtbemwjPcmbF7dgUeRlEAvxhqtX3/ntzxSB1inew/SsEgPrU4Yl0FF+CHhqgbeB/NJOhQY29/3hBGwMksfTUDymUmX6pUgIN1M26crIKFCn5IyqAXl10F+zL4PThZPnhmks7Y8BsGUbKkiE6ghdaUjEjBjGOGgbaGAjolG+nJ17xyM1Pc2speT4E/3VgAC34dpaByveGcf2SfsXir0KavcI86mUkjzaNF9u7GjGO0Szn742/aqbdUoOkJl41unb0Enf2/D4Up3fy6LrUqVqrHIM4Dea9WLQd0poD0FWSN12IKh+ylkouMkmhwLXUXFzIHOePS92/MsPM+9fLhH4cU64qxr9UzmfYRnNBpAHrjlxdkK9WZ1Oj4mdtu6R20vYkYcMIQgU38FvSN6uWGvPxJj+Ij,iv:ghvgkC6qFO/0tvsc7igCoZy7am8eNsd21WYCSAKiZDs=,tag:MFnk/Nnw+cloN+x7sd4LLg==,type:str]
Owner

Hmm, I didn't have thought about the following:

Which secrets get different sops files and which go into the same file?
can we put both of this secrets into the same yaml, is this desirable?

Hmm, I didn't have thought about the following: Which secrets get different sops files and which go into the same file? can we put both of this secrets into the same yaml, is this desirable?
Author
Owner

I think splitting per desired system user is useful (might even be necessary). Apart from that it feels more about conventions which I don't know.

Currently the secrets are used by root and mailman but giving the backup service root-access in itself feels like a mistake.

I think splitting per desired system user is useful (might even be necessary). Apart from that it feels more about conventions which I don't know. Currently the secrets are used by `root` and `mailman` but giving the backup service `root`-access in itself feels like a mistake.
Owner

refactoring the backup process sounds like something, that we should do uniform across all VM. So I think we should do that
in a dedicated pull request. I will open an issue for that. Finding a solution for this is probably out of scope here.

refactoring the backup process sounds like something, that we should do uniform across all VM. So I think we should do that in a dedicated pull request. I will open an issue for that. Finding a solution for this is probably out of scope here.
nerf marked this conversation as resolved
@ -0,0 +93,4 @@
serviceConfig = {
Type = "oneshot";
User = "mailman";
PrivateTmp = true;
Owner

can we set NoNewPrivileges = true;? or does it break the service?

And one could read the Sandboxing part of systemd.exec(5)

can we set `NoNewPrivileges = true;`? or does it break the service? And one could read the Sandboxing part of `systemd.exec(5)`
Author
Owner

Yes, I added a bunch of them in f334e00d01 that seemed reasonable and don't break the updater. Notably, I left out ExecPaths= and NoExecPaths= because the correct values are unclear to me.

Yes, I added a bunch of them in f334e00d01 that seemed reasonable and don't break the updater. Notably, I left out `ExecPaths=` and `NoExecPaths=` because the correct values are unclear to me.
nerf reviewed 2024-04-04 14:42:26 +00:00
@ -0,0 +113,4 @@
};
repo = "borg@192.168.1.11:lobon"; # TODO for https://gitea.mathebau.de/Fachschaft/nixConfig/issues/33
startAt = "daily";
user = "root";
Owner

This is probably a bigger refactoring pull request and outside the scope of this one.
We could think making it easier configurable that backups are made by a user that can
basically read everything but not write.

This is probably a bigger refactoring pull request and outside the scope of this one. We could think making it easier configurable that backups are made by a user that can basically read everything but not write.
nerf marked this conversation as resolved
Gonne added 1 commit 2024-04-04 15:13:54 +00:00
Gonne force-pushed lobon from 6b0a230d7e to f2b83cf5d8 2024-04-04 15:17:42 +00:00 Compare
Gonne force-pushed lobon from f2b83cf5d8 to 4b684bc1e6 2024-04-04 15:35:39 +00:00 Compare
Gonne force-pushed lobon from 4b684bc1e6 to f334e00d01 2024-04-04 15:45:59 +00:00 Compare
Gonne force-pushed lobon from f334e00d01 to 146a904259 2024-04-26 16:21:11 +00:00 Compare
Gonne force-pushed lobon from 146a904259 to d03291bb5d 2024-04-26 17:02:09 +00:00 Compare
Gonne force-pushed lobon from d03291bb5d to d2ed09dfd1 2024-06-12 07:18:04 +00:00 Compare
Gonne force-pushed lobon from d2ed09dfd1 to 12013c90b7 2024-06-24 07:52:27 +00:00 Compare
Gonne force-pushed lobon from 12013c90b7 to 27a70518bc 2024-07-01 19:34:58 +00:00 Compare
Gonne force-pushed lobon from 27a70518bc to 55ba2c9122 2024-07-02 13:58:13 +00:00 Compare
Gonne removed review request for Server-Minions 2024-08-16 08:26:28 +00:00
Gonne requested review from Server-Minions 2024-08-16 08:26:36 +00:00
nerf requested changes 2024-08-18 16:40:54 +00:00
Dismissed
nerf left a comment
Owner

It is more like, please answer my questions (and depending what the answers is, change some minor stuff), and
not really, request changes, but I only have limited options

It is more like, please answer my questions (and depending what the answers is, change some minor stuff), and not really, request changes, but I only have limited options
@ -0,0 +17,4 @@
options.services.mathebau-mailman = {
enable = mkEnableOption "mathebau mailman service";
hostName = mkOption {
type = str;
Owner

are these allowed to be empty?

are these allowed to be empty?
Author
Owner

Probably not. No idea how to achieve that.

Probably not. No idea how to achieve that.
Owner

there is lib.types.nonEmptyStr

there is `lib.types.nonEmptyStr`
Gonne marked this conversation as resolved
@ -0,0 +20,4 @@
type = str;
};
siteOwner = mkOption {
type = str;
Owner

same as above?

same as above?
Gonne marked this conversation as resolved
@ -0,0 +35,4 @@
transport_maps = ["hash:/var/lib/mailman/data/postfix_lmtp"];
local_recipient_maps = ["hash:/var/lib/mailman/data/postfix_lmtp"];
proxy_interfaces = "130.83.2.184";
smtputf8_enable = "no"; # HRZ does not know SMTPUTF8
Owner

m(

m(
Gonne marked this conversation as resolved
@ -0,0 +49,4 @@
settings.mta.verp_confirmations = "no";
};
nginx.virtualHosts.${cfg.hostName} = {
enableACME = true; # Get certificates (primarily for postfix)
Owner

I'm not sure how to stand on this, and it is a purely idiomatic question (not a technical one).
If we want the certs mainly for non nginx use, should we config them separately and not in the nginx block?

Also how does the webinterface work, are we proxied by cthulhu? If yes who handles tls certs?

I'm not sure how to stand on this, and it is a purely idiomatic question (not a technical one). If we want the certs mainly for non nginx use, should we config them separately and not in the nginx block? Also how does the webinterface work, are we proxied by cthulhu? If yes who handles tls certs?
Author
Owner

“Automatic cert validation and configuration for Apache and Nginx virtual hosts is included in NixOS, however if you would like to generate a wildcard cert or you are not using a web server you will have to configure DNS based validation.” – https://nixos.org/manual/nixos/stable/index.html#module-security-acme

I don't want to do DNS validation so this is the way. The services.mailman.serve.enable = true enables nginx anyway.

Web requests get proxied through cthulhu and reach this VM via http. Mail gets proxied via eihort and also probably reaches this VM in plaintext (possibly with STARTTLS).

On the other hand this VM is not supposed to be communicating with anything besides cthulhu and eihort so we might as well try to disable all TLS stuff.

“Automatic cert validation and configuration for Apache and Nginx virtual hosts is included in NixOS, however if you would like to generate a wildcard cert or you are not using a web server you will have to configure DNS based validation.” – https://nixos.org/manual/nixos/stable/index.html#module-security-acme I don't want to do DNS validation so this is the way. The `services.mailman.serve.enable = true` enables nginx anyway. Web requests get proxied through cthulhu and reach this VM via http. Mail gets proxied via eihort and also probably reaches this VM in plaintext (possibly with STARTTLS). On the other hand this VM is not supposed to be communicating with anything besides cthulhu and eihort so we might as well try to disable all TLS stuff.
Gonne marked this conversation as resolved
@ -0,0 +60,4 @@
"/var/lib/mailman"
"/var/lib/mailman-web"
];
files = ["/root/.ssh/known_hosts"]; # for the backup server bragi
Owner

we could move this to the general vm role, right? Every vm makes backups this way, (or am i missing something?)

we could move this to the general vm role, right? Every vm makes backups this way, (or am i missing something?)
Author
Owner

Maybe. This is in scope for the backup refactoring.

Maybe. This is in scope for the backup refactoring.
@ -0,0 +66,4 @@
security.acme.defaults.email = cfg.siteOwner;
security.acme.acceptTerms = true;
networking.firewall.allowedTCPPorts = [25 80 443];
Owner

See above comment about who handles tls, we might not need 443 and 80

See above comment about who handles tls, we might not need 443 and 80
Gonne marked this conversation as resolved
@ -0,0 +89,4 @@
${pkgs.curl}/bin/curl https://www-cgi.hrz.tu-darmstadt.de/mail/whitelist-update.php -F emaildomain=${cfg.hostName} -F password=$(cat /run/secrets/allowlistPass) -F emailliste=@/tmp/addresses -F meldungen=voll
# Cleanup
rm /tmp/addresses
'';
Owner

I love and hate this so much,maybe we should/could make this script its own package? maybe idiomatically correct but overkill.

I love and hate this so much,maybe we should/could make this script its own package? maybe idiomatically correct but overkill.
Author
Owner

I think it's overkill and I don't want to do it.

I think it's overkill and I don't want to do it.
Gonne marked this conversation as resolved
Gonne force-pushed lobon from 55ba2c9122 to df5e743d3f 2024-08-19 11:14:55 +00:00 Compare
Gonne force-pushed lobon from df5e743d3f to 081b9a9d34 2024-08-19 11:24:04 +00:00 Compare
Gonne added 1 commit 2024-10-12 11:56:59 +00:00
Author
Owner

I disabled all TLS on this machine.

I disabled all TLS on this machine.
Gonne requested review from nerf 2024-10-12 11:57:46 +00:00
nerf approved these changes 2024-10-12 14:09:25 +00:00
nerf left a comment
Owner

There was also a change to postfix, to change encryption to may

There was also a change to postfix, to change encryption to may
Gonne merged commit e7154785dd into main 2024-10-12 14:10:02 +00:00
Gonne deleted branch lobon 2024-10-12 14:10:03 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Fachschaft/nixConfig#30
No description provided.