diff --git a/tools/install_openvpn.sh b/tools/install_openvpn.sh index 3b52cf11b8..a3a2346fb6 100644 --- a/tools/install_openvpn.sh +++ b/tools/install_openvpn.sh @@ -1,60 +1,154 @@ -# rough history from wilk - need to cleanup -apt-get install -y openvpn bridge-utils -cp -R /usr/share/doc/openvpn/examples/easy-rsa/2.0/ /etc/openvpn/easy-rsa/ -cd /etc/openvpn/easy-rsa -source vars -./clean-all -./build-dh -./pkitool --initca -./pkitool --server server -./pkitool client1 -cd keys -openvpn --genkey --secret ta.key ## Build a TLS key -cp server.crt server.key ca.crt dh1024.pem ta.key ../../ -cd ../../ +#!/bin/bash +# install_openvpn.sh - Install OpenVPN and generate required certificates +# +# install_openvpn.sh --client name +# install_openvpn.sh --server [name] +# +# name is used on the CN of the generated cert, and the filename of +# the configuration, certificate and key files. +# +# --server mode configures the host with a running OpenVPN server instance +# --client mode creates a tarball of a client configuration for this server -cat >/etc/openvpn/server.conf <$VPN_DIR/$NAME.conf <$TMP_DIR/$HOST.conf <$VPN_DIR/hostname + fi + do_server $NAME + ;; + --clean) $CA_DIR/clean-all + ;; + *) usage +esac