X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=mail-route;h=dc74c7b5adb6f73912d442cea652b66ab2d2e453;hb=f37d0d46227306bfc4d098aec71fa4e1832fc2b8;hp=a508e2e9b0a95d50add908ec3744c8ef90fd591d;hpb=9094b3867bbafb65ad0c99fc4da0da642f83d40d;p=distro-setup diff --git a/mail-route b/mail-route index a508e2e..dc74c7b 100755 --- a/mail-route +++ b/mail-route @@ -59,8 +59,13 @@ esac # exim is replying to. I don't know why. #iptables -t mangle -A OUTPUT -m owner --uid-owner Debian-exim -j MARK --set-mark 0x1 +# match source or dest port. when we send to 25, it picks a random high port as +# the source. -e iptables -t mangle $iptables_op OUTPUT -m tcp -p tcp -m multiport --sports 25 -j MARK --set-mark 0x1 +for port in 25 143; do # smtp and imap. + e iptables -t mangle $iptables_op \ + OUTPUT -m tcp -p tcp -m multiport --ports $port -j MARK --set-mark 0x1 +done e iptables -t nat $iptables_op POSTROUTING -o tun0 -m mark --mark 0x1 -j SNAT --to-source 10.8.0.4 e ip rule $ip_op fwmark 1 table 1 # note, this rule does not persist when the tun interface is deleted