Archive for the ‘linux’ Category

Setting a static IP on ubuntu 20.04 with cloud-init

Friday, February 11th, 2022

So, it took me numerous tries, digging, and beating of head against curtin and the like, but I have finally figured out how to set a static IP on a host using cloud-init.

Mind you, I am not talking about setting a static iP for while the installer is running. That’s easy, and well documented. I’m talking about the next time it boots.

The solution requires two bits. They’re pretty straightforward, and both go in the cloud-init file

Bit one goes at the end of the autoinstall section, and deletes the default configuration and writes a permanent one instead. Note that the filesystem is mounted as /target

– rm /target/etc/cloud/cloud.cfg.d/50-curtin-networking.cfg
– mv /tmp/00-installer-config.yaml /target/etc/netplan

Bit two actually writes out the /tmp/00-installer-config.yaml that late-commands will be editing

– path: /tmp/00-installer-config.yaml
owner: root:root
permissions: “0644”
content: |
version: 2
critical: true
dhcp-identifier: mac
dhcp4: true
dhcp4: no
– {ipaddr}/16
– search.domain

haproxy and unable to load SSL certificate (weird one)

Friday, June 1st, 2018

So, I was setting up a haproxy this morning and I was having a heck of a time getting it to load the SSL Certificate. I kept getting “Unable to load SSL certificate”, which was not a phrase google was helping me with.

It turned out that the BEGIN CERTIFICATE line, as issued from namecheap, only had four ‘-‘ characters where haproxy wanted to see five. I also couldn’t do a openssl x509 -text -in, I would get the error “140146308224672:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:703:Expecting: TRUSTED CERTIFICATE”.

So, that’s a hour of my life I’ll not get back, but hopefully someone else will now find this problem on google.