IP blocklists¶
IP blocklists is an NGX OPS integration that sets up blocking or an HTTP challenge based on IP addresses, using Nginx's geo directive.
IP addresses coming from the different lists are aggregated and deduplicated before being included in the Nginx configuration.
The lists¶
IP address lists must be reachable from a URL and follow this format, one IP address per line:
Several community lists are available on the Internet, notably:
- duggytuxy/Data-Shield_IPv4_Blocklist — recommended
- Blocklist.de
- GreenSnow Blocklist
- CrowdSec through a bouncer — see the RDR-IT documentation
To optimize the configuration, the different lists are automatically aggregated and deduplicated.
There are also built-in lists based on:
- log analysis;
- the emulated WAF;
- the built-in challenge, for the addresses it blocked automatically.
Basic list configuration¶
To configure the lists, go to: ADMINISTRATION → Configuration → IP blocklists
In the input area, enter the configuration you want, then click Save.
Example 1: a single list¶
The following example uses only the Data-Shield list and updates every six hours:
enable: true
interval_cron: "0 */6 * * *"
block_action: deny_403
hit_logging_enable: true
hit_logging_method: dedicated
sources:
- name: datashield
url: "https://raw.githubusercontent.com/duggytuxy/Data-Shield_IPv4_Blocklist/refs/heads/main/prod_data-shield_ipv4_blocklist.txt"
enable: true
Example 2: several lists¶
You can also use several sources at the same time. In this example, the Data-Shield and GreenSnow lists are used:
enable: true
interval_cron: "0 */6 * * *"
block_action: drop_444
hit_logging_enable: true
hit_logging_method: dedicated
sources:
- name: datashield
url: "https://raw.githubusercontent.com/duggytuxy/Data-Shield_IPv4_Blocklist/refs/heads/main/prod_data-shield_ipv4_blocklist.txt"
enable: true
- name: greensnow
url: "https://blocklist.greensnow.co/greensnow.txt"
enable: true
Each source has its own name, its URL and an enable parameter to turn it on or off.
Blocking actions¶
The block_action parameter defines Nginx's behavior when an IP address present in a blocklist is detected.
In our examples:
Requests coming from an IP address present in the lists are then refused with an HTTP 403 Forbidden response.
The hit_logging_enable parameter turns on logging of blocks.
With:
blocks are recorded in a dedicated log, which makes them easier to browse and analyze.
drop_444closes the connection.
View the blocklists status¶
Once the configuration is saved, go to: INTEGRATIONS → IP blocklists
This page shows the status of the integration, along with a summary of the configured lists and the loaded IP addresses.

View the generated configuration¶
You can also view the configuration file generated by NGX Ops from: CONFIGURATION → Conf files → conf.d
The generated file is:
This file contains the configuration needed to handle IP addresses coming from the different blocklists.

Configure virtual hosts to use IP blocklists¶
Since the IP blocklists configuration is generated at the global level, each virtual host on which you want filtering applied must be told to use the blocklist.
To do so, add the following directives in the virtual host:
# Log blocks in a dedicated file
access_log /var/log/nginx/blocklist-hits.log blocklist_hits if=$blocklist_ip;
# Enable blocking of IP addresses present in the blocklists
include snippets/blocklist-enforce.conf;
The first directive records, in a dedicated file, the requests coming from IP addresses present in the blocklists.
The second directive includes the blocklist-enforce.conf snippet, which actually applies the block when the $blocklist_ip variable indicates that the client IP address is in a list.
Your virtual host can therefore be configured as follows:
server {
listen 80;
server_name example.com;
# Log requests blocked by the blocklists
access_log /var/log/nginx/blocklist-hits.log blocklist_hits if=$blocklist_ip;
# Enable blocking of IP addresses present in the blocklists
include snippets/blocklist-enforce.conf;
location / {
proxy_pass http://192.168.1.1;
}
}
💡 Tip: Filtering is only applied to the virtual hosts in which the
blocklist-enforce.confsnippet is included. You can therefore choose exactly which sites and applications get the IP blocklists.
Built-in lists¶
In addition to URL lists, a source can be generated locally. The three types are declared in sources::
sources:
- name: analyzer-auto
type: analyzer
enable: true
- name: waf-challenge
type: waf
list: challenge
enable: true
- name: waf-block
type: waf
list: block
action: drop_444
enable: true
- name: challenge-bans
type: challenge
action: deny_403
enable: true
analyzer source¶
The list is produced by the log analysis rules, working much like CrowdSec. The threshold, the time window and the decision to block are set rule by rule, not on the source:
- for built-in rules, in the Rules window of the Analysis page: threshold, window in minutes, "Actually block" checkbox and duration;
- for custom rules (YAML), with four fields:
rules:
- id: 101
name: admin_probe
# … usual detection fields …
blocklist_threshold: 5 # absent: the rule never takes part
blocklist_window_minutes: 1440 # counting window, 1440 by default (24 h), 14 days at most
blocklist_remediation: false # false by default: detects without blocking
blocklist_remediation_minutes: null # block duration, absent: as long as the threshold is exceeded
Observe before blocking
blocklist_remediation is false by default, on purpose. As long as it is not set to true, the rule detects ("detected" counter on the IP blocklists page, notification for each new IP crossing the threshold) but blocks nothing. Enabling the source on a production installation therefore blocks no address by surprise: first observe what detection would produce.
The block duration (blocklist_remediation_minutes) is renewed as long as the IP keeps triggering the rule, and is independent of the counting window.
The analyzer source is recomputed every minute (analyzer_interval_cron), without any download. Nginx is only reloaded when the list changes.
To keep a vhost's alerts without it feeding the list, add # nginx-control-analyze-no-remediation: on in its server block. See Log analysis.
waf source¶
Addresses come from the emulated WAF lists: list: block for addresses to refuse, list: challenge for those to submit to the challenge. Prerequisite: the emulated WAF enabled, with remediation mode on at least one vhost (addresses under observation are never listed). If the WAF is unreachable, the last list received is kept.
challenge source¶
It takes the addresses that the challenge blocked automatically after too many failures. The possible actions are deny_403 and drop_444: these addresses have already failed the challenge.
Action per list¶
block_action defines the default action: deny_403 (403 response) or drop_444 (the connection is closed without a response, which gives a scanner no information). Each source can override it with action, including with challenge, which requires challenge_enable: true.
An address present in several lists receives the most severe action: 444, then 403, then challenge. A block therefore always wins over a challenge.
Whitelist¶
The whitelist key is a global safety net, applied after all sources are merged: an address or range listed here is never blocked, whatever the source. It mainly serves to protect your own private ranges from a false positive.
The challenge as remediation¶
For a list to apply a challenge instead of a refusal:
- set
challenge_enable: true; - start the challenge container;
- in each protected vhost, after
blocklist-enforce.conf, addinclude snippets/challenge-gate.conf;.
Without challenge_enable, "challenge" addresses are detected and displayed, but nothing is applied in Nginx.
Log blocks¶
hit_logging_enable (disabled by default) writes a log of blocks and feeds the page's effectiveness measurement, the periodic summary and the search by list.
hit_logging_method |
Behavior |
|---|---|
dedicated |
One dedicated global log (blocklist-hits.log), one line per blocked request, all vhosts combined. This is accurate |
approx |
No additional log: effectiveness is limited to comparing the number of blocked IPs with global traffic |
The IP blocklists page¶
For each source, the page shows the status (last success or error, number of IPs), an Export link to view or download its list, the total of unique addresses, the current configuration and the generated files. It also offers:
- Refresh now;
- an IP search, which tells you in which list(s) an address appears;
- the effectiveness of blocks over 24 h, if logging is active;
- a filterable history of additions, removals and observation-only detections, exportable as CSV.
Publish the list to other systems¶
With public_enable: true, the merged list is served as plain text (one address or range per line), with no session or API:
| Address | Content |
|---|---|
/public/blocklist.txt |
The full list, open to everyone if public_token is empty |
/public/<token>/blocklist.txt |
The full list, with the token in the address |
/public/<token>/blocklist/<source>.txt |
A single source |
public_sources limits the published sources (all or a list of names). Sources with a challenge action and the whitelist are excluded. Always define a long, random public_token (16 to 128 characters) and expose the address over HTTPS. The limit is 60 requests per minute per IP. Another NGX Ops can consume this list as a type: url source.
How it works and security¶
- The two generated files are
conf/blocklist-ips.conf(the address table, loaded by Nginx) andsnippets/blocklist-enforce.conf(the blocking, to be included vhost by vhost). They are created empty from the first start: a vhost that includes them never makesnginx -tfail. - These files are generated locally: they must not be versioned in the Git repository and are excluded from the Git deployment.
- Only lines that strictly look like an IPv4 or IPv6 address, with or without CIDR, are kept. Everything else is ignored: no configuration injection is possible.
- A source that goes down does not remove its addresses: the last list received successfully stays active.
nginx -tis run before each reload. On failure, the previous files are restored. A reload only happens if the table or the action changed.- Disabling the feature (
enable: false) or the challenge (challenge_enable: false) empties the generated files without deleting them, since Nginx includes them.
The blocklists.yml keys¶
| Key | Default | Role |
|---|---|---|
enable |
— | Enables the feature |
interval_cron |
"0 */6 * * *" |
How often URL lists are fetched (5-field cron) |
analyzer_interval_cron |
"* * * * *" |
How often the analyzer source runs |
block_action |
deny_403 |
Default action: deny_403 or drop_444 |
hit_logging_enable |
false |
Log of blocks |
hit_logging_method |
dedicated |
dedicated or approx |
challenge_enable |
false |
Allows the challenge action |
challenge_engine |
builtin |
builtin or anubis |
challenge_upstream |
empty | Service address: nginx-challenge:8080 or anubis:8923 by default |
challenge_resolver |
127.0.0.11 |
DNS resolver used by Nginx |
challenge_exempt_path_regex |
^/[.]well-known/ |
Paths never submitted to the challenge |
challenge_exempt_ua_regex |
empty | User-Agents never submitted to the challenge |
public_enable, public_token, public_sources |
false, empty, all |
List publication |
sources |
— | The lists: name (letters, digits, _ and -, unique), url or type, action, enable |
whitelist |
empty | Addresses and ranges never blocked |
The shipped file, config/blocklists.yml, contains these keys with detailed comments.