File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,18 @@ function addArg {
35
35
fi
36
36
}
37
37
38
+ function setupIptablesAndRouting {
39
+ iptables -t nat -C POSTROUTING -s $OVPN_SERVER -o $OVPN_NATDEVICE -j MASQUERADE || {
40
+ iptables -t nat -A POSTROUTING -s $OVPN_SERVER -o $OVPN_NATDEVICE -j MASQUERADE
41
+ }
42
+ for i in " ${OVPN_ROUTES[@]} " ; do
43
+ iptables -t nat -C POSTROUTING -s " $i " -o $OVPN_NATDEVICE -j MASQUERADE || {
44
+ iptables -t nat -A POSTROUTING -s " $i " -o $OVPN_NATDEVICE -j MASQUERADE
45
+ }
46
+ done
47
+ }
48
+
49
+
38
50
addArg " --config" " $OPENVPN /openvpn.conf"
39
51
40
52
source " $OPENVPN /ovpn_env.sh"
53
65
54
66
# Setup NAT forwarding if requested
55
67
if [ " $OVPN_DEFROUTE " != " 0" ] || [ " $OVPN_NAT " == " 1" ] ; then
56
- iptables -t nat -C POSTROUTING -s $OVPN_SERVER -o $OVPN_NATDEVICE -j MASQUERADE || {
57
- iptables -t nat -A POSTROUTING -s $OVPN_SERVER -o $OVPN_NATDEVICE -j MASQUERADE
58
- }
59
- for i in " ${OVPN_ROUTES[@]} " ; do
60
- iptables -t nat -C POSTROUTING -s " $i " -o $OVPN_NATDEVICE -j MASQUERADE || {
61
- iptables -t nat -A POSTROUTING -s " $i " -o $OVPN_NATDEVICE -j MASQUERADE
62
- }
63
- done
68
+ setupIptablesAndRouting
64
69
fi
65
70
66
71
# Use a hacky hardlink as the CRL Needs to be readable by the user/group
85
90
86
91
echo " Running 'openvpn ${ARGS[@]} ${USER_ARGS[@]} '"
87
92
exec openvpn ${ARGS[@]} ${USER_ARGS[@]}
88
-
You can’t perform that action at this time.
0 commit comments