ClassicCityCleaning.com is Now Live

I just finished up with a new site at ClassicCityCleaning.com. The site is for a friend of mine who own a carpet cleaning business in Athens, Georgia. The site uses wordpress for all CMS duties and I created the theme myself, which is quite an accomplishment for me. I’m certainly not graphically-inclined, but I quite like how the rich red background turned out.

I’m liking wordpress more and more for simple sites like this. Most of the back-end admin portion of the site is all handled by the wordpress admin functions. Users can create and edit pages and posts on their own. There are plenty of good plugins that provide most of the basic functionality that a simple site needs.

Announcing WebPasswd

Do you have users who need access to web-based applications on multiple servers? Managing those users can be a pain when dealing with normal htpasswd-based permissions. Adding or removing users means editing each htpasswd file and remembering where all of them are.

Mod_auth_mysql is a good way to centralize that user database so that you can avoid having all of the separate htpasswd files. The apache module is available from any modern Linux distribution, so installing and configuring it takes less than 5 minutes. I started using it almost 2 years ago, and over that time have made a simple web application for managing the users and granting them permission to each application.

I’ve released the program as WebPasswd for anybody else who wants to use it. Now adding users and granting them access to application can be don with just a few clicks. Granting and revoking access to an application takes just seconds and is applied immediately. Configuring a new application takes a couple clicks, and then you just copy/paste the Apache configuration into the appropriate place on your web server. Try it out with this demo.

I think this will be useful to people. I have not seen another application that does something similar. Let me know if it works for you.

Installing Software RAID on a running Ubuntu Box

I’ve done this several times on several distro’s now. My last post was about setting this up on CentOS 5. Setting it up on Ubuntu is mostly similar, but requires a couple of significant changes.

Again, Falco’s HowToForge article does a good job of explaining the process. I followed the guide for Debian Etch with the following changes:

I don’t think that Step 2 (installinginitramfs-tools and mdadm) is required.

Prior to Step 3, when editing /etc/fstab, you need to know the UUID’s of your new volumes. You can use the ‘vol_id’ command to get those

root@host:~# vol_id /dev/sda1|grep UUID=
ID_FS_UUID=97b2e1f2-2f16-47be-8fac-8091a4d5817f

Instead of replacing /dev/sdX with /dev/mdX, you need to replace to UUID’s for those with the UUID’s from the new /dev/mdX devices. Also, when editing /boot/grub/menu.lst, you’ll need to replace the UUID for /dev/sda3 with the UUID for /dev/md2

The rest of the process should work as documented.

Using MySQL Bitwise operators to get the network portion of an IP Address

I like to store IP addresses in a database as unsigned 32-bit integers. It is efficient and elegant and is just fun to work with.

I recently had somebody scraping a site using a range of IP addresses from the same subnet to get around our bot-detection which worked at an individual IP level. It was a pretty simple change to summarize that at the network level. Just do a bitwise AND with 4294967040 to mask out the last octet

The number ‘4294967040’ came by calculating 2^32 – 2^8 so the binary number has all ones in the first 24 bits and all zeros in the last 8 bits.

  SELECT  ip, INET_NTOA(ip&4294967040) AS ipaddr, 
  FROM some_table
  GROUP BY ipaddr

Now those poor fools at 208.86.255.0/24 will be getting cached data from who-knows-when and they won’t even know it.