X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=mail-route;h=1dea430b1bb22288d93b95b570bee19102e241a5;hb=28904b44d0dd6ce9d43ab720b5efe9af2ce336de;hp=11f92c60513709bd9b400bb61a00879745034edd;hpb=2d3ce30754a3f24d922635647bab4990b60f5c27;p=distro-setup diff --git a/mail-route b/mail-route index 11f92c6..1dea430 100755 --- a/mail-route +++ b/mail-route @@ -21,7 +21,7 @@ usage() { cat <<'EOF' Usage: mail-route up|down|show -Marks tcp packets on port 25 and 143 to be routed through +Marks tcp packets on port 25, 143 and 587 to be routed through a vpn ip. If called from --up/--down in openvpn, (we have multiple args) $1 is the tun_dev, and action is from $script_type. @@ -115,10 +115,10 @@ iptmod() { #iptables modify modify() { # match source or dest port. note, when we send to a port, it picks a random high port as # the source. - for port in 25 143; do # smtp and imap. + for port in 25 143 587; do # smtp and imap. iptcommon="OUTPUT -m tcp -p tcp -m multiport --ports $port -j MARK --set-mark" iptmod iptables -t mangle $iptables_op $iptcommon 0x1 - iptmod iptables -t mangle $iptables_op $iptcommon 0x0 -d 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 + iptmod iptables -t mangle $iptables_op $iptcommon 0x0 -d 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,127.0.0.0/8 # note, we could have used a custom chain and returned instead of setting the mark again. # in case anyone was ever curious, the inverse of private ips is: #0.0.0.0/5,8.0.0.0/7,11.0.0.0/8,12.0.0.0/6,16.0.0.0/4,32.0.0.0/3,64.0.0.0/2,128.0.0.0/3,160.0.0.0/5,168.0.0.0/6,172.0.0.0/12,172.32.0.0/11,172.64.0.0/10,172.128.0.0/9,173.0.0.0/8,174.0.0.0/7,176.0.0.0/4,192.0.0.0/9,192.128.0.0/11,192.160.0.0/13,192.169.0.0/16,192.170.0.0/15,192.172.0.0/14,192.176.0.0/12,192.192.0.0/10,193.0.0.0/8,194.0.0.0/7,196.0.0.0/6,200.0.0.0/5,208.0.0.0/4,224.0.0.0/3 done