Add rules for blocking UDP / TCP Ports exern out.
This commit is contained in:
parent
52022cd6c7
commit
19bf795a99
@ -37,6 +37,29 @@ block_upnp_traffic_out=true
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# =============
|
||||||
|
# --- Block UDP Ports out
|
||||||
|
# =============
|
||||||
|
|
||||||
|
# - UDP Ports to block (only extern out)
|
||||||
|
# -
|
||||||
|
# - Comma separated list of udp ports
|
||||||
|
# -
|
||||||
|
block_udp_extern_out_ports=""
|
||||||
|
|
||||||
|
|
||||||
|
# =============
|
||||||
|
# --- Block TCP Ports out
|
||||||
|
# =============
|
||||||
|
|
||||||
|
# - TCP Ports to block (only extern out)
|
||||||
|
# -
|
||||||
|
# - Comma separated list of tcp ports
|
||||||
|
# -
|
||||||
|
block_tcp_extern_out_ports=""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# =============
|
# =============
|
||||||
# --- Interfaces not firewalled
|
# --- Interfaces not firewalled
|
||||||
# =============
|
# =============
|
||||||
|
@ -37,6 +37,29 @@ block_upnp_traffic_out=true
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# =============
|
||||||
|
# --- Block UDP Ports out
|
||||||
|
# =============
|
||||||
|
|
||||||
|
# - UDP Ports to block (only extern out)
|
||||||
|
# -
|
||||||
|
# - Comma separated list of udp ports
|
||||||
|
# -
|
||||||
|
block_udp_extern_out_ports=""
|
||||||
|
|
||||||
|
|
||||||
|
# =============
|
||||||
|
# --- Block TCP Ports out
|
||||||
|
# =============
|
||||||
|
|
||||||
|
# - TCP Ports to block (only extern out)
|
||||||
|
# -
|
||||||
|
# - Comma separated list of tcp ports
|
||||||
|
# -
|
||||||
|
block_tcp_extern_out_ports=""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# =============
|
# =============
|
||||||
# --- Interfaces not firewalled
|
# --- Interfaces not firewalled
|
||||||
# =============
|
# =============
|
||||||
|
@ -61,6 +61,35 @@ for _dev in $nat_devices ; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# =============
|
||||||
|
# --- Block UDP Ports out
|
||||||
|
# =============
|
||||||
|
|
||||||
|
declare -a block_udp_extern_out_port_arr=()
|
||||||
|
CUR_IFS="$IFS"
|
||||||
|
IFS=',' ; for _port in $block_udp_extern_out_ports ; do
|
||||||
|
|
||||||
|
block_udp_extern_out_port_arr+=("${_port}")
|
||||||
|
|
||||||
|
done
|
||||||
|
IFS="$CUR_IFS"
|
||||||
|
|
||||||
|
|
||||||
|
# =============
|
||||||
|
# --- Block TCP Ports out
|
||||||
|
# =============
|
||||||
|
|
||||||
|
declare -a block_tcp_extern_out_port_arr=()
|
||||||
|
CUR_IFS="$IFS"
|
||||||
|
IFS=',' ; for _port in $block_tcp_extern_out_ports ; do
|
||||||
|
|
||||||
|
block_tcp_extern_out_port_arr+=("${_port}")
|
||||||
|
|
||||||
|
done
|
||||||
|
IFS="$CUR_IFS"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# - VPN Interfaces
|
# - VPN Interfaces
|
||||||
# ---
|
# ---
|
||||||
|
@ -396,6 +396,61 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# - Block UDP Ports out
|
||||||
|
# ---
|
||||||
|
|
||||||
|
echononl "\tBlock UDP Ports extern out.."
|
||||||
|
|
||||||
|
if [[ ${#block_udp_extern_out_port_arr[@]} -gt 0 ]] ; then
|
||||||
|
|
||||||
|
for _port in ${block_udp_extern_out_port_arr[@]} ; do
|
||||||
|
|
||||||
|
for _dev in ${ext_if_arr[@]} ; do
|
||||||
|
|
||||||
|
$ip6t -A OUTPUT -o $_dev -p udp --dport $_port -j DROP
|
||||||
|
|
||||||
|
if $kernel_forward_between_interfaces ; then
|
||||||
|
$ip6t -A FORWARD -o $_dev -p udp --dport $_port -j DROP
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
done
|
||||||
|
echo_done
|
||||||
|
else
|
||||||
|
echo_skipped
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# - Block TCP Ports out
|
||||||
|
# ---
|
||||||
|
|
||||||
|
echononl "\tBlock TCP Ports extern out.."
|
||||||
|
|
||||||
|
if [[ ${#block_tcp_extern_out_port_arr[@]} -gt 0 ]] ; then
|
||||||
|
|
||||||
|
for _port in ${block_tcp_extern_out_port_arr[@]} ; do
|
||||||
|
|
||||||
|
for _dev in ${ext_if_arr[@]} ; do
|
||||||
|
|
||||||
|
$ip6t -A OUTPUT -o $_dev -p tcp --dport $_port -j DROP
|
||||||
|
|
||||||
|
if $kernel_forward_between_interfaces ; then
|
||||||
|
$ip6t -A FORWARD -o $_dev -p tcp --dport $_port -j DROP
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
done
|
||||||
|
echo_done
|
||||||
|
else
|
||||||
|
echo_skipped
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# - Allow Forwarding certain private Addresses
|
# - Allow Forwarding certain private Addresses
|
||||||
# ---
|
# ---
|
||||||
|
@ -717,6 +717,62 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# - Block UDP Ports out
|
||||||
|
# ---
|
||||||
|
|
||||||
|
echononl "\tBlock UDP Ports extern out.."
|
||||||
|
|
||||||
|
if [[ ${#block_udp_extern_out_port_arr[@]} -gt 0 ]] ; then
|
||||||
|
echo""
|
||||||
|
|
||||||
|
for _port in ${block_udp_extern_out_port_arr[@]} ; do
|
||||||
|
|
||||||
|
for _dev in ${ext_if_arr[@]} ; do
|
||||||
|
|
||||||
|
$ipt -A OUTPUT -o $_dev -p udp --dport $_port -j DROP
|
||||||
|
|
||||||
|
if $kernel_activate_forwarding ; then
|
||||||
|
$ipt -A FORWARD -o $_dev -p udp --dport $_port -j DROP
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
done
|
||||||
|
echo_done
|
||||||
|
else
|
||||||
|
echo_skipped
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# - Block TCP Ports out
|
||||||
|
# ---
|
||||||
|
|
||||||
|
echononl "\tBlock TCP Ports extern out.."
|
||||||
|
|
||||||
|
if [[ ${#block_tcp_extern_out_port_arr[@]} -gt 0 ]] ; then
|
||||||
|
|
||||||
|
for _port in ${block_tcp_extern_out_port_arr[@]} ; do
|
||||||
|
|
||||||
|
for _dev in ${ext_if_arr[@]} ; do
|
||||||
|
|
||||||
|
$ipt -A OUTPUT -o $_dev -p tcp --dport $_port -j DROP
|
||||||
|
|
||||||
|
if $kernel_activate_forwarding ; then
|
||||||
|
$ipt -A FORWARD -o $_dev -p tcp --dport $_port -j DROP
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
done
|
||||||
|
echo_done
|
||||||
|
else
|
||||||
|
echo_skipped
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# - Block IPs/Netwoks reading from file 'ban_ipv4.list'"
|
# - Block IPs/Netwoks reading from file 'ban_ipv4.list'"
|
||||||
# ---
|
# ---
|
||||||
|
Loading…
Reference in New Issue
Block a user