From bbf93a19d5ddeb8c06c8a5e0816cd7a1f3883534 Mon Sep 17 00:00:00 2001 From: Guo Yunhe Date: Fri, 12 Dec 2025 04:22:12 +0800 Subject: [PATCH] Add openSUSE Tumbleweed/Leap support (#1166) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --------- Co-authored-by: Stanislas Lange --- .github/workflows/docker-test.yml | 4 ++++ Makefile | 8 ++++++++ README.md | 26 +++++++++++++----------- openvpn-install.sh | 33 +++++++++++++++++++++++++++++-- test/Dockerfile.server | 4 ++++ 5 files changed, 61 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index a2d2b5f..f9325f2 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -56,6 +56,10 @@ jobs: image: almalinux:10 - name: archlinux image: archlinux:latest + - name: opensuse-leap-16.0 + image: opensuse/leap:16.0 + - name: opensuse-tumbleweed + image: opensuse/tumbleweed - name: oraclelinux-8 image: oraclelinux:8 - name: oraclelinux-9 diff --git a/Makefile b/Makefile index c73f669..8c3e871 100644 --- a/Makefile +++ b/Makefile @@ -111,6 +111,12 @@ test-arch: test-centos-stream-9: $(MAKE) test BASE_IMAGE=quay.io/centos/centos:stream9 +test-opensuse-leap: + $(MAKE) test BASE_IMAGE=opensuse/leap:16.0 + +test-opensuse-tumbleweed: + $(MAKE) test BASE_IMAGE=opensuse/tumbleweed + # Test all distributions (runs sequentially) test-all: $(MAKE) test-ubuntu-18.04 @@ -130,3 +136,5 @@ test-all: $(MAKE) test-amazon-2023 $(MAKE) test-arch $(MAKE) test-centos-stream-9 + $(MAKE) test-opensuse-leap + $(MAKE) test-opensuse-tumbleweed diff --git a/README.md b/README.md index 67690c9..5f002c1 100644 --- a/README.md +++ b/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, Amazon Linux, Arch Linux, Oracle Linux, Rocky Linux and AlmaLinux. +OpenVPN installer for Debian, Ubuntu, Fedora, openSUSE, CentOS, Amazon Linux, Arch Linux, Oracle Linux, Rocky Linux and AlmaLinux. This script will let you setup your own secure VPN server in just a few seconds. @@ -147,17 +147,19 @@ export PASS="1" The script supports these Linux distributions: -| | Support | -| ------------------ | ------- | -| AlmaLinux >= 8 | ✅ 🤖 | -| Amazon Linux 2023 | ✅ 🤖 | -| Arch Linux | ✅ 🤖 | -| CentOS Stream >= 8 | ✅ 🤖 | -| Debian >= 11 | ✅ 🤖 | -| Fedora >= 40 | ✅ 🤖 | -| Oracle Linux >= 8 | ✅ 🤖 | -| Rocky Linux >= 8 | ✅ 🤖 | -| Ubuntu >= 18.04 | ✅ 🤖 | +| | Support | +| ------------------- | ------- | +| AlmaLinux >= 8 | ✅ 🤖 | +| Amazon Linux 2023 | ✅ 🤖 | +| Arch Linux | ✅ 🤖 | +| CentOS Stream >= 8 | ✅ 🤖 | +| Debian >= 11 | ✅ 🤖 | +| Fedora >= 40 | ✅ 🤖 | +| openSUSE Leap >= 16 | ✅ 🤖 | +| openSUSE Tumbleweed | ✅ 🤖 | +| Oracle Linux >= 8 | ✅ 🤖 | +| Rocky Linux >= 8 | ✅ 🤖 | +| Ubuntu >= 18.04 | ✅ 🤖 | To be noted: diff --git a/openvpn-install.sh b/openvpn-install.sh index 8a22e93..2ed9da2 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -189,11 +189,21 @@ 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 == "opensuse-tumbleweed" ]]; then + OS="opensuse" + fi + if [[ $ID == "opensuse-leap" ]]; then + OS="opensuse" + if [[ ${VERSION_ID%.*} -lt 16 ]]; then + log_info "The script only supports openSUSE Leap 16+." + log_fatal "Your version of openSUSE Leap is not supported." + fi + fi if [[ $ID == "centos" || $ID == "rocky" || $ID == "almalinux" ]]; then OS="centos" fi @@ -213,10 +223,13 @@ function checkOS() { log_fatal "Your version of Amazon Linux is not supported." fi fi + if [[ $ID == "arch" ]]; then + OS="arch" + fi elif [[ -e /etc/arch-release ]]; then OS=arch else - log_fatal "It looks like you aren't running this installer on a Debian, Ubuntu, Fedora, CentOS, Amazon Linux 2023, Oracle Linux, Arch Linux, Rocky Linux or AlmaLinux system." + log_fatal "It looks like you aren't running this installer on a Debian, Ubuntu, Fedora, openSUSE, CentOS, Amazon Linux 2023, Oracle Linux, Arch Linux, Rocky Linux or AlmaLinux system." fi } @@ -363,6 +376,8 @@ function installUnbound() { run_cmd "Installing Unbound" yum install -y unbound elif [[ $OS =~ (fedora|amzn2023) ]]; then run_cmd "Installing Unbound" dnf install -y unbound + elif [[ $OS == "opensuse" ]]; then + run_cmd "Installing Unbound" zypper install -y unbound elif [[ $OS == "arch" ]]; then run_cmd "Installing Unbound" pacman -Syu --noconfirm unbound fi @@ -419,6 +434,13 @@ function installUnbound() { echo ' access-control: fd42:42:42:42::/112 allow' echo ' private-address: fd42:42:42:42::/112' fi + + # Disable remote-control (requires SSL certs on openSUSE) + if [[ $OS == "opensuse" ]]; then + echo '' + echo 'remote-control:' + echo ' control-enable: no' + fi } >/etc/unbound/unbound.conf.d/openvpn.conf run_cmd "Enabling Unbound service" systemctl enable unbound @@ -964,6 +986,8 @@ function installOpenVPN() { run_cmd "Installing OpenVPN" dnf install -y openvpn iptables openssl ca-certificates curl elif [[ $OS == 'fedora' ]]; then run_cmd "Installing OpenVPN" dnf install -y openvpn iptables openssl ca-certificates curl policycoreutils-python-utils + elif [[ $OS == 'opensuse' ]]; then + run_cmd "Installing OpenVPN" zypper install -y openvpn iptables openssl ca-certificates curl elif [[ $OS == 'arch' ]]; then run_cmd "Installing OpenVPN" pacman --needed --noconfirm -Syu openvpn iptables openssl ca-certificates curl fi @@ -1767,6 +1791,8 @@ function removeUnbound() { run_cmd "Removing Unbound" yum remove -y unbound elif [[ $OS =~ (fedora|amzn2023) ]]; then run_cmd "Removing Unbound" dnf remove -y unbound + elif [[ $OS == 'opensuse' ]]; then + run_cmd "Removing Unbound" zypper remove -y unbound fi run_cmd "Removing Unbound config" rm -rf /etc/unbound/ @@ -1793,6 +1819,7 @@ function removeOpenVPN() { # Remove customised service run_cmd "Removing service file" rm /etc/systemd/system/openvpn-server@.service else + # Debian, Ubuntu, openSUSE use openvpn@server run_cmd "Disabling OpenVPN service" systemctl disable openvpn@server run_cmd "Stopping OpenVPN service" systemctl stop openvpn@server # Remove customised service @@ -1845,6 +1872,8 @@ function removeOpenVPN() { run_cmd "Removing OpenVPN" dnf remove -y openvpn # Disable Copr repo run_cmd "Disabling OpenVPN Copr repo" dnf copr disable -y @OpenVPN/openvpn-release-2.6 2>/dev/null || true + elif [[ $OS == 'opensuse' ]]; then + run_cmd "Removing OpenVPN" zypper remove -y openvpn fi # Cleanup diff --git a/test/Dockerfile.server b/test/Dockerfile.server index fee1c81..7f7dbf4 100644 --- a/test/Dockerfile.server +++ b/test/Dockerfile.server @@ -25,6 +25,10 @@ RUN if command -v apt-get >/dev/null; then \ pacman -Syu --noconfirm \ iproute2 iptables curl procps-ng bind \ && pacman -Scc --noconfirm; \ + elif command -v zypper >/dev/null; then \ + zypper install -y \ + iproute2 iptables curl procps systemd tar gzip bind-utils gawk \ + && zypper clean -a; \ fi # Create TUN device (will be mounted at runtime)