Skip to content

feat(config): Add FCrDNS checker #682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ extldflags
facebookgo
Factset
fastcgi
FCr
fcrdns
fcrdnscheck
fdc
fdns
fediverse
finfos
Firecrawl
Expand Down Expand Up @@ -136,6 +141,7 @@ impressum
inp
IPTo
iptoasn
isp
iss
isset
ivh
Expand Down Expand Up @@ -227,6 +233,7 @@ redir
redirectscheme
refactors
relayd
remotehost
reputational
reqmeta
risc
Expand Down
5 changes: 4 additions & 1 deletion cmd/anubis/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/TecharoHQ/anubis"
"github.com/TecharoHQ/anubis/data"
"github.com/TecharoHQ/anubis/internal"
"github.com/TecharoHQ/anubis/internal/fcrdns"
"github.com/TecharoHQ/anubis/internal/thoth"
libanubis "github.com/TecharoHQ/anubis/lib"
botPolicy "github.com/TecharoHQ/anubis/lib/policy"
Expand Down Expand Up @@ -278,7 +279,8 @@ func main() {
log.Fatalf("you can't set COOKIE_DOMAIN and COOKIE_DYNAMIC_DOMAIN at the same time")
}

ctx := context.Background()
fdns := fcrdns.NewFCrDNS()
ctx := fcrdns.With(context.Background(), fdns)

// Thoth configuration
switch {
Expand Down Expand Up @@ -384,6 +386,7 @@ func main() {
}

s, err := libanubis.New(libanubis.Options{
FCrDNS: fdns,
BasePrefix: *basePrefix,
StripBasePrefix: *stripBasePrefix,
Next: rp,
Expand Down
28 changes: 12 additions & 16 deletions data/crawlers/applebot.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
# Indexing for search and Siri
# https://support.apple.com/en-us/119829
- name: applebot
user_agent_regex: Applebot
expression:
all:
- userAgent.matches("Applebot")
- fcrdns.check("\\.applebot\\.apple\\.com$")
action: ALLOW
# https://search.developer.apple.com/applebot.json
remote_addresses: [
"17.241.208.160/27",
"17.241.193.160/27",
"17.241.200.160/27",
"17.22.237.0/24",
"17.22.245.0/24",
"17.22.253.0/24",
"17.241.75.0/24",
"17.241.219.0/24",
"17.241.227.0/24",
"17.246.15.0/24",
"17.246.19.0/24",
"17.246.23.0/24",
]
- name: not-applebot
expression:
all:
- userAgent.matches("Applebot")
- '!(fcrdns.check("\\.applebot\\.apple\\.com$"))'
action: WEIGH
weight:
adjust: 5
45 changes: 13 additions & 32 deletions data/crawlers/bingbot.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,15 @@
- name: bingbot
user_agent_regex: \+http\://www\.bing\.com/bingbot\.htm
# https://www.bing.com/webmasters/help/how-to-verify-bingbot-3905dc26
expression:
all:
- userAgent.matches("\\+http\\://www\\.bing\\.com/bingbot\\.htm")
- fcrdns.check("\\.search\\.msn\\.com$")
action: ALLOW
# https://www.bing.com/toolbox/bingbot.json
remote_addresses: [
"157.55.39.0/24",
"207.46.13.0/24",
"40.77.167.0/24",
"13.66.139.0/24",
"13.66.144.0/24",
"52.167.144.0/24",
"13.67.10.16/28",
"13.69.66.240/28",
"13.71.172.224/28",
"139.217.52.0/28",
"191.233.204.224/28",
"20.36.108.32/28",
"20.43.120.16/28",
"40.79.131.208/28",
"40.79.186.176/28",
"52.231.148.0/28",
"20.79.107.240/28",
"51.105.67.0/28",
"20.125.163.80/28",
"40.77.188.0/22",
"65.55.210.0/24",
"199.30.24.0/23",
"40.77.202.0/24",
"40.77.139.0/25",
"20.74.197.0/28",
"20.15.133.160/27",
"40.77.177.0/24",
"40.77.178.0/23"
]
- name: not-bingbot
expression:
all:
- userAgent.matches("\\+http\\://www\\.bing\\.com/bingbot\\.htm")
- '!(fcrdns.check("\\.search\\.msn\\.com$"))'
action: WEIGH
weight:
adjust: 5
Loading
Loading