Changeset 2177


Ignore:
Timestamp:
Sep 19, 2012, 3:26:38 PM (7 years ago)
Author:
matthijs
Message:

openvpn: Slightly restructure client config generation.

This uses a subdirectory of /tmp to collect the files, which removes the
need to name all files separately on the zip cmdline. This makes it
easier to optionally add files to the zip later on.

References: #1206

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/fon/openvpn/files/usr/bin/openvpn-client.sh

    r2176 r2177  
    88[ "$HOST" = "" ] && HOST=`uci -P /var/state/ get network.wan.ipaddr`
    99[ "$PROTO" = "tcp-server" ] && PROTO="tcp-client"
    10 cd /tmp
     10DIR=$(mktemp -d -t)
     11cd "$DIR"
    1112cp /etc/openvpn/keys/ca.crt ca_$1.crt
    1213cp /etc/openvpn/keys/$1.crt $1.crt
     
    1415cat /etc/openvpn/client.ovpn | sed "s/%PROTO%/$PROTO/g" | sed "s/%IP%/$HOST/g" | sed "s/%PORT%/$PORT/g" | sed "s/%CLIENT%/$1/g" > ${NAME}.ovpn
    1516rm -f /tmp/$1_ovpn.zip
    16 zip /tmp/$1_ovpn.zip ca_$1.crt $1.crt $1.key ${NAME}.ovpn
    17 rm ca_$1.crt $1.crt $1.key ${NAME}.ovpn
     17zip /tmp/$1_ovpn.zip *
     18rm -rf "$DIR"
Note: See TracChangeset for help on using the changeset viewer.