All Posts

Easy OpenSSH VPN using tunneling

This is a simple VPN for those times when you want the ease of use of a VPN but only have a ssh server available. Both servers need to have ssh configured to allow tunnels. You need to change the configs for ssh under /etc/ssh Remote server sshd_config: PermitTunnel yes Local server ssh_config: Tunnel yes Remote server Setting up the tunnels requires you to use root when sshing.


This is just a simple script for doing a diff of two web pages. #!/bin/bash TMP1=$(mktemp) TMP2=$(mktemp) wget -q $1 -O $TMP1 wget -q $2 -O $TMP2 diff $TMP1 $TMP2 rm -f $TMP1 $TMP2

Installing stock CentOS kernel on an OVH or Kimsufi server

I recently signed up for a small dedicated server at for the grand price of £14 a month which I think is pretty good price for what you get. Brand Intel Model Celeron / Atom Frequency 1.20+ GHz Architecture 64 bits NIC

Set txqueuelen on virtual vnetX devices with libvirt

The txqueuelen is a value in the kernel on network interfaces that sets the transmit queue length. This value can be tuned for different work loads. In the case of modern networking the defaults can sometimes be changed to get better line speeds over ethernet. Most people will do this using a rc.local command to set it on the physical ethX devices like this. vim /etc/rc.local Add the following

Reverting to a previous snapshot using Linux LVM

Reverting to a previous snapshot has been possible for over a year!!!!! How did I miss that ?? This has for a long time been one of my only real criticisms of LVM and I just discovered that it was quietly committed into the kernel back in 2.6.33 The command used to do the revert is contained within lvconvert. From the lvconvert man page: --merge Merges a snapshot into its origin volume.

Turn off the Caps-Lock key

I HATE THE CAPS_LOCK KEY!!!! I don’t like it when people send me messages with full caps and I don’t like accidentally pressing it and then sending messages to other people who then think I am yelling at them. It also wastes too much keyboard space and is in an easy place to accidentally hit. Time to get rid of it. The following method is for Fedora 15 but will probably work on other Gnome 3 systems.

Linux network bond without restarting the network

This is quite handy to know if you need to create a new network bond on a live system without disrupting traffic. First of all create your bond configs in the normal way so that in the event of a reboot it will come back up working. See the Redhat documentation for how to do it in RHEL6. Now because we cannot just restart the networking to bring that up we need to construct it by hand.

Repairing MySQL multi-master replication

We have 2 servers, server1 is the known good and server2 is the one that is out of synchronisation. Make sure nothing is actively querying server2. You can do this by turning on full query logging and tailing the log file for any queries. mysql> SHOW GLOBAL VARIABLES like 'general_log%' ; +------------------+-------------------------------+ | Variable_name | Value | +------------------+-------------------------------+ | general_log | OFF | | general_log_file | /var/lib/mysql/server2.log | +------------------+-------------------------------+ 2 rows in set (0.

Checking SSL certificate expiry dates

This is just a quick note to save this useful bit of information. I may make in to a script one day or use it in something else. echo ''|openssl s_client -connect localhost:636 2>/dev/null | openssl x509 -noout -enddate | sed 's/^not.*\=//'

Unprivileged standalone instance of MySQL

Small script to run a instance of mysql in my home directory using the binary provided by the OS. Maybe some day I will make it more usable but for the time being it suits my needs. #!/bin/bash MYSQL_HOME=$HOME MYSQL_USER=$USER MYSQL_PORT=13306 ACTION=$1 if [ $ACTION == 'init' ]; then echo "initalising new mysql installation at $MYSQL_HOME/var/lib/mysql" rm -rf $MYSQL_HOME/var/lib/mysql mkdir -p $MYSQL_HOME/var/lib/mysql $MYSQL_HOME/mysql/data $HOME/var/lib/mysql/tmp mysql_install_db --user=$MYSQL_USER --datadir=$MYSQL_HOME/var/lib/mysql/data/ cat < $HOME/.my.cnf [mysqld] user=$MYSQL_USER datadir=$MYSQL_HOME/var/lib/mysql/data log-error=mysqld.