Utility to build country-specific IP sets for ipset/iptables and nftables.
Project description
Installation
pip install geoipsets
Usage
Utility output can be controlled using a configuration file and/or command line options. For the MaxMind provider type, this configuration file is required in order to provide the license-key. See the example for details.
The example file enables all options which is likely not what you want as it will generate IPv4 and IPv6 sets for both firewall types for all countries.
Typically, you would want to select only one firewall type along with a short list of countries and perhaps only for the IPv4 address family.
The utility will attempt to read the configuration file at /etc/geoipsets.conf but the location can be overidden using the --config PATH_TO_FILE command line option.
usage: geoipsets [-h] [-v] [-p {maxmind,dbip} [{maxmind,dbip} ...]] [-f {nftables,iptables} [{nftables,iptables} ...]] [-a {ipv4,ipv6} [{ipv4,ipv6} ...]]
[-l COUNTRIES] [-o OUTPUT_DIR] [-c CONFIG_FILE] [--checksum] [--no-checksum]
Utility to build country specific IP sets for ipset/iptables and nftables. Command line arguments take precedence over those in the configuration file.
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-p {maxmind,dbip} [{maxmind,dbip} ...], --provider {maxmind,dbip} [{maxmind,dbip} ...]
dataset provider(s) (default: dbip)
-f {nftables,iptables} [{nftables,iptables} ...], --firewall {nftables,iptables} [{nftables,iptables} ...]
firewall(s) to build sets for (default: nftables)
-a {ipv4,ipv6} [{ipv4,ipv6} ...], --address-family {ipv4,ipv6} [{ipv4,ipv6} ...]
IP protocol(s) to build sets for (default: ipv4)
-l COUNTRIES, --countries COUNTRIES
Path to a file containing 2-character country codes, one per line, or a comma-separated list of country codes. Argument is treated
as a path first. If it does not resolve, or the resolved file is invalid, then it is parsed as a comma-separated list.
-o OUTPUT_DIR, --output-dir OUTPUT_DIR
directory where geoipsets should be saved (default: /tmp)
-c CONFIG_FILE, --config-file CONFIG_FILE
path to configuration file (default: /etc/geoipsets.conf)
--checksum enable checksum validation of downloaded files (default)
--no-checksum disable checksum validation of downloaded files
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file geoipsets-2.4.0.tar.gz
.
File metadata
- Download URL: geoipsets-2.4.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df6dc021e5599cfdc1768dec5a436f0131a526df6b5aa58b7185148ce41e7571 |
|
MD5 | 6e6bd8676c6e9d332fd97aaca55a04c6 |
|
BLAKE2b-256 | 3ce9d362b65aca78edf9ad899bbee1cacfa8b53506dc6d4439d2afc1c4d524c0 |
File details
Details for the file geoipsets-2.4.0-py3-none-any.whl
.
File metadata
- Download URL: geoipsets-2.4.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcc4714b8f8919e49f14c3528c7cdf26a318f575453fa670d0ca1e7177a11310 |
|
MD5 | 9f19756d0a0ba4ffc4b581e915895b60 |
|
BLAKE2b-256 | 4b8bb741e614c715d8b74878684660eedb7701a00cfa2d69c3303120a1f29413 |