Archive

Author Archive

How to create self-signed certificates for use with Apache/SSL

September 20th, 2008

To create a self-signed certificate for use with a webserver such as Apache follow the following steps:

Generate a server key:

openssl genrsa -aes128 -out server.key 4096

Next, create a certificate signing request with it. This will prompt for several things such as country, state, etc. Make certain that “Common Name (eg, YOUR name)” matches the fully qualified domain name of your server (or IP address if you do not have one). You may create a challenge password at this point, however it will mean more typing for you.

Create the certificate signing requests:

openssl req -new -key server.key -out server.csr

Next, sign the certificate signing request. The following example expires the key in 365 days:

openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Now, make a version of the server.key which does not require a password:

openssl rsa -in server.key -out server.key.insecure
mv server.key server.key.secure
mv server.key.insecure server.key

Be careful with these files as they are quite sensitive and permissions should set very carefully. Chown them to root (if you are not already root). Some of the sites I have found say that you can chmod 000 them and it does seem to work in my experiments. Root always retains an effective 600 (read) rights on everything.

You now have the following files which are suitable for use on your self-signed certificate site:

server.crt: The self-signed server certificate
server.csr: Server certificate signing request
server.key: The private server key
            (does not require a password when starting Apache
server.key.secure: The private server key
            (it will require a password when starting Apache)

NOTE: These instructions have been paraphrased for my use. The original site can be found here.

Linux , ,

How to enable 802.1Q VLAN tagging in Ubuntu

September 18th, 2008

To make use of IEEE 802.1Q VLAN tagging capabilities in Ubuntu you must first install the user mode programs for Virtual LAN support:

sudo apt-get install vlan

Next the 8021q kernel module must be loaded to enable VLAN support on a kernel level:

sudo modprobe 8021q

A quick review of lsmod will ensure the kernel module was loaded:

lsmod | grep 8021q

The output of the command should look similar to this:

8021q                  26896  0

Next we can create a tagged interface in /etc/network/interfaces. The following example configures eth1 for VLAN 10 to use DHCP to obtain its IP address:

iface eth1.10 inet dhcp

The new VLAN 10 interface can now be initialized using:

ifup eth1.10

The usual nomenclature for making your interface come up automatically during the boot process is the same for your existing interfaces, just use eth1.10.

Once the interface is initialized you may want to refer to the following proc locations for configuration information:

/proc/net/vlan/config
/proc/net/vlan/[vlan-device]

Linux, Networking , , ,