From cf48ecd3b06a4404d4633f2967532df86dd44712 Mon Sep 17 00:00:00 2001 From: Nyr Date: Tue, 28 Apr 2015 18:35:54 +0200 Subject: [PATCH] Bugfixes - Little fix for Debian Jessie - Better systemd detection - Fixed revocation on CentOS --- openvpn-install.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 21716ad..f384ddc 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -115,7 +115,16 @@ if [[ -e /etc/openvpn/server.conf ]]; then # If it's the first time revoking a cert, we need to add the crl-verify line if ! grep -q "crl-verify" "/etc/openvpn/server.conf"; then echo "crl-verify /etc/openvpn/easy-rsa/2.0/keys/crl.pem" >> "/etc/openvpn/server.conf" - /etc/init.d/openvpn restart + # And restart + if pgrep systemd-journal; then + systemctl restart openvpn@server.service + else + if [[ "$OS" = 'debian' ]]; then + /etc/init.d/openvpn restart + else + service openvpn restart + fi + fi fi echo "" echo "Certificate for client $CLIENT revoked" @@ -288,10 +297,14 @@ else fi # And finally, restart OpenVPN if [[ "$OS" = 'debian' ]]; then - /etc/init.d/openvpn restart - else # Little hack to check for systemd - if pidof systemd; then + if pgrep systemd-journal; then + systemctl restart openvpn@server.service + else + /etc/init.d/openvpn restart + fi + else + if pgrep systemd-journal; then systemctl restart openvpn@server.service systemctl enable openvpn@server.service else