Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id 2D2CC782C38 for ; Sun, 22 Aug 2021 15:49:44 +0000 (UTC) Received: by mail-wr1-f44.google.com with SMTP id k29so22247184wrd.7 for ; Sun, 22 Aug 2021 08:49:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5s2rQMxh0uIn24urEZAxUj3DWmI8TNcCjGq/F+D9MHY=; b=ZDrPScCso121CHJoRqHv1oZOrdK3kbvw18Bc1xZSbCHkxAioRzgKXmVBoj30kbmkXr nFIGFr2czVUzLLbxJ95KHYmJSMgGhprZudvfIL1IW8eCDaM6sH6Br57Ys9+BpPyK425Z pSQtcarIQWMh3vYpYyDqjdoJOyJrBqTE6KhDZ7ynhE8a+WBzGwT7kNC52KoXckNVqEEe kMa0DmVEFZz3gJKzygvyzbMb9c6k1a8+rWvuAg5YFo5PkgR0IbppyBvTzcYYnHwr4HSG s9J4A6tjuxDEcfJe224m0H76KR8loWCArCBz6O5mu/FBKs+0gAz6zZgq5Z469rrNOdBY GhmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=5s2rQMxh0uIn24urEZAxUj3DWmI8TNcCjGq/F+D9MHY=; b=nPGWbO/WRniaLgkxhJkTSXZT+PflGve0fM60hj8Ab0wUZ0tO5DvlEpxCuP/jlxuCrG OUfziDdQQOA0BDyPlNBiNnoGzhFk3CK3UcE6qXbpvESDbI/bGcCLXHKuL089YoMXly31 T3pQXa9xVpPqtzzCpIrGWFbGHi3hMVLzXSIMn3crxT3bL4Gi2cygPUUd9pMpAFpVUDZG tfl5jsIQlJHI5b2jWqnuTykEfRwgvg0nU52dK0nHQJsMmTof0+SMGQLxZ9TONyK0+/89 Fmyj0DBygCJxcf4leLUPGQupsU5r+SuW5nrXep1cyLTkxacsnnvV4+UPfNP9Fj/Eux/O D8Fg== X-Gm-Message-State: AOAM530q92Sqw77KjPmIhp0HiGueUFeVqxYeHVWvoy3px/jzikWZN+Jr CmHIOh7KWEfVXzpqq1d90106AwHHMsA= X-Google-Smtp-Source: ABdhPJxDEieBsHJRBu8u8MzsdN/ZVu+iDK5uENA1boI/mX2dfMVmpO0saCF2AA9LG38QpKc+NxMsjA== X-Received: by 2002:adf:f044:: with SMTP id t4mr9544641wro.352.1629647384221; Sun, 22 Aug 2021 08:49:44 -0700 (PDT) Received: from localhost.localdomain ([94.31.100.46]) by smtp.gmail.com with ESMTPSA id n188sm14847523wmn.48.2021.08.22.08.49.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Aug 2021 08:49:43 -0700 (PDT) Sender: Marvin Preuss From: Marvin Preuss To: alpine-aports@lists.alpinelinux.org Cc: Marvin Preuss Subject: [PATCH v4] testing/tlsrouter: new aport Date: Sun, 22 Aug 2021 17:49:40 +0200 Message-Id: <20210822154940.950722-1-marvin@xsteadfastx.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit set prepare in the chronological order like leo suggested: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/24423#note_176100 --- testing/tlsrouter/APKBUILD | 52 +++++++++++++++++++++++++ testing/tlsrouter/go.mod | 5 +++ testing/tlsrouter/go.sum | 2 + testing/tlsrouter/tlsrouter.confd | 3 ++ testing/tlsrouter/tlsrouter.initd | 14 +++++++ testing/tlsrouter/tlsrouter.pre-install | 8 ++++ 6 files changed, 84 insertions(+) create mode 100644 testing/tlsrouter/APKBUILD create mode 100644 testing/tlsrouter/go.mod create mode 100644 testing/tlsrouter/go.sum create mode 100644 testing/tlsrouter/tlsrouter.confd create mode 100644 testing/tlsrouter/tlsrouter.initd create mode 100644 testing/tlsrouter/tlsrouter.pre-install diff --git a/testing/tlsrouter/APKBUILD b/testing/tlsrouter/APKBUILD new file mode 100644 index 0000000000..9383ff46a2 --- /dev/null +++ b/testing/tlsrouter/APKBUILD @@ -0,0 +1,52 @@ +# Contributor: Marvin Preuss +# Maintainer: Marvin Preuss +pkgname=tlsrouter +pkgver=0_git20210817 +pkgrel=0 +_short_commit=b6bb9b5 +pkgdesc="tls proxy that routes connections to backends based on tls sni" +url="https://github.com/inetaf/tcpproxy/tree/master/cmd/tlsrouter" +arch="all" +license="Apache-2.0" +options="!check" # some tests are failing +makedepends="go libcap" +subpackages="$pkgname-openrc" +install="$pkgname.pre-install" +source="tlsrouter-$pkgver.tar.gz::https://github.com/inetaf/tcpproxy/tarball/$_short_commit + $pkgname.initd + $pkgname.confd + go.mod + go.sum + " +builddir="$srcdir/inetaf-tcpproxy-$_short_commit/cmd/tlsrouter" + +export GOFLAGS="$GOFLAGS -modcacherw" + +prepare() { + default_prepare + cp "$srcdir/go.mod" "$builddir" + cp "$srcdir/go.sum" "$builddir" +} + +build() { + go build . +} + +package() { + install -Dm755 "$builddir/$pkgname" "$pkgdir/usr/bin/$pkgname" + + install -Dm755 "$srcdir/$pkgname.initd" \ + "$pkgdir/etc/init.d/$pkgname" + + install -Dm644 "$srcdir/$pkgname.confd" \ + "$pkgdir/etc/conf.d/$pkgname" + + setcap cap_net_bind_service=+ep "$pkgdir/usr/bin/$pkgname" +} +sha512sums=" +668dff16cdd7078b2fa1e363743ff642ef5e4bff20a7f320d855b6db8e69fd70b940875251950ec332ada8d1d4eb79649c30729fdf8a501e4fb5d8abc456de10 tlsrouter-0_git20210817.tar.gz +495b26eaba88b57f4e363b7e89e302ba73c89a38f69c3c299ba4dd3531e5a2231c92b90c11d79a0199fbe602059c43ad52ae3d6cdfe532b350a884a90b21983e tlsrouter.initd +7dde09a46fa706fc7ef511c034bd8e1cb58a29d55320cc5fae9fdd6a5dc053948cb28ef76f1f8893edd656a3b99dd222a54f660b12a220011fcb949c1f64874c tlsrouter.confd +aa271f389bb13defd50234623e03ae4246db5a3c5fc81fa40f02f277b9cec1b463e61bd44151ffbfae5f579087d89da9d91cf2e54db8a011c0e3c6bb46933aae go.mod +c9c7f86b7810aa098cc8dd5137502ec7683dc8141db07bc1dc0977b55f56adc2205219b76af96805a2d4ab7817a32f09f85df117e0179460a22a268f11f0e68c go.sum +" diff --git a/testing/tlsrouter/go.mod b/testing/tlsrouter/go.mod new file mode 100644 index 0000000000..1aac78ca5b --- /dev/null +++ b/testing/tlsrouter/go.mod @@ -0,0 +1,5 @@ +module tlsrouter + +go 1.16 + +require github.com/armon/go-proxyproto v0.0.0-20210323213023-7e956b284f0a diff --git a/testing/tlsrouter/go.sum b/testing/tlsrouter/go.sum new file mode 100644 index 0000000000..de51fb1c3d --- /dev/null +++ b/testing/tlsrouter/go.sum @@ -0,0 +1,2 @@ +github.com/armon/go-proxyproto v0.0.0-20210323213023-7e956b284f0a h1:AP/vsCIvJZ129pdm9Ek7bH7yutN3hByqsMoNrWAxRQc= +github.com/armon/go-proxyproto v0.0.0-20210323213023-7e956b284f0a/go.mod h1:QmP9hvJ91BbJmGVGSbutW19IC0Q9phDCLGaomwTJbgU= diff --git a/testing/tlsrouter/tlsrouter.confd b/testing/tlsrouter/tlsrouter.confd new file mode 100644 index 0000000000..3332390b62 --- /dev/null +++ b/testing/tlsrouter/tlsrouter.confd @@ -0,0 +1,3 @@ +# tlsrouter options + +tlsrouter_opts="-conf /etc/tlsrouter/tlsrouter.conf -listen :443" diff --git a/testing/tlsrouter/tlsrouter.initd b/testing/tlsrouter/tlsrouter.initd new file mode 100644 index 0000000000..3f2bfa3388 --- /dev/null +++ b/testing/tlsrouter/tlsrouter.initd @@ -0,0 +1,14 @@ +#!/sbin/openrc-run + +supervisor=supervise-daemon + +name=tlsrouter +command="/usr/bin/tlsrouter" +command_args="$tlsrouter_opts" +command_user="tlsrouter" +start_stop_daemon_args="--quiet" + +depend() { + need net + after firewall +} diff --git a/testing/tlsrouter/tlsrouter.pre-install b/testing/tlsrouter/tlsrouter.pre-install new file mode 100644 index 0000000000..e8bec36487 --- /dev/null +++ b/testing/tlsrouter/tlsrouter.pre-install @@ -0,0 +1,8 @@ +#!/bin/sh + +addgroup -S tlsrouter 2>/dev/null +adduser -S -D -h /var/lib/tlsrouter -s /sbin/nologin -G tlsrouter -g tlsrouter tlsrouter 2>/dev/null +mkdir -p /etc/tlsrouter 2>/dev/null +chown tlsrouter:tlsrouter /etc/tlsrouter 2>/dev/null + +exit 0 -- 2.33.0