1
0
mirror of https://github.com/Nyr/openvpn-install.git synced 2024-11-27 15:36:07 +03:00

Add support for AlmaLinux and Rocky Linux

An unrelated fix to avoid one harmless warning during removal is also included.
This commit is contained in:
Nyr 2021-09-03 18:58:25 +02:00
parent 2cce4599e2
commit 94c94bbbc9
2 changed files with 7 additions and 6 deletions

View File

@ -1,7 +1,7 @@
**New: [wireguard-install](https://github.com/Nyr/wireguard-install) is also available.** **New: [wireguard-install](https://github.com/Nyr/wireguard-install) is also available.**
## openvpn-install ## openvpn-install
OpenVPN [road warrior](http://en.wikipedia.org/wiki/Road_warrior_%28computing%29) installer for Ubuntu, Debian, CentOS and Fedora. OpenVPN [road warrior](http://en.wikipedia.org/wiki/Road_warrior_%28computing%29) installer for Ubuntu, Debian, AlmaLinux, Rocky Linux, CentOS and Fedora.
This script will let you set up your own VPN server in no more than a minute, even if you haven't used OpenVPN before. It has been designed to be as unobtrusive and universal as possible. This script will let you set up your own VPN server in no more than a minute, even if you haven't used OpenVPN before. It has been designed to be as unobtrusive and universal as possible.

View File

@ -30,9 +30,9 @@ elif [[ -e /etc/debian_version ]]; then
os="debian" os="debian"
os_version=$(grep -oE '[0-9]+' /etc/debian_version | head -1) os_version=$(grep -oE '[0-9]+' /etc/debian_version | head -1)
group_name="nogroup" group_name="nogroup"
elif [[ -e /etc/centos-release ]]; then elif [[ -e /etc/almalinux-release || -e /etc/rocky-release || -e /etc/centos-release ]]; then
os="centos" os="centos"
os_version=$(grep -oE '[0-9]+' /etc/centos-release | head -1) os_version=$(grep -shoE '[0-9]+' /etc/almalinux-release /etc/rocky-release /etc/centos-release | head -1)
group_name="nobody" group_name="nobody"
elif [[ -e /etc/fedora-release ]]; then elif [[ -e /etc/fedora-release ]]; then
os="fedora" os="fedora"
@ -40,7 +40,7 @@ elif [[ -e /etc/fedora-release ]]; then
group_name="nobody" group_name="nobody"
else else
echo "This installer seems to be running on an unsupported distribution. echo "This installer seems to be running on an unsupported distribution.
Supported distributions are Ubuntu, Debian, CentOS, and Fedora." Supported distros are Ubuntu, Debian, AlmaLinux, Rocky Linux, CentOS and Fedora."
exit exit
fi fi
@ -202,7 +202,7 @@ if [[ ! -e /etc/openvpn/server/server.conf ]]; then
[[ -z "$client" ]] && client="client" [[ -z "$client" ]] && client="client"
echo echo
echo "OpenVPN installation is ready to begin." echo "OpenVPN installation is ready to begin."
# Install a firewall in the rare case where one is not already available # Install a firewall if firewalld or iptables are not already available
if ! systemctl is-active --quiet firewalld.service && ! hash iptables 2>/dev/null; then if ! systemctl is-active --quiet firewalld.service && ! hash iptables 2>/dev/null; then
if [[ "$os" == "centos" || "$os" == "fedora" ]]; then if [[ "$os" == "centos" || "$os" == "fedora" ]]; then
firewall="firewalld" firewall="firewalld"
@ -542,14 +542,15 @@ else
semanage port -d -t openvpn_port_t -p "$protocol" "$port" semanage port -d -t openvpn_port_t -p "$protocol" "$port"
fi fi
systemctl disable --now openvpn-server@server.service systemctl disable --now openvpn-server@server.service
rm -rf /etc/openvpn/server
rm -f /etc/systemd/system/openvpn-server@server.service.d/disable-limitnproc.conf rm -f /etc/systemd/system/openvpn-server@server.service.d/disable-limitnproc.conf
rm -f /etc/sysctl.d/99-openvpn-forward.conf rm -f /etc/sysctl.d/99-openvpn-forward.conf
if [[ "$os" = "debian" || "$os" = "ubuntu" ]]; then if [[ "$os" = "debian" || "$os" = "ubuntu" ]]; then
rm -rf /etc/openvpn/server
apt-get remove --purge -y openvpn apt-get remove --purge -y openvpn
else else
# Else, OS must be CentOS or Fedora # Else, OS must be CentOS or Fedora
yum remove -y openvpn yum remove -y openvpn
rm -rf /etc/openvpn/server
fi fi
echo echo
echo "OpenVPN removed!" echo "OpenVPN removed!"