diff --git a/testing/go-away/APKBUILD b/testing/go-away/APKBUILD new file mode 100644 index 00000000000..be043cd940e --- /dev/null +++ b/testing/go-away/APKBUILD @@ -0,0 +1,43 @@ +# Contributor: Drew DeVault +# Contributor: Ferass El Hafidi +# Maintainer: Ferass El Hafidi +pkgname=go-away +pkgver=0.7.0 +pkgrel=0 +pkgdesc="Self-hosted abuse detection and rule enforcement against low-effort mass AI scraping and bots" +url="https://git.gammaspectra.live/git/go-away" +arch="all" +license="MIT" +makedepends="go>=1.24" +subpackages="$pkgname-openrc" +source=" + $pkgname-$pkgver.tar.gz::https://git.gammaspectra.live/git/go-away/archive/v$pkgver.tar.gz + $pkgname.confd + $pkgname.initd +" +options="net" +builddir="$srcdir/$pkgname" + +build() { + go build $GOFLAGS -trimpath -o go-away ./cmd/go-away +} + +check() { + go test ./... +} + +package() { + install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname + + install -Dm755 go-away "$pkgdir"/usr/bin/go-away + + mkdir -p "$pkgdir"/etc/go-away/ + cp -R examples/* "$pkgdir"/etc/go-away/ +} + +sha512sums=" +96a4fe401e1491b4dbc9da2aebd35b41d7d5fd88d14bf6f73aab1367c0505e0164b4da1ff7909eeeb9be9227b697d18b539bcc519ae450b8f1de80b412fae370 go-away-0.7.0.tar.gz +7c0e5a9a107a38a3ed1eacec7f332474e25662c2dfb713fc76f120766e499421e2710424e6550ccb5ee77bdbbeb2f810b21f42138f18e670f7ddbf4b33815e3c go-away.confd +4704c568a9130479184edc86056467e0b132ae54b7e9734346c2f46dd1699a4c43061025e0e853135e60ee5e89b9c86c8cafe736392e8767939263b52fe45fc2 go-away.initd +" diff --git a/testing/go-away/go-away.confd b/testing/go-away/go-away.confd new file mode 100644 index 00000000000..9c951931a1d --- /dev/null +++ b/testing/go-away/go-away.confd @@ -0,0 +1,13 @@ +# Configuration for /etc/init.d/go-away + +# Run the daemon as this user: +# GO_AWAY_USER=goaway + +# Bind daemon to address: +# GO_AWAY_BIND=:8080 + +# Policy file name +# GO_AWAY_POLICY=/etc/go-away/generic.yml + +# Additional arguments to provide to the daemon: +# GO_AWAY_ARGS= diff --git a/testing/go-away/go-away.initd b/testing/go-away/go-away.initd new file mode 100644 index 00000000000..37f22a5cd4d --- /dev/null +++ b/testing/go-away/go-away.initd @@ -0,0 +1,34 @@ +#!/sbin/openrc-run +supervisor=supervise-daemon + +name="go-away" +description="Self-hosted abuse detection and rule enforcement against low-effort mass AI scraping and bots" + +GO_AWAY_USER=${GO_AWAY_USER:-goaway} +GO_AWAY_BIND=${GO_AWAY_BIND:-:8080} +GO_AWAY_POLICY=${GO_AWAY_POLICY:-/etc/go-away/generic.yml} +LOGS=/var/log/go-away.log + +command=/usr/bin/go-away +command_user=goaway:goaway +command_user="$GO_AWAY_USER:$GO_AWAY_USER" +command_args="--bind $GO_AWAY_BIND --config /etc/go-away/config.yml --policy-snippets /etc/go-away/snippets/ --policy $GO_AWAY_POLICY $GO_AWAY_ARGS" +supervise_daemon_args="-1 $LOGS -2 $LOGS" + +extra_started_commands="reload" +description_reload="Reload configurationf ile" + +depend() { + need net + after firewall +} + +start_pre() { + checkpath -f "$LOGS" -m 644 -o $command_user +} + +reload() { + ebegin "Reloading configuration" + $supervisor $RC_SVCNAME --signal HUP + eend $? +} diff --git a/testing/go-away/go-away.pre-install b/testing/go-away/go-away.pre-install new file mode 100644 index 00000000000..2c9bdba83b8 --- /dev/null +++ b/testing/go-away/go-away.pre-install @@ -0,0 +1,9 @@ +#!/bin/sh + +user=goaway +group=goaway + +addgroup -S $group 2>/dev/null +adduser -S -D -H -s /sbin/nologin -G $group -g $user $user 2>/dev/null + +exit 0