chaitin / SafeLine

serve as a reverse proxy to protect your web services from attacks and exploits.
https://waf.chaitin.com
GNU General Public License v3.0
11.91k stars 732 forks source link

[Suggestion] Using IPinfo IP to Country ASN database #1035

Open abdullahdevrel opened 1 month ago

abdullahdevrel commented 1 month ago

What would you like to be added or improved?

I am requesting to add support for IPinfo's IP to Country database to the project. The database has the following features:

Database schema

Field Name Example Data Type Description
start_ip 1.0.16.0 TEXT Starting IP address of an IP address range
end_ip 1.0.31.255 TEXT Ending IP address of an IP address range
country JP TEXT ISO 3166 country code of the location
country_name Japan TEXT Name of the country
continent AS TEXT Continent code of the country
continent_name Asia TEXT Name of the continent
asn AS2519 TEXT Autonomous System Number
as_name ARTERIA Networks Corporation TEXT Name of the AS (Autonomous System) organization
as_domain arteria-net.com TEXT Official domain or website of the AS organization

Documentation: https://ipinfo.io/developers/ip-to-country-asn-database

Samples are available here: https://github.com/ipinfo/sample-database/tree/main/IP%20to%20Country%20ASN

The database can be downloaded simply by accessing the storage URI with an access token.


curl -L https://ipinfo.io/data/free/country_asn.mmdb?token=<YOUR_TOKEN> -o country_asn.mmdb

### Why is it needed?

Integrating IPinfo's IP to Country ASN database would bring highly accurate country, ASN, and ISP data to the platform. Moreover, since the license is open source-friendly, this will fit perfectly with the platform.

- Provides precise country, ASN, and ISP data down to individual IP addresses, ensuring accurate identification.
- Includes both IPv4 and IPv6 in a single, comprehensive dataset, covering all necessary IP information.
- Updated daily to ensure the WAF platform operates with the most current data.
- Licensed under CC-BY-SA 4.0, allowing open-source and commercial use, ideal for integration into open-source WAF platforms.
xbingW commented 4 weeks ago

It looks good, but I feel that the existing IP library information is completely sufficient, and there is not enough reason to support additional libraries. Or you can talk about a more specific scenario and we might consider it

abdullahdevrel commented 3 weeks ago

Hey @xbingW,

Thank you for reviewing the request.

I saw that the project may not be supporting IPv6 at this moment (https://github.com/chaitin/SafeLine/issues/612). Our free database packages both IPv4 and IPv6 in a single database, which will address support for IPv6. Also, there is a request to support ASN blacklist (https://github.com/chaitin/SafeLine/issues/222). The database contains ASN/ISP information in there as well.

Additionally, the database is updated daily and provides full accuracy. This means that unlike any IP to Country database out there, it provides zero compromise in terms of accuracy. Our data is backed by latency and networking driven data rather than reported geolocation data from ISPs and VPNs.

This means when it comes to accuracy, it is the best you can get. However, the database only provides country and ASN level information. We do not have a free variant of our city level geolocation data. What we have is the best-in-class country-level data for free to support open source projects.

Because safeline is designed to have a security layer, this level of accuracy, ASN data, and IPv6 support will be appreciated by the users.

Please, let me know what you think.