Posts List

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.

Installing stock CentOS kernel on an OVH or Kimsufi server

I recently signed up for a small dedicated server at Kimsufi.co.uk 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

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.

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.*\=//'

Parallel multi process bash with return codes

Have you ever needed to run a bunch of long running processes from a bash script and get their return codes ? I come across this issue quite frequently in my line of work. The most common one is where i need to run rsync to collect files from many machines then if successful run some other task. Depending on the amount of servers and data this can take several hours to run sequentially and I don’t really like waiting around to check the output so that I can run the next task.

Stunnel in client mode

Stunnel is a quick way on taking a non ssl connection and being able to wrap it in ssl for security stunnel version 4 - Fedora 12/RHEL 5.3 /Centos 5.3 vim /etc/stunnel/stunnel.conf add in client=yes [gmail] accept = 127.0.0.1:50000 connect = mail.google.com:443 then run stunnel stunnel version 3 - Ubuntu 8.10 (I haven’t used newer versions) Ubuntu 8.10 has 2 versions of stunnnel: stunnel3 and stunnel4. They have created a symbolic link from /usr/bin/stunnel -> /usr/bin/stunnel3

Delete single line from file

I quite often need to remove a single line from a file by its line number. The most common use case for me is the known_hosts file when I have reinstalled a system, I have in the past used vim and navigated to the line then removed it. This is all well and good but it gets to be a pain having to do it repeatedly, especially when you manage around 1000 servers and the get rebuilt frequently.

Reinstall CentOS using grub

This post is here mainly because I always forget how to do it. This is one of the simplest ways to reinstall a Centos (will probably work for RHEL and maybe even Fedora) system without needing PXE or physical access to the machine. Make sure that that you have tested you kickstart before you use it and don’t blame me if anything goes wrong. Save the following script and make it executable then run it.