By default, all NameHero VPS servers come installed with the ConfigServer Security & Firewall (csf) plugin. But if you don’t have it on your server, I strongly suggest that you install it. It’s invaluable. After setting up the CSF firewall on your VPS server, you might see a message in the CSF logs talking about country code filters like this:
The full error reads:
"CC Error: Country Code Filters setting MM_LICENSE_KEY must be set in /etc/csf/csf.conf to continue using the MaxMind database"
This error isn’t particularly serious, but it does tend to clog up the csf logs unnecessarily. In this tutorial, I’ll show you how to get rid of this annoying error, so you can more clearly see what’s going on with other things.
The MaxMind Database Needs a License Key to Download
MaxMind is a company that provides IP analytics, and CSF used to regularly use it to download publicly available databases that let them filter traffic based on which country the IP addresses were coming from. Previously, this database used to be publicly available for everyone to download, but because of some changes to the California Consumer Privacy Act (CCPA), they now require users to sign up for free and generate a license key for database access.
Personally, I can easily filter country-based traffic thanks to Cloudflare’s firewall, but CSF also filters out traffic when attackers access your server directly through your IP instead of just through Cloudflare. So you might still find a use for country-level blocking at the server level.
1. Signing up For a New MaxMind Account
The process is relatively simple. First, disable any VPN you might be using and access MaxMind’s sign up page here: https://www.maxmind.com/en/geolite2/signup
2. Generate the MaxMind License Key
After sign-up, confirm your e-mail ID, and then log into your dashboard. Click the “Generate New License Key” button. Now when it asks you if the key will be used for GeoIP Update, select “No” as shown here:
Click “Confirm”, and the system will display your MaxMind license key as shown here:
YOU CANNOT GET THIS KEY BACK! So make sure that you copy it somewhere else. MaxMind will only store the hashed key and they won’t be able to tell you what it was even if they wanted to. It’s the same way that passwords are stored in databases.
3. Enter the License Key into CSF
Log into your server dashboard and go to the CSF plugin. Scroll down till you find the button for the firewall configuration:
Click this. On the next page, search for the following key:
And paste in the value you got from Step 2 like this:
And you’re done!
Step 4: Save your Changes and Restart CSF
Once you’ve pasted the above value, scroll down to the bottom and click the “Change” button. And on the next screen, you’ll see an option to restart. Click that, and you won’t see any more country code error messages in the CSF logs!
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!