Follow up on WordPress security plugins post

I just wanted to write a quick follow up to the blog I wrote last week about a few plugins I was using for WordPress security in light of the global WordPress brute force attacks taking place . The good news is the Wordfence plugin does a great job blocking people trying to login to my site. The bad news is either the Stealth Login Page plugin doesn’t work or some how people are easily guessing my question and answer phrase to get to my login page, which seems hard to believe. I’m thinking there must be some other way to by pass it.

Because of this, I first removed the Stealth Login page and installed AskApache Password Protect. This requires you to create a separate user account and utilizes .htaccess to secure wp-admin and wp-login.php. When you attempt to login to the WordPress admin page, you are prompted by your web browser for one login. Then if you enter that properly, you are prompted for the normal WordPress login. There are other security features to the AskApache plugin, but I quickly broke my site trying them out, so I won’t touch on them.

This seemed to be a good option until I saw a post from Matt Hartley on Google+ mentioning a two factor authentication option for WordPress. That plugin is put out by Duo Security and it sends you an SMS text after you login for the second phase of authentication to your WordPress blog. You can configure it to remember your computer for a specific period of time, so you won’t have to do this every time you login.

The plugin was fairly simple to setup, and so far it seems to work great. The service is free for up to 10 users. If you want to set it up, you can find instructions here.

WordPress emails not working

This wasn’t intended to be my first post, but I just finished getting email working for this blog, so I figured why not post how I got it work. We can always do an intro later.

For this blog and another blog I just started, www.playingwithpython.com, I setup a Linux server to host the sites using Apache. After getting the sites setup, I went to setup a couple security plugins that send email alerts. Unfortunately, emails were not working.

Being a fairly recent adopter of Linux, these type of issue are never light bulb moments for me. It takes hitting up Google for the answers. Typically, I scour the web for a couple hours trying pull enough pieces together to get the puzzle put together. This was no different.

In order to save you the time that I wasted, let me just post the steps I did to get this working.

First, I immediately figured I didn’t load sendmail, since I loaded a barebones linux install for this server. So, first step is to load Sendmail.

Install Sendmail:

  1. Since I’m running CentOS, I installed sendmail with “yum install sendmail”.
  2. Next, I set the service to start automatically with the “chkconfig sendmail on” command.
  3. Lastly, start the service with “service sendmail start”.

Alright, send mail is loaded and allows local host by default. Let’s go test these emails again….. nope. Still not working. I was getting the error “Could not instantiate mail function”.

I went to check the logs in the file /var/log/maillog and found the error…

NOQUEUE: SYSERR(apache): can not chdir(/var/spool/clientmqueue/): Permission denied

The problem now is SELinux. You can test and resolve this issue via the following commands:

  1. Check to see if httpd can sendmail by running “getsebool -a | grep mail”
  2. See if “httpd_can_sendmail –> on” shows. If it says off, SELinux is blocking httpd from initiating sendmail.
  3. Run “setsebool -P httpd_can_sendmail on” to fix SELinux.

You should now be able to send emails via WordPress’s, well really PHP’s mail() function.