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.
Step 1: Edit the User Agent Files
To block or whitelist user agents, you need to edit the following files:
- For Blacklisting:
/opt/cpfence/app/cpfwaf/userdata_bl_agents
- For Whitelisting:
/opt/cpfence/app/cpfwaf/userdata_wl_agents
Add the user agents you want to block or whitelist in the respective files. Each user agent should be on a new line.
Step 2: Apply Your Changes
After editing the files, you need to disable and re-enable the Web Application Firewall (WAF) to apply your changes. Run the following commands in your terminal:
cpfence --disable-ols-waf
cpfence --enable-ols-waf
This will ensure that your changes take effect immediately.
Notes
- The changes will be preserved even after updating cPFence.