diff options
author | Francesco Colista <fcolista@alpinelinux.org> | 2017-09-21 13:57:19 +0000 |
---|---|---|
committer | Francesco Colista <fcolista@alpinelinux.org> | 2017-09-21 15:23:52 +0000 |
commit | b0ed51b1bcb6f0a500298b08f3480a9587ce89ed (patch) | |
tree | a69f85640c0b616c20a2ce38563df56d1b03ba72 | |
parent | 23278078823bcf134833a70fa94866bece9e17c8 (diff) | |
download | aports-b0ed51b1bcb6f0a500298b08f3480a9587ce89ed.tar.bz2 aports-b0ed51b1bcb6f0a500298b08f3480a9587ce89ed.tar.xz |
testing/sslh: new aport. Fixes #7860
-rw-r--r-- | testing/sslh/APKBUILD | 52 | ||||
-rw-r--r-- | testing/sslh/generate-version.patch | 59 | ||||
-rw-r--r-- | testing/sslh/makefile-settings.patch | 27 | ||||
-rw-r--r-- | testing/sslh/sslh.conf | 25 | ||||
-rw-r--r-- | testing/sslh/sslh.confd | 8 | ||||
-rw-r--r-- | testing/sslh/sslh.initd | 21 |
6 files changed, 192 insertions, 0 deletions
diff --git a/testing/sslh/APKBUILD b/testing/sslh/APKBUILD new file mode 100644 index 0000000000..efcd23d8c8 --- /dev/null +++ b/testing/sslh/APKBUILD @@ -0,0 +1,52 @@ +# Contributor: Francesco Colista <fcolista@alpinelinux.org> +# Maintainer: Francesco Colista <fcolista@alpinelinux.org> +pkgname=sslh +pkgver=1.18 +pkgrel=0 +pkgdesc="Applicative Protocol Multiplexer (e.g. share SSH and HTTPS on the same port) " +url="http://www.rutschle.net/tech/sslh.shtml" +arch="all" +license="GPL2" +makedepends="libconfig-dev libcap-dev pcre-dev perl" +subpackages="$pkgname-doc" +options="!check" +source="$pkgname-$pkgver.tar.gz::https://github.com/yrutschle/$pkgname/archive/v$pkgver.tar.gz + makefile-settings.patch + generate-version.patch + $pkgname.conf + $pkgname.initd + $pkgname.confd" +builddir="$srcdir/$pkgname-$pkgver" + +build() { + cd "$builddir" + export CFLAGS="$CFLAGS -std=gnu99" + make ENABLE_REGEX=1 USELIBPCRE=1 USELIBCONFIG=1 USELIBCAP=1 +} + +package() { + cd "$builddir" + make DESTDIR="$pkgdir" PREFIX=/usr install + install -D -m755 "$srcdir"/$pkgname.initd \ + "$pkgdir"/etc/init.d/$pkgname + install -D -m644 "$srcdir"/$pkgname.confd \ + "$pkgdir"/etc/conf.d/$pkgname + ln -s sslh-fork "$pkgdir/usr/sbin/sslh" + install -D -m644 "$srcdir"/$pkgname.conf \ + "$pkgdir"/etc/$pkgname/$pkgname.conf + mv scripts/fail2ban "$pkgdir"/etc/$pkgname +} + +doc() { + default_doc + cd "$builddir" + install -Dm 644 basic.cfg "$subpkgdir/usr/share/doc/$pkgname/basic.cfg" + install -Dm 644 example.cfg "$subpkgdir/usr/share/doc/$pkgname/example.cfg" +} + +sha512sums="859ad65a258534fde68295a2880c077a00205d96a6aafeb525abce836850b9deea7b39daa2dc74a0dc18d2b198884958a39fbe758d61c93b257676f3a7d4f7bc sslh-1.18.tar.gz +aa1a9f5a1ba022f5fbb4ae2a1237813685d31b70011a876725a100bfc1cb7c6aa9a2ded046fd2082facdd9530ade3f5d9be66734ab5ecaf7342b54ce203a329b makefile-settings.patch +8dbd8fa19c9689f0455a8f48be7ceb3ec7428bdbbea5f8b6ed21f510e4a98e2203eadb9cb9d318a3aa3b2329b6eecf1f9c462b40dbe0f68ed3f6943f339050dd generate-version.patch +dd2231677d3e3f371ef643ebb9b9e31effc058ac7b430fe17dfb801b23040c6bde7b6c7c6b0ff6757607207a506096334b0a8e7ce83c884d483717c338a3499c sslh.conf +ba0a0fe8785ab9963d4dc11c39d6cbd41fe14d1e8f6d61eb0bf6eb2855e4f2de119b76f82894f3d52a91467ee83f4bd805d8eafc3c7da7b5a4f630cc4a241462 sslh.initd +580114cef9356d66ec1e6c306837d44dc3098e8f3f805eda20c5d8f81f087bf295b25801ee64ee2bc667ce7324f510ff6f4fc7e222d1431ec3d4e82bbcfb160f sslh.confd" diff --git a/testing/sslh/generate-version.patch b/testing/sslh/generate-version.patch new file mode 100644 index 0000000000..311c2d5712 --- /dev/null +++ b/testing/sslh/generate-version.patch @@ -0,0 +1,59 @@ +diff --git a/genver.sh b/genver.sh +index 79fd0a0..3af41f7 100755 +--- a/genver.sh ++++ b/genver.sh +@@ -1,49 +1,6 @@ + #! /bin/sh +- +-if [ ${#} -eq 1 ] && [ "x$1" = "x-r" ]; then +- # release text only +- QUIET=1 +-else +- QUIET=0 +-fi +- +-if ! `(git status | grep -q "On branch") 2> /dev/null`; then +- # If we don't have git, we can't work out what +- # version this is. It must have been downloaded as a +- # zip file. +- +- # If downloaded from the release page, the directory +- # has the version number. +- release=`pwd | sed s/.*sslh-// | grep "[[:digit:]]"` +- +- if [ "x$release" = "x" ]; then +- # If downloaded from the head, Github creates the +- # zip file with all files dated from the last +- # change: use the Makefile's modification time as a +- # release number +- release=head-`perl -MPOSIX -e 'print strftime "%Y-%m-%d",localtime((stat "Makefile")[9])'` +- fi +-fi +- +-if head=`git rev-parse --verify HEAD 2>/dev/null`; then +- # generate the version info based on the tag +- release=`(git describe --tags || git --describe || git describe --all --long) \ +- 2>/dev/null | tr -d '\n'` +- +- # Are there uncommitted changes? +- git update-index --refresh --unmerged > /dev/null +- if git diff-index --name-only HEAD | grep -v "^scripts/package" \ +- | read dummy; then +- release="$release-dirty" +- fi +-fi +- +- +-if [ $QUIET -ne 1 ]; then +- printf "#ifndef VERSION_H \n" +- printf "#define VERSION_H \n\n" +- printf "#define VERSION \"$release\"\n" +- printf "#endif\n" +-else +- printf "$release\n" +-fi ++release=$(cat ChangeLog | head -1 | cut -d: -f1 | tr -d [v]) ++printf "#ifndef VERSION_H \n" ++printf "#define VERSION_H \n\n" ++printf "#define VERSION \"$release\"\n" ++printf "#endif\n" diff --git a/testing/sslh/makefile-settings.patch b/testing/sslh/makefile-settings.patch new file mode 100644 index 0000000000..8f53494ebc --- /dev/null +++ b/testing/sslh/makefile-settings.patch @@ -0,0 +1,27 @@ +diff --git a/Makefile b/Makefile +index b1cf9ce..6c6fa5e 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ + # Configuration + +-VERSION=$(shell ./genver.sh -r) ++VERSION=$(sh ./genver.sh -r) + ENABLE_REGEX=1 # Enable regex probes + USELIBCONFIG=1 # Use libconfig? (necessary to use configuration files) + USELIBPCRE= # Use libpcre? (needed for regex on musl) + +diff --git a/Makefile b/Makefile +index 6c6fa5e..441b939 100644 +--- a/Makefile ++++ b/Makefile +@@ -93,7 +93,8 @@ release: + install: sslh $(MAN) + mkdir -p $(DESTDIR)/$(BINDIR) + mkdir -p $(DESTDIR)/$(MANDIR) +- install -p sslh-fork $(DESTDIR)/$(BINDIR)/sslh ++ install -p sslh-fork $(DESTDIR)/$(BINDIR)/sslh-fork ++ install -p sslh-select $(DESTDIR)/$(BINDIR)/sslh-select + install -p -m 0644 $(MAN) $(DESTDIR)/$(MANDIR)/$(MAN) + + # "extended" install for Debian: install startup script diff --git a/testing/sslh/sslh.conf b/testing/sslh/sslh.conf new file mode 100644 index 0000000000..8bc52e84eb --- /dev/null +++ b/testing/sslh/sslh.conf @@ -0,0 +1,25 @@ +verbose: false; +foreground: true; +inetd: false; +numeric: false; +transparent: false; +timeout: 2; +user: "nobody"; +pidfile: "/var/run/sslh.pid"; + + +listen: +( + { host: "::0"; port: "443"; } +); + +protocols: +( + { name: "ssh"; service: "ssh"; host: "localhost"; port: "22"; probe: "builtin"; }, + { name: "openvpn"; host: "localhost"; port: "1194"; probe: "builtin"; }, + { name: "xmpp"; host: "localhost"; port: "5222"; probe: "builtin"; }, + { name: "http"; host: "localhost"; port: "80"; probe: "builtin"; }, + { name: "ssl"; host: "localhost"; port: "8443"; probe: "builtin"; }, + { name: "anyprot"; host: "localhost"; port: "8443"; probe: "builtin"; } +); + diff --git a/testing/sslh/sslh.confd b/testing/sslh/sslh.confd new file mode 100644 index 0000000000..73d08d5f44 --- /dev/null +++ b/testing/sslh/sslh.confd @@ -0,0 +1,8 @@ +# /etc/conf.d/sslh + +# Options to sslh itself. See the sslh(1) man page. +#DAEMON_OPTS="" + +# Multiplexing example +# Port 44 can be used for ssh, http, and https. Drop privileges after starting. +#DAEMON_OPTS="-p localhost:44 --ssh 127.0.0.1:22 --http 127.0.0.1:80 --ssl 127.0.0.1:443 --user nobody" diff --git a/testing/sslh/sslh.initd b/testing/sslh/sslh.initd new file mode 100644 index 0000000000..b75e96f2a3 --- /dev/null +++ b/testing/sslh/sslh.initd @@ -0,0 +1,21 @@ +#!/sbin/openrc-run +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +start() { + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start \ + --pidfile /var/run/${SVCNAME}.pid \ + --exec /usr/sbin/sslh -- \ + ${DAEMON_OPTS} \ + --pidfile /var/run/${SVCNAME}.pid + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --quiet --retry 20 \ + --pidfile /var/run/${SVCNAME}.pid + eend $? +} |