Skip to main content

Utility to build country-specific IP sets for ipset/iptables and nftables.

Project description

badge PyPI PyPI - Python Version Downloads GitHub

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geoipsets-2.4.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geoipsets-2.4.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file geoipsets-2.4.1.tar.gz.

File metadata

  • Download URL: geoipsets-2.4.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for geoipsets-2.4.1.tar.gz
Algorithm Hash digest
SHA256 9ee1225353de32ae09354d8ac1b3360790c22e12dec63512704af8307d8fb5c5
MD5 0e058651740e4f3b38321d0022204df4
BLAKE2b-256 5062ff6aef0aea494ea7deb37508f84a1fde5d88c5302626810724a8e157000d

See more details on using hashes here.

File details

Details for the file geoipsets-2.4.1-py3-none-any.whl.

File metadata

  • Download URL: geoipsets-2.4.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for geoipsets-2.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 25ac45a9ed557e7f03e67dc5fd312d503987a593ea122bcc25225ec13b892ee3
MD5 bb1fe87b515caeec2b5c84f2b6c7fcbe
BLAKE2b-256 75245e701821b3a381726accf47b8a76ca20db39d241511be8a8a6582c0d4253

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page