mirror of
https://github.com/Nyr/openvpn-install.git
synced 2024-11-24 05:56:08 +03:00
Install easy-rsa instead of downloading tarball from GitHub
This commit is contained in:
parent
54d7f66d96
commit
dc2ff7fb75
@ -147,9 +147,9 @@ if [[ -e /etc/openvpn/server.conf ]]; then
|
||||
semanage port -d -t openvpn_port_t -p $PROTOCOL $PORT
|
||||
fi
|
||||
if [[ "$OS" = 'debian' ]]; then
|
||||
apt remove --purge openvpn stunnel4 -y
|
||||
apt remove --purge openvpn stunnel4 easy-rsa -y
|
||||
else
|
||||
yum remove openvpn stunnel4 -y
|
||||
yum remove openvpn stunnel4 easy-rsa -y
|
||||
fi
|
||||
rm -rf /etc/openvpn /etc/stunnel
|
||||
rm -f /etc/sysctl.d/30-openvpn-forward.conf
|
||||
@ -238,28 +238,21 @@ else
|
||||
if [[ "$OS" = 'debian' ]]; then
|
||||
apt update
|
||||
apt dist-upgrade -y
|
||||
apt install openvpn iptables openssl ca-certificates stunnel4 -y
|
||||
apt install openvpn iptables openssl ca-certificates stunnel4 easy-rsa -y
|
||||
else
|
||||
# Else, the distro is CentOS
|
||||
yum install epel-release -y
|
||||
yum install openvpn iptables openssl ca-certificates stunnel4 -y
|
||||
yum install openvpn iptables openssl ca-certificates stunnel4 easy-rsa -y
|
||||
fi
|
||||
# Get easy-rsa
|
||||
EASYRSAURL='https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.4/EasyRSA-3.0.4.tgz'
|
||||
wget -O ~/easyrsa.tgz "$EASYRSAURL" 2>/dev/null || curl -Lo ~/easyrsa.tgz "$EASYRSAURL"
|
||||
tar xzf ~/easyrsa.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.tgz
|
||||
mkdir /etc/openvpn/easy-rsa/
|
||||
cd /etc/openvpn/easy-rsa/
|
||||
# Create the PKI, set up the CA, the DH params and the server + client certificates
|
||||
./easyrsa init-pki
|
||||
./easyrsa --batch build-ca nopass
|
||||
./easyrsa gen-dh
|
||||
./easyrsa build-server-full server nopass
|
||||
./easyrsa build-client-full $CLIENT nopass
|
||||
EASYRSA_CRL_DAYS=3650 ./easyrsa gen-crl
|
||||
easyrsa init-pki
|
||||
easyrsa --batch build-ca nopass
|
||||
easyrsa gen-dh
|
||||
easyrsa build-server-full server nopass
|
||||
easyrsa build-client-full $CLIENT nopass
|
||||
EASYRSA_CRL_DAYS=3650 easyrsa gen-crl
|
||||
# Move the stuff we need
|
||||
csplit -f /etc/openvpn/easy-rsa/pki/issued/cert. /etc/openvpn/easy-rsa/pki/issued/server.crt '/-----BEGIN CERTIFICATE-----/' '{*}'
|
||||
rm /etc/openvpn/easy-rsa/pki/issued/cert.00 /etc/openvpn/easy-rsa/pki/issued/server.crt
|
||||
|
Loading…
Reference in New Issue
Block a user