mirror of
https://git.freebsd.org/ports.git
synced 2025-04-28 01:26:39 -04:00
www/go-anubis: NEW PORT anti-scraper browser-based proof-of-work proxy
Differential Revision: https://reviews.freebsd.org/D49563 Reviewed by: diizzy Sponsored by: SkunkWerks, GmbH Tested by: dbaio, philip
This commit is contained in:
parent
819af278a3
commit
3745ef7406
6 changed files with 125 additions and 0 deletions
|
@ -223,6 +223,7 @@
|
|||
SUBDIR += glassfish4
|
||||
SUBDIR += glpi
|
||||
SUBDIR += gnome-user-share
|
||||
SUBDIR += go-anubis
|
||||
SUBDIR += go-www
|
||||
SUBDIR += gobuffalo
|
||||
SUBDIR += gohugo
|
||||
|
|
27
www/go-anubis/Makefile
Normal file
27
www/go-anubis/Makefile
Normal file
|
@ -0,0 +1,27 @@
|
|||
PORTNAME= anubis
|
||||
DISTVERSIONPREFIX= v
|
||||
DISTVERSION= 1.15.1
|
||||
CATEGORIES= www
|
||||
PKGNAMEPREFIX= go-
|
||||
|
||||
MAINTAINER= dch@FreeBSD.org
|
||||
COMMENT= Anti-scraper web proxy using browser-based proof-of-work challenges
|
||||
WWW= https://anubis.techaro.lol/
|
||||
|
||||
LICENSE= BSD3CLAUSE
|
||||
LICENSE_FILE= ${WRKSRC}/LICENSE
|
||||
|
||||
USES= go:modules,1.24
|
||||
USE_RC_SUBR= ${PORTNAME}
|
||||
|
||||
GO_MODULE= github.com/techarohq/${PORTNAME}
|
||||
GO_TARGET= ./cmd/${PORTNAME}
|
||||
GO_BUILDFLAGS= -ldflags="-X github.com/TecharoHQ/anubis.Version=v${DISTVERSION}"
|
||||
|
||||
PLIST_FILES= sbin/${PORTNAME}
|
||||
|
||||
do-install:
|
||||
${INSTALL_PROGRAM} ${WRKDIR}/bin/${PORTNAME} \
|
||||
${STAGEDIR}${PREFIX}/sbin/${PORTNAME}
|
||||
|
||||
.include <bsd.port.mk>
|
5
www/go-anubis/distinfo
Normal file
5
www/go-anubis/distinfo
Normal file
|
@ -0,0 +1,5 @@
|
|||
TIMESTAMP = 1743692515
|
||||
SHA256 (go/www_go-anubis/anubis-v1.15.1/v1.15.1.mod) = c4060528e14abead94fa468734829fd9ce1c88b9bea06ae6fed02d94c804013b
|
||||
SIZE (go/www_go-anubis/anubis-v1.15.1/v1.15.1.mod) = 2190
|
||||
SHA256 (go/www_go-anubis/anubis-v1.15.1/v1.15.1.zip) = 7ca38367229c5cace57929a2fb7ff8ccbdde911e00bcf3ed7ef01b84a0902cd4
|
||||
SIZE (go/www_go-anubis/anubis-v1.15.1/v1.15.1.zip) = 1207282
|
58
www/go-anubis/files/anubis.in
Normal file
58
www/go-anubis/files/anubis.in
Normal file
|
@ -0,0 +1,58 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: anubis
|
||||
# REQUIRE: DAEMON NETWORKING
|
||||
# KEYWORD: shutdown
|
||||
#
|
||||
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf to enable anubis:
|
||||
# anubis_enable (bool): Set to "NO" by default.
|
||||
# Set it to "YES" to enable anubis.
|
||||
# anubis_user (user): Set to "www" by default.
|
||||
# User to run anubis as.
|
||||
# anubis_group (group): Set to "www" by default.
|
||||
# Group to run anubis as.
|
||||
# anubis_args (str): Set to "" by default.
|
||||
# Extra flags passed to anubis.
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name=anubis
|
||||
rcvar=anubis_enable
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${anubis_enable:="NO"}
|
||||
: ${anubis_user:="www"}
|
||||
: ${anubis_group:="www"}
|
||||
: ${anubis_args:=""}
|
||||
|
||||
pidfile="/var/run/${name}.pid"
|
||||
daemon_pidfile="/var/run/${name}-daemon.pid"
|
||||
procname="%%PREFIX%%/sbin/anubis"
|
||||
command="/usr/sbin/daemon"
|
||||
command_args="-f -c -R 5 -r -T ${name} -p ${pidfile} -P ${daemon_pidfile} ${procname} ${anubis_args}"
|
||||
|
||||
start_precmd=anubis_startprecmd
|
||||
stop_postcmd=anubis_stoppostcmd
|
||||
|
||||
anubis_startprecmd()
|
||||
{
|
||||
if [ ! -e ${daemon_pidfile} ]; then
|
||||
install -o ${anubis_user} -g ${anubis_group} /dev/null ${daemon_pidfile};
|
||||
fi
|
||||
if [ ! -e ${pidfile} ]; then
|
||||
install -o ${anubis_user} -g ${anubis_group} /dev/null ${pidfile};
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
anubis_stoppostcmd()
|
||||
{
|
||||
if [ -f "${daemon_pidfile}" ]; then
|
||||
pids=$( pgrep -F ${daemon_pidfile} 2>&1 )
|
||||
_err=$?
|
||||
[ ${_err} -eq 0 ] && kill -9 ${pids}
|
||||
fi
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
16
www/go-anubis/pkg-descr
Normal file
16
www/go-anubis/pkg-descr
Normal file
|
@ -0,0 +1,16 @@
|
|||
Anubis is a web proxy that protects upstream resources from scraper bots
|
||||
by using a short hash-based proof-of-work challenge. It "weighs the soul of
|
||||
your connection" to determine if you're a legitimate user or an automated bot.
|
||||
|
||||
Anubis serves as a protective layer for websites that are being aggressively
|
||||
scraped by AI bots and other automated systems that don't respect robots.txt
|
||||
standards. It provides an alternative to services like Cloudflare when those
|
||||
options aren't available or desired.
|
||||
|
||||
The proof-of-work system requires clients to solve a computational challenge
|
||||
before accessing protected content, effectively deterring most automated
|
||||
scrapers while allowing legitimate users through with minimal disruption.
|
||||
|
||||
It should be noted that Anubis may cause problems for accessibility of
|
||||
protected websites, potentially confusing screen readers for blind users,
|
||||
or other problems for assisted interaction. Please consider carefully.
|
18
www/go-anubis/pkg-message
Normal file
18
www/go-anubis/pkg-message
Normal file
|
@ -0,0 +1,18 @@
|
|||
[
|
||||
{
|
||||
type: install
|
||||
message: <<EOM
|
||||
Anubis has been installed! Typically anubis is run behind a proxy, such as
|
||||
nginx, caddy, haproxy, or similar, that passes the `x-real-ip` header to
|
||||
anubis, which runs by default on port 8923. You will need to supply the
|
||||
target url that you are protecting.
|
||||
|
||||
Amend rc.conf as required. For example:
|
||||
|
||||
anubis_enable=YES
|
||||
anubis_args="-target http://localhost:4000/myapp -bind :8923"
|
||||
|
||||
For more information, see https://anubis.techaro.lol/
|
||||
EOM
|
||||
}
|
||||
]
|
Loading…
Add table
Reference in a new issue