UniFi Gateway IP Blocklist Setup

Block brute force attacks on your UniFi Dream Machine or Cloud Gateway VPN with ThreatListPro's automated IP blocklist. Complement UniFi Threat Management with proactive IP blocking.

Start 14-Day Free Trial
5.4M+
IPv4 Addresses Blocked
6h
New-Attacker Checks
10 min
Setup Time

UniFi VPN Is More Popular Than Ever

UniFi Dream Machines and Cloud Gateways now include built-in VPN servers (L2TP, WireGuard, OpenVPN). As adoption grows, so do brute force attacks targeting these endpoints.

Growing Attack Surface

UniFi's VPN features have made it a popular choice for small businesses and prosumers. But many deployments use default configurations with internet-facing VPN ports. Automated bots discover these endpoints via mass scanning and launch credential-stuffing attacks. UniFi's built-in Threat Management (IDS/IPS) helps, but it relies on signature matching -- it doesn't preemptively block known attackers.

Proactive Blocking with ThreatListPro

ThreatListPro provides a curated list of IPs observed attacking production Palo Alto GlobalProtect VPN portals in the US. By importing this list into your UniFi Gateway via a simple script, you block known attackers before they can reach your VPN server. This complements UniFi's Threat Management: ThreatListPro handles known threats while IDS catches novel attack patterns.

Recommended by WillieHowe

WillieHowe, a leading UniFi specialist and YouTube creator, is a ThreatListPro partner. Check out his setup tutorials for step-by-step video walkthroughs of ThreatListPro on UniFi Dream Machine Pro and Cloud Gateway Ultra.

UniFi Gateway Blocklist Setup -- Step by Step

Add ThreatListPro to your UniFi Dream Machine, UDM Pro, UDM SE, UDR, or Cloud Gateway using SSH and a scheduled script.

01

Get Your ThreatListPro Feed URL

Sign up at threatlistpro.com and copy your unique feed URL from your welcome email:
https://api.threatlistpro.com/v1/YOUR_API_KEY/blocklist.txt

02

Enable SSH on Your UniFi Gateway

In the UniFi Network app, go to Settings > System > Advanced and enable SSH. Set a strong SSH password. Connect to your gateway via SSH:
ssh [email protected]

03

Create the Update Script

Create the ThreatListPro update script below. It loads the list into an ipset of type hash:net, which keeps each CIDR range as one entry, and adds an iptables rule that drops traffic from those addresses. A hash:ip set does not work here: it expands every range into single addresses, and the list covers more than 5.4 million of them. The new list replaces the old one in a single swap, and only after a good download.

mkdir -p /data/threatlistpro cat > /data/threatlistpro/update.sh <<'SCRIPT' #!/bin/bash # cron runs with a short PATH; ipset and iptables live in sbin PATH=/usr/sbin:/usr/bin:/sbin:/bin FEED_URL="https://api.threatlistpro.com/v1/YOUR_API_KEY/blocklist.txt" TMP=/tmp/tlp-blocklist.txt # Stop if the download fails, so the last good list stays active curl -fsS --max-time 60 "$FEED_URL" -o "$TMP" || exit 1 grep -Eq '^[0-9]' "$TMP" || exit 1 # Upgrade from the old script: its set was hash:ip, which cannot hold the ranges if ipset list -n tlp_blocklist >/dev/null 2>&1 && ! ipset list -t tlp_blocklist | grep -q 'hash:net'; then while iptables -D INPUT -m set --match-set tlp_blocklist src -j DROP 2>/dev/null; do :; done ipset destroy tlp_blocklist || exit 1 fi # hash:net stores each CIDR range as one entry ipset create tlp_blocklist hash:net maxelem 65536 -exist ipset create tlp_new hash:net maxelem 65536 -exist ipset flush tlp_new grep -E '^[0-9]' "$TMP" | sed 's/^/add tlp_new /' | ipset restore -exist || exit 1 ipset swap tlp_new tlp_blocklist ipset destroy tlp_new # Keep the DROP rule first in INPUT, even after UniFi reprovisions its rules while iptables -D INPUT -m set --match-set tlp_blocklist src -j DROP 2>/dev/null; do :; done iptables -I INPUT 1 -m set --match-set tlp_blocklist src -j DROP SCRIPT chmod +x /data/threatlistpro/update.sh
04

Schedule Automatic Updates

Add a cron job to update the blocklist every hour. On UniFi OS 3.x, use the built-in cron:
(crontab -l 2>/dev/null | grep -v threatlistpro/update.sh; echo "0 * * * * /data/threatlistpro/update.sh") | crontab -
The script lives in /data/, which survives reboots and updates. The set and the rule are rebuilt on every run, so after a reboot blocking returns at the next scheduled run (or run the script once by hand). After a firmware update, check that the cron line is still there with crontab -l and add it again if it is missing.

05

Enable UniFi Threat Management (Recommended)

In the UniFi Network app, go to Settings > Security > Threat Management and enable IDS/IPS at level 3 or higher. This provides signature-based detection that complements ThreatListPro's IP-based blocking for layered defense.

06

Verify Blocking

Run the update script manually first:
/data/threatlistpro/update.sh
Then verify the set type and entry count (the type should be hash:net):
ipset list -t tlp_blocklist
Check iptables for the drop rule:
iptables -L INPUT -n | grep tlp_blocklist

ThreatListPro vs. Alternatives

Compare automated VPN-focused blocking against other approaches for protecting your UniFi gateway.

FeatureThreatListProManual BlockingEnterprise Threat Feeds
VPN brute-force focused✓✗✗
Checked for new attackers every 6 hours✓✗✓
Works with UniFi OS✓✓✗
Complements Threat Management✓✗✗
Script survives reboots and firmware updates✓✗✗
Price$19.99/moStaff timeQuote-based

Frequently Asked Questions

How do I add an IP blocklist to my UniFi Dream Machine?

The UniFi Network app has no setting for an external IP blocklist URL. The method on this page uses SSH: a script on the gateway downloads the ThreatListPro feed every hour, loads it into an ipset of type hash:net and drops traffic from those addresses with an iptables rule.

Does ThreatListPro work with UniFi Dream Machine Pro, SE, and Gateway models?

The script needs SSH access and the standard Linux tools curl, ipset and iptables, which UniFi OS gateways such as the UDM, UDM Pro, UDM SE and UDR provide. Before you start, run ipset version over SSH to confirm the command is there on your model and firmware.

Can I use ThreatListPro with UniFi's built-in Threat Management (IPS/IDS)?

Yes, and you should. UniFi's built-in Threat Management uses Suricata signatures to detect attack patterns, while ThreatListPro blocks known attacker IPs before they connect. Threat Management catches new attack patterns; ThreatListPro blocks IPs that have already been seen attacking VPN logins.

How often does the ThreatListPro blocklist update on UniFi?

ThreatListPro checks for new attackers every 6 hours; new entries come from attacks on live production Palo Alto GlobalProtect VPN portals in the US. Your UniFi gateway fetches the latest list on the cron schedule you set (recommended: every hour).

What format does ThreatListPro use for UniFi?

A plain text file with one IP address or CIDR range per line; lines starting with # are comments. The script skips the comments and loads the rest into an ipset of type hash:net, which keeps each range as one entry, and an iptables DROP rule references that set.

Why does the script use hash:net instead of hash:ip?

A hash:ip set expands every CIDR range into single addresses. The list covers more than 5.4 million IPv4 addresses, so a hash:ip set fills up and the rest of the list is silently left out. A hash:net set stores each range as one entry. If you used an earlier version of this script, the new one detects the old hash:ip set and replaces it.

How long does it take to set up ThreatListPro on UniFi?

About 10 minutes: enable SSH on your UniFi gateway, create the update script, add the cron job for automatic updates, and optionally turn on Threat Management for layered defense.

Do I need a paid ThreatListPro account to use it with UniFi?

ThreatListPro offers a 14-day free trial so you can test the blocklist on your UniFi gateway before committing. After the trial, the monthly plan is $19.99/month for the full VPN brute force blocklist, checked for new attackers every 6 hours.

Protect Your UniFi Gateway Today

Layer ThreatListPro on top of Threat Management for complete VPN protection.

Start 14-Day Free Trial

Works With All Major Firewalls

ThreatListPro provides a standard IP blocklist feed compatible with any firewall that supports external lists.

Palo Alto FortiGate pfSense OPNsense SonicWall Cisco ASA Sophos XG UniFi

Related Resources

Learn more about IP blocklists, VPN security, and how ThreatListPro compares to alternatives.

What Is an External Dynamic List (EDL)? VPN Brute Force Attacks Explained IP Blocklist vs Enterprise Threat Feed Stop Account Lockouts from Brute Force ThreatListPro vs FireHOL ThreatListPro vs AbuseIPDB Best VPN Brute Force Protection 2026 All Firewall Setup Guides