mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-24 11:58:38 -05:00
[PR #2095] [MERGED] Add ASN-based resource rule matching #2856
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fosrl/pangolin/pull/2095
Author: @WildeTechSolutions
Created: 12/16/2025
Status: ✅ Merged
Merged: 12/20/2025
Merged by: @oschwartz10612
Base:
main← Head:feature/asn-matching📝 Commits (4)
23ad1a2Add ASN-based resource rule matching42da3b0Add asn option to blueprint type91e700eAdd hybrid route26d8192Add blueprint validation📊 Changes
13 files changed (+808 additions, -14 deletions)
View changed files
➕
server/db/asns.ts(+321 -0)➕
server/db/maxmindAsn.ts(+13 -0)➕
server/lib/asn.ts(+29 -0)📝
server/lib/blueprints/types.ts(+65 -5)📝
server/lib/config.ts(+4 -0)📝
server/lib/readConfigFile.ts(+2 -1)📝
server/private/routers/hybrid.ts(+65 -0)📝
server/routers/badger/verifySession.ts(+61 -2)📝
server/routers/resource/createResourceRule.ts(+1 -1)📝
server/routers/resource/updateResourceRule.ts(+1 -1)📝
src/app/[orgId]/settings/resources/proxy/[niceId]/rules/page.tsx(+243 -3)📝
src/lib/pullEnv.ts(+2 -1)📝
src/lib/types/env.ts(+1 -0)📄 Description
This allows administrators to create resource access rules based on Autonomous System Numbers, similar to existing country-based rules. Useful for restricting access by ISP, cloud provider, or mobile carrier.
Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
Description
The implementation is nearly identical to using the Country rules with the maxmind GeoIP database. This time you just need the
GeoLite2-ASN.mmdbnext to yourGeoLite2-Country.mmdb. Fetching the ASN database is no different from fetching the Country database, and if Pangolin detects it, it will enable the rule capability just like with Country.Similar to country, a number of popular ASNs are provided in the dropdown by default. This is a great way to reduce unwanted traffic to resources that can't support other Authentication means (i.e. Mobile apps that need api access that don't support custom headers like Amperfy).
How to test?
Add the
geoip-updatercontainer todocker-compose.yml.The
GEOIP_EDITION_IDSvariable should contain the ASN database:Add the
maxmind_asn_pathvariable to theserverblock inconfig.yml:You can now create ASN rules in the same fashion as Country rules, i.e.
Bypass Authfor your mobile carrier andBlock AccessforALL.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.