docker-vpn/start-openvpn.sh

21 lines
296 B
Bash
Raw Normal View History

2021-08-07 18:24:20 +02:00
#!/usr/bin/env sh
create_net_dev() {
mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 600 /dev/net/tun
}
2021-08-07 19:54:15 +02:00
connect_vpn() {
openvpn --config "$OVPN_CONFIGURATION_FILE" --daemon
}
2021-08-07 20:09:36 +02:00
switch_user() {
cd "$OVPN_HOME"
su "$OVPN_USER"
}
2021-08-07 18:24:20 +02:00
create_net_dev
2021-08-07 19:54:15 +02:00
connect_vpn
2021-08-07 20:09:36 +02:00
switch_user