From f5ebe9d01d6939c25f449cc020bf501d6daf2d40 Mon Sep 17 00:00:00 2001 From: Angristan Date: Mon, 14 Mar 2016 21:38:40 +0100 Subject: [PATCH] Fix which bug on CentOS 7 minimal https://github.com/Nyr/openvpn-install/commit/7fb12dc5cbd08904a88f8eead1c75f43590f7457 --- openvpn-install-legacy.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openvpn-install-legacy.sh b/openvpn-install-legacy.sh index d8c53c5..617b8e7 100644 --- a/openvpn-install-legacy.sh +++ b/openvpn-install-legacy.sh @@ -136,7 +136,7 @@ if [[ -e /etc/openvpn/server.conf ]]; then sed -i "/iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT/d" $RCLOCAL fi sed -i '/iptables -t nat -A POSTROUTING -s 10.8.0.0\/24 -j SNAT --to /d' $RCLOCAL - if which sestatus; then + 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 @@ -307,11 +307,11 @@ crl-verify crl.pem" >> /etc/openvpn/server.conf sed -i "1 a\iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT" $RCLOCAL fi # If SELinux is enabled and a custom port was selected, we need this - if which sestatus; then + if hash sestatus 2>/dev/null; then if sestatus | grep "Current mode" | grep -qs "enforcing"; then if [[ "$PORT" != '1194' ]]; then # semanage isn't available in CentOS 6 by default - if ! which semanage > /dev/null 2>&1; then + if ! hash semanage 2>/dev/null; then yum install policycoreutils-python -y fi semanage port -a -t openvpn_port_t -p udp $PORT