From 95ee041e131e004673af4a18eae058df19cde328 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 922dd1c..758665d 100644 --- a/nixbld-etc-nixos/configuration.nix +++ b/nixbld-etc-nixos/configuration.nix @@ -230,7 +230,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"; @@ -305,7 +305,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"; @@ -319,7 +319,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"; }; @@ -1260,14 +1260,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" ]; }; @@ -1283,14 +1283,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 f0bb2fa..edd6063 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"