How to Block or Whitelist Certain User Agents ?

This guide will help you block or whitelist specific user agents in cPFence. You can manage these settings easily and ensure they are preserved across cPFence updates.

cPFence detects and blocks over 1000 known bots by default, helping to reduce server load and stop various automated attacks. The WebUI also lets you easily manage custom User-Agent blacklists and whitelists—no SSH or manual file editing needed. This ensures both protection and flexibility for hosting providers.

How to Manage User-Agent Blacklist and Whitelist from WebUI

 

 

 

  1. Open the cPFence WebUI on your Main Control Panel server.
  2. From the left sidebar, click Edit Configuration Files.
  3. Choose the target server from the Switch Server dropdown.
  4. In the Choose File to Edit dropdown:
    • Select 7) Manage WAF User-Agent Blacklist to edit the blacklist.
    • Select 8) Manage WAF User-Agent Whitelist to edit the whitelist.
  5. Click Load File to view and edit the list. Enter one User-Agent per line.
  6. Click Save File when you’re done.

 

Managing User Agents from CLI

You can also manage User-Agent blacklists and whitelists directly by editing the configuration files via the terminal.

  • To edit the blacklist:
nano /opt/cpfence/app/cpfwaf/userdata_bl_agents
  • To edit the whitelist:
nano /opt/cpfence/app/cpfwaf/userdata_wl_agents

Enter one User-Agent per line. After editing, no restart is needed—changes apply automatically.

Default SEO Bot Whitelisting

Popular SEO and search engine bots are already whitelisted by default to prevent accidental blocking and reduce support requests. Example bots:

AhrefsBot
dotbot
rogerbot
SplitSignalBot
SemrushBot
SiteAuditBot

You can add or remove any User-Agent in the WebUI or via CLI at any time.

Notes

  • The changes will be preserved even after updating cPFence.
  • whitelist useragent, blacklist useragent
  • 18 Kunder som kunne bruge dette svar
Hjalp dette svar dig?

Relaterede artikler

Why my custom WAF rules are not working?

If your custom ModSecurity rules aren’t taking effect, it’s often due to duplicate rule IDs or...

How to Enable / Disable WAF Rule by ID ?

This guide provides instructions for enabling and disabling specific WAF (Web Application...

How to Enable / Disable WAF?

The cPFence Web Application Firewall (WAF) now fully supports Apache, Nginx, OLS, and LSWS web...

How to Identify Problematic WAF Rule IDs in cPFence?

New! You can now use an automatic tracking tool to identify problematic WAF rules in real time....

How to Stop XML-RPC Attacks Server-Wide Using the cPFence WAF?

Note: This feature is now part of the WP-AutoShield Module and is active by default and done...