Comment 20 for bug 1077020

Revision history for this message
Scott Moser (smoser) wrote :

Verification done using latest released 12.04 cloud-image booting it under kvm in raring.

$ sudo apt-get install genisoimage -y
$ bzr branch lp:~smoser/+junk/backdoor-image ./bi

$ imgurl="http://cloud-images.ubuntu.com/releases/precise/release-20130204/ubuntu-12.04-server-cloudimg-amd64-disk1.img"
$ deburl="https://launchpad.net/ubuntu/+source/cloud-init/0.6.3-0ubuntu1.5/+build/4312778/+files/cloud-init_0.6.3-0ubuntu1.5_all.deb"

$ wget $imgurl -O precise-amd64.img.dist
$ wget $deburl -O cloud-init.deb

$ qemu-img convert -O qcow2 precise-amd64.img.dist disk1.img.dist
$ qemu-img create -f qcow2 -b disk1.img.dist patched.img.dist

## patch the patched.img.dist with new cloud-init
$ sudo ./bi/mount-callback-umount patched.img.dist -- \
    sh -ec 'mp=$MOUNTPOINT; cp cloud-init.deb $mp/tmp &&
            LANG=C chroot $mp dpkg -i /tmp/cloud-init.deb ;
            rm $mp/tmp/cloud-init.deb' --

$ qemu-img create -f qcow2 -b patched.img.dist patched.img

$ cat my-user-data
#cloud-config
password: passw0rd
chpasswd: { expire: False }
ssh_pwauth: True
output: {all: '| tee -a /var/log/cloud-init-output.log'}
ca-certs:
  ... ### content from above example 99-local-certs.cfg ###

$ echo "instance-id: $(uuidgen || echo i-abcdefg)" > my-meta-data
$ cloud-localds my-seed.img my-user-data my-meta-data

$ kvm -m 512 -drive file=patched.img,if=virtio -cdrom my-seed.img -curses

## now, logged in as ubuntu:passw0rd
% grep cloud-init.*found.data.source /var/log/cloud-init.log
found data source: DataSourceNoCloud [seed=/dev/sr0]
% grep -i cert /var/log/cloud-init-output.log
Updating certificates in /etc/ssl/certs... 1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d....done.
% ls -l /usr/lib/ssl/certs/ | grep -i cloud
lrwxrwxrwx 1 root root 23 Feb 19 22:04 b1d2b355.0 -> cloud-init-ca-certs.pem
lrwxrwxrwx 1 root root 23 Feb 19 22:04 cbbf81bb.0 -> cloud-init-ca-certs.pem
lrwxrwxrwx 1 root root 50 Feb 19 22:04 cloud-init-ca-certs.pem ->
    /usr/share/ca-certificates/cloud-init-ca-certs.crt