forked from eduvpn/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreset_instance_debian.sh
executable file
·42 lines (32 loc) · 1.1 KB
/
reset_instance_debian.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
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
# you can use this script to "reset" a VPN instance, i.e. remove all data and
# reinitialize it to the state after fresh install using deploy_${DIST}.sh
#
# NOTE: *ALL* VPN configuration will stop working, all users need to obtain
# a new configuration! All OAuth access tokens will become invalid!
#
if [ -z "${INSTANCE}" ]; then
INSTANCE=default
fi
(
INSTANCE=${INSTANCE} "$(dirname "$0")/openvpn_disable_stop_remove.sh"
)
systemctl stop apache2
systemctl stop php7.0-fpm
# remove data
rm -rf /var/lib/vpn-server-api/${INSTANCE}
rm -rf /var/lib/vpn-user-portal/${INSTANCE}
rm -rf /var/lib/vpn-admin-portal/${INSTANCE}
# initialize
sudo -u www-data vpn-user-portal-init --instance ${INSTANCE}
sudo -u www-data vpn-server-api-init --instance ${INSTANCE}
# regenerate internal API secrets
vpn-server-api-update-api-secrets --instance ${INSTANCE}
systemctl start php7.0-fpm
systemctl start apache2
# regenerate/restart firewall
vpn-server-node-generate-firewall --install
systemctl restart netfilter-persistent
(
INSTANCE=${INSTANCE} "$(dirname "$0")/openvpn_generate_enable_start.sh"
)