diff options
author | Ruoxi Wang | 2020-03-03 17:42:19 +0800 |
---|---|---|
committer | Ruoxi Wang | 2020-03-03 17:50:40 +0800 |
commit | 33be54ee9e0095af162faa70aa391cf2d4f27ed5 (patch) | |
tree | 042818309601f6ca3718ecea0fbc145a2ebcdd15 | |
download | aur-33be54ee9e0095af162faa70aa391cf2d4f27ed5.tar.gz |
First commit, modified udp2raw-tunnel's PKGBUILD
-rw-r--r-- | .SRCINFO | 19 | ||||
-rw-r--r-- | PKGBUILD | 39 | ||||
-rw-r--r-- | udp2raw-tunnel.install | 7 | ||||
-rw-r--r-- | udp2raw@.service | 18 | ||||
-rw-r--r-- | udp2raw_script.sh | 17 |
5 files changed, 100 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..b145ad43c694 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,19 @@ +pkgbase = udp2raw-tunnel-git + pkgdesc = An Encrypted, Anti-Replay, Multiplexed UdP Tunnel, tunnels udp traffic through fake-tcp or icmp by using raw socket + pkgver = r682.5cc304a + pkgrel = 1 + url = https://github.com/wangyu-/udp2raw-tunnel + install = udp2raw-tunnel.install + arch = x86_64 + license = MIT + depends = iptables + conflicts = udp2raw-tunnel + source = udp2raw-tunnel::git://github.com/wangyu-/udp2raw-tunnel.git + source = udp2raw_script.sh + source = udp2raw@.service + sha512sums = SKIP + sha512sums = bd58325188f7a4d143d97ea6dfb0b8f2f86f6b82b8cb7496478fb3a9c425d42044db91bd7f554ed95443ce11bad288d48aad1f76404e3efec68ecbff8c56820f + sha512sums = f1e2831c02163646c26601896a617e07704dc1b6324fc73f4ea576959bd33d70425472d42333ad8b7f210bd8761a83bf08db40987b016067f01590703982ae42 + +pkgname = udp2raw-tunnel-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..e0d92c0b3e04 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,39 @@ +# Maintainer: Reese Wang <thuwrx10 at gmail dotcom> +# Contributor: Felix Yan <felixonmars@archlinux.org> +# Contributor: Peter Cai <peter at typeblog dot net> + +pkgname=udp2raw-tunnel-git +pkgver=r682.5cc304a +pkgrel=1 +pkgdesc='An Encrypted, Anti-Replay, Multiplexed UdP Tunnel, tunnels udp traffic through fake-tcp or icmp by using raw socket' +url='https://github.com/wangyu-/udp2raw-tunnel' +arch=('x86_64') +depends=('iptables') +conflicts=('udp2raw-tunnel') +license=('MIT') +install=udp2raw-tunnel.install +source=("${pkgname%-*}::git://github.com/wangyu-/udp2raw-tunnel.git" + "udp2raw_script.sh" + "udp2raw@.service") +sha512sums=('SKIP' + 'bd58325188f7a4d143d97ea6dfb0b8f2f86f6b82b8cb7496478fb3a9c425d42044db91bd7f554ed95443ce11bad288d48aad1f76404e3efec68ecbff8c56820f' + 'f1e2831c02163646c26601896a617e07704dc1b6324fc73f4ea576959bd33d70425472d42333ad8b7f210bd8761a83bf08db40987b016067f01590703982ae42') + +pkgver() { + cd "${srcdir}/${pkgname%-*}" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +build() { + cd "${srcdir}/${pkgname%-*}" + make amd64_hw_aes +} + +package() { + cd "${srcdir}/${pkgname%-*}" + install -Dm755 udp2raw_amd64_hw_aes "$pkgdir"/usr/bin/udp2raw + install -Dm644 example.conf "$pkgdir"/etc/udp2raw/example.conf + install -Dm755 "$srcdir"/udp2raw_script.sh "$pkgdir"/usr/lib/udp2raw/udp2raw_script.sh + install -Dm644 "$srcdir"/udp2raw@.service "$pkgdir"/usr/lib/systemd/system/udp2raw@.service + install -Dm644 LICENSE.md "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.md +} diff --git a/udp2raw-tunnel.install b/udp2raw-tunnel.install new file mode 100644 index 000000000000..7dfb329ef507 --- /dev/null +++ b/udp2raw-tunnel.install @@ -0,0 +1,7 @@ +post_install() { + setcap cap_net_raw,cap_net_admin+ep usr/bin/udp2raw 2>/dev/null +} + +post_upgrade() { + post_install "$1" +} diff --git a/udp2raw@.service b/udp2raw@.service new file mode 100644 index 000000000000..5e3eeb4c08d0 --- /dev/null +++ b/udp2raw@.service @@ -0,0 +1,18 @@ +[Unit] +Description=UDP over TCP/ICMP/UDP tunnel +After=network-online.target + +[Service] +User=nobody +Type=simple +PermissionsStartOnly=true +CapabilityBoundingSet=CAP_NET_RAW CAP_NET_ADMIN +ExecStartPre=/usr/lib/udp2raw/udp2raw_script.sh /etc/udp2raw/%i.conf insert +ExecStart=/usr/bin/udp2raw --conf-file /etc/udp2raw/%i.conf +ExecStopPost=/usr/lib/udp2raw/udp2raw_script.sh /etc/udp2raw/%i.conf delete +Restart=always +RestartSec=30 +StartLimitBurst=10 + +[Install] +WantedBy=multi-user.target diff --git a/udp2raw_script.sh b/udp2raw_script.sh new file mode 100644 index 000000000000..d955f5ec40bb --- /dev/null +++ b/udp2raw_script.sh @@ -0,0 +1,17 @@ +#!/bin/bash +CONF_FILE="$1" +TARGET="$2" +RULE=`/sbin/su -s /bin/bash nobody -c "/usr/bin/udp2raw -g --conf-file $CONF_FILE"` + +if [[ "$RULE" =~ ^(.*?)iptables\ \-I\ (.*?)\ \-j\ DROP(.*?)$ ]]; then + RULE="${BASH_REMATCH[2]}" +else + echo "Malformed output" + exit 1 +fi + +if [[ "$TARGET" == 'insert' ]]; then + /usr/bin/iptables -I $RULE -j DROP || exit 1 +elif [[ "$TARGET" == 'delete' ]]; then + /usr/bin/iptables -D $RULE -j DROP || exit 1 +fi |