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

View File

@ -1198,6 +1198,7 @@ function removeOpenVPN() {
if [[ $REMOVE == 'y' ]]; then if [[ $REMOVE == 'y' ]]; then
# Get OpenVPN port from the configuration # Get OpenVPN port from the configuration
PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2) PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2)
PROTOCOL=$(grep '^proto ' /etc/openvpn/server.conf | cut -d " " -f 2)
# Stop OpenVPN # Stop OpenVPN
if [[ $OS =~ (fedora|arch|centos) ]]; then if [[ $OS =~ (fedora|arch|centos) ]]; then
@ -1227,8 +1228,8 @@ function removeOpenVPN() {
# SELinux # SELinux
if hash sestatus 2>/dev/null; then if hash sestatus 2>/dev/null; then
if sestatus | grep "Current mode" | grep -qs "enforcing"; then if sestatus | grep "Current mode" | grep -qs "enforcing"; then
if [[ $PORT != '1194' ]]; 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 fi
fi fi