Compare commits

...

16 Commits

Author SHA1 Message Date
Egor Savkin 2ee23bc03a Optimize new fw rules and tweak postfix
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-15 17:41:28 +08:00
Egor Savkin 60903e955f Stop rejecting packages from the tunnel
Appears that firewall rejects packages before they are getting unwrapped to GRE

Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-10 15:52:20 +08:00
Egor Savkin 4d7e836f07 Rebase and add intl interface to exceptions
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-09 11:15:31 +08:00
Egor Savkin e7570aa4ce Fix postfix settings so it should load successfully and accept and send messages through tunnel
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-09 11:08:12 +08:00
Egor Savkin eab2d70941 Fix postfix settings so it should load successfully
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-09 11:08:12 +08:00
Egor Savkin cbb077c441 Add virtual ips for the gre tunnel
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-09 11:08:12 +08:00
Egor Savkin 42b3d6ccf3 Return swan into the zoo
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-09 11:08:12 +08:00
Egor Savkin b1fb18a6c5 Use IPv6 for WG transport to decrease latency by 20%
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-09 11:08:12 +08:00
Egor Savkin 29352302be Ip rules instead of iptables tracking
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-09 11:08:12 +08:00
Egor Savkin 47e3d4cb88 Apply tested client configuration
Adds an additional route, but doesn't enforce it so other apps will remain the same, but smtp can use tunnel for sending. Also sends replies through the tunnel if connection arrives on the tunnel.
Better have something tested and working before I start doing "perfect".

Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-09 11:08:12 +08:00
Egor Savkin 5066b8cb9e Use wireguard instead of strongswan since its in the kernel
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-09 11:08:12 +08:00
Egor Savkin 74ecfdb430 WIP: Use gre/ipsec instead of proxy
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-09 11:08:12 +08:00
Egor Savkin 8e5a45ac91 Use proxychains-ng instead of tsocks
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-09 11:08:12 +08:00
Egor Savkin ef4fd68829 Use tsocks to wrap socks and add sock transport type
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-09 11:08:12 +08:00
Egor Savkin cd2eac023e Use wildcard instead of explicit specification
As in example at https://www.postfix.org/transport.5.html

Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-09 11:08:12 +08:00
Egor Savkin 05e3a47208 Use postfix options for routing mails through ssh tunnel
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-09 11:08:12 +08:00
2 changed files with 23 additions and 2 deletions

View File

@ -94,6 +94,10 @@ in
allowedUDPPorts = [ 53 67 500 4500 ];
trustedInterfaces = [ netifLan ];
logRefusedConnections = false;
extraCommands = ''
iptables -A INPUT -s 5.78.86.156 -p gre -j ACCEPT
iptables -A INPUT -s 5.78.86.156 -p ah -j ACCEPT
'';
};
useDHCP = false;
interfaces."${netifWan}".useDHCP = true; # PCCW - always wants active DHCP lease or cuts you off
@ -1257,8 +1261,26 @@ in
enablePop3 = true;
enablePop3Ssl = true;
certificateScheme = "acme-nginx";
policydSPFExtraConfig = "skip_addresses = 5.78.86.156,2a01:4ff:1f0:83de::1";
} // (import /etc/nixos/secret/email_settings.nix);
services.postfix = {
mapFiles.sender_transport = pkgs.writeText "sender_transport" ''
@m-labs-intl.com intltunnel:
* :
'';
config = {
sender_dependent_default_transport_maps = "hash:/var/lib/postfix/conf/sender_transport";
};
masterConfig."intltunnel" = {
type = "unix";
command = "smtp";
args = [
"-o" "inet_interfaces=10.47.3.1"
"-o" "smtp_helo_name=mail.m-labs-intl.com"
"-o" "inet_protocols=ipv4"
];
};
};
services.roundcube = {
enable = true;
hostName = "mail.m-labs.hk";

View File

@ -23,7 +23,6 @@ ns A 94.190.212.123
ns AAAA 2001:470:18:390::2
mail A 5.78.86.156
mail AAAA 2a01:4ff:1f0:83de::1
mail._domainkey IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJVPuhSGXghO7ib8Em/Se3jfCCIJK5g4zn5pGZ3/e0I0f+zGHMuvwpjkAKf6eSmo/AAXEaco28pDi3qE5xfV512AJsORCfPoPFyNhLsj/qtri6hc5KVSWW0Ja3MSFBINDCaX78c7PXPY+3jJJGpwSBDLjdxj9AQwtfiCVlH4qE/QIDAQAB"
_dmarc TXT "v=DMARC1; p=none"