From a891b7613cc455a388a2ff0693a20c305990e7bd Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Sat, 12 Mar 2022 23:55:32 -0600 Subject: [PATCH] Fix for Alpine Linux - Fix IPsec service on Alpine Linux. Fixes #1123. - Clean up unneeded /etc/rc.local code for this OS. --- extras/vpnupgrade_alpine.sh | 2 ++ vpnsetup_alpine.sh | 19 ++----------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/extras/vpnupgrade_alpine.sh b/extras/vpnupgrade_alpine.sh index 71add4e..e26b203 100755 --- a/extras/vpnupgrade_alpine.sh +++ b/extras/vpnupgrade_alpine.sh @@ -170,6 +170,7 @@ get_libreswan() { install_libreswan() { bigecho "Compiling and installing Libreswan, please wait..." cd "libreswan-$SWAN_VER" || exit 1 + sed -i '1c\#!/sbin/openrc-run' /etc/init.d/ipsec service ipsec stop >/dev/null 2>&1 sed -i '28s/stdlib\.h/sys\/types.h/' include/fd.h cat > Makefile.inc.local <<'EOF' @@ -255,6 +256,7 @@ update_config() { restart_ipsec() { bigecho "Restarting IPsec service..." mkdir -p /run/pluto + sed -i '1c\#!/sbin/openrc-run' /etc/init.d/ipsec service ipsec restart >/dev/null 2>&1 } diff --git a/vpnsetup_alpine.sh b/vpnsetup_alpine.sh index 910102d..947c9ea 100755 --- a/vpnsetup_alpine.sh +++ b/vpnsetup_alpine.sh @@ -475,25 +475,10 @@ exit 0 EOF chmod +x /etc/network/if-pre-up.d/iptablesload + sed -i '1c\#!/sbin/openrc-run' /etc/init.d/ipsec for svc in fail2ban ipsec xl2tpd; do - rc-update add "$svc" >/dev/null + rc-update add "$svc" default >/dev/null done - - if ! grep -qs "hwdsl2 VPN script" /etc/rc.local; then - if [ -f /etc/rc.local ]; then - conf_bk "/etc/rc.local" - else - echo '#!/bin/sh' > /etc/rc.local - fi -cat >> /etc/rc.local <<'EOF' - -# Added by hwdsl2 VPN script -(sleep 15 -service ipsec restart -service xl2tpd restart -echo 1 > /proc/sys/net/ipv4/ip_forward)& -EOF - fi } start_services() {