wlanboy
Content Contributer
Time to start the discussion about how to secure wordpress blogs.
There are some actions everyone should take to secure his wordpress blog:
On request the lighttpd and apache config for the password protection:
	
			
			There are some actions everyone should take to secure his wordpress blog:
- Strong passwords
I use openssl to generate passwords:
openssl rand -base64 60
Change the number of digits too.
 - Limit login attempts
There is a plugin doing the job.
It blocks the lightweight attacks. Because a botnet or someone using Tor does have a lot of IPs.
Best feature: This plugin is sending you email warnings if such attacks happen.

Another plugin (thanks Abdussamad) to limit the number of login attemts: Fail2ban plugin.
This plugin is creating log entries that can be catched by fail2ban.
 - Password protect wp-admin directory
htaccess/htpasswd are your friends.
 - Never ever use common usernames
No "admin", no "Admin", no "root", no "Administrator", not your nickname, not the domain name, well I guess you got it.
 - Add some filters
Ensure that wordpress is not telling everyone that the user exists but the password was wrong:
nano /wp-content/your-theme/functions.php
add_filter('login_errors',create_function('$a', "return null;"));
 - Disable xml-rpc, if you do not need it
Another filter:
Yup, xmlL-rpc is enabled by default since wordpress 3.5.Code:add_filter( 'xmlrpc_enabled', '__return_false' );
And of course there is a plugin for that.
 - Rename wp-login.php
Nice catch from eva.
There is a plugin that is able to rename the permalinks of the wp-login.php.
Nice way to let the attacker run/hit into empty space.
 - Update your wordpress instance and backup your database
 
On request the lighttpd and apache config for the password protection:
- lighttpd
$HTTP["url"] == "/wp-login.php" {
auth.backend = "htpasswd"
auth.backend.htpasswd.userfile = "/etc/lighttpd/wordpress"
auth.require = ("/wp-login.php" => (
"method" => "basic",
"realm" => "wordpress",
"require" => "valid-user"
))
}
$HTTP["url"] =~ "^/wp-admin/" {
auth.backend = "htpasswd"
auth.backend.htpasswd.userfile = "/etc/lighttpd/wordpress"
auth.require = ("/wp-admin" => (
"method" => "basic",
"realm" => "wordpress",
"require" => "valid-user"
))
}
 - apache
Code:<Files wp-login.php> AuthName "Restricted Wordpress-Area" AuthType Basic AuthUserFile ~/wordpress Require valid-user </Files> # Deny access to important files <FilesMatch "(\.htaccess|\.htpasswd)"> Order deny,allow Deny from all </FilesMatch> - ngix
Code:location = /wp-login.php { auth_basic "Restricted Wordpress-Area"; auth_basic_user_file /etc/nginx/wordpress; include /etc/nginx/conf.d/fastcgi.conf; } 
			
				Last edited by a moderator: