From 8d0b04e83c811e77fa500a7f547af239721f81dd Mon Sep 17 00:00:00 2001 From: randomshell <43271778+randomshell@users.noreply.github.com> Date: Mon, 2 Mar 2020 23:47:50 +0000 Subject: [PATCH] Fix deletion of selinux policy Change hard-coded udp protocol to `server.conf` protocol value --- openvpn-install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 90ea433..e9fab0e 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -1147,6 +1147,7 @@ function removeOpenVPN () { if [[ "$REMOVE" = 'y' ]]; then # Get OpenVPN port from the configuration PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2) + PROTOCOL=$(grep '^proto ' /etc/openvpn/server.conf | cut -d " " -f 2) # Stop OpenVPN if [[ "$OS" =~ (fedora|arch|centos) ]]; then @@ -1177,7 +1178,7 @@ function removeOpenVPN () { if hash sestatus 2>/dev/null; then if sestatus | grep "Current mode" | grep -qs "enforcing"; then if [[ "$PORT" != '1194' ]]; then - semanage port -d -t openvpn_port_t -p udp "$PORT" + semanage port -d -t openvpn_port_t -p "$PROTOCOL" "$PORT" fi fi fi