iThemes Banning You For 404 Error

Recently I updated the Better WP Security plugin. The developers have decided to rename it to iThemes Security. After a while I kept getting banned from the blog (I just kept getting a page stating “error”.

After doing some digging I found that the problem had been caused by the “default-user-image.png” image that was set in the All In One SEO Pack. I had changed the name of my wp-content folder (as per 1 of the recommendations in iThemes) however the links to this file were still leading to wp-content.

After installing iThemes make sure that you modify the location of the default user image in “All In One SEO” >> “Social Meta”. The setting you are looking for is “Default OG:Image”. Simply change wp-content to the new name that you have given the folder.

On a side note when looking for the issue I came across a red herring. In the main plugin script (all_in_one_seo_pack.php) a couple of constants are defined to state the name of the wp-content folder. When questioning this in the support forum I was advised they are not used any more. Begs the question why are they still there?

How A Ping Works

Introduction

One of the basic things that is generally asked when carrying out any network diagnostics (including the internet) is to carry out a ping. Here we will discuss what a ping is and how useful it is.

What Is A Ping

A ping is 1 of the most basic tool in any diagnostics toolkit. When you find you cannot access a website or a service on the internet you should check that you can actually connect to it (obviously after you have checked that you can access other services).

When you initiate a ping you are requesting that your device (usually a PC) sends a particular type of packet to the IP specified (if you specify a URL it will be translated into an IP first). The results that you receive back from the ping indicate how long it too to receive a response from the ping.

In this instance the type of packet is an ICMP packet (a handy link at the end of the article that shows what an ICMP packet is).

How You Read The Results From A Ping

Running a trace route is a very simple task. Firstly open a Dos prompt (click the link for instructions).

Once open you should see something similar to the screenshot below.

DOS Prompt
DOS Prompt

Now that we have the dos prompt we type the following command to carry out the ping:

ping mywebsite.com

As usual replace mywebsite.com with the IP or URL for the service that you are trying to test. This command is equivalent of writing “ping -n 4 petermcdonald.co.uk” you will see the “-n” switch shortly. This will result in something like the following:

Basic Ping
Basic Ping

As you can see I have pinged petermcdonald.co.uk (this site). Prior to the ping starting we receive an acknowledgement that a ping is about to take place and we are advised within brackets what IP address is to be pinged.

As you can see we have received 4 lines each with recurring information. In my case these are exactly the same but this is more of a fluke. Each response contains the following information:

  • Status of request and the IP that responded
  • Size of the packet denoted by bytes=
  • Response time for the packet denoted by time=XXms
  • Time to live denoted by TTL=XX

So lets look at each of these in turn.

Request Status

The status of the request, Usually this would be “Reply From IP” (of course it would not say IP it would have the actual IP address. Alternatively you may receive “Request Timed Out” which indicates that the response from the sent packet did not arrive in a timely manner. This could indicate that your connection is faulty, the server is bogged down or there is a DNS issue to name a few.

Packet Size

This is the size of packet in bytes that we have sent. This can be modified using the “-l” switch however there is little reason to do this normally. The maximum size on most modern PC’s are 65527 (unless you are doing something nefarious).

Response Time

The response time is measured in milliseconds and is how long it has taken for the response to the packet that you have sent takes to arrive. People believe that this is how long it took the packet to arrive at its destination however this is not the case. The time it takes to arrive at the destination is around half of the response time.

TTL

TTL stands for Time To Live. Contrary to what quite a few people believe this is not actually how long a packet will last for. Instead it is the maximum amount of hops that the packet will pass through prior to failing (to learn more about hops check out my article “How A Trace Route Works“)

The last piece of information that we receive are the statistics for the test. The information we have gained here are as follows:

  • Packets: Sent – How many packets we sent.
  • Received – How many responses we received
  • Lost – hopefully this would be 0 indicating that we received a response for each packet
  • Minimum – The time taken to receive a response from the fastest packer
  • Maximum – The time taken to receive a response from the slowest packer
  • Average – The average time of all requests to receive a response. The lower this figure the better.

What Else Can I Do With Ping

Previously I mentioned that “ping petermcdonald.co.uk” was equivalent to “ping -n 4 petermcdonald.co.uk”. You may have guessed by now but the “-n” switch allows you to specify how many packets you send (and you will receive a response line for each 1).

As you can see below the output is very similar to before.

Ping 10 times
Ping 10 times

You may also wish o continually ping an IP. You can also do this simply in this case by using the “-t” switch. This will continually ping the IP until you specifically tell it to stop (by using ctrl + c).

Again an example is below.

Continual Ping
Continual Ping

1 consideration on using the “-t” switch however. I have spoken with many people in the past who have done this and ran it for hours then when they see “Request timed out” they believe they must have a packet loss issue. This may not be the case. A server is quite free to ignore ping requests. Some do not respond at all and some stop responding if they are being bombarded. Others may also choose not to respond if they have too much traffic from other sources to deal with (after all if someone kept banging on your door wouldn’t you stop answering after a while? Why should servers be any different?).

There are other switches that you can use with the ping command however I would say those mentioned above are the most common. If you would like to read more about the switches available check out the link to the Microsoft article at the bottom of the article.

Potential Issues

Could Not Find Host

If you receive an error stating that the “Ping request could not find host” such as the below example. This could be due to a couple of things such as:

  • The domain is not registered (as in my example).
  • The DNS cannot be resolved for the domain name you have tried to ping.
Failed Ping
Failed Ping

Pings Work When They Shouldn’t

At times you may find that you receive a response from a ping when you know it should not respond. Alternatively you may find the domain resolves to an IP but does not respond to pings.

In my example for Could Not Find Host above I came across this problem. In my case as my ISP’s DNS could not resolve the host it provided the IP address they use for capturing traffic for non registered domain names (I had to change my DNS to be that of Google’s namely 8.8.8.8 as the primary and 8.8.4.4 for the tertiary).

If you suspect that this is happening try pinging a completely random domain that is not registered (I personally button bash my keyboard and put .com after it). If you receive the same response (ie IP address) then you can safely assume that the ISP is hijacking the DNS,

Unfortunately this is quite common these days as ISP’s can benefit from advertising on pages you may come across if you mistype a URL.

Further Reading

If you would like to learn more about the more advanced features of pathping take a look at this Microsoft Ping guide.

For more information on what an ICMP packet is read the Microsoft Internet Control Message Protocol article.

I hope you enjoyed this article. If you have any questions feel free to ask. I will no doubt tidy this article up over time and make amendments.

How A Trace Route Works

Introduction

Previously I have posted an article titled “How A Pathping Works“. In this article i demonstrated how a pathping can help identify where an issue lies if you are unable to connect to a webpage.

Sometimes however a pathping is overkill and you may only need to see where the connection fails. This is where a trace route comes in handy. Continue reading “How A Trace Route Works”

The Rise Of Crowd Funding In The Music Industry

Over recent times it has become a lot more evident that crowd funding is becoming a bigger influence in the music industry. At first I believed this to be more underground and unsigned bands

Since paying closer attention to the crowd funding projects that have been created it has shown be that this is far from being secluded to the newer bands. Continue reading “The Rise Of Crowd Funding In The Music Industry”

Issue when implementing NSURLSession

I have recently been playing with NSURLSession and seeing the benefits of using this over the old method.

Today I came across a slight issue that is worth noting. During my programming session I was implementing the delegates. I started with NSURLSessionDelegate then moved onto NSURLSessionTaskDelegate. At this point I decided to test the code and found that the following method was called in my delegate object

– (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error

I tried to output the error using

NSLog(@”%@”, [error localizedDescription]);

But unfortunately this was not helpful as I received Null. I originally thought that there was an error in my coding however I could not locate 1. On further checking I found that I have made a couple of assumptions and I believe they were quite well founded.

The description of – URLSession:task:didCompleteWithError: is as follows:

Tells the delegate that the task finished transferring data.

Unfortunately I do not believe the method is named very well. As the description states this method is called when an error occurs. If no errors occur then the task completed successfully.

To ensure that the request was successful something along the lines of the example brow will work.

- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error
{
    //TODO Implement method
    if (error == Nil) {
        //TODO ascertain the failure and report failure to the caller
        return;
    }
    //TODO Report success
}

Help Audit Truecrypt

Over the last couple of months Edward Snowden has shown us how intrusive governments has been. This has also raised questions such as how safe are you when using encryption software.

As Truecrypt is 1 of the more popular encryption solutions there is a vested interest for the NSA, GCHQ and other spy organisation in breaking the protection that these provide. There have also been suggestions that the NSA have attempted to coerce software developers in actively introducing backdoor’s into their software.

To date there has not been any large-scale security audits on the Truecrypt source code. Well this is about to change.

A team of people have started an Indiegogo Campaign.The campaign has already met the starting target however please do not let this influence your decision in backing the campaign. The more money pledged the better the results for the audit. The money will ensure that those carrying out the audit are properly compensated and funds are available to entice people in reporting bugs that they fund.

Be sure to back the Truecrypt Audit on Indiegogo.

Installing Zend Server 6.1 using Nginx and PHP 5.4.

Zend recently updated Zend Server and added the ability to use Nginx as the web server. I thought I would give it a go. I have installed Zend Server 6.1 on a fresh new install of Cent OS 6.4 (I used the minimal install ISO weighing at around 300 meg).

The following are the steps required to install.

Firstly we need to create the Nginx repository file as we re going to use yum to install everything:

touch /etc/yum.repos.d/nginx.repo

Next we need to add the repo details to use. Firstly open the file in vi:

vi /etc/yum.repos.d/nginx.repo

Then add the repo details (press “i” before typing, 😡 to close and save the file)

[nginx]
 name=nginx repo
 baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
 gpgcheck=0
 enabled=1

We now need to do the same for Zend Server:

touch /etc/yum.repos.d/zend.repo

Open the file:

vi /etc/yum.repos.d/zend.repo

Enter the repo details (remembering to press “i” before typing, 😡 to close and save the file):

[Zend]
 name=zend-server
 baseurl=http://repos.zend.com/zend-server/6.1/rpm/$basearch
 enabled=1
 gpgcheck=1
 gpgkey=http://repos.zend.com/zend.key
[Zend_noarch]
 name=zend-server - noarch
 baseurl=http://repos.zend.com/zend-server/6.1/rpm/noarch
 enabled=1
 gpgcheck=1
 gpgkey=http://repos.zend.com/zend.key

Now we simply need to download everything. For this I am choosing to use PHP 5.4 (my choices are 5.4 and 5.3, replace 5.4 with 5.3 in the next command if you are chosing PHP 5.3):

yum install zend-server-nginx-php-5.4

You maybe prompted to allow a key to be used. This is ok we are using the official repos for the packages so select y if prompted.

After some time (depending on your connection speed) Zend Server 6.1, PHP 5.4 and Nginx will be installed and we can reach the GUI. You maybe wondering when we installed Nginx. When we asked yum to install Zend Server it saw that it was dependant upon Nginx being installed first so added this to the download list (and used the Nginx repo from above to install it).

Now I am only using this locally behind a router etc so decided that I would disable iptables. I strongly recommend you do not do this for public servers. To disable iptables simply run the following command:

/etc/init.d/iptables stop

We can now access both the Nginx web server and the Zend Studio control panel which is located at http://your-ip:80081

Now we shall finish the installation. Firstly accept the licence and click next. The choose the profile you are using. As this is a development machine for me I am going to choose the development option. Needless to say you should choose the option that is right for your situation. Again click on next.

On this next page it is going to ask you for a password 4 time. 2 for the admin and 2 for the developer. If you intend to use the free licence, the developer password really is not going to be of much use but I would set something you will know anyway. The developer user is disabled for the free licence. Click next after entering the password.

On the next page click next. Read the summary and click submit.

After a few moments you will enter the web interface for the Zend Server application. Be sure to browse about and become comfortable with it. Be warned tho the initial licence is a trial licence and after 7 days you will need to enter a new licence. As mentioned there is a free licence which will disable some functionality (but still useful). For a breakdown of what each licence includes be sure to check our the Zend Server editions page which has more info.

One last note. The first time entering the web interface you will not be prompted for a login. After this you will need to use a login. The login is:

Username: admin
Password: As entered

Enjoy and happy programming.

Updating Zend Server 6.01 (PHP 5.4.11) to 6.10 (PHP 5.4.16)

Not too long ago I installed Zend Server which is a great tool that can help you manage and debug your PHP applications. It can also help make sure that your development environment is the same as your live environment so that surprises are less common for you.

Recently Zend updated Zend Server to 6.10 however there are no good instructions on how to update the product. After a bit of browsing I could see some questions about how to do this but little in the way of answers (it did only update a few days ago).

Anyway when you install Zend Server on Linux it sets up a new yum repository to use to install and keep the package updated however when trying to update nothing actually updated.

Upon checking the repository file at “/etc/yum.repos.d/zend.repo” I found that this contained the following:

[Zend]
 name=Zend Server
 baseurl=http://repos.zend.com/zend-server/6.0/rpm/$basearch
 enabled=1
 gpgcheck=1
 gpgkey=http://repos.zend.com/zend.key
[Zend_noarch]
 name=Zend Server - noarch
 baseurl=http://repos.zend.com/zend-server/6.0/rpm/noarch
 enabled=1
 gpgcheck=1
 gpgkey=http://repos.zend.com/zend.key

As you can see the file specifically references the repository for 6.0. To try to fix this I changed the file to have:

[Zend]
 name=Zend Server
 baseurl=http://repos.zend.com/zend-server/6.1/rpm/$basearch
 enabled=1
 gpgcheck=1
 gpgkey=http://repos.zend.com/zend.key
[Zend_noarch]
 name=Zend Server - noarch
 baseurl=http://repos.zend.com/zend-server/6.1/rpm/noarch
 enabled=1
 gpgcheck=1
 gpgkey=http://repos.zend.com/zend.key

Once I had done this I then carried out the following 2 commands:

yum clean all
yum update

This now prompted me if I wanted to update many components. Low and behold Zend Server now reports:

PHP Version 5.4.16Zend Server Version: 6.1.0

Zend Framework: 1.12.3, 2.2.1
Zend Server Gateway: 0.9.0
Build: 71826

Fingers crossed. All appears fine.

One thing that is a bit disappointing however is that now we have no ETA on Zend Server with PHP 5.5 support. I was looking forward to utilising some of the PHP 5.5 features on the product I am making.

The Danger Of Expired Domains

When thinking about domain name security I have always tended to think about ensuring that a domain name is not stolen. On reflection this really is not our only concern. Yahoo have recently announced that they are opening up email accounts that are no longer used (wired article). As you can imagine this has caused a bit of furore about the potential of emails these accounts may still be receiving.

So how does this relate to domain names? Continue reading “The Danger Of Expired Domains”

PHP 5.5 Release Imminent

*** New Since Writing This ***

PHP has now officially been released as can be seen on the PHP news page.

***

The release of PHP 5.5 is imminent now. The source code now appears to be getting merged on the official PHP github repository. The news file (which highlights a lot of the new features and fixes) can be found at https://github.com/php/php-src/blob/php-5.5.0/NEWS. I am particularly looking forward to using the new password functionality as well as being able to use the FINALLY keyword.

Along with the release of PHP 5.5 this will begin the end of life process for PHP 5.3. The issue is already being discussed on the PHP internals list.

http://news.php.net/php.internals/67734

As you can see the current plan is that once 5.3.27 is release in a few weeks the only updates to the 5.3 branch will be security only fixes (and there doesn’t appear to be any opposition to this). Johannes Schluter has posted a new blog post about what you can do from here if you are using PHP 5.3 and can be found here.

Now really is a good time to be looking at upgrading PHP. Preferably you should be looking at upgrading to 5.5.

ADDED

A good video to help explain the new release and update cycle for PHP can be found on youtube (this subject starts at 3:14):