Merge c245389b9c
into 80feebed16
commit
95eda68c21
28
README.md
28
README.md
|
@ -4,7 +4,7 @@
|
|||
![Lint](https://github.com/angristan/openvpn-install/workflows/Lint/badge.svg)
|
||||
[![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/angristan)
|
||||
|
||||
OpenVPN installer for Debian, Ubuntu, Fedora, CentOS, Arch Linux, Oracle Linux, Rocky Linux and AlmaLinux.
|
||||
OpenVPN installer for Debian, Ubuntu, Fedora, openSUSE, CentOS, Arch Linux, Oracle Linux, Rocky Linux and AlmaLinux.
|
||||
|
||||
This script will let you setup your own secure VPN server in just a few seconds.
|
||||
|
||||
|
@ -115,18 +115,20 @@ export PASS="1"
|
|||
|
||||
The script supports these Linux distributions:
|
||||
|
||||
| | Support |
|
||||
| ------------------ | ------- |
|
||||
| AlmaLinux 8 | ✅ |
|
||||
| Amazon Linux 2 | ✅ |
|
||||
| Arch Linux | ✅ |
|
||||
| CentOS 7 | ✅ 🤖 |
|
||||
| CentOS Stream >= 8 | ✅ 🤖 |
|
||||
| Debian >= 10 | ✅ 🤖 |
|
||||
| Fedora >= 35 | ✅ 🤖 |
|
||||
| Oracle Linux 8 | ✅ |
|
||||
| Rocky Linux 8 | ✅ |
|
||||
| Ubuntu >= 18.04 | ✅ 🤖 |
|
||||
| | Support |
|
||||
| ------------------- | ------- |
|
||||
| AlmaLinux 8 | ✅ |
|
||||
| Amazon Linux 2 | ✅ |
|
||||
| Arch Linux | ✅ |
|
||||
| CentOS 7 | ✅ 🤖 |
|
||||
| CentOS Stream >= 8 | ✅ 🤖 |
|
||||
| Debian >= 10 | ✅ 🤖 |
|
||||
| Fedora >= 35 | ✅ 🤖 |
|
||||
| openSUSE Leap 15.4+ | ✅ 🤖 |
|
||||
| openSUSE Tumbleweed | ✅ 🤖 |
|
||||
| Oracle Linux 8 | ✅ |
|
||||
| Rocky Linux 8 | ✅ |
|
||||
| Ubuntu >= 18.04 | ✅ 🤖 |
|
||||
|
||||
To be noted:
|
||||
|
||||
|
|
|
@ -50,12 +50,13 @@ function checkOS() {
|
|||
fi
|
||||
fi
|
||||
fi
|
||||
elif [[ -e /etc/system-release ]]; then
|
||||
elif [[ -e /etc/os-release ]]; then
|
||||
source /etc/os-release
|
||||
if [[ $ID == "fedora" || $ID_LIKE == "fedora" ]]; then
|
||||
OS="fedora"
|
||||
fi
|
||||
if [[ $ID == "centos" || $ID == "rocky" || $ID == "almalinux" ]]; then
|
||||
elif [[ $ID == "opensuse-leap" || $ID == "opensuse-tumbleweed" ]]; then
|
||||
OS="opensuse"
|
||||
elif [[ $ID == "centos" || $ID == "rocky" || $ID == "almalinux" ]]; then
|
||||
OS="centos"
|
||||
if [[ $VERSION_ID -lt 7 ]]; then
|
||||
echo "⚠️ Your version of CentOS is not supported."
|
||||
|
@ -64,8 +65,7 @@ function checkOS() {
|
|||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if [[ $ID == "ol" ]]; then
|
||||
elif [[ $ID == "ol" ]]; then
|
||||
OS="oracle"
|
||||
if [[ ! $VERSION_ID =~ (8) ]]; then
|
||||
echo "Your version of Oracle Linux is not supported."
|
||||
|
@ -73,8 +73,7 @@ function checkOS() {
|
|||
echo "The script only support Oracle Linux 8."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if [[ $ID == "amzn" ]]; then
|
||||
elif [[ $ID == "amzn" ]]; then
|
||||
OS="amzn"
|
||||
if [[ $VERSION_ID != "2" ]]; then
|
||||
echo "⚠️ Your version of Amazon Linux is not supported."
|
||||
|
@ -86,8 +85,10 @@ function checkOS() {
|
|||
fi
|
||||
elif [[ -e /etc/arch-release ]]; then
|
||||
OS=arch
|
||||
else
|
||||
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora, CentOS, Amazon Linux 2, Oracle Linux 8 or Arch Linux system"
|
||||
fi
|
||||
|
||||
if [[ -z "$OS" ]]; then
|
||||
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora, openSUSE, CentOS, Amazon Linux 2, Oracle Linux 8 or Arch Linux system"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
@ -139,6 +140,16 @@ prefetch: yes' >>/etc/unbound/unbound.conf
|
|||
sed -i 's|# hide-version: no|hide-version: yes|' /etc/unbound/unbound.conf
|
||||
sed -i 's|# use-caps-for-id: no|use-caps-for-id: yes|' /etc/unbound/unbound.conf
|
||||
|
||||
elif [[ $OS == "opensuse" ]]; then
|
||||
zypper install -y unbound
|
||||
|
||||
# Configuration
|
||||
sed -i 's|# interface: 0.0.0.0$|interface: 10.8.0.1|' /etc/unbound/unbound.conf
|
||||
sed -i 's|# access-control: 127.0.0.0/8 allow|access-control: 10.8.0.1/24 allow|' /etc/unbound/unbound.conf
|
||||
sed -i 's|# hide-identity: no|hide-identity: yes|' /etc/unbound/unbound.conf
|
||||
sed -i 's|# hide-version: no|hide-version: yes|' /etc/unbound/unbound.conf
|
||||
sed -i 's|# use-caps-for-id: no|use-caps-for-id: yes|' /etc/unbound/unbound.conf
|
||||
|
||||
elif [[ $OS == "arch" ]]; then
|
||||
pacman -Syu --noconfirm unbound
|
||||
|
||||
|
@ -174,7 +185,7 @@ prefetch: yes' >>/etc/unbound/unbound.conf
|
|||
access-control: fd42:42:42:42::/112 allow' >>/etc/unbound/unbound.conf
|
||||
fi
|
||||
|
||||
if [[ ! $OS =~ (fedora|centos|amzn|oracle) ]]; then
|
||||
if [[ ! $OS =~ (fedora|opensuse|centos|amzn|oracle) ]]; then
|
||||
# DNS Rebinding fix
|
||||
echo "private-address: 10.0.0.0/8
|
||||
private-address: fd42:42:42:42::/112
|
||||
|
@ -687,6 +698,8 @@ function installOpenVPN() {
|
|||
yum install -y openvpn iptables openssl wget ca-certificates curl
|
||||
elif [[ $OS == 'fedora' ]]; then
|
||||
dnf install -y openvpn iptables openssl wget ca-certificates curl policycoreutils-python-utils
|
||||
elif [[ $OS == 'opensuse' ]]; then
|
||||
zypper install -y openvpn iptables openssl wget ca-certificates curl policycoreutils-python-utils
|
||||
elif [[ $OS == 'arch' ]]; then
|
||||
# Install required dependencies and upgrade the system
|
||||
pacman --needed --noconfirm -Syu openvpn iptables openssl wget ca-certificates curl
|
||||
|
@ -924,7 +937,7 @@ verb 3" >>/etc/openvpn/server.conf
|
|||
fi
|
||||
|
||||
# Finally, restart and enable OpenVPN
|
||||
if [[ $OS == 'arch' || $OS == 'fedora' || $OS == 'centos' || $OS == 'oracle' ]]; then
|
||||
if [[ $OS == 'arch' || $OS == 'fedora' || $OS == 'opensuse' || $OS == 'centos' || $OS == 'oracle' ]]; then
|
||||
# Don't modify package-provided service
|
||||
cp /usr/lib/systemd/system/openvpn-server@.service /etc/systemd/system/openvpn-server@.service
|
||||
|
||||
|
@ -1213,6 +1226,8 @@ function removeUnbound() {
|
|||
yum remove -y unbound
|
||||
elif [[ $OS == 'fedora' ]]; then
|
||||
dnf remove -y unbound
|
||||
elif [[ $OS == 'opensuse' ]]; then
|
||||
zypper remove -y unbound
|
||||
fi
|
||||
|
||||
rm -rf /etc/unbound/
|
||||
|
@ -1235,7 +1250,7 @@ function removeOpenVPN() {
|
|||
PROTOCOL=$(grep '^proto ' /etc/openvpn/server.conf | cut -d " " -f 2)
|
||||
|
||||
# Stop OpenVPN
|
||||
if [[ $OS =~ (fedora|arch|centos|oracle) ]]; then
|
||||
if [[ $OS =~ (fedora|opensuse|arch|centos|oracle) ]]; then
|
||||
systemctl disable openvpn-server@server
|
||||
systemctl stop openvpn-server@server
|
||||
# Remove customised service
|
||||
|
@ -1280,6 +1295,8 @@ function removeOpenVPN() {
|
|||
yum remove -y openvpn
|
||||
elif [[ $OS == 'fedora' ]]; then
|
||||
dnf remove -y openvpn
|
||||
elif [[ $OS == 'opensuse' ]]; then
|
||||
zypper remove -y openvpn
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
|
|
Loading…
Reference in New Issue