forked from nicolargo/openvpnscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathovinstallclient.sh
More file actions
46 lines (39 loc) · 967 Bytes
/
ovinstallclient.sh
File metadata and controls
46 lines (39 loc) · 967 Bytes
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
43
44
45
46
#!/bin/bash
# Script d'installation d'un nouveau client
#
# Frédéric Le Barzic- 08/2012
# GPL
#
# Syntaxe: # ./ovinstallclient.sh <clienname>
VERSION="0.1"
SERVER="0.0.0.0"
# Test que le script est lance en root
if [ $EUID -ne 0 ]; then
echo "Le script doit être lancé en root: # $0 <nomduclient>" 1>&2
exit 1
fi
# Test parametre
if [ $# -ne 1 ]; then
echo "Il faut saisir le nom du client: # $0 <nomduclient>" 1>&2
exit 1
fi
echo "---"
echo "Installation de OpenVpn"
yum -y install openvpn
echo "---"
echo "Installation de OpenVpn"
sftp root@${SERVER}:/etc/openvpn/clientconf/$1/$1.zip /etc/openvpn
unzip /etc/openvpn/$1.zip
echo "---"
echo "Lancemlent de OpenVpn"
/etc/init.d/openvpn start
sleep 3
echo "---"
echo "Test de la connexion"
ping -q -c5 10.8.0.1 > /dev/null
if [ $? -eq 0 ]; then
echo "Le serveur VPN ping correctement"
exit 0
fi
echo "Erreur le serveur VPN est injoiniable"
exit 1