aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuraj Lutter <otis@FreeBSD.org>2023-11-17 22:25:29 +0000
committerJuraj Lutter <otis@FreeBSD.org>2023-11-19 14:22:25 +0000
commitab04066dd703688b2ca580c6c20d26e14e6d3a37 (patch)
tree333e1bd5b976a7545efca0c1674621266dd75617
parentfe2c29ebcfbf5321af2c46b42511fdcd6933f29b (diff)
downloadports-ab04066dd703688b2ca580c6c20d26e14e6d3a37.tar.gz
ports-ab04066dd703688b2ca580c6c20d26e14e6d3a37.zip
net/ts-warp: Add new port
Add net/ts-warp port, Transparent proxy server and traffic wrapper. WWW: https://github.com/mezantrop/ts-warp Committing slightly modified version (reworked Makefile a bit, corrected pkg-plist and rc.d script). Also connect to the category's Makefile. PR: 269460 Differential Revision: https://reviews.freebsd.org/D42665
-rw-r--r--net/Makefile1
-rw-r--r--net/ts-warp/Makefile31
-rw-r--r--net/ts-warp/distinfo3
-rwxr-xr-xnet/ts-warp/files/tswarp.in67
-rw-r--r--net/ts-warp/pkg-descr6
-rw-r--r--net/ts-warp/pkg-plist8
6 files changed, 116 insertions, 0 deletions
diff --git a/net/Makefile b/net/Makefile
index ed089872d347..0cafc8732ad4 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -1555,6 +1555,7 @@
SUBDIR += trafshow3
SUBDIR += trickle
SUBDIR += trippy
+ SUBDIR += ts-warp
SUBDIR += tsclient
SUBDIR += tsctp
SUBDIR += tsocks
diff --git a/net/ts-warp/Makefile b/net/ts-warp/Makefile
new file mode 100644
index 000000000000..2a8f65721853
--- /dev/null
+++ b/net/ts-warp/Makefile
@@ -0,0 +1,31 @@
+PORTNAME= ts-warp
+DISTVERSION= 1.4.0-15
+DISTVERSIONSUFFIX= -g4c04cb2
+CATEGORIES= net
+
+MAINTAINER= zmey20000@yahoo.com
+COMMENT= Transparent proxy server and traffic wrapper
+WWW= https://github.com/mezantrop/ts-warp
+
+LICENSE= BSD2CLAUSE
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+USE_GITHUB= yes
+GH_ACCOUNT= mezantrop
+
+USE_RC_SUBR= tswarp
+
+do-install:
+ ${MKDIR} ${STAGEDIR}/var/db/ts-warp
+ ${INSTALL_PROGRAM} ${WRKSRC}/ts-warp ${STAGEDIR}${PREFIX}/bin
+ ${INSTALL_PROGRAM} ${WRKSRC}/ts-pass ${STAGEDIR}${PREFIX}/bin
+ ${INSTALL_DATA} ${WRKSRC}/examples/ts-warp.ini \
+ ${STAGEDIR}${PREFIX}/etc/ts-warp.conf.sample
+ ${INSTALL_DATA} ${WRKSRC}/examples/ts-warp_pf_freebsd.conf \
+ ${STAGEDIR}${PREFIX}/etc/ts-warp_pf.conf.sample
+ ${INSTALL_MAN} ${WRKSRC}/man/ts-pass.1 ${STAGEDIR}${MAN1PREFIX}/man/man1
+ ${INSTALL_MAN} ${WRKSRC}/man/ts-warp.sh.1 ${STAGEDIR}${MAN1PREFIX}/man/man1
+ ${INSTALL_MAN} ${WRKSRC}/man/ts-warp.5 ${STAGEDIR}${MAN5PREFIX}/man/man5
+ ${INSTALL_MAN} ${WRKSRC}/man/ts-warp.8 ${STAGEDIR}${MAN8PREFIX}/man/man8
+
+.include <bsd.port.mk>
diff --git a/net/ts-warp/distinfo b/net/ts-warp/distinfo
new file mode 100644
index 000000000000..4e45922db830
--- /dev/null
+++ b/net/ts-warp/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1700394340
+SHA256 (mezantrop-ts-warp-1.4.0-15-g4c04cb2_GH0.tar.gz) = c886b07135a255102a4f44a00c0f192b19ced361ffd9a00a519de601489d6a42
+SIZE (mezantrop-ts-warp-1.4.0-15-g4c04cb2_GH0.tar.gz) = 22432943
diff --git a/net/ts-warp/files/tswarp.in b/net/ts-warp/files/tswarp.in
new file mode 100755
index 000000000000..8f01d8583d63
--- /dev/null
+++ b/net/ts-warp/files/tswarp.in
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+# PROVIDE: tswarp
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# tswarp_enable (bool): Set to NO by default.
+# Set it to YES to enable ts-warp.
+# tswarp_configfile (string): Set to %%PREFIX%%/etc/ts-warp.conf
+#
+# tswarp_pfconf (string): Set to %%PREFIX%%/etc/ts-warp_pf.conf
+#
+# tswarp_flags (string): Set to "-d -v 2" by default
+
+. /etc/rc.subr
+
+name=tswarp
+desc="ts-warp serice startup script"
+rcvar=tswarp_enable
+pidfile=/var/run/ts-warp.pid
+
+load_rc_config $name
+
+: ${tswarp_enable:=NO}
+: ${tswarp_configfile:="%%PREFIX%%/etc/ts-warp.conf"}
+: ${tswarp_pfconf:="%%PREFIX%%/etc/ts-warp_pf.conf"}
+: ${tswarp_logfile:=/var/log/ts-warp.log}
+: ${tswarp_actfile:=/var/db/ts-warp/ts-warp.act}
+: ${tswarp_flags="-d -v 2"}
+
+command="%%PREFIX%%/bin/ts-warp"
+command_args="-c ${tswarp_configfile} -l ${tswarp_logfile} \
+ -p ${pidfile} -t ${tswarp_actfile} ${tswarp_flags}"
+required_files="${pf_rules} ${tswarp_configfile} ${tswarp_pfconf}"
+start_precmd=ts_warp_prestart
+stop_postcmd="[ -e ${pf_rules} ] && /sbin/pfctl -f ${pf_rules}"
+
+ts_warp_prestart()
+{
+ [ -d /var/db/ts-warp ] || /bin/mkdir -p /var/db/ts-warp
+
+ echo "Configuring PF for TS-Warp"
+
+ awk -v pf_conf=${tswarp_pfconf} '
+ /ts-warp/ {next}
+ /ns-warp/ {next}
+ /rdr-anchor/ {rdrpos = NR}
+ {pf[NR] = $0}
+
+ END {
+ for (i = 0; i < NR; i++)
+ if (i == rdrpos + 1) {
+ print("rdr-anchor \"ts-warp\"")
+ print("rdr-anchor \"ns-warp\"")
+ } else
+ print(pf[i])
+ print("anchor \"ts-warp\"")
+ print("anchor \"ns-warp\"")
+ printf("load anchor \"ts-warp\" from \"%s\"\n", pf_conf)
+ }
+ ' ${pf_rules} | /sbin/pfctl -f -
+}
+
+run_rc_command "$1"
diff --git a/net/ts-warp/pkg-descr b/net/ts-warp/pkg-descr
new file mode 100644
index 000000000000..1d38a5320afa
--- /dev/null
+++ b/net/ts-warp/pkg-descr
@@ -0,0 +1,6 @@
+ts-warp - Transparent proxy server and traffic wrapper
+
+It features a proxy services with TCP-traffic redirection to
+external Socks4/5 and HTTPS proxy servers:
+ - Transparent firewall-based traffic redirector
+ - Internal Socks and HTTPS proxy server
diff --git a/net/ts-warp/pkg-plist b/net/ts-warp/pkg-plist
new file mode 100644
index 000000000000..ba773905cd32
--- /dev/null
+++ b/net/ts-warp/pkg-plist
@@ -0,0 +1,8 @@
+bin/ts-pass
+bin/ts-warp
+@sample etc/ts-warp.conf.sample
+@sample etc/ts-warp_pf.conf.sample
+man/man1/ts-pass.1.gz
+man/man1/ts-warp.sh.1.gz
+man/man5/ts-warp.5.gz
+man/man8/ts-warp.8.gz