Update iptables.sh

This commit is contained in:
MarkusMcNugen 2018-02-03 02:50:52 -05:00 committed by GitHub
parent a874eabbe0
commit f1b2d458fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,8 @@ done
# ip route # ip route
### ###
DEBUG=true
# split comma seperated string into list from LAN_NETWORK env variable # split comma seperated string into list from LAN_NETWORK env variable
IFS=',' read -ra lan_network_list <<< "${LAN_NETWORK}" IFS=',' read -ra lan_network_list <<< "${LAN_NETWORK}"
@ -47,7 +49,7 @@ if [[ $iptable_mangle_exit_code == 0 ]]; then
echo "[info] iptable_mangle support detected, adding fwmark for tables" | ts '%Y-%m-%d %H:%M:%.S' echo "[info] iptable_mangle support detected, adding fwmark for tables" | ts '%Y-%m-%d %H:%M:%.S'
# setup route for deluge webui using set-mark to route traffic for port 8112 to eth0 # setup route for deluge webui using set-mark to route traffic for port 8080 to eth0
echo "8080 webui" >> /etc/iproute2/rt_tables echo "8080 webui" >> /etc/iproute2/rt_tables
ip rule add fwmark 1 table webui ip rule add fwmark 1 table webui
ip route add default via $DEFAULT_GATEWAY table webui ip route add default via $DEFAULT_GATEWAY table webui
@ -94,7 +96,7 @@ iptables -A INPUT -s "${docker_network_cidr}" -d "${docker_network_cidr}" -j ACC
# accept input to vpn gateway # accept input to vpn gateway
iptables -A INPUT -i eth0 -p $VPN_PROTOCOL --sport $VPN_PORT -j ACCEPT iptables -A INPUT -i eth0 -p $VPN_PROTOCOL --sport $VPN_PORT -j ACCEPT
# accept input to deluge webui port 8112 # accept input to deluge webui port 8080
iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --sport 8080 -j ACCEPT iptables -A INPUT -i eth0 -p tcp --sport 8080 -j ACCEPT
@ -137,8 +139,8 @@ iptables -A OUTPUT -o eth0 -p $VPN_PROTOCOL --dport $VPN_PORT -j ACCEPT
if [[ $iptable_mangle_exit_code == 0 ]]; then if [[ $iptable_mangle_exit_code == 0 ]]; then
# accept output from deluge webui port 8112 - used for external access # accept output from deluge webui port 8112 - used for external access
iptables -t mangle -A OUTPUT -p tcp --dport 8112 -j MARK --set-mark 1 iptables -t mangle -A OUTPUT -p tcp --dport 8080 -j MARK --set-mark 1
iptables -t mangle -A OUTPUT -p tcp --sport 8112 -j MARK --set-mark 1 iptables -t mangle -A OUTPUT -p tcp --sport 8080 -j MARK --set-mark 1
fi fi