Speedtest

Installed speedtest.net Mini in my server:

speedtest.net mini

Check your speed against my server which has a 100mbps synchronous line.

The server is in France by the way.

WikiLeaks mirror

This server is now a proud WikiLeaks mirror: http://wikileaks.abadcer.com/

In the Mass Mirror Project page they kindly explain how to do this step by step, and there is a form if you want to submit your details: http://wikileaks.ch/Mass-mirroring-Wikileaks.html

In my case it was very easy to follow because those instructions are ideal for Debian/Ubuntu and I have Debian Squeeze

What I did was simply this:

1. Created the user “wikileaks” and assigned it a good password. Any online password generator is a quick way of getting one, 14 characters or more is ideal. Allowing punctuation characters makes your password stronger and because it is random it is immune to dictionary attacks (although hard to remember). The number of combinations are very simply to calculate, total number of possible values in each character multiplied by itself as many times are characters the password has. Example:

  • If you use only numbers and 4 characters you have: 10 * 10 * 10 * 10 = 10.000 combinations.
  • If you use a 14 characters password with numbers (10), characters (26 uper case + 26 lower case), punctuation characters (34) you have: 96 * 96 (14 times) = 96^14 = 5.646.733.123.551.136.024.526.585.856 combinations (That is a big number ).

2. Set up the DNS name and the VirtualHost in Apache. Nothing special here, did a very similar thing to what they recommend in their site. Only addition was to disable PHP. They don’t need it so it should not be enabled. First rule of security is to allow always as little permissions as possible. To do that in Apache simply add anywhere in the VirtualHost:

php_value engine off

3. Set up an FTP account. Just to steps:

Install:

apt-get install proftpd

Setup in /etc/proftpd/proftpd.conf:

DefaultRoot /var/www/wikileaks.abadcer.com wikileaks

Again the key thing in security here is the password, IP filtering and IP ban (blocking someone after several failures) is not a good practice as it would make your FTP server easier for DoS attacks.

Upgrade from Debian Lenny to Squeeze in OVH RPS

This website is hosted in one of these servers: http://www.ovh.co.uk/products/rps_offers.xml

OVH offers a wide list of possible OS to install in your dedicated box and I believe the best one is Debian, I love its simplicity, community support, security and above all its cleanliness, you start with a clean base system and you install and configure just what you need, having full control of it.

In OVH you can install Debian 5 (Lenny), which is ideal for web hosting, but if you want to upgrade Debian 6 (Squeeze), much up-to-date and now stable, this is how to do it:

  • 1. Install Debian50_x64 from the OVH Manager (in one of two partitions, I chose one).
  • 2. Updated it:


aptitude update
aptitude upgrade

  • 3. Changed /etc/apt/sources.list replacing “lenny” with “squeeze”.
  • 4. Prepare the upgrade:


aptitude update
aptitude install apt dpkg aptitude

touch /etc/udev/kernel-upgrade

  • 6. Avoid a problem with locale during the upgrade:


apt-get install locales
dpkg-reconfigure locales

  • 7. Upgrade all packages.

apt-get dist-upgrade

  • 8. During this installation the key questions to respond are the ones regarding the boot, because the system will boot from the Netboot using the OVH kernel the questions about Lilo and Grup should be just set to do nothing.
  • 9. That completes the upgrade, but in my case, after all packages were upgraded, the system for some reason didn’t generate the disk devices in /dev properly. I had the system mounted in /dev/sda1 but the swap was not mounted. In fact there were no /dev/sda or /dev/uba at all. To fix this you would need to create the missing devices and mount your swap (believe me you don’t want a server without swap). So first check the major and minor values from the partition info:

cat /proc/partitions
major minor #blocks name

180 0 503808 uba
180 1 497983 uba1
8 0 20971520 sda
8 1 20479969 sda1

  • 10.  Create the devices accordingly to your values above, then you can enable the swap disk again, in my example:

mknod /dev/uba b 180 0
mknod /dev/uba1 b 180 1
swapon -a
mknod /dev/sda b 8 0
mknod /dev/sda1 b 8 1

  • 11. That is all, the system has all packages upgraded now and I am happy running Apache 2.2.16 with PHP 5.3.3 !!

Update: Now that Squeeze is stable you might want to try to upgrade to Debian “wheezy” (testing) in order to have newer versions of packages and still a very robust system. I would say that after upgrading to Squeeze you might just have to edit /etc/apt/sources.list again and replace “squeeze” with “wheezy”, then “apt-get update” and “apt-get dist-upgrade”. If anyone tries please let me know what problems (if any) encountered.

Adding a photo album

Not happy with the existing solutions/plugins to generate photo albums in WordPress I decided to create my own based on a BASH script and some PHP code.

  • Upload the photos you want to a folder, example:

http://abadcer.com/photos/

  • Because this folder doesn’t contain any index.php or default.html or similar I enabled “directory browsing” so you can see the files, in this case the photos, and click on them to see them. To do so create a file called .htaccess and put inside:

+Indexes

  • At this point you just have some folders with big JPG files inside, I decided to automate a process which creates thumbnails of this files in a subfolder called “.thumbs”. It is designed to search all JPGs in all the subfolders. My example worked in Debian in the folder where the images are:

find . -type f | grep -E "jpg|JPG" | grep -v "/.thumbs/" | awk '{ run="convert -geometry 150x150 " "\"" $0 "\" ";
file=$0;
sub(/(.*)\//, "", file);
folder=$0;
sub(file, "", folder);
system("mkdir " "\"" folder ".thumbs/" "\"");
run=run "\"" folder ".thumbs/" file "\"";
system(run);}'

  • This will create the thumbnail (max 150 pixels wide or long) in /.thumbs/ subfolder. It basically finds all JPG files and run this command for each file found:

convert -geometry '150x150' "./Alex day 5/DSC_6395_resize.JPG" "./Alex day 5/.thumbs/DSC_6395_resize.JPG"

<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
$jpg = strpos($file,"JPG");
$jpg_low = strpos($file,"jpg");
if($jpg == true | $jpg_low == true) {
echo "<a href=\"$file\"> <img src=\".thumbs/$file\" /></a>\n";
}
}
closedir($handle);
}
?>

How did I put all this together

  • Got a domain in 123-reg.co.uk
  • Got a dedicated Linux server from ovh.co.uk
  • Got Apache2, MySQL and PHP5 installed
  • Changed the DNS settings of abadcer.com to point to this server.
  • Downloaded and install WordPress from wordpress.org
  • Found a nice theme to skin the site.
  • Done

It is easier than what it looks, more details soon.

First post

Hello! Not much to see here yet. I’ll post interesting things soon.