fix(selinux): fix deletion of selinux policy (#555)

This commit is contained in:
randomshell 2020-04-27 14:03:55 +00:00 committed by GitHub
parent 87bfd046dd
commit 3b2c84b94d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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