From b239328a0ba64574d549e9a8c21e4c8855584a8e Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Mon, 16 Jun 2014 01:16:30 +0100 Subject: [PATCH] Import (and adopt) sslh package to new packagefeed Signed-off-by: Jonathan McCrohan --- net/sslh/Makefile | 51 +++++++++++++++++++ net/sslh/files/sslh.config | 30 +++++++++++ net/sslh/files/sslh.init | 62 +++++++++++++++++++++++ net/sslh/patches/001-no_sslh_select.patch | 29 +++++++++++ 4 files changed, 172 insertions(+) create mode 100644 net/sslh/Makefile create mode 100644 net/sslh/files/sslh.config create mode 100644 net/sslh/files/sslh.init create mode 100644 net/sslh/patches/001-no_sslh_select.patch diff --git a/net/sslh/Makefile b/net/sslh/Makefile new file mode 100644 index 0000000000..c0e27885a7 --- /dev/null +++ b/net/sslh/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2009-2012 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=sslh +PKG_VERSION:=1.16 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://rutschle.net/tech/ +PKG_MD5SUM:=1e85b84eb82a96b81de9b1e637a3e795 + +include $(INCLUDE_DIR)/package.mk + +define Package/sslh + SECTION:=net + CATEGORY:=Network + SUBMENU:=Routing and Redirection + TITLE:=SSL/SSH multiplexer + URL:=http://rutschle.net/tech/sslh.shtml + MAINTAINER:=Jonathan McCrohan +endef + +define Package/sslh/conffiles +/etc/config/sslh +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS)" \ + USELIBCONFIG= \ + USELIBWRAP= \ + all +endef + +define Package/sslh/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/sslh-fork $(1)/usr/sbin/sslh + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME) + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME) +endef + +$(eval $(call BuildPackage,sslh)) diff --git a/net/sslh/files/sslh.config b/net/sslh/files/sslh.config new file mode 100644 index 0000000000..07ed02b47c --- /dev/null +++ b/net/sslh/files/sslh.config @@ -0,0 +1,30 @@ +package 'sslh' + +config 'sslh' 'default' + # disable or enable + option 'enable' '1' + # listen defaults to '0.0.0.0:443' (all interfaces) + # multiple -p arguments may be supplied using a uci list + # -p : + option 'listen' '' + # ssh defaults to 'localhost:22' + # --ssh : + option 'ssh' '' + # ssl defaults to 'localhost:443' + # --ssl : + option 'ssl' '' + # openvpn defaults to 'localhost:1194' + # --openvpn : + option 'openvpn' '' + # tinc defaults to 'localhost:655' + # --tinc : + option 'tinc' '' + # xmpp defaults to 'localhost:5222' + # --xmpp : + option 'xmpp' '' + # timeout (for ssh, then ssl is assumed) defaults to 2 + # -t + option 'timeout' '' + # verbose defaults to off + # -v + option 'verbose' '0' diff --git a/net/sslh/files/sslh.init b/net/sslh/files/sslh.init new file mode 100644 index 0000000000..cc146864de --- /dev/null +++ b/net/sslh/files/sslh.init @@ -0,0 +1,62 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2012 OpenWrt.org + +START=95 + +# XXX: pid-files are useless because sslh forks after creating them +SERVICE_USE_PID= + +start_instance() { + local section="$1" + + # check if section is enabled (default) + local enable + config_get_bool enable "${section}" 'enable' '0' + [ ${enable} -gt 0 ] || return 1 + + local args="" + local val + # A) listen parameter + config_get vals "${section}" listen + [ -n "${vals}" ] && for val in $vals; do append args "-p ${val}"; done + # B) ssh parameter + config_get val "${section}" ssh + [ -n "${val}" ] && append args "--ssh ${val}" + # C) ssl parameter + config_get val "${section}" ssl + [ -n "${val}" ] && append args "--ssl ${val}" + # D) openvpn parameter + config_get val "${section}" openvpn + [ -n "${val}" ] && append args "--openvpn ${val}" + # E) tinc parameter + config_get val "${section}" tinc + [ -n "${val}" ] && append args "--tinc ${val}" + # F) xmpp parameter + config_get val "${section}" xmpp + [ -n "${val}" ] && append args "--xmpp ${val}" + # G) timeout (before a connection is considered to be SSH) + config_get val "${section}" timeout + [ -n "${val}" ] && append args "-t ${val}" + # H) verbose parameter + local verbosed + config_get_bool verbosed "${section}" verbose 0 + [ "${verbosed}" -ne 0 ] && append args "-v" + + # Defaults were removed for --user and --pidfile options + # in sslh 1.11; Define them here instead. + append args "--user nobody" + append args "--pidfile /var/run/sslh.pid" + + # XXX: allow more that one instance to run simultaneously + SERVICE_MATCH_NAME=1 SERVICE_NAME="sslh-dummy-$$" \ + service_start /usr/sbin/sslh ${args} +} + +start() { + config_load 'sslh' + config_foreach start_instance 'sslh' +} + +stop() { + service_stop /usr/sbin/sslh +} diff --git a/net/sslh/patches/001-no_sslh_select.patch b/net/sslh/patches/001-no_sslh_select.patch new file mode 100644 index 0000000000..71530269e2 --- /dev/null +++ b/net/sslh/patches/001-no_sslh_select.patch @@ -0,0 +1,29 @@ +--- a/Makefile ++++ b/Makefile +@@ -37,16 +37,12 @@ all: sslh $(MAN) echosrv + $(CC) $(CFLAGS) -D'VERSION=$(VERSION)' -c $< + + +-sslh: $(OBJS) sslh-fork sslh-select ++sslh: $(OBJS) sslh-fork + + sslh-fork: $(OBJS) sslh-fork.o Makefile common.h + $(CC) $(CFLAGS) -D'VERSION=$(VERSION)' -o sslh-fork sslh-fork.o $(OBJS) $(LIBS) + #strip sslh-fork + +-sslh-select: $(OBJS) sslh-select.o Makefile common.h +- $(CC) $(CFLAGS) -D'VERSION=$(VERSION)' -o sslh-select sslh-select.o $(OBJS) $(LIBS) +- #strip sslh-select +- + echosrv: $(OBJS) echosrv.o + $(CC) $(CFLAGS) -o echosrv echosrv.o probe.o common.o $(LIBS) + +@@ -77,7 +73,7 @@ uninstall: + update-rc.d sslh remove + + clean: +- rm -f sslh-fork sslh-select echosrv $(MAN) *.o *.gcov *.gcno *.gcda *.png *.html *.css *.info ++ rm -f sslh-fork echosrv $(MAN) *.o *.gcov *.gcno *.gcda *.png *.html *.css *.info + + tags: + ctags --globals -T *.[ch]