mirror of
https://github.com/namibia/openvpn-install.git
synced 2024-12-22 06:48:55 +00:00
Add Centos 8 Support (#506)
This commit is contained in:
parent
40a9fb975a
commit
12ba1a9d9a
@ -109,6 +109,7 @@ The script supports these OS and architectures:
|
||||
| -------------- | ---- | ----- | ----- | ----- |
|
||||
| Amazon Linux 2 | ❔ | ✅ | ❔ | ❔ |
|
||||
| Arch Linux | ❔ | ✅ | ❔ | ✅ |
|
||||
| Centos 8 | ❌ | ✅ | ❔ | ❔ |
|
||||
| CentOS 7 | ❔ | ✅ | ❌ | ✅ |
|
||||
| Debian 8 | ✅ | ✅ | ❌ | ❌ |
|
||||
| Debian 9 | ❌ | ✅ | ✅ | ✅ |
|
||||
|
@ -54,7 +54,7 @@ function checkOS () {
|
||||
source /etc/os-release
|
||||
if [[ "$ID" = "centos" ]]; then
|
||||
OS="centos"
|
||||
if [[ ! $VERSION_ID == "7" ]]; then
|
||||
if [[ ! $VERSION_ID =~ (7|8) ]]; then
|
||||
echo "⚠️ Your version of CentOS is not supported."
|
||||
echo ""
|
||||
echo "The script only support CentOS 7."
|
||||
@ -621,7 +621,7 @@ function installOpenVPN () {
|
||||
apt-get install -y openvpn iptables openssl wget ca-certificates curl
|
||||
elif [[ "$OS" = 'centos' ]]; then
|
||||
yum install -y epel-release
|
||||
yum install -y openvpn iptables openssl wget ca-certificates curl
|
||||
yum install -y openvpn iptables openssl wget ca-certificates curl tar
|
||||
elif [[ "$OS" = 'amzn' ]]; then
|
||||
amazon-linux-extras install -y epel
|
||||
yum install -y openvpn iptables openssl wget ca-certificates curl
|
||||
@ -668,12 +668,13 @@ function installOpenVPN () {
|
||||
SERVER_NAME="server_$(head /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)"
|
||||
echo "set_var EASYRSA_REQ_CN $SERVER_CN" >> vars
|
||||
|
||||
# Workaround to remove unharmful error until easy-rsa 3.0.7
|
||||
# https://github.com/OpenVPN/easy-rsa/issues/261
|
||||
sed -i 's/^RANDFILE/#RANDFILE/g' pki/openssl-easyrsa.cnf
|
||||
|
||||
# Create the PKI, set up the CA, the DH params and the server certificate
|
||||
./easyrsa init-pki
|
||||
|
||||
# Workaround to remove unharmful error until easy-rsa 3.0.7
|
||||
# https://github.com/OpenVPN/easy-rsa/issues/261
|
||||
sed -i 's/^RANDFILE/#RANDFILE/g' pki/openssl-easyrsa.cnf
|
||||
|
||||
./easyrsa --batch build-ca nopass
|
||||
|
||||
if [[ $DH_TYPE == "2" ]]; then
|
||||
@ -848,7 +849,7 @@ verb 3" >> /etc/openvpn/server.conf
|
||||
fi
|
||||
|
||||
# Finally, restart and enable OpenVPN
|
||||
if [[ "$OS" = 'arch' || "$OS" = 'fedora' ]]; then
|
||||
if [[ "$OS" = 'arch' || "$OS" = 'fedora' || "$OS" = 'centos' ]]; then
|
||||
# Don't modify package-provided service
|
||||
cp /usr/lib/systemd/system/openvpn-server@.service /etc/systemd/system/openvpn-server@.service
|
||||
|
||||
@ -1144,7 +1145,7 @@ function removeOpenVPN () {
|
||||
PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2)
|
||||
|
||||
# Stop OpenVPN
|
||||
if [[ "$OS" =~ (fedora|arch) ]]; then
|
||||
if [[ "$OS" =~ (fedora|arch|centos) ]]; then
|
||||
systemctl disable openvpn-server@server
|
||||
systemctl stop openvpn-server@server
|
||||
# Remove customised service
|
||||
|
Loading…
Reference in New Issue
Block a user