Skip to content

Geofencing helper for Mikrotik

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

Orhideous/thangail

Repository files navigation

🛡️ Thangail

Geofencing helper for Mikrotik

Why?

Because someone is NOT welcome here

How?

https://thangail.link

Self-hosting

Run image and expose service, say, at http://thangail.lan:8080

docker run --rm -p 8080:80 ghcr.io/orhideous/thangail:0.1.1

Then, on MikroTik:

# Add firewall rules
/ip firewall raw add chain=prerouting action=drop src-address-list=thangail
/ipv6 firewall raw add chain=prerouting action=drop src-address-list=thangail
# Download and import IPv4 rules 
/tool fetch url="http://thangail.lan:8080/api/v0/list?country=cn&name=thangail&timeout=60d&version=v4" dst-path=v4.list
/import v4.list
/file remove v4.list
# Download and import IPv6 rules 
/tool fetch url="http://thangail.lan:8080/api/v0/list?country=cn&name=thangail&timeout=60d&version=v6" dst-path=v6.list
/import v6.list
/file remove v6.list

Rinse and repeat every 60 days, and keep an eye on memory/CPU usage.

Q&A

Geofencing entire countries is unethical!

So what?

I don't trust this.

Good, you shouldn't. Self-host it.

I'd like to help.

PRs are welcome.

What is the source of country IP blocks?

RIR, compiled by Marcel Bischoff here: herrbischoff/country-ip-blocks.