I am also leaning towards it. Here is my wishlist and I will try to accomplish it with Anubis:
Members that chose "remain always logged in" should never be bothered with a challenge. Members that are logging in can receive a challenge, no problem. Guests also can receive a challenge, no problem.
If these can be accomplished with Anubis, I think it is a complete and sufficient solution.
This should accomplish the user logged in check. Anubis, like others, does checks against client cookies. If the cookie exists, it is validated for the name and then permits the client, bypassing the challenge:
YAML:
- name: XenForoUserLoggedIn
action: ALLOW
expression:
all:
- '"Cookie" in headers'
- 'headers["Cookie"].contains("xf_user=")'
Here's a config file that can be used as a starting point:
YAML:
bots:
- name: PermitIndexAndCore
action: ALLOW
expression:
any:
- path == "/"
- path.startsWith("/js/")
- path == "/css.php"
- path.startsWith("/admin.php")
- path.startsWith("/styles/")
- path.startsWith("/data/")
- path.startsWith("/api/")
- name: XenForoUserLoggedIn
action: ALLOW
expression:
all:
- '"Cookie" in headers'
- 'headers["Cookie"].contains("xf_user=")'
- import: /etc/anubis/data/clients/discord-embed.yaml
- import: /etc/anubis/data/crawlers/_allow-good.yaml
- import: /etc/anubis/data/crawlers/alibaba-cloud.yaml
- import: /etc/anubis/data/crawlers/tencent-cloud.yaml
- import: /etc/anubis/data/bots/aggressive-brazilian-scrapers.yaml
- import: /etc/anubis/data/bots/ai-catchall.yaml
- import: /etc/anubis/data/bots/headless-browsers.yaml
- import: /etc/anubis/data/common/keep-internet-working.yaml
- import: /etc/anubis/data/common/allow-private-addresses.yaml
- import: /etc/anubis/data/common/rfc-violations.yaml
- name: challenge-all
action: CHALLENGE
path_regex: .*
challenge:
algorithm: fast
difficulty: 4
store:
backend: valkey
parameters:
url: "redis://10.48.0.10:6379/6"
What the above does:
1. Allows
all clients to view the index without a challenge.
1a. If the client goes to view something that
isn't the index or XF2's core components (JS/CSS), challenge.
2. If the client has an
xf_user cookie set, bypass challenge.
3. If client is a 'good bot', no challenge, bypass/allow.
4. If the client is a 'bad bot' (or otherwise configured), explicit deny or harshly challenge.
5. Anything not caught by the rules set, auto-challenge at a level of 4.
In my case, all sessions for the challenge system, are stored to redis/valkey - no memory storage on Anubis itself. Which in turn means you can also spin up additional Anubis instances for the same domain if ever required/desired.
There is also the weights system, but it's fairly advanced when it comes to "finding that sweet spot". It's a careful balance between pissing off legitimate users and harshly blocking bots. No one likes challenges/walled gardens, but we're all unfortunately at a point where abusive bots need to be curbed.