Introduced SOURCE_IFACE variable

This commit is contained in:
2023-04-27 10:44:43 +00:00
parent 5825811547
commit fa8de49a28

View File

@@ -150,7 +150,9 @@ fi;
if [[ -z "$SOURCE_IP" ]]; then
if [[ -z "$SOURCE" ]]; then
#SOURCE_IP="0.0.0.0/0";
echo "No source IP added"
echo "No source IP added";
elif [ "$SOURCE" == "SOURCE_IFACE" ]; then
echo "VPN interface added instead of IP or domain name";
else
IDX=0
for i in $(echo $SOURCE) ; do
@@ -244,7 +246,11 @@ fi
prerouting() {
if [ "$SOURCE_IP" != "" ]; then
if [ "$SOURCE" == "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
elif [ "$SOURCE_IP" != "" ]; then
if [ "$SOURCE_PORT" != "" ]; then
if [ "$TARGET_IP" != "" ]; then
if [ "$TARGET_PORT" != "" ]; then