(Updated 12/6/2021) Here are a few tweaks that I have found and use on my WordPress installs to harden them and improve security. This post is mostly for my own benefit – for when I have to stand up a new server and can’t recollect what I did to my current server/site…. That said, I hope it helps you too.
Please note: While these work for me… I can not guarantee they will work for you.
Please make a backup of your site before you make any changes. I’m not responsible for any changes you make.
- Follow my post about adding a SSL certificate to your site.
2. The one comes from the ReallySimpleSSL plugin. It’s a great plugin to use to migrate your site to SSL. Anyways, in one of their articles (link) they go over some settings to add to your site’s htaccess file. Please read their article, before adding the following lines so you understand what each is doing. (Just for reference, here is an article describing how the htaccess file works). If you are running bitnami, try look in “/opt/bitnami/apps/wordpress/conf”.
Header always set Strict-Transport-Security: "max-age=31536000" env=HTTPS Header always set Content-Security-Policy "upgrade-insecure-requests" Header always set X-Content-Type-Options "nosniff" Header always set X-XSS-Protection "1; mode=block" Header always set Expect-CT "max-age=7776000, enforce" Header always set Referrer-Policy: "no-referrer-when-downgrade"
Another header that now needs to get added to your htaccess file is a “permissions-policy”, more info can be found here.
Header always set Permissions-Policy "geolocation=(); midi=(); notifications=(); push=(); sync-xhr=(); accelerometer=(); gyroscope=(); magnetometer=(); payment=(); camera=(); microphone=(); usb=(); xr=(); speaker=(self); vibrate=(); fullscreen=(self);"
After updating your htaccess file, restart your apache service using the command below,
sudo /opt/bitnami/ctlscript.sh restart apache
Then scan your site’s headers using SecurityHeaders.com to verify that you pass with an A+.
4. A solution like WPS Hide Login to hide the normal login page. This will help reduce login attempts done by bots.
5. A firewall and malware scanner solution like Wordfence.
6. Run your site’s URL thru the Qualys SSL Server Test, and address any SSL shortcoming the server might have.
That’s it for now. I’ll try to update this post with more tweaks and hardening suggestions as I implement things.