From 399c3c87b97af75bf8d76006c785320b894e8ca4 Mon Sep 17 00:00:00 2001 From: Blake Fleischer Date: Mon, 10 Mar 2025 05:24:45 -0400 Subject: [PATCH] Add support for Amazon Linux 2023 out of the box (#1259) Co-authored-by: Stanislas Lange --- README.md | 25 +++++++++++++------------ openvpn-install.sh | 13 +++++++++---- 2 files changed, 22 insertions(+), 16 deletions(-) mode change 100755 => 100644 openvpn-install.sh diff --git a/README.md b/README.md index e670650..4d787ad 100644 --- a/README.md +++ b/README.md @@ -132,18 +132,19 @@ 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 | ✅ | +| Amazon Linux >= 2023.6 | ✅ | +| Arch Linux | ✅ | +| CentOS 7 | ✅ | +| CentOS Stream >= 8 | ✅ 🤖 | +| Debian >= 10 | ✅ 🤖 | +| Fedora >= 35 | ✅ 🤖 | +| Oracle Linux 8 | ✅ | +| Rocky Linux 8 | ✅ | +| Ubuntu >= 18.04 | ✅ 🤖 | To be noted: diff --git a/openvpn-install.sh b/openvpn-install.sh old mode 100755 new mode 100644 index a0e04a4..bf3171c --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -75,11 +75,14 @@ function checkOS() { fi fi if [[ $ID == "amzn" ]]; then - OS="amzn" - if [[ $VERSION_ID != "2" ]]; then + if [[ $VERSION_ID == "2" ]]; then + OS="amzn" + elif [[ "$(echo "$PRETTY_NAME" | cut -c 1-18)" == "Amazon Linux 2023." ]] && [[ "$(echo "$PRETTY_NAME" | cut -c 19)" -ge 6 ]]; then + OS="amzn2023" + else echo "⚠️ Your version of Amazon Linux is not supported." echo "" - echo "The script only support Amazon Linux 2." + echo "The script only support Amazon Linux 2 or Amazon Linux 2023.6+" echo "" exit 1 fi @@ -719,6 +722,8 @@ function installOpenVPN() { elif [[ $OS == 'amzn' ]]; then amazon-linux-extras install -y epel yum install -y openvpn iptables openssl wget ca-certificates curl + elif [[ $OS == 'amzn2023' ]]; then + dnf install -y openvpn iptables openssl wget ca-certificates elif [[ $OS == 'fedora' ]]; then dnf install -y openvpn iptables openssl wget ca-certificates curl policycoreutils-python-utils elif [[ $OS == 'arch' ]]; then @@ -958,7 +963,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 == 'centos' || $OS == 'oracle' || $OS == 'amzn2023' ]]; then # Don't modify package-provided service cp /usr/lib/systemd/system/openvpn-server@.service /etc/systemd/system/openvpn-server@.service