I have a bastion
servers which accept users via OpenVPN. The bastion has two network adapters: one leg on the internet and the other leg on a private network. Each user has different IP address and different places where he can visit inside the private network.
For example: the user John has the static IP 10.8.0.1
, on OpenVPN. John can only access this IP address 10.8.1.1
, inside the internal network. Any other place that John will try to access should be blocked.
I tried to do something like this:
iptables -A FORWARD -p tcp --source 10.8.0.1 --destination 10.8.1.1 -j ACCEPT
The default policy for INPUT,OUTPUT and FORWARD is block.
I was expected that will allow John access his resource. But actually all his requests are being blocked.
What I'm doing wrong?
Update 1
Adding the full code:
#!/bin/sh
# flush all
iptables -F
iptables -X
# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
# Allow unlimited traffic on loopback
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A FORWARD -p tcp --source 10.8.0.1 --destination 10.8.1.1 -j ACCEPT
# make sure nothing comes or goes out of this box
iptables -A INPUT -j DROP
iptables -A OUTPUT -j DROP