| 1 | <!--startmeta |
| 2 | custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/crates/netflow-plugin/integrations/ipdeny_country_zones.md" |
| 3 | meta_yaml: "https://github.com/netdata/netdata/edit/master/src/crates/netflow-plugin/metadata.yaml" |
| 4 | sidebar_label: "IPDeny Country Zones" |
| 5 | learn_status: "Published" |
| 6 | learn_rel_path: "Network Flows/Enrichment Methods" |
| 7 | keywords: ['ipdeny', 'country zones', 'geoip', 'country', 'cidr', 'ip intelligence', 'flow enrichment'] |
| 8 | message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE FLOWS' metadata.yaml FILE" |
| 9 | endmeta--> |
| 10 | |
| 11 | <!-- markdownlint-disable-file --> |
| 12 | |
| 13 | # IPDeny Country Zones |
| 14 | |
| 15 | |
| 16 | <img src="https://netdata.cloud/img/network-wired.svg" width="150"/> |
| 17 | |
| 18 | |
| 19 | Plugin: netflow-plugin |
| 20 | Module: ipdeny |
| 21 | |
| 22 | <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> |
| 23 | |
| 24 | ## Overview |
| 25 | |
| 26 | Enrich network flows with country codes from IPDeny country zone files. |
| 27 | IPDeny publishes country-specific CIDR lists and an `all-zones.tar.gz` |
| 28 | archive. The Netdata downloader reads the IPv4 country-zone archive and maps |
| 29 | each `<country>.zone` member to that ISO country code. |
| 30 | |
| 31 | IPDeny Country Zones are country-only and the current built-in source is IPv4 |
| 32 | only. They do not provide ASN, AS organization, state, city, latitude, or |
| 33 | longitude. Pair IPDeny with another ASN source when you also need AS fields, |
| 34 | and use DB-IP, MaxMind, IP2Location, or a custom MMDB when IPv6 country |
| 35 | coverage is required. |
| 36 | |
| 37 | For the IP-intelligence mechanism (lookup order, MMDB composition, refresh, |
| 38 | provider chains), see |
| 39 | [IP Intelligence](https://learn.netdata.cloud/docs/network-flows/enrichment). |
| 40 | |
| 41 | |
| 42 | The netflow plugin reads MMDB files only. Use Netdata's |
| 43 | `topology-ip-intel-downloader` to fetch IPDeny's HTTPS country-zone archive, |
| 44 | convert the CIDR lists to `topology-ip-geo.mmdb`, and write the file into the |
| 45 | standard auto-detected cache directory. The plugin reloads the generated MMDB |
| 46 | automatically when the file changes. |
| 47 | |
| 48 | |
| 49 | This integration is only supported on the following platforms: |
| 50 | |
| 51 | - Linux |
| 52 | |
| 53 | This integration runs as a single instance per Netdata Agent. |
| 54 | |
| 55 | |
| 56 | ### Default Behavior |
| 57 | |
| 58 | #### Auto-Detection |
| 59 | |
| 60 | Not used by the default install. After the downloader writes `topology-ip-geo.mmdb` into the standard cache path, the plugin auto-detects the generated file. |
| 61 | |
| 62 | #### Limits |
| 63 | |
| 64 | Country-only IPv4 source. No ASN, AS name, IPv6 coverage, state, city, latitude, or longitude are available from this built-in source. |
| 65 | |
| 66 | #### Performance Impact |
| 67 | |
| 68 | Lookups are local MMDB reads after conversion. Memory use is mostly the mapped database file and the kernel page cache needed to keep active pages hot. |
| 69 | |
| 70 | ## Setup |
| 71 | |
| 72 | |
| 73 | ### Prerequisites |
| 74 | |
| 75 | #### Downloader with IPDeny support |
| 76 | |
| 77 | Run the bundled downloader when available. Packaged 32-bit installs do not |
| 78 | include this binary: |
| 79 | |
| 80 | ```bash |
| 81 | sudo /usr/sbin/topology-ip-intel-downloader \ |
| 82 | --asn iptoasn:combined \ |
| 83 | --geo ipdeny:country-zones |
| 84 | ``` |
| 85 | |
| 86 | `ipdeny:country-zones` is valid only for `--geo`. The example pairs it |
| 87 | with IPtoASN so the resulting cache contains both AS and country fields. |
| 88 | |
| 89 | |
| 90 | #### IPDeny usage policy |
| 91 | |
| 92 | IPDeny publishes usage limits and copyright policy on its site. Review |
| 93 | those terms before mirroring, redistributing, or downloading more often |
| 94 | than needed. |
| 95 | |
| 96 | |
| 97 | |
| 98 | ### Configuration |
| 99 | |
| 100 | #### Options |
| 101 | |
| 102 | Once the downloader has produced an IPDeny-derived geo MMDB in the cache |
| 103 | directory, the plugin auto-detects it. To pin paths explicitly, set |
| 104 | `enrichment.geoip.geo_database` and keep `asn_database` pointed at your chosen |
| 105 | ASN provider. |
| 106 | |
| 107 | |
| 108 | <details open><summary>Config options</summary> |
| 109 | |
| 110 | |
| 111 | |
| 112 | | Option | Description | Default | Required | |
| 113 | |:-----|:------------|:--------|:---------:| |
| 114 | | enrichment.geoip.asn_database | Optional ASN MMDB paths supplied by another provider. | [] | no | |
| 115 | | enrichment.geoip.geo_database | Path to the IPDeny-derived geo MMDB. Empty = auto-detect from the cache directory. | [] | no | |
| 116 | | enrichment.geoip.optional | When true, missing or unreadable MMDBs are warnings, not fatal at startup. | false (true when auto-detected) | no | |
| 117 | |
| 118 | |
| 119 | </details> |
| 120 | |
| 121 | |
| 122 | |
| 123 | #### via File |
| 124 | |
| 125 | The configuration file name for this integration is `netflow.yaml`. |
| 126 | |
| 127 | |
| 128 | You can edit the configuration file using the [`edit-config`](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#edit-configuration-files) script from the |
| 129 | Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#locate-your-config-directory). |
| 130 | |
| 131 | ```bash |
| 132 | cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata |
| 133 | sudo ./edit-config netflow.yaml |
| 134 | ``` |
| 135 | |
| 136 | ##### Examples |
| 137 | |
| 138 | ###### After running the downloader with IPtoASN ASN and IPDeny country |
| 139 | |
| 140 | Auto-detection picks up both generated cache files. |
| 141 | |
| 142 | ```yaml |
| 143 | enrichment: |
| 144 | geoip: |
| 145 | asn_database: [] |
| 146 | geo_database: [] |
| 147 | optional: true |
| 148 | |
| 149 | ``` |
| 150 | ###### Explicit IPDeny country path |
| 151 | |
| 152 | Pin IPDeny for country and keep a separate ASN source. |
| 153 | |
| 154 | <details open><summary>Config</summary> |
| 155 | |
| 156 | ```yaml |
| 157 | enrichment: |
| 158 | geoip: |
| 159 | asn_database: |
| 160 | - /var/cache/netdata/topology-ip-intel/topology-ip-asn.mmdb |
| 161 | geo_database: |
| 162 | - /var/cache/netdata/topology-ip-intel/topology-ip-geo.mmdb |
| 163 | optional: false |
| 164 | |
| 165 | ``` |
| 166 | </details> |
| 167 | |
| 168 | |
| 169 | |
| 170 | ### IPv6 country fields are empty |
| 171 | |
| 172 | The current built-in IPDeny downloader source uses the IPv4 |
| 173 | `all-zones.tar.gz` archive. Use DB-IP, MaxMind, IP2Location, or a custom |
| 174 | MMDB if IPv6 country enrichment is required. |
| 175 | |
| 176 | |
| 177 | ### ASN fields are empty |
| 178 | |
| 179 | IPDeny zone files carry country CIDRs only. Configure a separate ASN |
| 180 | provider in the downloader. |
| 181 | |
| 182 | |
| 183 | ### Download blocked or rate-limited |
| 184 | |
| 185 | Check IPDeny's usage limits and retry later. The plugin continues using the |
| 186 | last generated MMDB file until the downloader publishes a replacement. |
| 187 | |
| 188 | |
| 189 |