Created
September 3, 2019 03:04
-
-
Save rezarahimian/a3912b5aaee4761df32178cf7677b7f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Source networking configuration. | |
. /etc/clearos/network.conf | |
# Bail if not ipv4 | |
if [ "$FW_PROTO" != 'ipv4' ]; then | |
return 0 | |
fi | |
if [ -n "$LANIF" ]; then | |
# Add isolation rules | |
for iLAN in $LANIF; do | |
for oLAN in $LANIF; do | |
if [ "$iLAN" != "$oLAN" ]; then | |
$IPTABLES -I FORWARD -i $iLAN -o $oLAN -j DROP | |
fi | |
done | |
done | |
fi | |
# Really all the above should be inserted below the existing "RELATED,ESTABLISHED" rule | |
# but this is a dirty fix. Delete the existing and add a new one. | |
$IPTABLES -D FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT | |
$IPTABLES -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment