Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If OVPN_NAT is not true, iptables camouflage will not be added #75

Open
AEGEGE opened this issue Sep 18, 2023 · 2 comments
Open

If OVPN_NAT is not true, iptables camouflage will not be added #75

AEGEGE opened this issue Sep 18, 2023 · 2 comments

Comments

@AEGEGE
Copy link

AEGEGE commented Sep 18, 2023

It is necessary to modify the code 'if [ "$OVPN_NAT" == "true" ]; then' in the configuration script/opt/configuration/setup_networking.sh to 'if [ "$OVPN_NAT" != "true" ]; then'

`if [ "${OVPN_ROUTES}x" != "x" ] ; then

IFS=","
read -r -a route_list <<< "$OVPN_ROUTES"

echo "" >/tmp/routes_config.txt

for this_route in ${route_list[@]} ; do

echo "routes: adding route $this_route to server config"
echo "push "route $this_route"" >> /tmp/routes_config.txt

if [ "$OVPN_NAT" == "true" ]; then
IFS=" "
this_net=echo $this_route | awk '{ print $1 }'
this_cidr=ipcalc -nb $this_route | grep ^Netmask | awk '{ print $NF }'
IFS=","
to_masquerade="${this_net}/${this_cidr}"
echo "iptables: masquerade from $ovpn_net to $to_masquerade via $this_natdevice"
echo -n "Checking for existing iptables rule: "
iptables -t nat -C POSTROUTING -s "$ovpn_net" -d "$to_masquerade" -o $this_natdevice -j MASQUERADE 2>&1 ||
iptables -t nat -A POSTROUTING -s "$ovpn_net" -d "$to_masquerade" -o $this_natdevice -j MASQUERADE
fi

done

IFS=" "

else`

@wheelybird
Copy link
Owner

I'm not quite sure what the question is. Is this a PR? If so could you commit it as a PR so I can look at the diff?

@AEGEGE
Copy link
Author

AEGEGE commented Sep 18, 2023

I'm not quite sure what the question is. Is this a PR? If so could you commit it as a PR so I can look at the diff?

Added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants