docker-vpn/start-openvpn.sh
2021-08-07 20:09:36 +02:00

20 lines
296 B
Bash

#!/usr/bin/env sh
create_net_dev() {
mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 600 /dev/net/tun
}
connect_vpn() {
openvpn --config "$OVPN_CONFIGURATION_FILE" --daemon
}
switch_user() {
cd "$OVPN_HOME"
su "$OVPN_USER"
}
create_net_dev
connect_vpn
switch_user