Use postfix options for routing mails through tunnel #45

Closed
esavkin wants to merge 15 commits from enable-mail-proxy-and-tunnel into master
2 changed files with 13 additions and 12 deletions
Showing only changes of commit 4c300688d9 - Show all commits

View File

@ -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";

View File

@ -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"