From 135fb645344bb6c8cc06517df8ef12c215f034cc Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Tue, 27 Sep 2011 12:57:53 -0500 Subject: [PATCH] Major refactor of vpn install --- tools/install_openvpn.sh | 174 ++++++++++++++++++++++++++++++--------- 1 file changed, 134 insertions(+), 40 deletions(-) diff --git a/tools/install_openvpn.sh b/tools/install_openvpn.sh index 3b52cf1..a3a2346 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