VMWare and udev weirdness

If you’ve started using RHEL6-ish (Scientific in my case) releases with VMWare, you may run into this problem. Clone a VM from a template, boot it up and it’s network interface won’t light up. Well, we know that’s because of the hardware address mismatch in ifcfg-eth0. VMWare assigns the new VM a new hardware address automatically. What you may not have noticed, is udev renamed eth0 to eth1 and even after you fixed the problem in ifcfg-eth0, the interface still won’t light up. In order to fix this:

1. Edit /etc/udev/rules.d/70-persistent-net.rules
2. Change the end of the line, NAME=”eth1″ to NAME=”eth0″
3. Save and exit, then reboot.

Now the network interface should be up. Some people have suggested simply removing the file /etc/udev/rules.d/70-persistent-net.rules but that did not work, udev simply re-created it with the same values.

Reduce access_log noise

This is just a quick guide to eliminate certain activity from your access_log files.

Create a new file called filter.conf (where you put this depends on your apache deployment). Adapt the patterns as necessary. See apache docs for all the possible variables. You can pile up as many filters as you like.

SetEnvIFNoCase User-Agent "Googlebot" exclude_from_log
SetEnvIfNoCase Request_URI "\.(gif)|(jpg)|(png)|(css)|(ico)$" exclude_from_log
SetEnvIfNoCase Request_Method "(OPTIONS)|(PROPFIND)" exclude_from_log

This file should be included (probably at the global level) for easiest use. For OS provided apache, either put it in /etc/httpd/conf.d or explicitly include it into httpd.conf.

Anywhere you want the filter applied, simple alter you access_log definition to include the parameter after “combined”.

CustomLog "logs/access_log" combined env=!exclude_from_log

Restart apache to pick up the change and review your access_log to make sure it worked.

JBoss AS 7

Deploying JBoss AS 7 on Linux.

1. Download the JBoss AS tarball from http://www.jboss.org/jbossas/downloads/

wget http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.tar.gz

2. Extract the downloaded tarball

tar -zxvf jboss-as-7.1.1.Final.tar.gz

3. Move the folder to a filesystem with plenty of room:

mv jboss-as-7.1.1.Final /usr/local/

4. Rename the folder to jboss (or symlink the versioned folder to jboss)

mv jboss-as-7.1.1.Final jboss

or

ln -s jboss-as-7.1.1.Final jboss

This particular version comes with 2 modes of operation, standalone or domain. You’ll need to choose which one you need. Use the init script from my github repo: (coming soon)

SSH login using keys

Here’s how to setup SSH so you can use keys for authentication.

1. Create a set of keys:

ssh-keygen -t dsa

2. Hit “Enter” three times, we want the default location for the keys, and no passphrase.
3. You should now have a folder called .ssh in your home folder. Inside are the public and private keys.
4. Use SCP to copy the public key, “id_dsa.pub” to your remote hosts.

scp .ssh/id_dsa.pub me@10.1.2.3:

5. On each host create a .ssh folder in the account you want to access on the remote host (can be multiple accounts).

mkdir .ssh

6. Move (or copy if multiple) the id_dsa.pub file inside the .ssh folder, renaming it to authorized_keys

mv id_dsa.pub ~/.ssh/authorized_keys

7. Set the folder permissions on .ssh to 700.

chmod 700 ~/.ssh

Log out of the host and try logging back in. If everything is still set to defaults, you should be logged into the remote host without using a password.

This method is as secure as the interactive login but you need to guard your private key.

Pound from source

Pound is a reverse proxy, load balancer and HTTPS front-end for Web servers.

1. Install (or confirm installed):

gcc
openssl-devel
pcre-devel

2. Download pound source from http://www.apsis.ch/pound
3. Untar the source tarball
4. Navigate into the source
5. Apply the patch (see the git repo below)

patch -p1 < Pound-2.6.patch

6. Configure the package

./configure \
--prefix=/usr/local/pound \
--sysconfdir=/usr/local/pound/conf \
--enable-pcreposix

7. Run:

make

5. Create folders

mkdir -p /usr/local/pound/{sbin,conf}

6. Copy the pound binary to /usr/local/pound/sbin
7. Create a pound.cfg file in /usr/local/pound/conf

Look for an init script here: https://github.com/breauxaj/pound.git