Import (and adopt) sslh package to new packagefeed 31/head
authorJonathan McCrohan <jmccrohan@gmail.com>
Mon, 16 Jun 2014 00:16:30 +0000 (01:16 +0100)
committerJonathan McCrohan <jmccrohan@gmail.com>
Mon, 16 Jun 2014 00:19:20 +0000 (01:19 +0100)
Signed-off-by: Jonathan McCrohan <jmccrohan@gmail.com>
net/sslh/Makefile [new file with mode: 0644]
net/sslh/files/sslh.config [new file with mode: 0644]
net/sslh/files/sslh.init [new file with mode: 0644]
net/sslh/patches/001-no_sslh_select.patch [new file with mode: 0644]

diff --git a/net/sslh/Makefile b/net/sslh/Makefile
new file mode 100644 (file)
index 0000000..c0e2788
--- /dev/null
@@ -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 <jmccrohan@gmail.com>
+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 (file)
index 0000000..07ed02b
--- /dev/null
@@ -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 <listenaddr>:<listenport>
+       option 'listen' ''
+       # ssh defaults to 'localhost:22'
+       # --ssh <sshhost>:<sshport>
+       option 'ssh' ''
+       # ssl defaults to 'localhost:443'
+       # --ssl <sslhost>:<sslport>
+       option 'ssl' ''
+       # openvpn defaults to 'localhost:1194'
+       # --openvpn <openvpnhost>:<openvpnport>
+       option 'openvpn' ''
+       # tinc defaults to 'localhost:655'
+       # --tinc <tinchost>:<tincport>
+       option 'tinc' ''
+       # xmpp defaults to 'localhost:5222'
+       # --xmpp <xmpphost>:<xmppport>
+       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 (file)
index 0000000..cc14686
--- /dev/null
@@ -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 (file)
index 0000000..7153026
--- /dev/null
@@ -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]