diff --git a/lib/tasks/ubuntu/rapidftr.conf b/lib/tasks/ubuntu/rapidftr.conf index c9da2f91e..31ac3d5cf 100644 --- a/lib/tasks/ubuntu/rapidftr.conf +++ b/lib/tasks/ubuntu/rapidftr.conf @@ -9,10 +9,10 @@ post-start script RAPIDFTR_LXC_HOST="10.0.3.3" ( - iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination $RAPIDFTR_LXC_HOST:80 - iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination $RAPIDFTR_LXC_HOST:443 - iptables -t nat -A PREROUTING -p tcp --dport 5984 -j DNAT --to-destination $RAPIDFTR_LXC_HOST:5984 - iptables -t nat -A PREROUTING -p tcp --dport 6984 -j DNAT --to-destination $RAPIDFTR_LXC_HOST:6984 + iptables -t nat -A PREROUTING -p tcp --dport 80 ! -s $RAPIDFTR_LXC_HOST -j DNAT --to-destination $RAPIDFTR_LXC_HOST:80 + iptables -t nat -A PREROUTING -p tcp --dport 443 ! -s $RAPIDFTR_LXC_HOST -j DNAT --to-destination $RAPIDFTR_LXC_HOST:443 + iptables -t nat -A PREROUTING -p tcp --dport 5984 ! -s $RAPIDFTR_LXC_HOST -j DNAT --to-destination $RAPIDFTR_LXC_HOST:5984 + iptables -t nat -A PREROUTING -p tcp --dport 6984 ! -s $RAPIDFTR_LXC_HOST -j DNAT --to-destination $RAPIDFTR_LXC_HOST:6984 iptables -A FORWARD -p tcp -o lxcbr0 -j ACCEPT ) || echo "Unable to configure port forwarding rules" @@ -22,10 +22,10 @@ end script post-stop script RAPIDFTR_LXC_HOST="10.0.3.3" ( - iptables -t nat -D PREROUTING -p tcp --dport 80 -j DNAT --to-destination $RAPIDFTR_LXC_HOST:80 - iptables -t nat -D PREROUTING -p tcp --dport 443 -j DNAT --to-destination $RAPIDFTR_LXC_HOST:443 - iptables -t nat -D PREROUTING -p tcp --dport 5984 -j DNAT --to-destination $RAPIDFTR_LXC_HOST:5984 - iptables -t nat -D PREROUTING -p tcp --dport 6984 -j DNAT --to-destination $RAPIDFTR_LXC_HOST:6984 + iptables -t nat -D PREROUTING -p tcp --dport 80 ! -s $RAPIDFTR_LXC_HOST -j DNAT --to-destination $RAPIDFTR_LXC_HOST:80 + iptables -t nat -D PREROUTING -p tcp --dport 443 ! -s $RAPIDFTR_LXC_HOST -j DNAT --to-destination $RAPIDFTR_LXC_HOST:443 + iptables -t nat -D PREROUTING -p tcp --dport 5984 ! -s $RAPIDFTR_LXC_HOST -j DNAT --to-destination $RAPIDFTR_LXC_HOST:5984 + iptables -t nat -D PREROUTING -p tcp --dport 6984 ! -s $RAPIDFTR_LXC_HOST -j DNAT --to-destination $RAPIDFTR_LXC_HOST:6984 iptables -D FORWARD -p tcp -o lxcbr0 -j ACCEPT ) || echo "Unable to remove port forwarding rules"