Преглед на файлове

Import (and adopt) sslh package to new packagefeed

Signed-off-by: Jonathan McCrohan <jmccrohan@gmail.com>
Jonathan McCrohan преди 10 години
родител
ревизия
b239328a0b
променени са 4 файла, в които са добавени 172 реда и са изтрити 0 реда
  1. 51
    0
      net/sslh/Makefile
  2. 30
    0
      net/sslh/files/sslh.config
  3. 62
    0
      net/sslh/files/sslh.init
  4. 29
    0
      net/sslh/patches/001-no_sslh_select.patch

+ 51
- 0
net/sslh/Makefile Целия файл

@@ -0,0 +1,51 @@
1
+#
2
+# Copyright (C) 2009-2012 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=sslh
11
+PKG_VERSION:=1.16
12
+PKG_RELEASE:=1
13
+
14
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15
+PKG_SOURCE_URL:=http://rutschle.net/tech/
16
+PKG_MD5SUM:=1e85b84eb82a96b81de9b1e637a3e795
17
+
18
+include $(INCLUDE_DIR)/package.mk
19
+
20
+define Package/sslh
21
+  SECTION:=net
22
+  CATEGORY:=Network
23
+  SUBMENU:=Routing and Redirection
24
+  TITLE:=SSL/SSH multiplexer
25
+  URL:=http://rutschle.net/tech/sslh.shtml
26
+  MAINTAINER:=Jonathan McCrohan <jmccrohan@gmail.com>
27
+endef
28
+
29
+define Package/sslh/conffiles
30
+/etc/config/sslh
31
+endef
32
+
33
+define Build/Compile
34
+	$(MAKE) -C $(PKG_BUILD_DIR) \
35
+		CC="$(TARGET_CC)" \
36
+		CFLAGS="$(TARGET_CFLAGS)" \
37
+		USELIBCONFIG= \
38
+		USELIBWRAP= \
39
+		all
40
+endef
41
+
42
+define Package/sslh/install
43
+	$(INSTALL_DIR) $(1)/usr/sbin
44
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/sslh-fork $(1)/usr/sbin/sslh
45
+	$(INSTALL_DIR) $(1)/etc/init.d/
46
+	$(INSTALL_BIN) files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
47
+	$(INSTALL_DIR) $(1)/etc/config
48
+	$(INSTALL_CONF) files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
49
+endef
50
+
51
+$(eval $(call BuildPackage,sslh))

+ 30
- 0
net/sslh/files/sslh.config Целия файл

@@ -0,0 +1,30 @@
1
+package 'sslh'
2
+
3
+config 'sslh' 'default'
4
+	# disable or enable
5
+	option 'enable' '1'
6
+	# listen defaults to '0.0.0.0:443' (all interfaces)
7
+	# multiple -p arguments may be supplied using a uci list
8
+	# -p <listenaddr>:<listenport>
9
+	option 'listen' ''
10
+	# ssh defaults to 'localhost:22'
11
+	# --ssh <sshhost>:<sshport>
12
+	option 'ssh' ''
13
+	# ssl defaults to 'localhost:443'
14
+	# --ssl <sslhost>:<sslport>
15
+	option 'ssl' ''
16
+	# openvpn defaults to 'localhost:1194'
17
+	# --openvpn <openvpnhost>:<openvpnport>
18
+	option 'openvpn' ''
19
+	# tinc defaults to 'localhost:655'
20
+	# --tinc <tinchost>:<tincport>
21
+	option 'tinc' ''
22
+	# xmpp defaults to 'localhost:5222'
23
+	# --xmpp <xmpphost>:<xmppport>
24
+	option 'xmpp' ''
25
+	# timeout (for ssh, then ssl is assumed) defaults to 2
26
+	# -t
27
+	option 'timeout' ''
28
+	# verbose defaults to off
29
+	# -v
30
+	option 'verbose' '0'

+ 62
- 0
net/sslh/files/sslh.init Целия файл

@@ -0,0 +1,62 @@
1
+#!/bin/sh /etc/rc.common
2
+# Copyright (C) 2009-2012 OpenWrt.org
3
+
4
+START=95
5
+
6
+# XXX: pid-files are useless because sslh forks after creating them
7
+SERVICE_USE_PID=
8
+
9
+start_instance() {
10
+	local section="$1"
11
+
12
+	# check if section is enabled (default)
13
+	local enable
14
+	config_get_bool enable "${section}" 'enable' '0'
15
+	[ ${enable} -gt 0 ] || return 1
16
+
17
+	local args=""
18
+	local val
19
+	# A) listen parameter
20
+	config_get vals "${section}" listen
21
+	[ -n "${vals}" ] && for val in $vals; do append args "-p ${val}"; done
22
+	# B) ssh parameter
23
+	config_get val "${section}" ssh
24
+	[ -n "${val}" ] && append args "--ssh ${val}"
25
+	# C) ssl parameter
26
+	config_get val "${section}" ssl
27
+	[ -n "${val}" ] && append args "--ssl ${val}"
28
+	# D) openvpn parameter
29
+        config_get val "${section}" openvpn
30
+        [ -n "${val}" ] && append args "--openvpn ${val}"
31
+	# E) tinc parameter
32
+        config_get val "${section}" tinc
33
+        [ -n "${val}" ] && append args "--tinc ${val}"
34
+	# F) xmpp parameter
35
+	config_get val "${section}" xmpp
36
+	[ -n "${val}" ] && append args "--xmpp ${val}"
37
+	# G) timeout (before a connection is considered to be SSH)
38
+	config_get val "${section}" timeout
39
+	[ -n "${val}" ] && append args "-t ${val}"
40
+	# H) verbose parameter
41
+	local verbosed
42
+	config_get_bool verbosed "${section}" verbose 0
43
+	[ "${verbosed}" -ne 0 ] && append args "-v"
44
+
45
+	# Defaults were removed for --user and --pidfile options
46
+	# in sslh 1.11; Define them here instead.
47
+	append args "--user nobody"
48
+	append args "--pidfile /var/run/sslh.pid"
49
+
50
+	# XXX: allow more that one instance to run simultaneously
51
+	SERVICE_MATCH_NAME=1 SERVICE_NAME="sslh-dummy-$$" \
52
+	service_start /usr/sbin/sslh ${args}
53
+}
54
+
55
+start() {
56
+	config_load 'sslh'
57
+	config_foreach start_instance 'sslh'
58
+}
59
+
60
+stop() {
61
+	service_stop /usr/sbin/sslh
62
+}

+ 29
- 0
net/sslh/patches/001-no_sslh_select.patch Целия файл

@@ -0,0 +1,29 @@
1
+--- a/Makefile
2
++++ b/Makefile
3
+@@ -37,16 +37,12 @@ all: sslh $(MAN) echosrv
4
+ 	$(CC) $(CFLAGS) -D'VERSION=$(VERSION)' -c $<
5
+ 
6
+ 
7
+-sslh: $(OBJS) sslh-fork sslh-select
8
++sslh: $(OBJS) sslh-fork
9
+ 
10
+ sslh-fork: $(OBJS) sslh-fork.o Makefile common.h
11
+ 	$(CC) $(CFLAGS) -D'VERSION=$(VERSION)' -o sslh-fork sslh-fork.o $(OBJS) $(LIBS)
12
+ 	#strip sslh-fork
13
+ 
14
+-sslh-select: $(OBJS) sslh-select.o Makefile common.h 
15
+-	$(CC) $(CFLAGS) -D'VERSION=$(VERSION)' -o sslh-select sslh-select.o $(OBJS) $(LIBS)
16
+-	#strip sslh-select
17
+-
18
+ echosrv: $(OBJS) echosrv.o
19
+ 	$(CC) $(CFLAGS) -o echosrv echosrv.o probe.o common.o $(LIBS)
20
+ 
21
+@@ -77,7 +73,7 @@ uninstall:
22
+ 	update-rc.d sslh remove
23
+ 
24
+ clean:
25
+-	rm -f sslh-fork sslh-select echosrv $(MAN) *.o *.gcov *.gcno *.gcda *.png *.html *.css *.info 
26
++	rm -f sslh-fork echosrv $(MAN) *.o *.gcov *.gcno *.gcda *.png *.html *.css *.info 
27
+ 
28
+ tags:
29
+ 	ctags --globals -T *.[ch]