Logging into your WordPress site is all fun and games… until you wind up on an unprotected wireless access point which is being sniffed by nefarious noses. Then you might have a problem. You see, on your home LAN you are protected (or should be) by your router. Hopefully you have a strong passphrase protecting you from the outside world. If not, well, you should apply one soon.
Once you step outside of your network you are trusting that any wireless access points beyond your control are secure. This is where SSL comes in handy. Normally, connecting to your website on port 80 (http://) is perfectly fine. An issue arises, though, when you want to log in to your site. Once you enter your username and password all that information is transmitted in clear text to your server or web hosting company. Any malicious user sitting on the same network can sniff that traffic and acquire your URL and subsequently your IP address, your username and your password. If that account has admin permissions on your WordPress server, you can practically say goodbye to it because now the aforementioned malicious user has everything they need to log in to your account and indiscriminately destroy all your hard work.
SSL encrypts all traffic to and from a website. Applying a SSL certificate to your site and logging in via HTTPS is all you need to feel warm and fuzzy that if there is someone out there watching your traffic they cannot see when you log in. Although normal traffic to your site may not need encryption, logging in certainly does.
Begin by acquiring a free SSL certificate from StartSSL.com
StartSSL has guides for requesting a cert and applying it to your server as do other sites on the interwebs. I might write a guide in the future.
Apply your SSL cert to your Apache/HTTPd webserver
I am on CentOS, so your directory and file locations may differ on other Linux flavors.
Copy your private key file to:
Copy your SSL key, the CA root and CA chain to:
Open your /etc/httpd/conf.d/ssl.conf file and edit the following sections to enable SSL on your server.
Enforce high encryption in Apache and ace the Qualys SSL Test
Disable SSLv2 and SSLv3. These protocols are now considered weak, vulnerable, pathetic.
SSLProtocol All -SSLv2 -SSLv3
Add the ‘SSLHonorCipherOrder On‘ directive:
Enable a strong cipher suite:
Set the path to your SSL certificate:
Set the path to your SSL private key file:
Set the path to the CA chain and root certs:
Restart the webserver:
service httpd restart
systemctl restart httpd
Enable SSL through your Linux server firewall
I edited my iptables file with the below 443 rule:
-A INPUT -p tcp -m state -m tcp --dport 443 --state NEW -j ACCEPT
Force SSL on the admin wp-login page
You can force SSL via the wp-config.php file as well. Doing so will force any requests on port 80 to the admin login page to 443. Add the below line to the very top of your wp-config.php file. Make sure you applied a valid SSL cert before doing this.
, true );
Change your MySQL database root username
Another hardening step is to change your MySQL root username to something else. This will protect against brute force attacks where all standard usernames are tried, especially root.
UPDATE mysql.user SET user="newusername" WHERE user="root";
Disable wrong username/password messages on login page
When you enter a wrong username or password on the login page, the system informs you of this. Disabling this may not be a super security measure, but it is certainly part of the security by obscurity motto which can be part of an overall policy to protect your site.
Add this line to your wp-content/themes/themename/functions.php file for your selected theme:
add_filter('login_errors',create_function('$a', "return null;"));
- Edit your /etc/httpd/conf/httpd.conf
- Disable directory browsing by deleting ‘Indexes‘ from the section ‘Options Indexes FollowSymLinks‘.
- Remove access to xmlrpc.php by adding the following to the ALIAS directive section:
redirect 404 /xmlrpc.php
- Hide versioning of Apache by adding the following at the very end:
- Restart Apache
systemclt restart httpd
Hide PHP versioning
Edit your PHP.ini file, located at /etc/PHP.ini, and modify the line for expose_php = on to off.
expose_php = off