From 3f377de6813b417729b4e840921544825e1df4da Mon Sep 17 00:00:00 2001 From: Angristan Date: Mon, 20 Aug 2018 22:16:28 +0200 Subject: [PATCH] Add installEasyRsa () --- openvpn-install.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index c33938f..700dda4 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -82,6 +82,15 @@ function getNIC () { return $(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1) } +function installEasyRsa () { + wget -O ~/EasyRSA-3.0.4.tgz https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.4/EasyRSA-3.0.4.tgz + tar xzf ~/EasyRSA-3.0.4.tgz -C ~/ + mv ~/EasyRSA-3.0.4/ /etc/openvpn/ + mv /etc/openvpn/EasyRSA-3.0.4/ /etc/openvpn/easy-rsa/ + chown -R root:root /etc/openvpn/easy-rsa/ + rm -f ~/EasyRSA-3.0.4.tgz +} + function newclient () { echo "" echo "Do you want to protect the configuration file with a password?" @@ -562,13 +571,9 @@ WantedBy=multi-user.target" > /etc/systemd/system/iptables.service if [[ -d /etc/openvpn/easy-rsa/ ]]; then rm -rf /etc/openvpn/easy-rsa/ fi - # Get easy-rsa - wget -O ~/EasyRSA-3.0.4.tgz https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.4/EasyRSA-3.0.4.tgz - tar xzf ~/EasyRSA-3.0.4.tgz -C ~/ - mv ~/EasyRSA-3.0.4/ /etc/openvpn/ - mv /etc/openvpn/EasyRSA-3.0.4/ /etc/openvpn/easy-rsa/ - chown -R root:root /etc/openvpn/easy-rsa/ - rm -f ~/EasyRSA-3.0.4.tgz + # Install easy-rsa + installEasyRsa + cd /etc/openvpn/easy-rsa/ || return # Generate a random, alphanumeric identifier of 16 characters for CN and one for server name SERVER_CN="cn_$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 16 | head -n 1)"