Commit graph

18 commits

Author SHA1 Message Date
Remilia Da Costa Faro
d6d879133e
Allow filtering by remote addresses (#52)
* Added the possibility to define rules for remote addresses

* Added change in changelog

* Added check for X-Real-Ip and X-Forwarded-For when checking for remote address filtering

* cmd/anubis: refine IP filtering logic

* Optimize the configuration so that the IP trie is created once at
  application start instead of dynamically being created every request.
* Document the changes in the changelog and docs site.
* Allow pure IP range filtering.
* Allow user agent based IP range filtering.
* Allow path based IP range filtering.
* Create --debug-x-real-ip-default flag for testing Anubis locally
  without a HTTP load balancer.

---------

Co-authored-by: Xe Iaso <me@xeiaso.net>
2025-03-21 15:39:34 -04:00
Xe Iaso
e7b9b17b92
cmd/anubis: explain why users are seeing Anubis (#55)
* cmd/anubis: explain why users are seeing Anubis

Closes #25
Closes #38

Also includes the beginnings of a "user guides" section in the docs for
user-facing documentation.

* Update docs/docs/user/known-broken-extensions.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Xe Iaso <me@xeiaso.net>

* cmd/anubis: fix indentation in index.templ

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-03-21 14:21:59 -04:00
Xe Iaso
d3e509517c
cmd/anubis: configurable difficulty per-bot rule (#53)
Closes #30

Introduces the "challenge" field in bot rule definitions:

```json
{
  "name": "generic-bot-catchall",
  "user_agent_regex": "(?i:bot|crawler)",
  "action": "CHALLENGE",
  "challenge": {
    "difficulty": 16,
    "report_as": 4,
    "algorithm": "slow"
  }
}
```

This makes Anubis return a challenge page for every user agent with
"bot" or "crawler" in it (case-insensitively) with difficulty 16 using
the old "slow" algorithm but reporting in the client as difficulty 4.

This is useful when you want to make certain clients in particular
suffer.

Additional validation and testing logic has been added to make sure
that users do not define "impossible" challenge settings.

If no algorithm is specified, Anubis defaults to the "fast" algorithm.

Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-21 13:48:00 -04:00
makeworld
90049001e9
Add kagibot (#44)
* Add kagibot

Signed-off-by: makeworld <25111343+makew0rld@users.noreply.github.com>

* Update CHANGELOG.md

Signed-off-by: makeworld <25111343+makew0rld@users.noreply.github.com>

---------

Signed-off-by: makeworld <25111343+makew0rld@users.noreply.github.com>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Xe Iaso <me@xeiaso.net>
2025-03-21 11:16:19 -04:00
soopyc
1c00431098
general unix domain sockets support (#45)
* feat: allow binding to unix domain sockets

this is useful when the user does not want to expose more tcp ports than
needed. also simplifes configuration in some situation, like with nixos
modules as the socket paths can be automatically configured.

docs updated with additional configuration flags.

Signed-off-by: Cassie Cheung <me@soopy.moe>

* feat: graceful shutdown and cleanup on signal

this is needed to clean up left-over unix sockets, else on the next boot
listener panics with `address already in use`.

Co-authored-by: cat <cat@gensokyo.uk>
Signed-off-by: Cassie Cheung <me@soopy.moe>

* feat: support unix socket upstream targets

adds support for proxying unix socket upstreams, essentially allowing
anubis to run without listening on tcp sockets at all*.

*for metrics, neither prometheus and victoriametrics supports scraping
from unix sockets. if metrics are desired, tcp sockets are still needed.

Co-authored-by: cat <cat@gensokyo.uk>
Signed-off-by: Cassie Cheung <me@soopy.moe>

* docs: add changelog entry

---------

Signed-off-by: Cassie Cheung <me@soopy.moe>
Co-authored-by: cat <cat@gensokyo.uk>
2025-03-21 10:58:05 -04:00
Charlotte
d93adbc111
Skip TestLookup test when networking is disabled (#49) 2025-03-21 10:43:10 -04:00
Xe Iaso
95dddb5549
cmd/containerbuild: default to ttl.sh for third party contributions (#51)
* cmd/containerbuild: default to ttl.sh for third party contributions

Closes #48

Signed-off-by: Xe Iaso <me@xeiaso.net>

* track comment tags

Signed-off-by: Xe Iaso <me@xeiaso.net>

* empty commit to make sure double-commenting doesn't work

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-21 10:34:01 -04:00
Callum Thomson
f1220ecc57
Fix when hardwareConcurrency is undefined (#42) 2025-03-21 08:51:19 -04:00
Dennis ten Hoove
d1512a1f79
Ensure content flows and stays centered on small screens (#27)
* Ensure content flows and stays centered on small screens

Fixes #18

* Do not overflow image, instead resize with page

* update CHANGELOG

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Xe Iaso <me@xeiaso.net>
2025-03-20 17:19:45 -04:00
Xe Iaso
c88775bb8a
cmd/anubis: lower default difficulty to 4
Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-20 16:58:49 -04:00
Donatas
eeaed6a317
fix: no duplicate work when exceeding hardcoded int (#36)
* fix: no duplicate work when exceeding that 1xxx number

* run go generate and update CHANGELOG

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Xe Iaso <me@xeiaso.net>
2025-03-20 16:20:53 -04:00
Federico Gaggero
3e9a93f629
Fix: Removed several visible AI artifacts (e.g., 6 fingers) (#37)
* Fix: Removed several visible AI artifacts (e.g., 6 fingers)

* Add an entry to docs/docs/CHANGELOG.md
2025-03-20 16:09:49 -04:00
Xe Iaso
52d7a3cd2b
cmd/anubis: drastically optimize proof of work (#19)
* cmd/anubis: drastically optimize proof of work

Closes #12
Closes #17

This drastically optimizes the proof of work check by removing the
stringify call at every iteration. Additionally, this optimizes the
checks by running them in parallel for as many threads as the browser
has available (according to navigator.hardwareConcurrency).

This also changes the redirect lag to 250 milliseconds instead of 2000
milliseconds in order to be perceptually faster. This is below the
reaction time threshold of many people, so this will make the post-check
success phase perceptually instant.

Testing on an iPhone 7 Plus has shown that this can clear a difficulty 4
check in 3.4 seconds.

This actually optimizes the check so much it may be a logistical concern
for operators.

* cmd/anubis/js: fix happy cachebuster logic

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-20 09:26:39 -04:00
Xe Iaso
c81e938f63
cmd/containerbuild: set container build timestamp to the timestamp of the commit (#15)
Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-19 09:57:36 -04:00
Xe Iaso
1efcb88261
Try using ko to build images
Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-19 09:10:29 -04:00
Xe Iaso
4ebccb197e
cmd/anubis: point the links elsewhere
Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-18 17:49:26 -04:00
Xe Iaso
fd6903aeed
cmd/anubis: rephrase noscript warning
Closes Xe/x#701

Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-17 21:22:53 -04:00
Xe Iaso
9923878c5c
initial import from /x/ monorepo
Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-17 19:33:07 -04:00