diff --git a/www/Makefile b/www/Makefile --- a/www/Makefile +++ b/www/Makefile @@ -223,6 +223,7 @@ SUBDIR += glassfish4 SUBDIR += glpi SUBDIR += gnome-user-share + SUBDIR += go-anubis SUBDIR += go-www SUBDIR += gobuffalo SUBDIR += gohugo diff --git a/www/go-anubis/Makefile b/www/go-anubis/Makefile new file mode 100644 --- /dev/null +++ b/www/go-anubis/Makefile @@ -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 diff --git a/www/go-anubis/distinfo b/www/go-anubis/distinfo new file mode 100644 --- /dev/null +++ b/www/go-anubis/distinfo @@ -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 diff --git a/www/go-anubis/files/anubis.in b/www/go-anubis/files/anubis.in new file mode 100644 --- /dev/null +++ b/www/go-anubis/files/anubis.in @@ -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" diff --git a/www/go-anubis/pkg-descr b/www/go-anubis/pkg-descr new file mode 100644 --- /dev/null +++ b/www/go-anubis/pkg-descr @@ -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. diff --git a/www/go-anubis/pkg-message b/www/go-anubis/pkg-message new file mode 100644 --- /dev/null +++ b/www/go-anubis/pkg-message @@ -0,0 +1,18 @@ +[ +{ + type: install + message: <