If you're facing issues when attempting to bulk blacklist or whitelist IPs in cPFence, the most common cause is improper file format. To resolve this, you need to convert the file to the correct Unix format. Follow the steps below to fix the issue.
Step 1: Convert the File to Unix Format
Run the following command to convert the file format using dos2unix
:
dos2unix /var/www/#################/path/tor_ips.txt
You should see output similar to this:
dos2unix: converting file /var/www/#################/path/tor_ips.txt to Unix format...
This will ensure the file is in the correct format, and your bulk IP blacklisting or whitelisting command will work properly.
Step 2: Run the Bulk Blacklist Command
After converting the file, you can proceed with running the bulk blacklist or whitelist command. For example, to blacklist IPs from a file:
cpfence --bulk-blacklist-ip https://domain.com/tor_ips.txt
You should see the following output as the command runs:
Downloading the IP list to a temporary file... please wait.
IP list downloaded to /tmp/tmp.E4GPQTMroz.
Cleaning up the IP list, removing invalid entries...
IP list has been cleaned and validated. Proceeding with the requested bulk operation..
Blacklisting all ips in /tmp/tmp.E4GPQTMroz ... please wait.
This may take 10/15 minutes for large lists...
All IPs from /tmp/tmp.E4GPQTMroz have been blacklisted.
Temporary file /tmp/tmp.E4GPQTMroz has been removed.
Need Further Assistance?
If you encounter any issues or need additional help, feel free to reach out to our support team via your client portal.