diff options
Diffstat (limited to 'net/sslh/files')
-rw-r--r-- | net/sslh/files/sslh.config | 38 | ||||
-rw-r--r-- | net/sslh/files/sslh.init | 74 |
2 files changed, 112 insertions, 0 deletions
diff --git a/net/sslh/files/sslh.config b/net/sslh/files/sslh.config new file mode 100644 index 0000000..242c46c --- /dev/null +++ b/net/sslh/files/sslh.config @@ -0,0 +1,38 @@ +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' '' + # http defaults to 'localhost:80' + # --http <httphost>:<httpport> + option 'http' '' + # tls defaults to 'localhost:443' + # --tls <tlshost>:<tlsport> + option 'tls' '' + # 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' + # transparent defaults to false + # --transparent + option 'transparent' '0' + # use external config file + # option configfile '/etc/sslh.conf' diff --git a/net/sslh/files/sslh.init b/net/sslh/files/sslh.init new file mode 100644 index 0000000..bf5136d --- /dev/null +++ b/net/sslh/files/sslh.init @@ -0,0 +1,74 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2017 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) tls parameter + config_get val "${section}" tls + [ -n "${val}" ] && append args "--tls ${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" + # I) sslh config file (cmd line args override file settings) + config_get val "${section}" configfile + [ -n "${val}" ] && append args "-F${val}" + # J) http parameter + config_get val "${section}" http + [ -n "${val}" ] && append args "--http ${val}" + # K) transparent parameter + config_get_bool val "${section}" transparent 0 + [ "${val}" -ne 0 ] && append args "--transparent" + + mkdir -p "/var/tmp/sslh" + + # 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" + append args "-C /var/tmp/sslh" + + # 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 +} |