From 4c300688d95df0b353b1bd2f3b359ff4c75cc9d0 Mon Sep 17 00:00:00 2001 From: Egor Savkin Date: Mon, 7 Oct 2024 16:43:43 +0800 Subject: [PATCH] Fix postfix settings so it should load successfully Signed-off-by: Egor Savkin --- nixbld-etc-nixos/configuration.nix | 23 ++++++++++++----------- nixbld-etc-nixos/named/m-labs-intl.com | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/nixbld-etc-nixos/configuration.nix b/nixbld-etc-nixos/configuration.nix index 6c23acc..a6b65d4 100644 --- a/nixbld-etc-nixos/configuration.nix +++ b/nixbld-etc-nixos/configuration.nix @@ -262,7 +262,7 @@ in }; greTunnels.intl0 = { dev = netifWan; - remote = "5.78.16.0"; + remote = "5.78.86.156"; local = "94.190.212.123"; ttl = 255; type = "tun"; @@ -353,7 +353,7 @@ in }; services.strongswan-swanctl.swanctl.connections.intl = { local_addrs = [ "94.190.212.123" ]; - remote_addrs = [ "5.78.16.0" ]; + remote_addrs = [ "5.78.86.156" ]; local.main = { auth = "pubkey"; id = "fqdn:m-labs.hk"; @@ -367,7 +367,7 @@ in children.intl0 = { mode = "transport"; ah_proposals = [ "sha256-curve25519" ]; - remote_ts = [ "5.78.16.0[gre]" ]; + remote_ts = [ "5.78.86.156[gre]" ]; local_ts = [ "94.190.212.123[gre]" ]; start_action = "start"; }; @@ -1305,14 +1305,14 @@ in }; }; - environment.etc."postfix/sender_relay".text = '' + services.postfix.mapFiles.sender_relay = pkgs.writeText "sender_relay" '' m-labs-intl.com smtptun: * : ''; systemd.services.postfix-rebuild-sender-relay = { description = "Postfix Rebuild Sender Dependent Relayhost Maps"; serviceConfig = { - ExecStart = "${pkgs.postfix}/sbin/postmap /etc/postfix/sender_relay"; + ExecStart = "${pkgs.postfix}/sbin/postmap /var/lib/postfix/conf/sender_relay"; }; wantedBy = [ "multi-user.target" ]; }; @@ -1328,14 +1328,15 @@ in } // (import /etc/nixos/secret/email_settings.nix); services.postfix = { config = { - sender_dependent_relayhost_maps = "hash:/etc/postfix/sender_relay"; - masterConfig.smtptun = { - type = "smtp"; - command = "smtp"; - args = "-o smtp_bind_address=10.47.3.2"; - }; + sender_dependent_relayhost_maps = "hash:/var/lib/postfix/conf/sender_relay"; + }; + masterConfig."smtptun" = { + type = "unix"; + command = "smtp"; + args = [ "-o" "smtp_bind_address=10.47.3.2" ]; }; }; + services.roundcube = { enable = true; hostName = "mail.m-labs.hk"; diff --git a/nixbld-etc-nixos/named/m-labs-intl.com b/nixbld-etc-nixos/named/m-labs-intl.com index fdb5510..ac71b52 100644 --- a/nixbld-etc-nixos/named/m-labs-intl.com +++ b/nixbld-etc-nixos/named/m-labs-intl.com @@ -22,7 +22,7 @@ $TTL 7200 ns A 94.190.212.123 ns AAAA 2001:470:18:390::2 -mail A 5.78.16.0 +mail A 5.78.86.156 mail._domainkey IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJVPuhSGXghO7ib8Em/Se3jfCCIJK5g4zn5pGZ3/e0I0f+zGHMuvwpjkAKf6eSmo/AAXEaco28pDi3qE5xfV512AJsORCfPoPFyNhLsj/qtri6hc5KVSWW0Ja3MSFBINDCaX78c7PXPY+3jJJGpwSBDLjdxj9AQwtfiCVlH4qE/QIDAQAB" _dmarc TXT "v=DMARC1; p=none"