commit: 079dd9ea758b26dd3a78446b545a308981e1d2af Author: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in> AuthorDate: Sat Apr 19 11:06:54 2025 +0000 Commit: Anna Vyalkova <cyber+gentoo <AT> sysrq <DOT> in> CommitDate: Sat Apr 19 12:13:05 2025 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=079dd9ea
www-apps/anubis: new package, add 1.16.0 Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq.in> www-apps/anubis/Manifest | 1 + www-apps/anubis/anubis-1.16.0.ebuild | 49 ++++++++++++++++++++++++++++++++++++ www-apps/anubis/files/anubis.confd | 27 ++++++++++++++++++++ www-apps/anubis/files/anubis.initd | 31 +++++++++++++++++++++++ www-apps/anubis/metadata.xml | 16 ++++++++++++ 5 files changed, 124 insertions(+) diff --git a/www-apps/anubis/Manifest b/www-apps/anubis/Manifest new file mode 100644 index 000000000..446a42806 --- /dev/null +++ b/www-apps/anubis/Manifest @@ -0,0 +1 @@ +DIST anubis-src-vendor-npm-1.16.0.tar.gz 5194724 BLAKE2B 7de4b65e86c7bcd2b909189bab3541f2d074877c59a2402e765e9733ae613c84c4e55819a2ea8f42d6c45af02cf55c47482c773ea1089607e075767021fdb135 SHA512 772547e0b9459d13ff3ac3bb86819e5803de1f12a8729b78cc4f50f69b16bbaddc94e3c329be5f1d2426688b3a8a4c05c1ac1039e953febb893faf9400d75475 diff --git a/www-apps/anubis/anubis-1.16.0.ebuild b/www-apps/anubis/anubis-1.16.0.ebuild new file mode 100644 index 000000000..9a16842fc --- /dev/null +++ b/www-apps/anubis/anubis-1.16.0.ebuild @@ -0,0 +1,49 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit go-module systemd + +DESCRIPTION="Weighs the soul of incoming HTTP requests to stop AI crawlers" +HOMEPAGE=" + https://anubis.techaro.lol/ + https://github.com/TecharoHQ/anubis +" +SRC_URI="https://github.com/TecharoHQ/anubis/releases/download/v${PV}/anubis-src-vendor-npm-${PV}.tar.gz" +S="${WORKDIR}/anubis-src-vendor-npm-${PV}" + +LICENSE="Apache-2.0 BSD MIT OFL-1.1" +SLOT="0" +KEYWORDS="~amd64" + +DOCS=( + # from yeetfile.js + README.md + docs/docs/CHANGELOG.md + docs/docs/admin/policies.md + docs/docs/admin/native-install.mdx + data/botPolicies.json +) + +src_compile() { + emake prebaked-build +} + +src_test() { + local -x DONT_USE_NETWORK=1 + ego test ./... || die +} + +src_install() { + dobin var/anubis + systemd_dounit run/[email protected] + + newinitd "${FILESDIR}"/anubis.initd anubis + newconfd "${FILESDIR}"/anubis.confd anubis + + insinto /etc/anubis + doins run/default.env + + einstalldocs +} diff --git a/www-apps/anubis/files/anubis.confd b/www-apps/anubis/files/anubis.confd new file mode 100644 index 000000000..9aca2fa2f --- /dev/null +++ b/www-apps/anubis/files/anubis.confd @@ -0,0 +1,27 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# The URL of the service that Anubis should forward valid requests to. Supports +# Unix domain sockets. +#ANUBIS_TARGET="http://localhost:3923" +#ANUBIS_TARGET="unix:///path/to/socket" + +# The network address that Anubis listens on. +# +# If unset, listen on /run/anubis_${instance}/anubis.sock Unix socket instead. +#ANUBIS_BIND_PORT=":8923" + +# The network address that Anubis serves Prometheus metrics on. +# +# If unset, listen on /run/anubis_${instance}/metrix.sock Unix socket instead. +#ANUBIS_METRICS_BIND_PORT=":9090" + +# The difficulty of the challenge, or the number of leading zeroes that must be +# in successful responses. +#ANUBIS_DIFFICULTY=4 + +# Configure the user[:group] Anubis will run as. +#ANUBIS_USER="anubis:anubis" + +# Additional command-line options for Anubis. +#ANUBIS_OPTS="" diff --git a/www-apps/anubis/files/anubis.initd b/www-apps/anubis/files/anubis.initd new file mode 100644 index 000000000..16ef936d6 --- /dev/null +++ b/www-apps/anubis/files/anubis.initd @@ -0,0 +1,31 @@ +#!/sbin/openrc-run +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 +# +# shellcheck shell=sh + +instance=${RC_SVCNAME#*.} + +supervisor="supervise-daemon" +command="/usr/bin/anubis" +command_args="\ + -bind ${ANUBIS_BIND_PORT:-/run/anubis_${instance?}/anubis.sock -bind-network unix} \ + -metrics-bind ${ANUBIS_METRICS_BIND_PORT:-/run/anubis_${instance?}/metrics.sock -metrics-bind-network unix} \ + -target ${ANUBIS_TARGET:-http://localhost:3923} \ + -difficulty ${ANUBIS_DIFFICULTY:-4} \ + ${ANUBIS_OPTS} +" +command_user="${ANUBIS_USER:-anubis:anubis}" +command_background=1 +pidfile="/run/anubis_${instance?}/anubis.pid" + +start_pre() { + if [ "${instance?}" = "${RC_SVCNAME?}" ]; then + eerror "${RC_SVCNAME?} cannot be started directly. You must create" + eerror "symbolic links to it for the services you want to start" + eerror "and add those to the appropriate runlevels." + return 1 + fi + + checkpath -d -o "${command_user?}" "/run/anubis_${instance?}" +} diff --git a/www-apps/anubis/metadata.xml b/www-apps/anubis/metadata.xml new file mode 100644 index 000000000..f18f7c2cd --- /dev/null +++ b/www-apps/anubis/metadata.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>[email protected]</email> + <name>Anna</name> + </maintainer> + <longdescription> + Anubis weighs the souls of incoming HTTP requests and uses a sha256 + proof-of-work challenge in order to protect upstream resources from + scraper bots. + </longdescription> + <upstream> + <remote-id type="github">TecharoHQ/anubis</remote-id> + </upstream> +</pkgmetadata>
