diff options
author | Matt Turner <mattst88@gentoo.org> | 2017-06-14 08:36:41 -0700 |
---|---|---|
committer | Matt Turner <mattst88@gentoo.org> | 2017-06-14 08:48:04 -0700 |
commit | 58ad6e14c853928499f34ee991120ee2196058e7 (patch) | |
tree | 2e790d43e098ce37ea25dc3cfa372abfd351ace5 /net-proxy/redsocks/files | |
parent | www-apps/gitea: Remove old (diff) | |
download | gentoo-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.
Diffstat (limited to 'net-proxy/redsocks/files')
-rw-r--r-- | net-proxy/redsocks/files/redsocks.conf | 15 | ||||
-rw-r--r-- | net-proxy/redsocks/files/redsocks.init | 53 | ||||
-rw-r--r-- | net-proxy/redsocks/files/redsocks.service | 15 |
3 files changed, 83 insertions, 0 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 |