From ed9b79a2d7e7ece10ae66d20a9295a6f1307c659 Mon Sep 17 00:00:00 2001 From: Egor Savkin Date: Tue, 8 Oct 2024 16:00:18 +0800 Subject: [PATCH] Fix postfix settings so it should load successfully and accept and send messages through tunnel Signed-off-by: Egor Savkin --- nixbld-etc-nixos/configuration.nix | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/nixbld-etc-nixos/configuration.nix b/nixbld-etc-nixos/configuration.nix index 758665d..6aea33f 100644 --- a/nixbld-etc-nixos/configuration.nix +++ b/nixbld-etc-nixos/configuration.nix @@ -238,8 +238,8 @@ in interfaces.intl0 = { ipv4.addresses = [ { - address = "10.47.3.2"; - prefixLength = 30; + address = "10.47.3.1"; + prefixLength = 31; } ]; ipv4.routes = [ @@ -348,7 +348,7 @@ in serviceConfig = { Type = "oneshot"; RemainAfterExit = true; - ExecStart = "${pkgs.iproute2}/bin/ip rule add from 10.47.3.0/30 table 3"; + ExecStart = "${pkgs.iproute2}/bin/ip rule add from 10.47.3.0/31 table 3"; ExecStop = "${pkgs.iproute2}/bin/ip rule del table 3"; }; }; @@ -1260,14 +1260,14 @@ in }; }; - services.postfix.mapFiles.sender_relay = pkgs.writeText "sender_relay" '' - m-labs-intl.com smtptun: + services.postfix.mapFiles.sender_transport = pkgs.writeText "sender_transport" '' + @m-labs-intl.com intltunnel: * : ''; systemd.services.postfix-rebuild-sender-relay = { - description = "Postfix Rebuild Sender Dependent Relayhost Maps"; + description = "Postfix Rebuild Sender Dependent Transport Maps"; serviceConfig = { - ExecStart = "${pkgs.postfix}/sbin/postmap /var/lib/postfix/conf/sender_relay"; + ExecStart = "${pkgs.postfix}/sbin/postmap /var/lib/postfix/conf/sender_transport"; }; wantedBy = [ "multi-user.target" ]; }; @@ -1283,12 +1283,16 @@ in } // (import /etc/nixos/secret/email_settings.nix); services.postfix = { config = { - sender_dependent_relayhost_maps = "hash:/var/lib/postfix/conf/sender_relay"; + sender_dependent_default_transport_maps = "hash:/var/lib/postfix/conf/sender_transport"; }; - masterConfig."smtptun" = { + masterConfig."intltunnel" = { type = "unix"; command = "smtp"; - args = [ "-o" "smtp_bind_address=10.47.3.2" ]; + args = [ + "-o" "smtp_bind_address=10.47.3.1" + "-o" "inet_interfaces=10.47.3.1" + "-o" "inet_protocols=ipv4" + ]; }; };