Apache2 Server Signature

The following tutorial will provide you with the steps required to disable server information on folder list pages and any of the error pages. The following screenshot shows what I am talking about.

Server Info

I will be showing how I did this on Ubuntu Server 14.04.4 LTS.

This information can provide a hacker with the versions of software installed on your server. Depending on your configuration, PHP information is shared as well. Lets go ahead and get this secured.

First we want to open the apache2.conf in our favorite text editor.

sudo nano /etc/apache2/apache2.conf

Next, we will add a few lines to the end of the config.

ServerSignature Off
ServerTokens Prod

We will now want to restart Apache.

sudo service apache2 restart

On a folder page or error code page you will see the version information is now gone. Unfortunately PHP still sends version information in the page header. To turn that off we need to edit one more config.

sudo nano /etc/php5/apache2/php.ini

Change the expose_php from “On” to “Off”. You will need to find the line in the php.ini file.

expose_php = Off

We can now save the file and restart Apache.

sudo service apache2 restart

We are done! Version numbers will no longer be view-able.
If you have any questions, please use the comments bellow!

Ubuntu Server static IP

Easy enough? By default, Ubuntu Server is configured with DHCP enabled but we need a static IP. The following tutorial will show you just how to do that!

Let’s open the interfaces configuration file.

sudo nano /etc/network/interfaces

It should look like the following.

auto eth0
iface eth0 inet dhcp

DHCP is currently set but we need a static IP. The following configuration will show what needs to be changed and add.

auto eth0
face eth0 inet static
        address 192.168.1.4
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1
        dns-nameserver 192.168.1.2 192.168.1.1

In previous version of Ubuntu you needed to edit the /etc/resolv.conf and add a line. This is no longer the case.

I hope this tutorial helped!

Audio Click Xubuntu 14.04.1 LTS

I had finally had enough of a very annoying clicking noise through the headphones on my HP Pavilion dm1 Netbook. I love this machine because of its compact size and long lasting battery. The system originally had Windows 7 witch was a struggle with just an Atom processor. I fell in love with Xubuntu on this machine immediately with one slight annoyance. Every 10 seconds there was a click in the audio. This only happened when there was no audio playing. It also went away when the audio mixer was open but why waste the ram keeping it open?

Solution was simple enough. Power save kept switching the Intel sound card on and off every 10 seconds causing the click. Solution? Turn it on and leave it on! Here are the steps.

First, open a terminal window.

sudo nano /usr/lib/pm-utils/power.d/intel-audio-powersave

Comment out the following line with a #.

# INTEL_AUDIO_POWERSAVE=${INTEL_AUDIO_POWERSAVE:-true}

And then add the following line below the pervious line.

INTEL_AUDIO_POWERSAVE=false

Save the file and reboot the computer. That is it, no more click!

TeamSpeak start up Ubuntu 14.04.1 LTS

This problem stumpt me for a while. I run a TeamSpeak damon on my VPS linux box. The issue with this application, is they do not create startup script in the /etc/init.d folder.

There are many TeamSpeak startup scripts but the following seems to work best for me.

#!/bin/sh
 
case "$1" in
start)
/etc/teamspeak3/ts3server_startscript.sh start
;;
stop)
/etc/teamspeak3/ts3server_startscript.sh stop
;;
status)
/etc/teamspeak3/ts3server_startscript.sh status
;;
*)
  echo "Usage: `basename $0` {start|stop|status}" >&2
  exit 1
  ;;
esac
exit 0

Now that the bash script has been created in the /ete/init.d directory we can now use “service teamspeak3 start” to start the damon but every time the server restarts we have to run this manually. We need to add Teamspeak to the system start up. The following command will add this.

update-rc.d teamspeak3 defaults

That is it. Next time your server reboots Teamspeak will start.

IIS7: What a change

In the next few weeks, I am required to use one of my most scariest server products I have used. IIS. I use to manage a small network that used IIS for hosting internal mail interface and other web based products our company used. Back then, we were running IIS6 on Server 2003 R2, and what a scary machine that was. IIS6 wasn’t very intuitive compared to other Microsoft server products at that time. When you needed to add a site or add a CGI extension, it always felt you had to hack it to get something to work and you never went back to it after it was working.

I was required to install it for a programming class and what a change. For someone that never had proper training on IIS, the new interface has defiantly been improved and is now very intuitive.

To install IIS7 was open Control Panel -> Programs and Features -> “Turn Windows feature on or off”. I checked the “Internet Information Service” in the list and that was it. Windows installed the service without needing the disks.

It was that easy to get the new web server up and running on my local development machine.

IIS7 Main screen
Browsed to http://localhost to make sure my new IIS server was running.

I remember spending hours in the server room trying to get PHP installed on the old IIS6 machine we were running. I thought, I wonder how easy it will be on IIS7? Turns out very easy! Microsoft now has an installation you can download that installs PHP 5.3.13 into your IIS.

A few things need to be done first. Make sure you have installed CGI. Windows does not do this by default.

CGI Installation
Be sure “CGI” is checked.

IIS is now ready for the PHP installation. Go to php.iis.net to download the executable. Once you have it download, run it and follow the on screen instruction.

That is it! You have now installed PHP on your IIS server. Create a phpinfo() file on the root of your web-server to make sure everything is working.

My phpinfo().

If you run into the error “Handler “PHP53_via_FastCGI” has a bad module “FastCgiModule” in its module list” it means CGI is not installed. Go back into Windows Features and check “CGI”.