I'm looking for someone who can write a Caddy plugin that can implement blocking by ASN.
ASNs are Autonomous System Numbers and you can find out more info about them here: https://www.arin.net/resources/guide/asn/.
The general way that this system should function:
Upon startup of caddy(and on a refresh interval) all the IPs announced by a particular ASN should get refreshed. BGP.Tools has an api which can get this data, but being able to support multiple ways to get this data would be great.
curl https://bgp.tools/table.jsonl -A "Your Name <your@email.com> Thanks for BPG.Tools :)" -s | grep 400587
Here we are looking for ips originated by AS400587. The ASN should be configurable. If the incoming request comes from an IP that's not on the list, the request should be dropped.
Configuration via caddyfile is a must, and via the JSON API on caddy would be a nice to have.
For caddyfile we would like something like the following for allowing access:
allow_asn 400587 395887
With multiple ASNs allowed. Feel free to ask more in the comments.
This is a post created on the open genie platform you can view it best on this user interface: @rishi556/write-a-caddy-plugin-for-asn-based-whitelist-1715725805525