build-windows-client 1.6 KB
Newer Older
David Kempe's avatar
David Kempe committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash 

set -e

if [ -f /var/lib/openvpn-server/ca-store ]
then
    if grep -q ca-store /proc/mounts
    then
        echo "ca-store mounted"
    else
        echo "ca-store not mounted, or your session has expired."
        echo "Use ovs mount-ca-store to mount your ca-store"
        exit 1
    fi

fi

. /usr/share/openvpn-server/functions.sh
. /etc/openvpn-server/config.sh

WORKDIR=$(mktemp -d)

pushd $WORKDIR >/dev/null

25
26
27
28
29
30
if [ -z $1 ] || [ -z $2 ] ; then
    ask_key_questions
else
    OVPN_COMMONNAME=$1
    OVPN_EMAIL=$2
fi
David Kempe's avatar
David Kempe committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

FILEBASE="${OVPN_ORGNICK}-${OVPN_COMMONNAME}"

make_pkcs12 "$OVPN_EMAIL" "$OVPN_COMMONNAME" "./${FILEBASE}.p12"

sed "s/%%ORGNICK%%/$OVPN_ORGNICK/;
        s/%%USERNAME%%/$OVPN_COMMONNAME/"                                 \
        /usr/share/openvpn-server/windows-client/sol1-deploy.nsi        \
        > openvpn-deploy.nsi

sed "s/%%ORGNICK%%/$OVPN_ORGNICK/;
        s/%%USERNAME%%/$OVPN_COMMONNAME/;
        s/%%REMOTE%%/$OVPN_REMOTE/"                                     \
        /usr/share/openvpn-server/config-templates/ovpn-client.conf     \
        > ${FILEBASE}.ovpn

makensis -NOCD ./openvpn-deploy.nsi >/dev/null 2>&1

popd >/dev/null

51
52
if [ "$CACHE_BUILDS" == "yes" ]; then 
    mv $WORKDIR/sol1-openvpn-deploy.exe /var/lib/openvpn-server/openssl/builds/openvpn-${FILEBASE}.exe
David Kempe's avatar
David Kempe committed
53
	echo "Your OpenVPN Windows client has been built in /var/lib/openvpn-server/openssl/builds/openvpn-${FILEBASE}.exe"
54
55
else 
    mv $WORKDIR/sol1-openvpn-deploy.exe ./openvpn-${FILEBASE}.exe
David Kempe's avatar
David Kempe committed
56
57
58
59
60
61
	echo "Your OpenVPN Windows client has been built in openvpn-${FILEBASE}.exe"
fi

rm -rf $WORKDIR


62
allocate_ip()
David Kempe's avatar
David Kempe committed
63

64

David Kempe's avatar
David Kempe committed
65