wheelybird / openvpn-server-ldap-otp

A dockerised OpenVPN server using LDAP for authentication, with optional 2FA via Google Authenticator
MIT License
171 stars 74 forks source link

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

Open AEGEGE opened 1 year ago

AEGEGE commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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