Viewers: in countries Watching now:
This course explains how to secure self-hosted WordPress sites, including site configuration, code modification, and the use of free plug-ins. Beginning with the basics of site security, author Jeff Starr explains how to harden a WordPress site by configuring authentication keys, setting proper file permissions, and removing version numbers. The course shows how to implement a firewall, prevent automated spam, and control proxy access, and concludes with a series of advanced tips and site security best practices.
In this screencast, we equip ourselves with a powerful way to protect our site against the bad guys. Keeping an eye on our server log files, we employ the excellent WP-Ban plug-in to block specific threats and other malicious behavior. To really take your security to the next level, it's important to keep an eye on your server access and error logs. Such logs are readily available from your server control panel and elsewhere, so ask your host if you don't see them. Here we have an excerpt from a hypothetical error log where various details are recorded for each 404 Not Found error.
Each of these are malicious requests, as evidenced by the nasty-looking URL. Timewise, these requests happened about a minute apart. Usually they're more frequently, but it also depends on your server and what your server is capable of. They all have the same recorded IP address, and they all also have the same user agent. The sort of malicious activity recorded here happens constantly, and it does a good job of wasting server resources and slowing things down for your legitimate visitors.
There are many solutions for defending against malicious requests, but for WordPress-powered sites the easiest way is to simply block them with a plug-in. Going to the Plugins menu, let's click on the Add New button and do a quick search for the WP-Ban plug-in. Enter the name and click Search, and WP-Ban should be listed among one of the first few results. So we see it here, and we click on the Details link to learn a little bit more about this plug-in.
As we see here in the description, the plug-in provides a way for WordPress users to block malicious requests and other malicious activity using the IP address, user agent, and other aspects of the request. It's been a while since this plug-in was updated, but it has been downloaded many times and enjoys good ratings. The installation, if we go to the web site, we see that the installation is typical, and as we see here, the plug-in is already installed on the site, so we are ready to jump into the Plugin Configuration page to configure the plug-in.
We click on the Ban link in the Settings menu to go there. Here at the WP-Ban Settings page, first and foremost, the plug-in tells us our own IP address, hostname, user agent, and so on. Next, we have the banned fields themselves, where we will be listing and blocking the bad guys. We can ban by IP, IP range, host name, referrer, user agent, and we can even exclude IPs, and customize the banned message that blocked requests will receive.
Really, at this point, there's nothing to configure, but just beneath the Banned fields, there are two more sections worth mentioning. First, the Ban Stats panel, where we can see the statistics about what's being blocked, and then beneath that an Uninstall option, should you decide to remove the plug-in later. So there is nothing to configure upfront, but let's return now to our hypothetical error log and see how to immunize our site against future attacks. There are lots of choices for blocking.
We can block by the IP address, referrer, user agent, and request string. If we determine that the user agent EmailSiphon is a bad bot, we can block it with WP-Ban. We can also block the IP address specifically. So let's start with the IP address. We copy that and return to the plug-in page and in the Banned IPs field, we just paste the IP address. Then let's returned to the error log and grab that user agent, copy, and then return to the plug-in page, scroll down, and paste it into place.
Once we have these two items in place, we click Save Changes, and done. Any requests meeting our new criteria will now be blocked and presented with the official 'you've been banned' message. Now, let's see it in action. We can't spoof an IP here, but we can spoof a user agent by going to bots versus browsers. We need two things to see this demonstration work. We need the user agent, which we had EmailSiphon, and we need the URL for our web site, so we can try to access it.
Once these two items are in place, we click the Go button and see the ban message. We have been banned. Anyone requesting our web site from using this user agent, EmailSiphon, will be banned. Likewise for the IP and likewise for any other item, host name, IP range, referrers and so on. This plug-in will ban malicious requests and specific threats. Finally, back at the Banned Options page, let's scroll down and verify that that request was actually recorded in the Ban Stats section of the plug-in, and here it is here.
Here is our IP address, here is the attempt, and if we would like, we can reset this. This is a great way to keep an eye on the different requests that are being made by the things that you are blocking. So in this screencast, we've seen how to get more fine-grain control over your site's security. The powerful WP-Ban plug-in makes it easy to block specific threats and keep your site safe, secure, and performing great.
There are currently no FAQs about WordPress 3: Developing Secure Sites.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.