-
Notifications
You must be signed in to change notification settings - Fork 1
/
lxcvpn.sh
33 lines (27 loc) · 696 Bytes
/
lxcvpn.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
HOST=
PVE_USER_NAME=
PVE_USER_AUTH_REALM=
PVE_USER_TOKEN=
PVE_USER_TOKEN_SECRET=
NODE=
VMID=
startVPNLXC(){
data=`curl -s -k --location --request POST "$HOST/api2/json/nodes/$NODE/lxc/$VMID/status/start" \
--header "Authorization: PVEAPIToken=$PVE_USER_NAME@$PVE_USER_AUTH_REALM!$PVE_USER_TOKEN=$PVE_USER_TOKEN_SECRET"`
}
stopVPNLXC(){
data=`curl -s -k --location --request POST "$HOST/api2/json/nodes/$NODE/lxc/$VMID/status/stop" \
--header "Authorization: PVEAPIToken=$PVE_USER_NAME@$PVE_USER_AUTH_REALM!$PVE_USER_TOKEN=$PVE_USER_TOKEN_SECRET"`
}
echo $1
if [ $1 == "up" ]
then
startVPNLXC
sleep 10
# INSERT SSH TUNNEL HERE
fi
if [ $1 == "down" ]
then
stopVPNLXC
fi