From f2e6b6728d7f3c5b271427d75998ce46b650e73f Mon Sep 17 00:00:00 2001 From: bedefaced Date: Wed, 23 Aug 2017 14:04:40 +0300 Subject: [PATCH] checkserver fix (for using systemctl); install.sh small refactoring; openvpn some dists bugfix (systemctl with full config name) --- ipsec/checkserver.sh | 4 ++-- ipsec/install.sh | 10 +++++----- openvpn/checkserver.sh | 2 +- openvpn/install.sh | 20 ++++++++++++-------- pptp/checkserver.sh | 2 +- pptp/install.sh | 10 +++++----- 6 files changed, 26 insertions(+), 22 deletions(-) diff --git a/ipsec/checkserver.sh b/ipsec/checkserver.sh index e95791f..ec7c190 100755 --- a/ipsec/checkserver.sh +++ b/ipsec/checkserver.sh @@ -3,11 +3,11 @@ RET=$(pgrep xl2tpd) if [ $? -eq 1 ]; then - /etc/init.d/xl2tpd restart + systemctl restart xl2tpd fi RET=$(pgrep starter) if [ $? -eq 1 ]; then - /etc/init.d/strongswan restart + systemctl restart strongswan fi diff --git a/ipsec/install.sh b/ipsec/install.sh index da34381..d0a6929 100755 --- a/ipsec/install.sh +++ b/ipsec/install.sh @@ -10,7 +10,7 @@ fi echo echo "Installing strongSwan and xl2tp server..." -apt-get install strongswan xl2tpd cron iptables procps +apt-get -y install strongswan xl2tpd cron iptables procps net-tools echo echo "Configuring routing..." @@ -39,15 +39,15 @@ echo echo "Configuring PSK..." $DIR/psk.sh -echo -echo "Configuring VPN users..." -$DIR/adduser.sh - echo echo "Adding cron jobs..." yes | cp -rf $DIR/checkserver.sh $CHECKSERVER $DIR/autostart.sh +echo +echo "Configuring VPN users..." +$DIR/adduser.sh + echo echo "Starting strongSwan and xl2tp..." service xl2tpd restart diff --git a/openvpn/checkserver.sh b/openvpn/checkserver.sh index 9956229..fcee6a0 100755 --- a/openvpn/checkserver.sh +++ b/openvpn/checkserver.sh @@ -3,5 +3,5 @@ RET=$(pgrep openvpn) if [ $? -eq 1 ]; then - /etc/init.d/openvpn restart + systemctl restart openvpn@openvpn-server fi diff --git a/openvpn/install.sh b/openvpn/install.sh index 29fe91b..38b8a5a 100755 --- a/openvpn/install.sh +++ b/openvpn/install.sh @@ -12,7 +12,7 @@ fi echo echo "Installing OpenVPN..." -apt-get install openvpn easy-rsa cron iptables procps +apt-get -y install openvpn easy-rsa cron iptables procps net-tools echo echo "Configuring routing..." @@ -34,6 +34,10 @@ echo echo "Configuring DNS parameters..." $DIR/dns.sh +# workaround: Debian's openssl version is not compatible with easy-rsa +# using openssl-1.0.0.cnf if openssl.cnf not exists +cp -n /etc/openvpn/easy-rsa/openssl-1.0.0.cnf /etc/openvpn/easy-rsa/openssl.cnf + echo echo "Creating server keys..." make-cadir $CADIR @@ -45,21 +49,21 @@ source ./vars ./build-dh openvpn --genkey --secret ta.key -cd $STARTDIR - -echo -echo "Configuring VPN users..." -$DIR/adduser.sh echo echo "Adding cron jobs..." yes | cp -rf $DIR/checkserver.sh $CHECKSERVER $DIR/autostart.sh +cd $STARTDIR +echo +echo "Configuring VPN users..." +$DIR/adduser.sh + echo echo "Starting OpenVPN..." -systemctl enable openvpn -service openvpn restart +systemctl -f enable openvpn@openvpn-server +systemctl restart openvpn@openvpn-server echo echo "Installation script completed!" diff --git a/pptp/checkserver.sh b/pptp/checkserver.sh index cf36582..fae691a 100755 --- a/pptp/checkserver.sh +++ b/pptp/checkserver.sh @@ -3,5 +3,5 @@ RET=$(pgrep pptpd) if [ $? -eq 1 ]; then - /etc/init.d/pptpd restart + systemctl restart pptpd fi diff --git a/pptp/install.sh b/pptp/install.sh index 0921a87..86605a5 100755 --- a/pptp/install.sh +++ b/pptp/install.sh @@ -10,15 +10,11 @@ fi echo echo "Installing PPTP server..." -apt-get install pptpd cron iptables procps +apt-get -y install pptpd cron iptables procps net-tools ADDUSER="no" ANSUSER="yes" -echo -echo "Configuring VPN users..." -$DIR/adduser.sh - echo echo "Configuring iptables firewall..." $DIR/iptables-setup.sh @@ -44,6 +40,10 @@ echo "Adding cron jobs..." yes | cp -rf $DIR/checkserver.sh $CHECKSERVER $DIR/autostart.sh +echo +echo "Configuring VPN users..." +$DIR/adduser.sh + echo echo "Starting pptpd..." service pptpd restart