From 3b2c84b94d17c636a148148873d08c55bee9acbf Mon Sep 17 00:00:00 2001 From: randomshell <43271778+randomshell@users.noreply.github.com> Date: Mon, 27 Apr 2020 14:03:55 +0000 Subject: [PATCH] fix(selinux): fix deletion of selinux policy (#555) --- openvpn-install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 7c2cffc..1928158 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -1198,6 +1198,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 @@ -1227,8 +1228,8 @@ function removeOpenVPN() { # SELinux 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" + if [[ "$PORT" != '1194' ]]; then + semanage port -d -t openvpn_port_t -p "$PROTOCOL" "$PORT" fi fi fi