20 lines
537 B
Plaintext
20 lines
537 B
Plaintext
#!/usr/bin/with-contenv bash
|
|
|
|
# Make sure OpenVPN config directory exists.
|
|
mkdir -p /config/openvpn/
|
|
|
|
# Copy over the default OpenVPN config if it does not exist
|
|
cp -n /etc/defaults/openvpn.conf /config/openvpn/
|
|
|
|
# Create server CA/keys and keys for client "client" if they do not exist
|
|
if [ ! -d "/config/openvpn/keys" ]; then
|
|
cd /usr/share/easy-rsa
|
|
source vars
|
|
./clean-all
|
|
./build-dh
|
|
./pkitool --initca
|
|
./pkitool --server server
|
|
./pkitool client
|
|
openvpn --genkey --secret /config/openvpn/keys/ta.key
|
|
fi
|