Files
Flypaper/docs/overview.md
T
2026-11-15 19:05:21 +01:00

68 lines
3.6 KiB
Markdown

# How Flypaper works
Every server on the internet gets a steady stream of bots probing for `/.env`, `/.git/config`,
`/wp-login.php` and friends, usually sent to the bare IP address or to host names that don't
exist. Blocklists play whack-a-mole with addresses that change daily. Flypaper takes the
opposite approach: it lets the bot in and then answers very, very slowly. While a scanner waits
for an endless HTML page that trickles in a few bytes at a time, it isn't scanning someone
else, and every catch is logged with its origin for you to look at.
```mermaid
flowchart LR
bot["Scanner bot"] -->|"GET /.env<br/>Host: 203.0.113.7"| proxy["Reverse proxy"]
proxy -->|"known site"| apps["Your apps"]
proxy -->|"unknown host<br/>+ X-Real-IP"| flypaper["Flypaper"]
flypaper -.->|"endless HTML,<br/>a few bytes at a time"| bot
flypaper --> db[("SQLite:<br/>catches, settings")]
you["You (LAN)"] -->|"dashboard, port 8081"| flypaper
```
1. Your reverse proxy keeps serving your real sites. Everything it has no site for (the
default/catch-all server) goes to Flypaper.
2. Flypaper listens on two ports. Port `8080` is the trap: everything that arrives there is
caught. Port `8081` serves the dashboard and never traps; keep it inside your LAN.
3. A caught request gets `200 OK` and an endless, plausible-looking HTML page: random chunks
of 1 to 64 bytes with random pauses of 50 ms to 1 s in between.
4. A connection governor caps the number of catches overall and per IP and ends every catch
after a maximum hold time. If there is no free slot, the request gets a quick `404`.
5. When a catch ends, Flypaper logs one line and stores the event in SQLite, enriched with
country, city and network provider (ASN) from the free DB-IP databases.
## Features
- **Trap** for everything that reaches the trap port: whatever host or path a bot asks for
- **Slow delivery** of endless generated HTML or plain text (or both, alternating per catch)
with irregular timing; content, pauses, chunk sizes and hold time are set in the dashboard
- **Limits**: maximum connections overall and per IP, maximum hold time per catch
- **Dashboard**: totals, a world map, top countries, providers, IPs and paths, the latest
catches with expandable details; login with an admin password
- **GeoIP**: country, city and ASN per catch from DB-IP Lite, downloaded and refreshed
monthly; existing catches are filled in once the databases are available
- **Settings page**: hold method, limits and retention, changed at runtime
without a restart
- **Retention**: old catches are deleted daily (90 days by default); catches from private
networks are not stored by default; buttons to delete private or all catches
- **One log line per catch**, so `docker logs` alone shows whether the trap works
- **MCP server** on the dashboard port, so AI assistants can query the catches read-only
([docs/mcp.md](mcp.md))
- **Health endpoint** `/health` for container health checks (on the trap port it answers only
to private addresses)
- **No configuration needed to start**: one volume, two ports, the admin password is set on
first visit
## Trying the trap locally
```bash
curl -N http://localhost:8080/
```
This catch comes from a private address and is therefore not stored; the log line ends with
`(not stored)`.
## Attribution
Origins come from [IP Geolocation by DB-IP](https://db-ip.com), licensed under
[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/); the dashboard shows this attribution
in its footer. The world map is generated from [Natural Earth](https://www.naturalearthdata.com)
data (public domain).