Use postfix options for routing mails through tunnel #45
|
@ -92,7 +92,7 @@ in
|
|||
firewall = {
|
||||
allowedTCPPorts = [ 53 80 443 2222 7402 ];
|
||||
allowedUDPPorts = [ 53 67 500 4500 ];
|
||||
trustedInterfaces = [ netifLan netifUSA ];
|
||||
trustedInterfaces = [ netifLan ];
|
||||
|
||||
logRefusedConnections = false;
|
||||
extraCommands = ''
|
||||
iptables -A INPUT -s 5.78.86.156 -p gre -j ACCEPT
|
||||
|
@ -1252,18 +1252,6 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
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 Transport Maps";
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.postfix}/sbin/postmap /var/lib/postfix/conf/sender_transport";
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
|
||||
mailserver = {
|
||||
enable = true;
|
||||
localDnsResolver = false; # conflicts with dnsmasq
|
||||
|
@ -1274,6 +1262,9 @@ in
|
|||
certificateScheme = "acme-nginx";
|
||||
} // (import /etc/nixos/secret/email_settings.nix);
|
||||
services.postfix = {
|
||||
sb10q marked this conversation as resolved
Outdated
sb10q
commented
"smtptun" is quite a confusing name. You'd think it's some postfix internal option. Make it more specific and explicit. "smtptun" is quite a confusing name. You'd think it's some postfix internal option. Make it more specific and explicit.
|
||||
mapFiles.sender_transport = pkgs.writeText "sender_transport" ''
|
||||
@m-labs-intl.com intltunnel:
|
||||
'';
|
||||
sb10q
commented
In https://www.postfix.org/transport.5.html I don't see the syntax In https://www.postfix.org/transport.5.html I don't see the syntax ``@domain``. Just ``domain``. What is going on?
esavkin
commented
I checked previously and it just didn't work until I used I checked previously and it just didn't work until I used `@domain`
sb10q
commented
Why the apparent discrepancy with the documentation? How carefully did you check? Why the apparent discrepancy with the documentation? How carefully did you check?
|
||||
config = {
|
||||
sb10q marked this conversation as resolved
Outdated
sb10q
commented
Is this really required? I would expect NixOS to deal by itself with Is this really required? I would expect NixOS to deal by itself with ``services.postfix.mapFiles`` without requiring any additional user-defined systemd services.
sb10q
commented
https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/mail/postfix.nix#L752-L755 Does this not work for some reason, or is it your usual sloppiness? https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/mail/postfix.nix#L752-L755
Does this not work for some reason, or is it your usual sloppiness?
|
||||
sender_dependent_default_transport_maps = "hash:/var/lib/postfix/conf/sender_transport";
|
||||
sb10q
commented
Is the line Is the line ``* :`` needed?
|
||||
};
|
||||
|
@ -1281,8 +1272,8 @@ in
|
|||
type = "unix";
|
||||
command = "smtp";
|
||||
args = [
|
||||
"-o" "smtp_bind_address=10.47.3.1"
|
||||
"-o" "inet_interfaces=10.47.3.1"
|
||||
"-o" "smtp_helo_name=mail.m-labs-intl.com"
|
||||
"-o" "inet_protocols=ipv4"
|
||||
];
|
||||
};
|
||||
sb10q
commented
Is inet_protocols=ipv4 still needed? Is inet_protocols=ipv4 still needed?
esavkin
commented
Yes, otherwise it tries to use ipv6 Yes, otherwise it tries to use ipv6
sb10q
commented
Despite net_interfaces=10.47.3.1 ? Despite net_interfaces=10.47.3.1 ?
esavkin
commented
Yes Yes
|
||||
|
|
No.