From 629b39d3b34fdd1dbd2669955f73a7fbe1a9157a Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Sun, 20 Mar 2022 23:10:11 -0500 Subject: [PATCH] Add Oracle Linux - Add support for Oracle Linux 8 and 7. --- extras/ikev2changeaddr.sh | 5 +++-- extras/ikev2setup.sh | 9 +++++---- extras/quickstart.sh | 12 +++++++----- extras/vpnuninstall.sh | 8 ++++---- extras/vpnupgrade.sh | 10 ++++++---- extras/vpnupgrade_centos.sh | 15 +++++++++++++-- vpnsetup.sh | 12 +++++++----- vpnsetup_centos.sh | 19 +++++++++++++++---- 8 files changed, 60 insertions(+), 30 deletions(-) diff --git a/extras/ikev2changeaddr.sh b/extras/ikev2changeaddr.sh index 0f49d01..34a5499 100755 --- a/extras/ikev2changeaddr.sh +++ b/extras/ikev2changeaddr.sh @@ -41,6 +41,7 @@ check_os() { if grep -qs "Red Hat" "$rh_file"; then os_type=rhel fi + [ -f /etc/oracle-release ] && os_type=ol if grep -qs "release 7" "$rh_file"; then os_ver=7 elif grep -qs "release 8" "$rh_file"; then @@ -70,8 +71,8 @@ check_os() { *) cat 1>&2 <<'EOF' Error: This script only supports one of the following OS: - Ubuntu, Debian, CentOS/RHEL 7/8, Rocky Linux, AlmaLinux, - Amazon Linux 2 or Alpine Linux + Ubuntu, Debian, CentOS/RHEL, Rocky Linux, AlmaLinux, + Oracle Linux, Amazon Linux 2 or Alpine Linux EOF exit 1 ;; diff --git a/extras/ikev2setup.sh b/extras/ikev2setup.sh index f37f812..b67df10 100755 --- a/extras/ikev2setup.sh +++ b/extras/ikev2setup.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# Script to set up and manage IKEv2 on Ubuntu, Debian, CentOS/RHEL, -# Rocky Linux, AlmaLinux, Amazon Linux 2 and Alpine Linux +# Script to set up and manage IKEv2 on Ubuntu, Debian, CentOS/RHEL, Rocky Linux, +# AlmaLinux, Oracle Linux, Amazon Linux 2 and Alpine Linux # # DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! # @@ -52,6 +52,7 @@ check_os() { if grep -qs "Red Hat" "$rh_file"; then os_type=rhel fi + [ -f /etc/oracle-release ] && os_type=ol if grep -qs "release 7" "$rh_file"; then os_ver=7 elif grep -qs "release 8" "$rh_file"; then @@ -81,8 +82,8 @@ check_os() { *) cat 1>&2 <<'EOF' Error: This script only supports one of the following OS: - Ubuntu, Debian, CentOS/RHEL 7/8, Rocky Linux, AlmaLinux, - Amazon Linux 2 or Alpine Linux + Ubuntu, Debian, CentOS/RHEL, Rocky Linux, AlmaLinux, + Oracle Linux, Amazon Linux 2 or Alpine Linux EOF exit 1 ;; diff --git a/extras/quickstart.sh b/extras/quickstart.sh index bb3e0e5..e9d6092 100755 --- a/extras/quickstart.sh +++ b/extras/quickstart.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Quick start script to set up an IPsec VPN server on Ubuntu, Debian, -# CentOS/RHEL, Rocky Linux, AlmaLinux, Amazon Linux 2 and Alpine Linux +# Quick start script to set up an IPsec VPN server on Ubuntu, Debian, CentOS/RHEL, +# Rocky Linux, AlmaLinux, Oracle Linux, Amazon Linux 2 and Alpine Linux # Works on any dedicated server or virtual private server (VPS) # # DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! @@ -77,6 +77,7 @@ check_os() { if grep -qs "Red Hat" "$rh_file"; then os_type=rhel fi + [ -f /etc/oracle-release ] && os_type=ol if grep -qs "release 7" "$rh_file"; then os_ver=7 elif grep -qs "release 8" "$rh_file"; then @@ -109,8 +110,8 @@ check_os() { *) cat 1>&2 <<'EOF' Error: This script only supports one of the following OS: - Ubuntu, Debian, CentOS/RHEL 7/8, Rocky Linux, AlmaLinux, - Amazon Linux 2 or Alpine Linux + Ubuntu, Debian, CentOS/RHEL, Rocky Linux, AlmaLinux, + Oracle Linux, Amazon Linux 2 or Alpine Linux EOF exit 1 ;; @@ -254,7 +255,8 @@ install_pkgs() { get_setup_url() { base_url="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master" sh_file="vpnsetup_ubuntu.sh" - if [ "$os_type" = "centos" ] || [ "$os_type" = "rhel" ] || [ "$os_type" = "rocky" ] || [ "$os_type" = "alma" ]; then + if [ "$os_type" = "centos" ] || [ "$os_type" = "rhel" ] || [ "$os_type" = "rocky" ] \ + || [ "$os_type" = "alma" ] || [ "$os_type" = "ol" ]; then sh_file="vpnsetup_centos.sh" elif [ "$os_type" = "amzn" ]; then sh_file="vpnsetup_amzn.sh" diff --git a/extras/vpnuninstall.sh b/extras/vpnuninstall.sh index f24282c..e737fe1 100755 --- a/extras/vpnuninstall.sh +++ b/extras/vpnuninstall.sh @@ -1,7 +1,6 @@ #!/bin/bash # -# Script to uninstall IPsec VPN on Ubuntu, Debian, CentOS/RHEL, -# Rocky Linux, AlmaLinux, Amazon Linux 2 and Alpine Linux +# Script to uninstall IPsec VPN # # DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! # @@ -40,6 +39,7 @@ check_os() { if grep -qs "Red Hat" "$rh_file"; then os_type=rhel fi + [ -f /etc/oracle-release ] && os_type=ol if grep -qs "release 7" "$rh_file" || grep -qs "release 8" "$rh_file"; then grep -qi rocky "$rh_file" && os_type=rocky grep -qi alma "$rh_file" && os_type=alma @@ -64,8 +64,8 @@ check_os() { *) cat 1>&2 <<'EOF' Error: This script only supports one of the following OS: - Ubuntu, Debian, CentOS/RHEL 7/8, Rocky Linux, AlmaLinux, - Amazon Linux 2 or Alpine Linux + Ubuntu, Debian, CentOS/RHEL, Rocky Linux, AlmaLinux, + Oracle Linux, Amazon Linux 2 or Alpine Linux EOF exit 1 ;; diff --git a/extras/vpnupgrade.sh b/extras/vpnupgrade.sh index 2b731ab..8ce5589 100755 --- a/extras/vpnupgrade.sh +++ b/extras/vpnupgrade.sh @@ -1,7 +1,7 @@ #!/bin/sh # # Script to update Libreswan on Ubuntu, Debian, CentOS/RHEL, Rocky Linux, -# AlmaLinux, Amazon Linux 2 and Alpine Linux +# AlmaLinux, Oracle Linux, Amazon Linux 2 and Alpine Linux # # The latest version of this script is available at: # https://github.com/hwdsl2/setup-ipsec-vpn @@ -42,6 +42,7 @@ check_os() { if grep -qs "Red Hat" "$rh_file"; then os_type=rhel fi + [ -f /etc/oracle-release ] && os_type=ol if grep -qs "release 7" "$rh_file"; then os_ver=7 elif grep -qs "release 8" "$rh_file"; then @@ -74,8 +75,8 @@ check_os() { *) cat 1>&2 <<'EOF' Error: This script only supports one of the following OS: - Ubuntu, Debian, CentOS/RHEL 7/8, Rocky Linux, AlmaLinux, - Amazon Linux 2 or Alpine Linux + Ubuntu, Debian, CentOS/RHEL, Rocky Linux, AlmaLinux, + Oracle Linux, Amazon Linux 2 or Alpine Linux EOF exit 1 ;; @@ -135,7 +136,8 @@ install_pkgs() { get_setup_url() { base_url="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" sh_file="vpnupgrade_ubuntu.sh" - if [ "$os_type" = "centos" ] || [ "$os_type" = "rhel" ] || [ "$os_type" = "rocky" ] || [ "$os_type" = "alma" ]; then + if [ "$os_type" = "centos" ] || [ "$os_type" = "rhel" ] || [ "$os_type" = "rocky" ] \ + || [ "$os_type" = "alma" ] || [ "$os_type" = "ol" ]; then sh_file="vpnupgrade_centos.sh" elif [ "$os_type" = "amzn" ]; then sh_file="vpnupgrade_amzn.sh" diff --git a/extras/vpnupgrade_centos.sh b/extras/vpnupgrade_centos.sh index dd691e9..7f3c3a0 100755 --- a/extras/vpnupgrade_centos.sh +++ b/extras/vpnupgrade_centos.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Script to update Libreswan on CentOS/RHEL, Rocky Linux and AlmaLinux +# Script to update Libreswan on CentOS/RHEL, Rocky Linux, AlmaLinux and Oracle Linux # # The latest version of this script is available at: # https://github.com/hwdsl2/setup-ipsec-vpn @@ -45,6 +45,7 @@ check_os() { if grep -qs "Red Hat" "$rh_file"; then os_type=rhel fi + [ -f /etc/oracle-release ] && os_type=ol if grep -qs "release 7" "$rh_file"; then os_ver=7 elif grep -qs "release 8" "$rh_file"; then @@ -56,7 +57,11 @@ check_os() { exiterr "CentOS Linux 8 is EOL and not supported." fi else - exiterr "This script only supports CentOS/RHEL 7/8, Rocky Linux and AlmaLinux." +cat 1>&2 <<'EOF' +Error: This script only supports one of the following OS: + CentOS/RHEL, Rocky Linux, AlmaLinux or Oracle Linux +EOF + exit 1 fi } @@ -162,6 +167,12 @@ install_pkgs_2() { rp1="$erp=*server-*optional*" rp2="$erp=*releases-optional*" rp3="$erp=[Pp]ower[Tt]ools" + if [ "$os_type" = "ol" ] && [ "$os_ver" = "8" ]; then + rp3="$erp=ol8_codeready_builder" + fi + if [ "$os_type" = "ol" ] && [ "$os_ver" = "7" ]; then + rp2="$erp=ol7_optional_latest" + fi [ "$os_type" = "rhel" ] && rp3="$erp=codeready-builder-for-rhel-8-*" if [ "$os_ver" = "7" ]; then ( diff --git a/vpnsetup.sh b/vpnsetup.sh index 1b57d0b..04da4f7 100755 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Script for automatic setup of an IPsec VPN server on Ubuntu, Debian, -# CentOS/RHEL, Rocky Linux, AlmaLinux, Amazon Linux 2 and Alpine Linux +# Script for automatic setup of an IPsec VPN server on Ubuntu, Debian, CentOS/RHEL, +# Rocky Linux, AlmaLinux, Oracle Linux, Amazon Linux 2 and Alpine Linux # Works on any dedicated server or virtual private server (VPS) # # DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! @@ -77,6 +77,7 @@ check_os() { if grep -qs "Red Hat" "$rh_file"; then os_type=rhel fi + [ -f /etc/oracle-release ] && os_type=ol if grep -qs "release 7" "$rh_file"; then os_ver=7 elif grep -qs "release 8" "$rh_file"; then @@ -109,8 +110,8 @@ check_os() { *) cat 1>&2 <<'EOF' Error: This script only supports one of the following OS: - Ubuntu, Debian, CentOS/RHEL 7/8, Rocky Linux, AlmaLinux, - Amazon Linux 2 or Alpine Linux + Ubuntu, Debian, CentOS/RHEL, Rocky Linux, AlmaLinux, + Oracle Linux, Amazon Linux 2 or Alpine Linux EOF exit 1 ;; @@ -254,7 +255,8 @@ install_pkgs() { get_setup_url() { base_url="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master" sh_file="vpnsetup_ubuntu.sh" - if [ "$os_type" = "centos" ] || [ "$os_type" = "rhel" ] || [ "$os_type" = "rocky" ] || [ "$os_type" = "alma" ]; then + if [ "$os_type" = "centos" ] || [ "$os_type" = "rhel" ] || [ "$os_type" = "rocky" ] \ + || [ "$os_type" = "alma" ] || [ "$os_type" = "ol" ]; then sh_file="vpnsetup_centos.sh" elif [ "$os_type" = "amzn" ]; then sh_file="vpnsetup_amzn.sh" diff --git a/vpnsetup_centos.sh b/vpnsetup_centos.sh index dd96266..dec0b46 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# Script for automatic setup of an IPsec VPN server on CentOS/RHEL, -# Rocky Linux and AlmaLinux +# Script for automatic setup of an IPsec VPN server on CentOS/RHEL, Rocky Linux, +# AlmaLinux and Oracle Linux # Works on any dedicated server or virtual private server (VPS) # # DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! @@ -71,6 +71,7 @@ check_os() { if grep -qs "Red Hat" "$rh_file"; then os_type=rhel fi + [ -f /etc/oracle-release ] && os_type=ol if grep -qs "release 7" "$rh_file"; then os_ver=7 elif grep -qs "release 8" "$rh_file"; then @@ -82,7 +83,11 @@ check_os() { exiterr "CentOS Linux 8 is EOL and not supported." fi else - exiterr "This script only supports CentOS/RHEL 7/8, Rocky Linux and AlmaLinux." +cat 1>&2 <<'EOF' +Error: This script only supports one of the following OS: + CentOS/RHEL, Rocky Linux, AlmaLinux or Oracle Linux +EOF + exit 1 fi } @@ -197,8 +202,14 @@ install_vpn_pkgs_1() { rp2="$erp=*server-*optional*" rp3="$erp=*releases-optional*" rp4="$erp=[Pp]ower[Tt]ools" + if [ "$os_type" = "ol" ] && [ "$os_ver" = "8" ]; then + rp1="$erp=ol8_developer_EPEL" + rp4="$erp=ol8_codeready_builder" + fi + if [ "$os_type" = "ol" ] && [ "$os_ver" = "7" ]; then + rp3="$erp=ol7_optional_latest" + fi [ "$os_type" = "rhel" ] && rp4="$erp=codeready-builder-for-rhel-8-*" - ( set -x yum -y -q install nss-devel nspr-devel pkgconfig pam-devel \