Introduced SOURCE_IFACE variable

This commit is contained in:
2023-04-27 11:59:15 +00:00
parent fa8de49a28
commit c57549e032

View File

@@ -151,7 +151,8 @@ if [[ -z "$SOURCE_IP" ]]; then
if [[ -z "$SOURCE" ]]; then
#SOURCE_IP="0.0.0.0/0";
echo "No source IP added";
elif [ "$SOURCE" == "SOURCE_IFACE" ]; then
elif [ "$(set | grep -w SOURCE_IFACE)" != "" ]; then
SOURCE=$SOURCE_IFACE;
echo "VPN interface added instead of IP or domain name";
else
IDX=0
@@ -246,7 +247,7 @@ fi
prerouting() {
if [ "$SOURCE" == "SOURCE_IFACE" ]; then
if [ "$(set |grep -w SOURCE_IFACE)" != "" ]; then
debug "$IPTABLES -I PREROUTING -i $SOURCE_IFACE -p $PROTOCOL --dport $SOURCE_PORT -m comment --comment $COMMENT -j DNAT --to $TARGET_IP:$TARGET_PORT"
$IPTABLES -w -I PREROUTING -i $SOURCE_IFACE -p $PROTOCOL --dport $SOURCE_PORT -m comment --comment "$COMMENT" -j DNAT --to $TARGET_IP:$TARGET_PORT