Hi, I have to new packages stud: The Scalable TLS Unwrapping Daemon and libev which is needed by stud. So with stud there is no need for using stunnel any longer. It supports the new proxy protocol and plays nicely with certificate chains.
please have a look at the atached patch. regard, Thomas
Index: packages/libs/libev/Makefile =================================================================== --- packages/libs/libev/Makefile (revision 0) +++ packages/libs/libev/Makefile (revision 0) @@ -0,0 +1,59 @@ +# +# Copyright (C) 2006-2010 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:=libev +PKG_VERSION:=4.04 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://dist.schmorp.de/libev/ +PKG_MD5SUM:=c1130d0a4782681ba5277df1bc3fb335 + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/libev + SECTION:=libs + CATEGORY:=Libraries + TITLE:=Another of event notification library + URL:=http://software.schmorp.de/pkg/libev.html + MAINTAINER:=Thomas Heil <h...@terminal-consulting.de> +endef + +define Package/libev/description +A full-featured and high-performance (see benchmark) event loop that is loosely +modelled after libevent, but without its limitations and bugs. +It is used, among others, in the GNU Virtual Private Ethernet and rxvt-unicode +packages, and in the Deliantra MORPG Server and Client. +endef + +TARGET_CFLAGS += $(FPIC) + +CONFIGURE_ARGS += \ + --enable-shared \ + --enable-static \ + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include/libev + $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/libev + $(INSTALL_DIR) $(1)/usr/lib/libev + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libev.{la,a,so} $(1)/usr/lib/libev + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libev.so.4* $(1)/usr/lib/libev +endef + +define Package/libev/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libev.so.4* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,libev)) + Index: packages/net/stud/files/stud.hotplug =================================================================== --- packages/net/stud/files/stud.hotplug (revision 0) +++ packages/net/stud/files/stud.hotplug (revision 0) @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ "$ACTION" = add ]; then + + /etc/init.d/stud enabled && \ + /etc/init.d/stud start +fi + Index: packages/net/stud/files/init.stud =================================================================== --- packages/net/stud/files/init.stud (revision 0) +++ packages/net/stud/files/init.stud (revision 0) @@ -0,0 +1,76 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2010-2011 OpenWrt.org + +START=80 + +section_enabled() { + config_get_bool enable "$1" 'enable' 0 + config_get_bool enabled "$1" 'enabled' 0 + [ $enable -gt 0 ] || [ $enabled -gt 0 ] +} + + +start_instance () { + local section="$1" + section_enabled "$section" || return 1 + + config_get name "$section" name + config_get enabled "$section" enabled + config_get frontend_address "$section" frontend_address + config_get backend_address "$section" backend_address + config_get tls_only "$section" tls_only + config_get ciphers "$section" ciphers + config_get engine "$section" engine + config_get workers "$section" workers + config_get backlog "$section" backlog + config_get setuid_user "$section" setuid_user + config_get shared_cache_sessions "$section" shared_cache_sessions + config_get cache_update_accept "$section" cache_update_accept + config_get cache_update_send "$section" cache_update_send + config_get cache_update_iface "$section" cache_update_iface + config_get client_tcp_keepalive_sec "$section" client_tcp_keepalive_sec + config_get syslog "$section" syslog + config_get write_ip "$section" write_ip + config_get write_proxy "$section" write_proxy + config_get ulimit_n "$section" ulimit_n + config_get cert "$section" cert + + ulimit -n ${ulimit_n:-131072} + opts="-q" + + if [ "${tls_only}" = "1" ]; then + opts="${opts} --tls" + else + opts="${opts} --ssl" + fi + + echo "Starting Stud instance $name" + start-stop-daemon -S -x /usr/sbin/stud -p /var/run/${name:+stud-$name.pid} -m -b -- $opts ${shared_cache_sessions:+-C $shared_cache_sessions} \ + ${frontend_address:+-f $frontend_address} ${backend_address:+-b $backend_address} \ + ${cache_update_accept:+-U $cache_update_accept} ${cache_update_send:+-P $cache_update_send} \ + ${engine:+-e $engine} ${workers:+ -n $workers} ${backlog:+-B $backlog} ${ciphers:+-c \'$ciphers\'} \ + ${write_ip:+--write-ip} ${write_proxy:+--write-proxy} $cert + +} + +stop_instance () { + local section="$1" + config_get name "$section" name + start-stop-daemon -p /var/run/${name:+stud-$name.pid} -K + echo "Stopping Stud instance $name" + [ -f /var/run/${name:+stud-$name.pid} ] && + rm /var/run/${name:+stud-$name.pid} + +} + + +start() { + config_load 'stud' + config_foreach start_instance 'stud' +} + +stop() { + config_load 'stud' + config_foreach stop_instance 'stud' +} + Property changes on: packages/net/stud/files/init.stud ___________________________________________________________________ Added: svn:executable + * Index: packages/net/stud/files/config.stud =================================================================== --- packages/net/stud/files/config.stud (revision 0) +++ packages/net/stud/files/config.stud (revision 0) @@ -0,0 +1,23 @@ +config stud + option name 'config1' + option enabled '1' + option frontend_address '0.0.0.0,443' + option backend_address '127.0.0.1,81' + option tls_only '0' + option ciphers 'ALL:!ADH:!EXPORT56:RC4+RSA:HIGH:MEDIUM:!LOW:!SSLv2:+EXP:!eNUL:!EXP-DES-CBC-SHA:!EXP-RC2-CBC-MD5:!EXP-RC4-MD5:!EXP-DES-CBC-SHA:!EXP-RC2-CBC-MD5:!EXP-RC4-MD5:!EXP-EDH-RSA-DES-CBC-SHA:!EXP-EDH-RSA-DES-CBC-SHA:!EXP-EDH-RSA-DES-CBC-SHA' + option engine '' + option workers '2' + option backlog '10000' + option setuid_user 'nobody' + option shared_cache_sessions '10000' + option cache_update_accept '' + option cache_update_send '' + option cache_update_iface '' + option client_tcp_keepalive_sec '' + option syslog '0' + option write_ip '' + option write_proxy '1' + option ulimit_n '16384' + option cert '/etc/ssl/all-in-one.pem' + + Index: packages/net/stud/patches/001-Makefile.patch =================================================================== --- packages/net/stud/patches/001-Makefile.patch (revision 0) +++ packages/net/stud/patches/001-Makefile.patch (revision 0) @@ -0,0 +1,10 @@ +Index: stud-0.3.27/Makefile +=================================================================== +--- stud-0.3.27.orig/Makefile ++++ stud-0.3.27/Makefile +@@ -1,5 +1,4 @@ + # [g]make USE_xxxx=1 +-# + # USE_SHARED_CACHE : enable/disable a shared session cache (disabled by default) + + DESTDIR = Index: packages/net/stud/patches/002-openssl-no-edch.patch =================================================================== --- packages/net/stud/patches/002-openssl-no-edch.patch (revision 0) +++ packages/net/stud/patches/002-openssl-no-edch.patch (revision 0) @@ -0,0 +1,20 @@ +Index: stud-0.3.27/stud.c +=================================================================== +--- stud-0.3.27.orig/stud.c ++++ stud-0.3.27/stud.c +@@ -283,6 +283,7 @@ static int init_dh(SSL_CTX *ctx, const c + LOG("{core} DH initialized with %d bit key\n", 8*DH_size(dh)); + DH_free(dh); + ++#ifndef OPENSSL_NO_ECDH + #ifdef NID_X9_62_prime256v1 + EC_KEY *ecdh = NULL; + ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); +@@ -290,6 +291,7 @@ static int init_dh(SSL_CTX *ctx, const c + EC_KEY_free(ecdh); + LOG("{core} ECDH Initialized with NIST P-256\n"); + #endif ++#endif + + return 0; + } Index: packages/net/stud/Makefile =================================================================== --- packages/net/stud/Makefile (revision 0) +++ packages/net/stud/Makefile (revision 0) @@ -0,0 +1,101 @@ +# Copyright 2011 Bump Technologies, Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY BUMP TECHNOLOGIES, INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BUMP TECHNOLOGIES, INC. OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# The views and conclusions contained in the software and documentation are those of the +# authors and should not be interpreted as representing official policies, either expressed +# or implied, of Bump Technologies, Inc. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=stud +PKG_VERSION:=0.3.27 +PKG_RELEASE:=1 +PKG_REV:=6d8eac670c709a7d4a9f467432e6b5ce7d789a0b + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/bumptech/stud.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_SOURCE_PROTO:= git + +include $(INCLUDE_DIR)/package.mk + +define Package/stud + SUBMENU:=Web Servers/Proxies + SECTION:=net + CATEGORY:=Network + TITLE:=The Scalable TLS Unwrapping Daemon + URL:=https://github.com/bumptech/stud + DEPENDS:=+libpcre +libev +libopenssl + MAINTAINER:=Thomas Heil <h...@terminal-consulting.de> +endef + +define Download/ebtree + FILE:=ebtree-6.0.6.tar.gz + URL:=http://1wt.eu/tools/ebtree/ + EBTREE=$(FILE) + MD5SUM:=5ed2f8299e5e1833ee795dd73d0b5b81 +endef +$(eval $(call Download,ebtree)) + + +define Package/stud/conffiles +/etc/stud.cfg +endef + +define Package/stud/description + Scalable TLS Unwrapping Daemon +endef + +TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/usr/include/libev -lev -lssl -I$(STAGING_DIR)/usr/include/openssl +TARGET_CFLAGS += $(FPIC) -std=gnu99 +TARGET_LDFLAGS += -lev -lssl -lcrypto -L$(STAGING_DIR)/usr/lib/libev -L$(STAGING_DIR)/usr/lib -lpthread -lrt + +define Build/Prepare + $(call Build/Prepare/Default) + tar -zxvf $(DL_DIR)/ebtree-6.0.6.tar.gz -C $(PKG_BUILD_DIR) + ln -s $(PKG_BUILD_DIR)/ebtree-6.0.6 $(PKG_BUILD_DIR)/ebtree +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + USE_SHARED_CACHE=1 \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS) -DUSE_SHARED_CACHE=1" \ + LD="$(TARGET_CC)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + all +endef + +define Package/stud/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/stud $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/config.stud $(1)/etc/config/stud + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/init.stud $(1)/etc/init.d/stud + $(INSTALL_DIR) $(1)/etc/hotplug.d/net + $(INSTALL_BIN) ./files/stud.hotplug $(1)/etc/hotplug.d/net/90-stud +endef + +$(eval $(call BuildPackage,stud))
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel