summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gentoo.org>2017-06-14 08:36:41 -0700
committerMatt Turner <mattst88@gentoo.org>2017-06-14 08:48:04 -0700
commit58ad6e14c853928499f34ee991120ee2196058e7 (patch)
tree2e790d43e098ce37ea25dc3cfa372abfd351ace5
parentwww-apps/gitea: Remove old (diff)
downloadgentoo-58ad6e14c853928499f34ee991120ee2196058e7.tar.gz
gentoo-58ad6e14c853928499f34ee991120ee2196058e7.tar.bz2
gentoo-58ad6e14c853928499f34ee991120ee2196058e7.zip
net-proxy/redsocks: Ship man page, init files, etc
Also move config file to /etc/redsocks.conf (there's a single file, no need for a directory) and add a redsocks user and group.
-rw-r--r--net-proxy/redsocks/files/redsocks.conf15
-rw-r--r--net-proxy/redsocks/files/redsocks.init53
-rw-r--r--net-proxy/redsocks/files/redsocks.service15
-rw-r--r--net-proxy/redsocks/metadata.xml15
-rw-r--r--net-proxy/redsocks/redsocks-0.5.ebuild19
-rw-r--r--net-proxy/redsocks/redsocks-9999.ebuild19
6 files changed, 128 insertions, 8 deletions
diff --git a/net-proxy/redsocks/files/redsocks.conf b/net-proxy/redsocks/files/redsocks.conf
new file mode 100644
index 000000000000..76b2c5f893c4
--- /dev/null
+++ b/net-proxy/redsocks/files/redsocks.conf
@@ -0,0 +1,15 @@
+# Config file for /etc/init.d/redsocks
+
+# Path to the redsocks binary (needs to be absolute path).
+
+#REDSOCKS_BINARY="/usr/sbin/redsocks"
+
+# Path to the redsocks config (needs to be absolute path).
+
+#REDSOCKS_CONFIG="/etc/redsocks.conf"
+
+# Pid file to use (needs to be absolute path).
+
+#REDSOCKS_PIDFILE="/run/redsocks/redsocks.pid"
+
+rc_use="logger"
diff --git a/net-proxy/redsocks/files/redsocks.init b/net-proxy/redsocks/files/redsocks.init
new file mode 100644
index 000000000000..853d9b57a6bb
--- /dev/null
+++ b/net-proxy/redsocks/files/redsocks.init
@@ -0,0 +1,53 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+: ${REDSOCKS_BINARY:=/usr/sbin/redsocks}
+: ${REDSOCKS_CONFIG:=/etc/redsocks.conf}
+: ${REDSOCKS_PIDFILE:=/run/redsocks/redsocks.pid}
+
+extra_commands="checkconfig"
+extra_started_commands="reload"
+
+depend() {
+ need localmount
+ use dns
+}
+
+checkconfig() {
+ if [ ! -f "${REDSOCKS_CONFIG}" ] ; then
+ eerror "No ${REDSOCKS_CONFIG} file exists!"
+ return 1
+ fi
+
+ "${REDSOCKS_BINARY}" -t -c ${REDSOCKS_CONFIG} || return 1
+}
+
+start() {
+ checkconfig || return 1
+
+ ebegin "Starting ${SVCNAME}"
+ start-stop-daemon --start --exec "${REDSOCKS_BINARY}" \
+ -p "${REDSOCKS_PIDFILE}" -c ${REDSOCKS_CONFIG}
+ eend $?
+}
+
+stop() {
+ if [ "${RC_CMD}" = "restart" ] ; then
+ checkconfig || return 1
+ fi
+
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --stop --exec "${REDSOCKS_BINARY}" \
+ -p "${REDSOCKS_PIDFILE}" -c "${REDSOCKS_CONFIG}"
+ eend $?
+}
+
+reload() {
+ checkconfig || return 1
+
+ ebegin "Reloading ${SVCNAME}"
+ start-stop-daemon --signal HUP --exec "${REDSOCKS_BINARY}" \
+ -p "${REDSOCKS_PIDFILE}" -c "${REDSOCKS_CONFIG}"
+ eend $?
+}
diff --git a/net-proxy/redsocks/files/redsocks.service b/net-proxy/redsocks/files/redsocks.service
new file mode 100644
index 000000000000..db0e9d6093e9
--- /dev/null
+++ b/net-proxy/redsocks/files/redsocks.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Transparent redirector of any TCP connection to proxy using your firewall
+
+[Service]
+Type=forking
+PIDFile=/run/redsocks/redsocks.pid
+User=redsocks
+ExecStartPre=/usr/sbin/redsocks -t -c /etc/redsocks.conf
+ExecStart=/usr/sbin/redsocks -c /etc/redsocks.conf \
+ -p /run/redsocks/redsocks.pid
+ExecStopPost=/bin/rm /run/redsocks/redsocks.pid
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-proxy/redsocks/metadata.xml b/net-proxy/redsocks/metadata.xml
index bf35bd06d383..8f0d16e0c220 100644
--- a/net-proxy/redsocks/metadata.xml
+++ b/net-proxy/redsocks/metadata.xml
@@ -5,6 +5,21 @@
<email>mattst88@gentoo.org</email>
<name>Matt Turner</name>
</maintainer>
+ <longdescription lang="en">
+ Redirect any TCP connection to a SOCKS or HTTPS proxy server Redsocks
+ is a daemon running on the local system, that will transparently tunnel
+ any TCP connection via a remote SOCKS4, SOCKS5 or HTTP proxy server. It
+ uses the system firewall's redirection facility to intercept TCP
+ connections, thus the redirection is system-wide, with fine-grained
+ control, and does not depend on LD_PRELOAD libraries.
+
+ Redsocks supports tunneling TCP connections and UDP packets. It has
+ authentication support for both, SOCKS and HTTP proxies.
+
+ Also included is a small DNS server returning answers with the
+ "truncated" flag set for any UDP query, forcing the resolver to use
+ TCP.
+ </longdescription>
<upstream>
<remote-id type="github">darkk/redsocks</remote-id>
</upstream>
diff --git a/net-proxy/redsocks/redsocks-0.5.ebuild b/net-proxy/redsocks/redsocks-0.5.ebuild
index 609aff1f9571..984f5b196d5c 100644
--- a/net-proxy/redsocks/redsocks-0.5.ebuild
+++ b/net-proxy/redsocks/redsocks-0.5.ebuild
@@ -11,7 +11,7 @@ else
EGIT_REPO_URI="git://github.com/darkk/${PN}.git"
fi
-inherit toolchain-funcs ${GIT_ECLASS}
+inherit systemd toolchain-funcs user ${GIT_ECLASS}
DESCRIPTION="Transparent redirector of any TCP connection to proxy"
HOMEPAGE="http://darkk.net.ru/redsocks/"
@@ -25,13 +25,24 @@ RDEPEND="${DEPEND}
[[ ${PV} != *9999 ]] && S="${WORKDIR}"/"${PN}"-release-"${PV}"
+pkg_setup() {
+ enewgroup redsocks
+ enewuser redsocks -1 -1 /run/redsocks redsocks
+}
+
src_compile() {
CC="$(tc-getCC)" emake || die "emake failed"
}
src_install() {
- dobin redsocks
+ dosbin redsocks
+ doman debian/redsocks.8
use doc && dodoc README doc/*
- insinto /etc/redsocks
- newins redsocks.conf.example redsocks.conf
+ insinto /etc
+ newins debian/redsocks.conf redsocks.conf
+
+ newinitd "${FILESDIR}"/redsocks.init redsocks
+ newconfd "${FILESDIR}"/redsocks.conf redsocks
+
+ systemd_dounit "${FILESDIR}"/redsocks.service
}
diff --git a/net-proxy/redsocks/redsocks-9999.ebuild b/net-proxy/redsocks/redsocks-9999.ebuild
index 609aff1f9571..984f5b196d5c 100644
--- a/net-proxy/redsocks/redsocks-9999.ebuild
+++ b/net-proxy/redsocks/redsocks-9999.ebuild
@@ -11,7 +11,7 @@ else
EGIT_REPO_URI="git://github.com/darkk/${PN}.git"
fi
-inherit toolchain-funcs ${GIT_ECLASS}
+inherit systemd toolchain-funcs user ${GIT_ECLASS}
DESCRIPTION="Transparent redirector of any TCP connection to proxy"
HOMEPAGE="http://darkk.net.ru/redsocks/"
@@ -25,13 +25,24 @@ RDEPEND="${DEPEND}
[[ ${PV} != *9999 ]] && S="${WORKDIR}"/"${PN}"-release-"${PV}"
+pkg_setup() {
+ enewgroup redsocks
+ enewuser redsocks -1 -1 /run/redsocks redsocks
+}
+
src_compile() {
CC="$(tc-getCC)" emake || die "emake failed"
}
src_install() {
- dobin redsocks
+ dosbin redsocks
+ doman debian/redsocks.8
use doc && dodoc README doc/*
- insinto /etc/redsocks
- newins redsocks.conf.example redsocks.conf
+ insinto /etc
+ newins debian/redsocks.conf redsocks.conf
+
+ newinitd "${FILESDIR}"/redsocks.init redsocks
+ newconfd "${FILESDIR}"/redsocks.conf redsocks
+
+ systemd_dounit "${FILESDIR}"/redsocks.service
}