Skip to content

Commit 9eae930

Browse files
committed
ovpn_run: Don't call sysctl which requires --privileged
* Instead encourage the user to change how they invoke docker.
1 parent afc68a4 commit 9eae930

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

bin/ovpn_run

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,18 @@ fi
8787

8888
ip -6 route show default 2>/dev/null
8989
if [ $? = 0 ]; then
90-
echo "Enabling IPv6 Forwarding"
91-
# If this fails, ensure the docker container is run with --privileged
92-
# Could be side stepped with `ip netns` madness to drop privileged flag
90+
echo "Checking IPv6 Forwarding"
91+
if [ "$(</proc/sys/net/ipv6/conf/all/disable_ipv6)" != "0" ]; then
92+
echo "Sysctl error for disable_ipv6, please run docker with '--sysctl net.ipv6.conf.all.disable_ipv6=0'"
93+
fi
94+
95+
if [ "$(</proc/sys/net/ipv6/conf/default/forwarding)" != "1" ]; then
96+
echo "Sysctl error for default forwarding, please run docker with '--sysctl net.ipv6.conf.default.forwarding=1'"
97+
fi
9398

94-
sysctl -w net.ipv6.conf.all.disable_ipv6=0 || echo "Failed to enable IPv6 support"
95-
sysctl -w net.ipv6.conf.default.forwarding=1 || echo "Failed to enable IPv6 Forwarding default"
96-
sysctl -w net.ipv6.conf.all.forwarding=1 || echo "Failed to enable IPv6 Forwarding"
99+
if [ "$(</proc/sys/net/ipv6/conf/all/forwarding)" != "1" ]; then
100+
echo "Sysctl error for all forwarding, please run docker with '--sysctl net.ipv6.conf.all.forwarding=1'"
101+
fi
97102
fi
98103

99104
echo "Running 'openvpn ${ARGS[@]} ${USER_ARGS[@]}'"

0 commit comments

Comments
 (0)