mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-25 09:32:43 +00:00
data: add some examples of expression-based rules
Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
- name: allow-git-clients
|
||||||
|
action: ALLOW
|
||||||
|
expression:
|
||||||
|
and:
|
||||||
|
- userAgent.startsWith("git/") || userAgent.contains("libgit") || userAgent.startsWith("go-git") || userAgent.startsWith("JGit/") || userAgent.startsWith("JGit-")
|
||||||
|
- >
|
||||||
|
"Git-Protocol" in headers && headers["Git-Protocol"] == "version=2"
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
- name: go-get
|
||||||
|
action: ALLOW
|
||||||
|
expression:
|
||||||
|
and:
|
||||||
|
- userAgent.startsWith("Go-http-client/")
|
||||||
|
- '"go-get" in query'
|
||||||
|
- query["go-get"] == "1"
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
- name: allow-api-routes
|
||||||
|
action: ALLOW
|
||||||
|
expression:
|
||||||
|
and:
|
||||||
|
- '!(method == "HEAD" || method == "GET")'
|
||||||
|
- path.startsWith("/api/")
|
||||||
@@ -8,3 +8,6 @@
|
|||||||
- name: robots-txt
|
- name: robots-txt
|
||||||
path_regex: ^/robots.txt$
|
path_regex: ^/robots.txt$
|
||||||
action: ALLOW
|
action: ALLOW
|
||||||
|
- name: sitemap
|
||||||
|
path_regex: ^/sitemap.xml$
|
||||||
|
action: ALLOW
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
- name: no-user-agent-string
|
||||||
|
expression: userAgent == ""
|
||||||
|
action: DENY
|
||||||
+1
-1
@@ -3,6 +3,6 @@ package data
|
|||||||
import "embed"
|
import "embed"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
//go:embed botPolicies.yaml botPolicies.json apps bots common crawlers
|
//go:embed botPolicies.yaml botPolicies.json apps bots clients common crawlers
|
||||||
BotPolicies embed.FS
|
BotPolicies embed.FS
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user