git status in the prompt

Working with git a lot I decided I needed some git status in my prompt.

I searched the web and some solutions where almost what I wanted and this one by Sebastian Celis came very close.

But it didn’t work with my version of zsh, because that didn’t seem to understand the =~ operator.

I also think Sebastian makes things over complicated and so I changed some things aroud.

This is what I came up with:

[Read More]
Tags: git sysadm code linux 

No network on CentOS 6

When installing a minimal CentOS 6 system, minimal really, really means minimal. After a reboot the network interfaces do not start, so network connectivity is non existing.

Looking into that I noticed that the file /etc/sysconfig/network-scripts/ifcfg-eth0 contained

DEVICE=eth0
HWADDR=11:22:33:44:55:66
NM_CONTROLLED=yes
ONBOOT=no
BOOTPROTO=dhcp
TYPE=Ethernet
USERCTL=no
PEERDNS=yes
IPV6INIT=no

The lines that mess things up are NM_CONTROLLED=yes meaning the interfaces are managed with NetworkManager, which isn’t actually installed as part of a minimal install. You want a minimal install, you get a minimal install. And ONBOOT=no, meaning do not start the interface on boot. How stupid is that!

[Read More]
Tags: sysadm linux 

Finding key codes on Linux

It often happens that I get into a situation where I need to know key codes of pressed keys. On my Mac that’s simple. Just use the Key Codes by Many Tricks.

But on Linux I constantly was trying to find out which key produced what.

So I ended up writing a program for that. I started of in the shell, but that ended up being rather tricky and unnecessary complicated. So I redid the whole thing in C.

[Read More]
Tags: code linux sysadm 

sed tips and tricks

I’m creating a Puppet Starter Kit with some standard manifests included and a complete set of documentation. All documentation should be written in Markdown and will be served by Markdoc. But I want to generate all Markdown files from the Puppet manifests, so I only need to document the manifest file. Generating the Markdown is not that difficult, except that I kept ending up with empty lines at the top of the manifest code and I wanted to get rid of those. Of course this should be done with sed, because the whole generation process is written in bash. When playing around with sed I found

[Read More]
Tags: sysadm linux code 

Puppet updates

When working with Puppet and a VCS (like git and SVN) it’s nice to have a simple way of updating the Puppet tree.

My tree is always in /etc/puppet and owned by user and group puppet. User puppet is allowed to checkout the complete tree from git or subversion.

I have created two one-liners to update the complete tree and make sure all rights are still correct.

update_svn ~ \{.bash} #!/bin/bash # update_svn su - puppet -c `cd /etc/puppet; svn up; cd doc; ../bin/gendoc' ~

[Read More]
Tags: puppet sysadm code 

Updated Pygments

I’m using Pygments for quite some time now and I just noticed there was a new version available (1.5). I installed that and I was wondering if there would be a lexer included for Puppet. Well, it wasn’t, but a short Google action directed me to the Pygments lexer for the Puppet DSL.

Of course my old CentOS 5 system with Python 2.6 doesn’t want to install this, so I hacked the Puppet lexer into Pygments.

[Read More]

FreeBSD PXE boot Part 2

Some posts ago I wrote that I was busy to find out how a FreeBSD machine can be PXE-ed from a Linux server. Well, I found that some time ago, but I didn’t have the time to type it here, yet. Well, as always, once you know how it’s done, it’s quite simple. But because a lot of the FreeBSD documentation is very old (talking about FreeBSD 4, 5 and 6) it takes some time to find it all.

[Read More]

Why does Puppet keep breaking?????

In my previous post I stipulated that I was PXE booting FreeBSD. Well this works and I will come back on that. But for the configuration I want to run Puppet. Nice and easy config management.

On my server I run Puppet from source. This because the server is a CentOS box with a very old Ruby and Puppet. So I decided to run the Puppet client from source as well. Getting the git repo is easy enough and installing Puppet should not be to hard.

[Read More]

umask per directory

Some users insist on using bash. This is a good shell, but not as good as zsh. But, I do want them to be able to use the per directory umask as well as all the zsh users.

So I started digging, as the bash shell does not support a chpwd hook.

This is what I came up with:

chpwd()
{   # Set the initial umask
    case "${PWD}/"
    in
        /etc/puppet/*)
            um=$(umask)
            umask 007
        ;;
        *)
            [[ x"${um}" != x"" ]] && umask ${um}
        ;;
    esac
}
function cd()
{
    builtin cd "${@}"
    chpwd
}
[Read More]

umask per directory

I’ve been working with Puppet some time now, and we are configuring our way through a lot of hosts, with 6 persons, all working in the same Puppet master directory.

This should work fine with all UNIX/Linux groups and setgid directories. But simple problem arose with the git version control stuff.

Once in a while the complete git repo was destroyed and quite a lot of searching revealed the reason why.

[Read More]
Tags: puppet sysadm 

Compiling OpenSSL and OpenSSH

My server at home runs CentOS 5 and this has OpenSSH version 4.3. Running updates doesn’t update this version, because RedHat keeps the version number stable.

But I wanted a newer OpenSSH because of some nice new features. But when I do compile a new version I’m still stuck with old OpenSSL, and that’s not what I want.

Well, you can guess it by now, this is what I did.

I first got the newest version of OpenSSL and compiled it with

[Read More]
Tags: sysadm 

Back to m0n0wall

Some time ago I switch from m0n0wall to pfSense and I did like it a lot.

But a problem with PPTP tunneling made me think again. Was pfSense the way to go?

Well, it wasn’t. When I was trying to get IPv6 up and running it turned out that pfSense doesn’t support IPv6 out of the box. And m0n0wall does. There where some answers on the internet, but I was not willing to hack the pfSense box if that was not needed. And the pfSense website states that IPv6 support will come after the release of 2.0. I’m not going to hold my breath that long. And the PPTP tunneling problem can only be solved when you have a dual external IP address. My provider won’t give me a static one, so two statics is completely out of the question.

[Read More]
Tags: sysadm 

My new Internet connection

About a month or two ago I was contacted by my ISP asking if I would like a lot faster internet connection and a lower price. Well, you have to be nuts to deny such an offer, so I decided to comply.

About a week later the new internet modem showed up and I connected everything up.

Running speedtest made me very happy.

Speedtest

Not bad at all :-)

Tags: sysadm 

Hmm, VMware and 4k disk blocks

At work we now have a very nice SAN with two machines running VMware vSphere. I did try to add fibre storage to the VMware machines and that didn’t work. I did get a lot of errors and unknown problems. Even Google never heard of them. One of those was ~ Error during the configuration of the host: Failed to get disk partition information ~

Googling for this and more generic terms pointed me to a hint to partition the disk on the VMware server itself and then create a VMFS filesystem onto it. Well, that should be easy enough.

[Read More]
Tags: sysadm