diff options
author | Zeta | 2017-07-20 15:20:42 +0000 |
---|---|---|
committer | Zeta | 2017-07-20 15:20:42 +0000 |
commit | 8d1c7e7e5c10b751debf2427a6856fbb5b419552 (patch) | |
tree | d12a32ba0b31fafc761941b910ee2e37447b8874 | |
download | aur-8d1c7e7e5c10b751debf2427a6856fbb5b419552.tar.gz |
first commit, adapted AUR redsocks to redsocks2 from https://github.com/semigodking/redsocks
-rw-r--r-- | .SRCINFO | 24 | ||||
-rw-r--r-- | PKGBUILD | 51 | ||||
-rw-r--r-- | redsocks2.install | 33 | ||||
-rw-r--r-- | redsocks2.rules | 28 | ||||
-rw-r--r-- | redsocks2.tmpfiles | 1 |
5 files changed, 137 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..0447a7c9bb8a --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,24 @@ +pkgbase = redsocks2-git + pkgdesc = Transparent redirector of any TCP connection to proxy using your firewall + pkgver = 0.66.r17.g56015a6 + pkgrel = 1 + url = https://github.com/semigodking/redsocks + install = redsocks2.install + arch = i686 + arch = x86_64 + license = GPL3 + makedepends = git + depends = libevent + provides = redsocks2 + conflicts = redsocks + backup = etc/conf.d/redsocks2 + backup = etc/iptables/redsocks2.rules + source = redsocks2-git::git+https://github.com/gilcu3/redsocks.git + source = redsocks2.tmpfiles + source = redsocks2.rules + md5sums = SKIP + md5sums = 9be5e8bea768b1a8fdec55a8e8af33fd + md5sums = 04702a7faf31d707d3df4c116bd58a6d + +pkgname = redsocks2-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..92c812e5907e --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,51 @@ +# Maintainer: gilcu3 <gilcu3@gmail.com> +# Contributor: mortzu <me@mortzu.de> +# Contributor: David Manouchehri <d@32t.ca> +# Submitter: fluffylime <fluffylime@gmail.com> + +pkgname=redsocks2-git +pkgver=0.66.r17.g56015a6 +pkgrel=1 +pkgdesc='Transparent redirector of any TCP connection to proxy using your firewall' +arch=('i686' 'x86_64') +url='https://github.com/semigodking/redsocks' +license=('GPL3') +depends=('libevent') +makedepends=('git') +conflicts=('redsocks') +provides=('redsocks2') +install=redsocks2.install +backup=('etc/conf.d/redsocks2' + 'etc/iptables/redsocks2.rules') + +source=("$pkgname"::'git+https://github.com/gilcu3/redsocks.git' + 'redsocks2.tmpfiles' + 'redsocks2.rules') +md5sums=('SKIP' + '9be5e8bea768b1a8fdec55a8e8af33fd' + '04702a7faf31d707d3df4c116bd58a6d') + +pkgver() { + cd "$pkgname" + + git describe | sed -E 's/([^-]*-g)/r\1/;s/-/./g;s/release.//g' +} + +build() { + cd "$pkgname" + + make +} + +package() { + cd "$pkgname" + + install -Dm644 "$srcdir/$pkgname/redsocks2.conf.example" "$pkgdir/etc/redsocks2.conf" + install -Dm644 "$srcdir/redsocks2.rules" "$pkgdir/etc/iptables/redsocks2.rules" + install -Dm644 "$srcdir/redsocks2.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/redsocks2.conf" + + install -Dm755 "redsocks2" "$pkgdir/usr/bin/redsocks2" + install -Dm644 "README" "$pkgdir/usr/share/doc/redsocks2/README" + install -Dm644 "redsocks2.service" "$pkgdir/usr/lib/systemd/system/redsocks2.service" + install -Dm644 "redsocks2.conf.example" "$pkgdir/usr/share/doc/redsocks2/redsocks2.conf.example" +} diff --git a/redsocks2.install b/redsocks2.install new file mode 100644 index 000000000000..ed641f16a9e6 --- /dev/null +++ b/redsocks2.install @@ -0,0 +1,33 @@ +#!/bin/sh + +add_redsocks_user() { + getent group redsocks &>/dev/null || groupadd -r redsocks >/dev/null + getent passwd redsocks &>/dev/null || useradd -r -g redsocks -d / -s /bin/false -c redsocks redsocks >/dev/null + systemd-tmpfiles --create redsocks2.conf +} + +post_install() { + add_redsocks_user + cat << EOF +To launch redsocks2: + +1. Start an ssh tunnel on port 4711 +2. Start the redsocks2 and iptables daemons: + + rc.d start redsocks2 iptables + +3. Load the redsocks2 iptables rules: + + iptables-restore /etc/iptables/redsocks2.rules +EOF +} + +post_upgrade() { + add_redsocks_user +} + +post_remove() { + getent passwd redsocks &>/dev/null && userdel redsocks >/dev/null + getent group redsocks &>/dev/null && groupdel redsocks >/dev/null + true +} diff --git a/redsocks2.rules b/redsocks2.rules new file mode 100644 index 000000000000..f9d979e30a4c --- /dev/null +++ b/redsocks2.rules @@ -0,0 +1,28 @@ +# Transparent SOCKS proxy +# See: http://darkk.net.ru/redsocks/ + +*nat +:PREROUTING ACCEPT [0:0] +:INPUT ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:POSTROUTING ACCEPT [0:0] +:REDSOCKS - [0:0] + +# Redirect all output through redsocks +-A OUTPUT -p tcp -j REDSOCKS + +# Whitelist LANs and some other reserved addresses. +# https://en.wikipedia.org/wiki/Reserved_IP_addresses#Reserved_IPv4_addresses +-A REDSOCKS -d 0.0.0.0/8 -j RETURN +-A REDSOCKS -d 10.0.0.0/8 -j RETURN +-A REDSOCKS -d 127.0.0.0/8 -j RETURN +-A REDSOCKS -d 169.254.0.0/16 -j RETURN +-A REDSOCKS -d 172.16.0.0/12 -j RETURN +-A REDSOCKS -d 192.168.0.0/16 -j RETURN +-A REDSOCKS -d 224.0.0.0/4 -j RETURN +-A REDSOCKS -d 240.0.0.0/4 -j RETURN + +# Redirect everything else to redsocks port +-A REDSOCKS -p tcp -j REDIRECT --to-ports 31338 + +COMMIT diff --git a/redsocks2.tmpfiles b/redsocks2.tmpfiles new file mode 100644 index 000000000000..beaa109c2f05 --- /dev/null +++ b/redsocks2.tmpfiles @@ -0,0 +1 @@ +d /run/redsocks 0755 redsocks redsocks - - |