For discussion of Alpine Linux development and developer support

2 2

[alpine-devel] [PATCH] testing/dante: new aport https://www.inet.no/dante/ Dante - A free SOCKS server

Paul Kilar
Details
Message ID
<1405354456-6025-1-git-send-email-pkilar@gmail.com>
Sender timestamp
1405354456
DKIM signature
missing
Download raw message
Patch: +114 -0
---
 testing/dante/APKBUILD                 | 64 ++++++++++++++++++++++++++++++++++
 testing/dante/dante-server.pre-install |  5 +++
 testing/dante/sockd.confd              |  2 ++
 testing/dante/sockd.initd              | 43 +++++++++++++++++++++++
 4 files changed, 114 insertions(+)
 create mode 100644 testing/dante/APKBUILD
 create mode 100644 testing/dante/dante-server.pre-install
 create mode 100644 testing/dante/sockd.confd
 create mode 100644 testing/dante/sockd.initd

diff --git a/testing/dante/APKBUILD b/testing/dante/APKBUILD
new file mode 100644
index 0000000..f3bcfa9
--- /dev/null
+++ b/testing/dante/APKBUILD
@@ -0,0 +1,64 @@
+# Contributor: Paul Kilar <pkilar@gmail.com>
+# Maintainer: Paul Kilar <pkilar@gmail.com>
+pkgname=dante
+pkgver='1.4.0'
+pkgrel=0
+pkgdesc="Dante is SOCKS server and a SOCKS client"
+url="http://www.inet.no/dante/index.html"
+arch="all"
+license="BSD/CMU"
+depends=""
+depends_dev=""
+makedepends="bison flex"
+install="$pkgname-server.pre-install"
+options="libtool"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-server"
+source="http://www.inet.no/dante/files/$pkgname-$pkgver.tar.gz
+sockd.initd
+sockd.confd"
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+	local i
+	cd "$_builddir"
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+}
+
+build() {
+	cd "$_builddir"
+	./configure --prefix=/usr
+	make || return 1
+}
+
+package() {
+	cd "$_builddir"
+	make install DESTDIR=$pkgdir || return 1
+}
+
+server() {
+	depends=
+	cd "$_builddir"
+	install -D -m644 "example/sockd.conf" \
+		"$subpkgdir/etc/sockd.conf" || return 1
+	install -D -m644 "$srcdir"/sockd.confd \
+		"$subpkgdir"/etc/conf.d/sockd || return 1
+	install -D -m755 "$srcdir"/sockd.initd \
+		"$subpkgdir"/etc/init.d/sockd || return 1
+
+	install -d "$subpkgdir/usr/sbin"
+	mv "$pkgdir/usr/sbin/sockd" "$subpkgdir/usr/sbin/sockd"
+}
+
+md5sums="c117a3ce25afb936f13b76f1d2524879  dante-1.4.0.tar.gz
+2e947985f21a3b0121ac4af8adb16e0c  sockd.initd
+cb49c2fc52c777cc313b089f9d333160  sockd.confd"
+sha256sums="55d448f2d523e69b5637ef12c05556f39201a2c397b4671a2aaaa914ba65684b  dante-1.4.0.tar.gz
+40792a170047097164aef164b26f3df00c75b39ca3f6d6a346322f8d286a4b16  sockd.initd
+0b25fe45b5b4315ef3958b89d6b63fd77004ea26d9f5160380c34bbc6e7bbd9f  sockd.confd"
+sha512sums="978a70eb789dd2d00a9ac4a7671d13450f9ac96344ae41382c38de7a12e98c2e24159c2e140c95caff0cc9119f7cf409a8716130b34957020706a17c0f96de38  dante-1.4.0.tar.gz
+3859b2ccd5c4987fb1221697cba87163d23b53de29fb8b6dd3a6b5560288c2a21c1528f2d7f54fea33644dc50361d594c6fca3364e89a58d01c3de5d6b2d4ebf  sockd.initd
+09b744340c03369983a9b07e50215288e5a43d15497db479867132bee46f34a7a8e451c980e064f751ad50e5231d77fa5ae9fd5cf2efe3274ae50168bfceaa67  sockd.confd"
diff --git a/testing/dante/dante-server.pre-install b/testing/dante/dante-server.pre-install
new file mode 100644
index 0000000..f245d67
--- /dev/null
+++ b/testing/dante/dante-server.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+addgroup -S sockd 2>/dev/null
+adduser -S -H -h /dev/null -s /sbin/nologin -D -G sockd sockd 2>/dev/null
+exit 0
diff --git a/testing/dante/sockd.confd b/testing/dante/sockd.confd
new file mode 100644
index 0000000..37628d3
--- /dev/null
+++ b/testing/dante/sockd.confd
@@ -0,0 +1,2 @@
+# enter the sockd options
+SOCKD_OPTS="-D"
diff --git a/testing/dante/sockd.initd b/testing/dante/sockd.initd
new file mode 100644
index 0000000..ebf2780
--- /dev/null
+++ b/testing/dante/sockd.initd
@@ -0,0 +1,43 @@
+#!/sbin/runscript
+#
+# startup script for sockd daemon
+#
+
+depend() {
+    need net
+    after firewall
+    provide sockd
+    use dns
+}
+
+SOCKD_PIDFILE=${SSHD_PIDFILE:-/var/run/${SVCNAME}.pid}
+SOCKD_BINARY=${SSHD_BINARY:-/usr/sbin/sockd}
+
+check_config() {
+    $SOCKD_BINARY -V || return 1
+}
+
+#########################################################################################
+
+start() {
+    check_config || return 1
+    ebegin "Starting ${SVCNAME}"
+    start-stop-daemon --start --exec "${SOCKD_BINARY}" \
+        --pidfile "${SOCKD_PIDFILE}" \
+        -- ${SOCKD_OPTS}
+    eend $?
+}
+
+stop() {
+    ebegin "Stopping ${SVCNAME}"
+    start-stop-daemon --stop --exec "${SOCKD_BINARY}" \
+        --pidfile "${SOCKD_PIDFILE}" --quiet
+    eend $?
+}
+
+restart() {
+    ebegin "Restarting ${SVCNAME}"
+    stop
+    start
+    eend $?
+}
-- 
2.0.0



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa
Details
Message ID
<20140715161713.45d96990@ncopa-desktop.alpinelinux.org>
In-Reply-To
<1405354456-6025-1-git-send-email-pkilar@gmail.com> (view parent)
Sender timestamp
1405433833
DKIM signature
missing
Download raw message
On Mon, 14 Jul 2014 12:14:16 -0400
Paul Kilar <pkilar@gmail.com> wrote:

> ---
>  testing/dante/APKBUILD                 | 64 ++++++++++++++++++++++++++++++++++
>  testing/dante/dante-server.pre-install |  5 +++
>  testing/dante/sockd.confd              |  2 ++
>  testing/dante/sockd.initd              | 43 +++++++++++++++++++++++
>  4 files changed, 114 insertions(+)
>  create mode 100644 testing/dante/APKBUILD
>  create mode 100644 testing/dante/dante-server.pre-install
>  create mode 100644 testing/dante/sockd.confd
>  create mode 100644 testing/dante/sockd.initd
> 
...

> --- /dev/null
> +++ b/testing/dante/sockd.initd
> @@ -0,0 +1,43 @@
> +#!/sbin/runscript
> +#
> +# startup script for sockd daemon
> +#
> +
> +depend() {
> +    need net
> +    after firewall
> +    provide sockd
> +    use dns
> +}

I believe the rest could be rewritten as:

command=/usr/sbin/sockd
pidfile=/var/run/${SVCNAME}.pid
command_args="${SOCKD_OPTS}"

start_pre() {
	$command -V
}

and that should be enough

see: http://www.linuxhowtos.org/manpages/8/runscript.htm

> +
> +SOCKD_PIDFILE=${SSHD_PIDFILE:-/var/run/${SVCNAME}.pid}
> +SOCKD_BINARY=${SSHD_BINARY:-/usr/sbin/sockd}

SSHD?

> +
> +check_config() {
> +    $SOCKD_BINARY -V || return 1
> +}
> +
> +#########################################################################################
> +
> +start() {
> +    check_config || return 1
> +    ebegin "Starting ${SVCNAME}"
> +    start-stop-daemon --start --exec "${SOCKD_BINARY}" \
> +        --pidfile "${SOCKD_PIDFILE}" \
> +        -- ${SOCKD_OPTS}
> +    eend $?
> +}
> +
> +stop() {
> +    ebegin "Stopping ${SVCNAME}"
> +    start-stop-daemon --stop --exec "${SOCKD_BINARY}" \
> +        --pidfile "${SOCKD_PIDFILE}" --quiet
> +    eend $?
> +}
> +
> +restart() {
> +    ebegin "Restarting ${SVCNAME}"
> +    stop
> +    start
> +    eend $?
> +}

restart is not needed to define. openrc will do the stop/start for you.

-nc


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Dean Takemori
Details
Message ID
<A628AB0C-F5FA-4A38-B59C-7E18F810D08D@hawaii.rr.com>
In-Reply-To
<1405354456-6025-1-git-send-email-pkilar@gmail.com> (view parent)
Sender timestamp
1405514476
DKIM signature
missing
Download raw message
On Jul 14, 2014, at 6:14 AM, Paul Kilar <pkilar@gmail.com> wrote:

> ---
> testing/dante/APKBUILD                 | 64 ++++++++++++++++++++++++++++++++++
> testing/dante/dante-server.pre-install |  5 +++
> testing/dante/sockd.confd              |  2 ++
> testing/dante/sockd.initd              | 43 +++++++++++++++++++++++
> 4 files changed, 114 insertions(+)
> create mode 100644 testing/dante/APKBUILD
> create mode 100644 testing/dante/dante-server.pre-install
> create mode 100644 testing/dante/sockd.confd
> create mode 100644 testing/dante/sockd.initd


Coincidentally, I have experimenting with dante-1.4.0 on alpine myself.

On alpine-3.0.1, with musl-1.1.3-r0, I get this when starting the socked after configuring and building with defaults

sockd[11056]: error: serverinit(): sched_getscheduler(2): failed to retrieve current cpuscheduling policy: Function not implemented


It starts and appears to work (very limited testing) by configuring with 

ac_cv_func_sched_setscheduler=no ./configure 

-dean takemori




---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---