From patchwork Sun May 12 14:24:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ummeegge X-Patchwork-Id: 2250 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail01.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web07.i.ipfire.org (Postfix) with ESMTPS id 48A9285BDD0 for ; Sun, 12 May 2019 05:24:24 +0100 (BST) Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 451rSR0TY8z5L72t; Sun, 12 May 2019 05:24:23 +0100 (BST) Received: from ipfire-server.local (i59F72F39.versanet.de [89.247.47.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 451rSM6R59z5L72t; Sun, 12 May 2019 05:24:19 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201904rsa; t=1557635060; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:openpgp:autocrypt; bh=Q5tWWfotIFNfFTlEwMgvzE1hxwQxt1tsw84ZlD0idwk=; b=GdHslwNrY67LKp9BdROqr+h7N8UO49kLtqg4irkSEG51+ClXskRZ+fdQFdaJMeEW85qi5z KGNdaYWb8lD1yeieXWbT4Nx3ff4LDS+VXAUpNWnktyDOwdwt7LAhWhdi+vlBcJ0BMPXXz9 kyQrBR076amGF1ZHgaXpS1vIUB6fQx3bRF4ssKyiIGhXIdkKT7uLnsj8lF78ntddzGmxs2 u69FFoL0O6iPfO/Ov8k9JfbMqvzS6KgSGMdKZJex+yahP9hWZ6WcG7nNSRB+3OPGXEAWNH Hnt9hJwrPPt5svpfEqoRaoyMDSf6Wthp5EL+zFNPo+UDOD4Ky+TGh0HOzgnyPw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201904ed25519; t=1557635060; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:openpgp:autocrypt; bh=Q5tWWfotIFNfFTlEwMgvzE1hxwQxt1tsw84ZlD0idwk=; b=fZAqfsvioaJz7Jgn0G1wtrMsArWHSTE0Kdd7s/++yTzwgVaEDOakBTvuZsRXR29eXUp1j2 h/DgCOZpWsMmbjCg== From: Erik Kapfer To: development@lists.ipfire.org Subject: [PATCH v2] sslh: update to 1.20 Date: Sun, 12 May 2019 06:24:07 +0200 Message-Id: <20190512042407.30144-1-ummeegge@ipfire.org> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20190423070606.5642-1-ummeegge@ipfire.org> References: <20190423070606.5642-1-ummeegge@ipfire.org> Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=ummeegge smtp.mailfrom=ummeegge@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" - New user and group sslh has been added. - Added USELIBCAP to make transparent mode possible. - red.up script has been added. If red IP changes, sslh will be restarted to run with the new IP. - red.up script searches for sslh symlink in rc3.d, if nothing can be found, it will not start so it can be disabled via WUI (services.cgi). - Symlinks for runlevels has been nevertheless added to sslh package to control it also via services.cgi. - Configuration block has been added to sslh initscript. - External IP address check will also be used for configure options. - Configure provides currently only OpenVPN - OpenVPN port will be automatically investigated. Signed-off-by: Erik Kapfer --- config/rootfiles/packages/sslh | 1 + config/sslh/25-sslh | 17 +++++++++++++++++ lfs/initscripts | 3 --- lfs/sslh | 16 +++++++++------- src/initscripts/packages/sslh | 41 +++++++++++++++++++++++++++++++++-------- src/paks/sslh/install.sh | 16 +++++++++++++++- src/paks/sslh/uninstall.sh | 4 +++- 7 files changed, 78 insertions(+), 20 deletions(-) create mode 100644 config/sslh/25-sslh diff --git a/config/rootfiles/packages/sslh b/config/rootfiles/packages/sslh index 2c67aad3a..15d5ff8f9 100644 --- a/config/rootfiles/packages/sslh +++ b/config/rootfiles/packages/sslh @@ -1,2 +1,3 @@ +etc/rc.d/init.d/networking/red.up/25-sslh etc/rc.d/init.d/sslh usr/sbin/sslh diff --git a/config/sslh/25-sslh b/config/sslh/25-sslh new file mode 100644 index 000000000..0b65d4309 --- /dev/null +++ b/config/sslh/25-sslh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Check if SSLH has been enabled in WUI +if ls /etc/rc.d/rc3.d | grep -q '.*sslh' >/dev/null; then + # If SSLH is enabled and running but red0 gets a new IP, restart SSLH + if pgrep 'sslh' > /dev/null; then + /etc/init.d/sslh restart + else + # If sslh is not running yet, start it + /etc/init.d/sslh start + fi +else + # If SSLH has been disabled on boot via services WUI, stop service + /etc/init.d/sslh stop +fi + +# EOF diff --git a/lfs/initscripts b/lfs/initscripts index 055e106d0..3173a04e4 100644 --- a/lfs/initscripts +++ b/lfs/initscripts @@ -136,9 +136,6 @@ $(TARGET) : ln -sf ../init.d/client175 /etc/rc.d/rc0.d/K34client175 ln -sf ../init.d/client175 /etc/rc.d/rc3.d/S66client175 ln -sf ../init.d/client175 /etc/rc.d/rc6.d/K34client175 - ln -sf ../init.d/sslh /etc/rc.d/rc3.d/S98sslh - ln -sf ../init.d/sslh /etc/rc.d/rc0.d/K02sslh - ln -sf ../init.d/sslh /etc/rc.d/rc6.d/K02sslh ln -sf ../init.d/vdradmin /etc/rc.d/rc3.d/S99vdradmin ln -sf ../init.d/vdradmin /etc/rc.d/rc0.d/K01vdradmin ln -sf ../init.d/vdradmin /etc/rc.d/rc6.d/K01vdradmin diff --git a/lfs/sslh b/lfs/sslh index 100cec065..ab453c75d 100644 --- a/lfs/sslh +++ b/lfs/sslh @@ -1,7 +1,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007-2018 IPFire Team # +# Copyright (C) 2007-2019 IPFire Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -24,7 +24,7 @@ include Config -VER = 1.7a +VER = 1.20 THISAPP = sslh-$(VER) DL_FILE = $(THISAPP).tar.gz @@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) PROG = sslh -PAK_VER = 5 +PAK_VER = 6 DEPS = "" @@ -44,7 +44,7 @@ objects = $(DL_FILE) $(DL_FILE) = $(DL_FROM)/$(DL_FILE) -$(DL_FILE)_MD5 = ee124654412198a5e11fe28acf10634d +$(DL_FILE)_MD5 = 0db26ed2825b1ef6c83959a988279912 install : $(TARGET) @@ -77,11 +77,13 @@ $(subst %,%_MD5,$(objects)) : $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) - cd $(DIR_APP) && make CFLAGS="$(CFLAGS)" $(MAKETUNING) USELIBWRAP= - cd $(DIR_APP) && install -v -m 755 sslh /usr/sbin + cd $(DIR_APP) && make CFLAGS="$(CFLAGS)" $(MAKETUNING) USELIBCAP=1 USELIBWRAP= + cd $(DIR_APP) && install -v -m 755 sslh-fork /usr/sbin/sslh - #install initscripts + # Install initscripts $(call INSTALL_INITSCRIPT,sslh) + # Install red.up + install -v -m 754 -D $(DIR_CONF)/sslh/25-sslh /etc/rc.d/init.d/networking/red.up/25-sslh @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/src/initscripts/packages/sslh b/src/initscripts/packages/sslh index 43e58f392..f227ae9fb 100644 --- a/src/initscripts/packages/sslh +++ b/src/initscripts/packages/sslh @@ -3,31 +3,56 @@ # Based on sysklogd script from LFS-3.1 and earlier. # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org +# +############################################################# +# . /etc/sysconfig/rc . $rc_functions +DAEMON="/usr/sbin/sslh" +PID="/var/run/sslh.pid" + +# Check external IP address and ports +EXTERNAL_IP_ADDRESS="$(/dev/null; then + groupadd -g 131 sslh +fi + +if ! getent passwd sslh; then + useradd -u 123 -g sslh -c "SSLH daemon user" -d /var/empty -s /bin/false sslh +fi + +# Set symlink for runlevels +ln -svf ../init.d/sslh /etc/rc.d/rc0.d/K02sslh +ln -svf ../init.d/sslh /etc/rc.d/rc3.d/S98sslh +ln -svf ../init.d/sslh /etc/rc.d/rc6.d/K02sslh + start_service --background ${NAME} diff --git a/src/paks/sslh/uninstall.sh b/src/paks/sslh/uninstall.sh index dca34ccbd..4dfa0b274 100644 --- a/src/paks/sslh/uninstall.sh +++ b/src/paks/sslh/uninstall.sh @@ -24,4 +24,6 @@ . /opt/pakfire/lib/functions.sh stop_service ${NAME} remove_files -rm -f /etc/rc.d/init.d/networking/red.up/50-sslh + +# Delete symlinks in runlevels +rm -f /etc/rc.d/rc?.d/???sslh;