From f6a9a8261ccff8897b97227fdd0500b7156ff0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schr=C3=B6der?= Date: Thu, 24 Sep 2015 16:24:06 +0200 Subject: [PATCH] added stunnel to package list --- stunnel/Makefile | 69 ++++++++++++++++++++++++++++++++++++++ stunnel/files/stunnel.init | 44 ++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 stunnel/Makefile create mode 100644 stunnel/files/stunnel.init diff --git a/stunnel/Makefile b/stunnel/Makefile new file mode 100644 index 000000000..0c2280260 --- /dev/null +++ b/stunnel/Makefile @@ -0,0 +1,69 @@ +# +# 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:=stunnel + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/mkschreder/stunnel.git +PKG_SOURCE_VERSION:=c212441a18a27564c5fe76710fcde17b1c4d0850 +PKG_VERSION:=5.33 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz +PKG_MAINTAINER:=Martin Schröder +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) + +PKG_RELEASE=$(PKG_VERSION)-$(PKG_SOURCE_VERSION) +PKG_FIXUP:=libtool +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/stunnel + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libopenssl +libwrap + TITLE:=SSL TCP Wrapper + URL:=http://www.stunnel.org/ +endef + +define Package/stunnel/description + Stunnel is a program that allows you to encrypt arbitrary TCP + connections inside SSL (Secure Sockets Layer) available on both Unix + and Windows. Stunnel can allow you to secure non-SSL aware daemons and + protocols (like POP, IMAP, LDAP, etc) by having Stunnel provide the + encryption, requiring no changes to the daemon's code. +endef + +define Package/stunnel/conffiles +/etc/stunnel/stunnel.conf +endef + +CONFIGURE_ARGS+= \ + --with-random=/dev/urandom \ + --with-threads=fork \ + --with-ssl=$(STAGING_DIR)/usr \ + +define Build/Compile + mkdir -p $(PKG_INSTALL_DIR)/etc/stunnel + echo '#dummy' > $(PKG_INSTALL_DIR)/etc/stunnel/stunnel.pem + $(call Build/Compile/Default) +endef + +define Package/stunnel/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/stunnel $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib/stunnel + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/stunnel/libstunnel.so $(1)/usr/lib/stunnel/ + $(INSTALL_DIR) $(1)/etc/stunnel + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/stunnel/stunnel.conf-sample $(1)/etc/stunnel/stunnel.conf + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/stunnel.init $(1)/etc/init.d/stunnel +endef + +$(eval $(call BuildPackage,stunnel)) diff --git a/stunnel/files/stunnel.init b/stunnel/files/stunnel.init new file mode 100644 index 000000000..5831b2a4b --- /dev/null +++ b/stunnel/files/stunnel.init @@ -0,0 +1,44 @@ +#!/bin/sh /etc/rc.common + +START=90 +STOP=96 + +USE_PROCD=1 +NAME=stunnel +PROG=/usr/bin/stunnel + +start_service() { + if [ -s "/etc/stunnel/stunnel.pem" ]; then + chmod og-rwx /etc/stunnel/stunnel.pem + else + [ -e /etc/stunnel/stunnel.conf ] && \ + . /etc/stunnel/stunnel.conf + + X509_CN=${X509_CN:-"router"} + X509_O=${X509_O:-"openwrt.org"} + X509_OU=${X509_OU:-"open-source firmware"} + + [ -x /sbin/keygen ] && { + (keygen "$X509_CN" "$X509_O" "$X509_OU" > /etc/stunnel/stunnel.pem; + chmod og-rwx /etc/stunnel/stunnel.pem ) + } + fi + procd_open_instance + procd_set_param command "$PROG" + procd_set_param respawn + procd_close_instance +} + +stop_service() { + service_stop "$PROG" +} + +service_triggers() { + procd_add_reload_trigger network wireless +} + +reload_service() { + stop + start +} +