Skip to content

Commit 8f09769

Browse files
committed
systemd: reduce container privilege by whitelisting NET_ADMIN capability
1 parent 925b08f commit 8f09769

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

init/[email protected]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ ExecStartPre=-/usr/bin/docker pull $IMG
6464
ExecStartPre=/bin/sh -c 'test -z "$IP6_PREFIX" && exit 0; sysctl net.ipv6.conf.all.forwarding=1'
6565

6666
# Main process
67-
ExecStart=/usr/bin/docker run --rm --privileged -v ${DATA_VOL}:/etc/openvpn --name ${NAME} -p ${PORT} ${IMG} ovpn_run $ARGS
67+
ExecStart=/usr/bin/docker run --rm --cap-add=NET_ADMIN -v ${DATA_VOL}:/etc/openvpn --name ${NAME} -p ${PORT} ${IMG} ovpn_run $ARGS
6868

6969
# IPv6: Add static route for IPv6 after it starts up
7070
ExecStartPost=/bin/sh -c 'test -z "${IP6_PREFIX}" && exit 0; sleep 1; ip route replace ${IP6_PREFIX} via $(docker inspect -f "{{ .NetworkSettings.GlobalIPv6Address }}" $NAME ) dev docker0'

0 commit comments

Comments
 (0)