From d94a77d35c39fb297b0cd0d033fbf23617e0c903 Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Tue, 4 Jul 2023 15:56:50 +0200 Subject: [PATCH 1/6] configure kpp --- flake.nix | 6 +++++- modules/kpp.nix | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 modules/kpp.nix diff --git a/flake.nix b/flake.nix index 04919d3..55f9fbe 100755 --- a/flake.nix +++ b/flake.nix @@ -3,9 +3,11 @@ nixpkgs.url = github:nixos/nixpkgs/nixos-23.05; sops-nix.url = github:Mic92/sops-nix; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; + kpp.url = "github:fsr/kpp"; + kpp.inputs.nixpkgs.follows = "nixpkgs"; # fsr-infoscreen.url = github:fsr/infoscreen; # some anonymous strukturer accidentally removed the flake.nix }; - outputs = { self, nixpkgs, sops-nix, ... }@inputs: + outputs = { self, nixpkgs, sops-nix, kpp, ... }@inputs: { #packages."aarch64-linux".sanddorn = self.nixosConfigurations.sanddorn.config.system.build.sdImage; packages."x86_64-linux".quitte = self.nixosConfigurations.quitte-vm.config.system.build.vm; @@ -36,11 +38,13 @@ system = "x86_64-linux"; modules = [ inputs.sops-nix.nixosModules.sops + inputs.kpp.nixosModules.default ./hosts/quitte/configuration.nix ./modules/options.nix ./modules/base.nix ./modules/sops.nix ./modules/ldap.nix + ./modules/kpp.nix # ./modules/keycloak.nix replaced by portunus ./modules/mail.nix ./modules/mailman.nix diff --git a/modules/kpp.nix b/modules/kpp.nix new file mode 100644 index 0000000..7767711 --- /dev/null +++ b/modules/kpp.nix @@ -0,0 +1,15 @@ +{ config, ... }: +let + domain = "kpp.${config.fsr.domain}"; +in +{ + services.kpp = { + enable = true; + hostName = domain; + }; + services.nginx.virtualHosts."${domain}" = { + enableACME = true; + forceSSL = true; + }; + +} From fdc5d31442b1d661ae9c21127644606e51517c6b Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Tue, 4 Jul 2023 16:10:53 +0200 Subject: [PATCH 2/6] update input --- flake.lock | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/flake.lock b/flake.lock index ae76547..97e3e93 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "kpp": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688479784, + "narHash": "sha256-xCI0Q8pQK5JRHYwieQApHmLseuXLiHnsYVlxUVKLCQA=", + "owner": "fsr", + "repo": "kpp", + "rev": "bf78c8481cbd1a43a122da90a63bbd0ed257b244", + "type": "github" + }, + "original": { + "owner": "fsr", + "repo": "kpp", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1685004253, @@ -34,6 +54,7 @@ }, "root": { "inputs": { + "kpp": "kpp", "nixpkgs": "nixpkgs", "sops-nix": "sops-nix" } From 9be95bc7d7eeff22433c912c9be5a248b126e0c7 Mon Sep 17 00:00:00 2001 From: Fugi Date: Thu, 6 Jul 2023 01:10:47 +0200 Subject: [PATCH 3/6] Fix IPv6 mail sending, add noreply alias --- modules/mail.nix | 64 +++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/modules/mail.nix b/modules/mail.nix index fd1c09d..a1e93e3 100644 --- a/modules/mail.nix +++ b/modules/mail.nix @@ -39,7 +39,7 @@ in domain = "${domain}"; origin = "${domain}"; destination = [ "${hostname}" "${domain}" "localhost" ]; - networks = [ "127.0.0.1" "141.30.30.169" ]; + networksStyle = "host"; # localhost and own public IP sslCert = "/var/lib/acme/${hostname}/fullchain.pem"; sslKey = "/var/lib/acme/${hostname}/key.pem"; relayDomains = [ "hash:/var/lib/mailman/data/postfix_domains" ]; @@ -47,7 +47,6 @@ in extraAliases = '' # Taken from kaki, maybe we can throw out some at some point # General redirections for pseudo accounts - postmaster: root bin: root daemon: root named: root @@ -62,9 +61,13 @@ in dumper: root operator: root abuse: postmaster + postmaster: root # trap decode to catch security attacks decode: root + + # yeet into the void + noreply: /dev/null ''; config = { home_mailbox = "Maildir/"; @@ -153,37 +156,36 @@ in pkgs.dovecot_pigeonhole ]; extraConfig = '' - auth_username_format = %Ln - passdb { - driver = ldap - args = ${dovecot-ldap-args} + auth_username_format = %Ln + passdb { + driver = ldap + args = ${dovecot-ldap-args} + } + userdb { + driver = ldap + args = ${dovecot-ldap-args} + } + service auth { + unix_listener /var/lib/postfix/auth { + group = postfix + mode = 0660 + user = postfix } - userdb { - driver = ldap - args = ${dovecot-ldap-args} + } + service managesieve-login { + inet_listener sieve { + port = 4190 } - service auth { - unix_listener /var/lib/postfix/auth { - group = postfix - mode = 0660 - user = postfix - } + service_count = 1 + } + service lmtp { + unix_listener dovecot-lmtp { + group = postfix + mode = 0600 + user = postfix } - service managesieve-login { - inet_listener sieve { - port = 4190 - } - - service_count = 1 - } - service lmtp { - unix_listener dovecot-lmtp { - group = postfix - mode = 0600 - user = postfix - } - client_limit = 1 - } + client_limit = 1 + } ''; }; opendkim = { @@ -191,7 +193,7 @@ in domains = "csl:${config.fsr.domain}"; selector = config.networking.hostName; configFile = pkgs.writeText "opendkim-config" '' - UMask 0117 + UMask 0117 ''; }; rspamd = { From 6c542cadb9d0ab251797999c053d0558f9debc97 Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Fri, 7 Jul 2023 10:14:02 +0200 Subject: [PATCH 4/6] fix sending to aliases --- modules/mail.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/mail.nix b/modules/mail.nix index a1e93e3..c68a5d3 100644 --- a/modules/mail.nix +++ b/modules/mail.nix @@ -102,6 +102,7 @@ in ]; # smtpd_sender_login_maps = [ "ldap:${ldap-senders}" ]; alias_maps = [ "hash:/etc/aliases" ]; + alias_database = [ "hash:/etc/aliases" ]; # alias_maps = [ "hash:/etc/aliases" "ldap:${ldap-aliases}" ]; smtpd_milters = [ "local:/run/opendkim/opendkim.sock" ]; non_smtpd_milters = [ "local:/var/run/opendkim/opendkim.sock" ]; @@ -109,7 +110,7 @@ in smtpd_sasl_path = "/var/lib/postfix/auth"; smtpd_sasl_type = "dovecot"; #mailman stuff - local_transport = "lmtp:unix:/run/dovecot2/dovecot-lmtp"; + mailbox_transport = "lmtp:unix:/run/dovecot2/dovecot-lmtp"; transport_maps = [ "hash:/var/lib/mailman/data/postfix_lmtp" ]; local_recipient_maps = [ "hash:/var/lib/mailman/data/postfix_lmtp" "ldap:${config.sops.secrets."postfix_ldap_aliases".path}" ]; From bbda0accc42c11ee8e9c4a5eda5bcce5977bbbb1 Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Fri, 7 Jul 2023 10:55:23 +0200 Subject: [PATCH 5/6] fix postfix ldap query --- secrets/quitte.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/secrets/quitte.yaml b/secrets/quitte.yaml index 70daf77..2c2add9 100644 --- a/secrets/quitte.yaml +++ b/secrets/quitte.yaml @@ -15,7 +15,7 @@ mediawiki: postgres: ENC[AES256_GCM,data:XRfUc2PRMJcoILAnm5MWr2Cg5u4e/IhGMUnz/oIQSzY=,iv:8U+qlD1SQzxUyD/6QK4SdwRCDyMODK/lP0IDrLlcQ4U=,tag:2spNMj9dY2wWilOusq24yQ==,type:str] initial_admin: ENC[AES256_GCM,data:iET5rz9rygx49NDBjKwqAlRgpeS+jq5iM5zmjnoKcyk=,iv:11iDbCrpzjCdyAB22R8NknJ6vzcpVZXCXB3iWsGWXw0=,tag:1RCyg1ysOWaXKdqqdHqRrw==,type:str] ldapprovider: ENC[AES256_GCM,data:CPsrWmUviUpFIVVN/2a1lRjJCoZCWR9zrHm3T5Tv/YuXSYXStZGfBgXN96zhJUUpZcwiJq95o1sajyit+6itZCcGAPu0BTHSnNXRu1fgifonXE0ghw6rvzwkYpfBS+rfmBcG2wxX+7uZG3ulANYpvvGMxpKgM5IzQjE1sAytRDir6QeMGcFHP2gV4xQAdTNUZK2V+EKOlrcV5vTSzDSy3eXg18TVUgZqdxaQFfwnr2UN0eEEZ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IRSNnxGa8eHMmFQ==,type:str] +postfix_ldap_aliases: ENC[AES256_GCM,data:kpffdciWI08Of2fm2B1lZ4rOYIhWtoBTnpU1N0iwiStA81Yl/NMDgHDCVv79XY6SuFTCBd6npKNz/0ibBy1WDSrDQymV5MIUmWVPwLcBSNMjD0d69PJYdUDVLmyhNkjB2hEL9JaH1PiO4iBM5y9yZx1LT+zlauAZEJPFgO/MvjkMknHZPKnRpBtT8wKTWTYUtBvzQtlACLKdIF0t37Q2DZAMtWrAgsrH811zUbsxJbYDInvNDPDHZHS+ZfF0Q1vXDLWUm+zZij6KRAJdOuEU9dyzhU/t93+LO9zKADwyF1Xk+2Uh,iv:cEui6fcDDINpUUcLZxGwPBMP1PjQVNMdScgaWdnIJ80=,tag:/7/mZckPJ7YLuJMp/BqbOQ==,type:str] mautrix-telegram_env: ENC[AES256_GCM,data:2p5vYV+/vEDrrZItTcT1vxddv2tM7dLGBUmG+OXHccTzJ2UhyYpDGgUMr5KgObxvyssYBZTsvbV7QFN3sjcU/jVPx1qEUn6zyKO0HBQjrviVU3urx5zNOnCEHwDKyDrZ1Hu/CE6lpGNrtGlpewgOs/+84JZIZhC9qSuzDhN38sr4OGfMr29fMzafYC+TGHoZyA64GI9xz0KvXhwg6ci1hLtVWYEOFW2Nf8uLY8qkNLuDzA6bYx8rn3CEXoxiv0n4,iv:jmcWTyVkqu9nDc1ws2NxkMKrHPZ13i3jqDkk4Y0kejw=,tag:BjhmPc4lSbsZBmZ/q2CqGg==,type:str] sops: kms: [] @@ -32,8 +32,8 @@ sops: NEJBTHE2end1RDlHRTNFYlZjTjhib2cKmQRHpBKZ2DbQ5CfOwcSPfZAm9fnnpxUk +LcR8haK//O3N2uNf9etDW3VsT5ipPucCdFU1m/v9L5tcN6ZP8WP+w== -----END AGE ENCRYPTED FILE----- - lastmodified: "2023-07-04T07:41:45Z" - mac: ENC[AES256_GCM,data:YLC02dhSSLl9C1B7wo/AJcY4a4zc1LIaA0PKH0H8uZ8I9Kh105yk4sc2cz15FVMLtkMeIdfnhmWxbnPyLbM0mA9bAYT9MQn65quEgDumr+XH0UW6m1e2S23/2fxTFH1xRWsu7/Kon/gdzLb5hf2m30eJAP7MrdpxDz28Q7ut1P4=,iv:9UC71WxpDt1bxWSu16Sc+OKpy6KmX0Ru+Q54LYuQCBU=,tag:CpNKSJem+XHimm+yzRpwaw==,type:str] + lastmodified: "2023-07-07T08:54:55Z" + mac: ENC[AES256_GCM,data:JlITbCiRVYkS9wWLxAOX3ZUtgtmBFiS4JeNt+3/prTScPVC3cqhZPx6UWfPh8hzS1NZGSJEy9J2roWm1DEZnj73cRmjwROAx/RiiGXJIkfxgUik4HFleIpKuOJ31Jkvl7m+YaEcgNail+KakKSy7H3Jf21Qu08fLGrN3kwt+JUA=,iv:GtuJrjnId9aU5f9o5hGYMNBN5FRB1OSLWCp9zFimhzA=,tag:RTL70JdR4C0UhXnMH01LPQ==,type:str] pgp: - created_at: "2023-04-23T17:48:54Z" enc: | From 105b2a0476d564a58b5dd28229ef7b544c5f9d18 Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Fri, 7 Jul 2023 11:03:57 +0200 Subject: [PATCH 6/6] mail: include aliases in local recipient maps --- modules/mail.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mail.nix b/modules/mail.nix index c68a5d3..3124c88 100644 --- a/modules/mail.nix +++ b/modules/mail.nix @@ -113,7 +113,7 @@ in mailbox_transport = "lmtp:unix:/run/dovecot2/dovecot-lmtp"; transport_maps = [ "hash:/var/lib/mailman/data/postfix_lmtp" ]; - local_recipient_maps = [ "hash:/var/lib/mailman/data/postfix_lmtp" "ldap:${config.sops.secrets."postfix_ldap_aliases".path}" ]; + local_recipient_maps = [ "hash:/var/lib/mailman/data/postfix_lmtp" "ldap:${config.sops.secrets."postfix_ldap_aliases".path}" "$alias_maps" ]; }; }; dovecot2 = {