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