Verify range-less vendors by forward-confirmed reverse DNS

Amazonbot, meta-externalagent, YouBot, Bytespider and PetalBot publish
no IP range file, so they were counted in the user-agent tally and
nowhere else - the largest single source of traffic on the sample
instance was also the least examined.

Check them by FCrDNS: the PTR record must end in a vendor domain and
that hostname must resolve back to the same address. The forward step
is the part that matters. A PTR record alone is written by whoever
controls the address block, so without confirming it forward the check
would accept anything its owner chose to claim.

ASN verification was considered and deliberately left out. Genuine
YouBot and genuine Amazonbot both live in AS14618, which is also every
EC2 instance a spoofer could rent. An ASN match shows the traffic came
from a cloud, not from the vendor; presenting that as verification
would be worse than presenting nothing.

Report RFC1918 sources separately rather than as failures. On the
sample instance 21624 of meta-externalagent's 21651 requests came from
172.18.0.1, the Docker bridge gateway: the real client address was
replaced before it reached the log. Those are not spoofed, they are
unjudgeable, and calling them spoofed would be a false accusation
caused by the reader's own proxy configuration.

Resolution is capped at CRAWLER_RDNS_MAX unique addresses per bot
(busiest first) so a flood of distinct forgeries cannot stall the
weekly mail on DNS timeouts, and can be disabled with CRAWLER_RDNS=0.

Assisted-by: Claude:opus-5
This commit is contained in:
Sergei Poljanski 2026-08-11 02:55:57 +04:00
commit 81716c2fc9
Signed by: asxpi
GPG key ID: 4F8851660FA4121B
3 changed files with 187 additions and 8 deletions

View file

@ -38,3 +38,12 @@ CRAWLER_MAIL_INI=/data/gitea/conf/app.ini
#CRAWLER_SMTP_FROM=alerts@example.com
# smtp+starttls (default) | smtps | smtp (no TLS, local relay)
#CRAWLER_SMTP_PROTOCOL=smtp+starttls
# --- reverse DNS ------------------------------------------------------
# FCrDNS verification for vendors that publish no IP ranges
# (Amazonbot, meta-externalagent, YouBot, Bytespider, PetalBot).
# Set to 0 to disable if your resolver is slow or unavailable.
CRAWLER_RDNS=1
# Max unique addresses resolved per bot per run. Each costs two DNS
# lookups; the busiest addresses are resolved first.
CRAWLER_RDNS_MAX=400