Test images, insecure on purpose

fixed passwords, open SSH for everyone

Every system gets root/root and a distribution-named user with the same password and passwordless sudo, SSH password and root logins, and cloud-init limited to the NoCloud seed; images are verified against HTTPS checksums. Run garden VMs on a machine you own or a throwaway CI runner.

On the map: start here

▶ Watch this deck — 7 scenes, ~5 min

01 Insecure on purpose

INSECURE ON PURPOSE README.md, Security Notice: security traded for convenience in tests fixed passwords SSH takes passwords, root's too cloud-init listens only to the seed any script, runner or person logs in no keys to hand out Not for production for testing, development and CI
The README's security notice: fixed passwords, SSH password logins with root allowed, and cloud-init that listens only to the seed, traded so that any script, test runner or person can log in without keys. The images are not for production

The README's security notice: fixed passwords and SSH password logins, traded for easy access in tests. The images are for testing, development and CI, not for production.

image-garden's machines are built for one thing: being easy to get into while you test. So the README opens with a security notice, and it's worth reading before your first boot. Every machine has fixed passwords. SSH accepts those passwords, and root may log in with one. cloud-init listens only to the seed image-garden hands it. In return, any script, any test runner and any person can log in, with no keys to hand out. The notice ends plainly: these images are not for production. This deck goes through each trade, then what it means for where you run them.

Details and sources

Details

  • The third of the README's four aims is "simple, insecure access methods": automatic network, SSH password authentication and serial port login (README.md:15-21).
  • The Security Notice lists fixed passwords (root/root, and the distribution's name for the user account), SSH password authentication on by default, guest apt sources switched from HTTPS to HTTP so that pkgproxy can cache packages, and images and checksum lists downloaded over HTTPS, each image checked against its checksum, and ends: "These images are NOT suitable for production use", intended for full-system testing, development and CI/CD (README.md:25-38).

02 Fixed passwords

FIXED PASSWORDS users: - name: root plain_text_passwd: root - name: ubuntu plain_text_passwd: ubuntu user-data, the same in every cloud system sudo: ["ALL=(ALL) NOPASSWD:ALL"] $ ./ubuntu-cloud-24.04.x86_64.run \ --query vm.memory_mb=2048 system.users.0.username=root system.users.0.password=root system.users.1.username=ubuntu system.users.1.password=ubuntu Ubuntu Core: no root login, ubuntu only
The user-data gives root the password root and creates a user named after the distribution, ubuntu with password ubuntu, with passwordless sudo; ./ubuntu-cloud-24.04.x86_64.run --query prints both users and passwords. Ubuntu Core has only ubuntu

Every cloud system has root/root and a user named after the distribution, such as ubuntu/ubuntu, with passwordless sudo. .run --query prints them.

Here are the passwords. During the one provisioning boot, cloud-init sets root's password to root, and creates a second user named after the distribution, with the same word as its password: ubuntu and ubuntu on our running example. That user may run any command with sudo, and sudo asks for no password. Nothing is random and nothing is hidden. The .run script even prints them: run it with --query and it lists each user and password, which is how snapcraft-vm, for one, learns how to log in. Ubuntu Core is the exception: it has no root login, only ubuntu.

Details and sources

Details

03 SSH with passwords, root included

SSH WITH PASSWORDS cloud-init ssh_pwauth: true # appended to /etc/ssh/sshd_config UsePam yes PermitRootLogin yes #PermitRootLogin prohibit-password a key-only root login, commented out: the yes wins $ ssh root@… password: root root@ubuntu-24-04:~# no key installed, none needed serial console: the .run script's login prompt takes the same passwords
cloud-init sets ssh_pwauth: true; image-garden appends UsePam yes and PermitRootLogin yes to the SSH server's configuration and comments out PermitRootLogin prohibit-password, so ssh as root with the password root works, with no key installed; the same passwords work on the serial console of the .run script

cloud-init enables SSH password authentication; image-garden appends UsePam yes and PermitRootLogin yes to sshd_config and comments out PermitRootLogin prohibit-password.

Next, SSH. cloud-init turns on password logins, and image-garden appends two lines to the SSH server's configuration: UsePam yes, and PermitRootLogin yes. Some distributions ship PermitRootLogin prohibit-password, which allows root in with a key only; that line gets commented out, so the yes wins. So ssh as root to the machine, type root, and you're in. No key of yours is installed, and none is needed. The same passwords work on the serial console, which is where the .run script leaves you, at a login prompt in your terminal.

Details and sources

Details

  • ssh_pwauth: true is set in the user-data (mk/010-qemu.mk:197) and again in /etc/cloud/cloud.cfg.d/99-image-garden.cfg (mk/010-qemu.mk:221-227).
  • /root/sshd_config.APPEND holds UsePam yes and PermitRootLogin yes (mk/010-qemu.mk:212-220); runcmd appends it to /etc/ssh/sshd_config, removes it, and comments out PermitRootLogin prohibit-password with sed (mk/010-qemu.mk:241-243). sshd takes the first value it reads for a keyword, so commenting out the earlier line is what lets the appended yes apply (derived from sshd_config(5)).
  • The display default is -nographic, which puts the serial console in your terminal (mk/010-qemu.mk:13); the quick start logs in there as ubuntu/ubuntu or root/root (README.md:77-83).
  • The host name in the prompt is the group and release with dots turned to dashes, ubuntu-24-04 (mk/010-qemu.mk:94-97, mk/010-qemu.mk:196).

04 cloud-init hears only the seed

ONLY THE SEED a cloud's metadata service user-data meta-data seed ISO: cidata cloud-init, first boot datasource_list: - NoCloud touch /etc/cloud/cloud-init.disabled later boots skip cloud-init no new orders from the network, no changes on the next boot
Instead of a cloud's metadata service, cloud-init reads the user-data and meta-data from a seed ISO labelled cidata attached for the first boot; datasource_list limits it to NoCloud, and touching /etc/cloud/cloud-init.disabled makes later boots skip cloud-init

The only data source is the cidata seed ISO; datasource_list: [NoCloud] keeps cloud-init from probing clouds, and /etc/cloud/cloud-init.disabled turns it off after the first boot.

Where does cloud-init get its orders? In a cloud, it asks a metadata service on the network. Here, image-garden packs the user-data and meta-data into a small seed ISO labelled cidata, attaches it for the first boot, and cloud-init reads them from there. The user-data also writes a setting that limits cloud-init to that one source, NoCloud, so it probes no cloud services. And its last command creates cloud-init.disabled, so later boots skip cloud-init altogether. Nothing on the network can hand your machine new orders, and nothing changes behind your back on the next boot.

Details and sources

Details

  • %.seed.iso is made with xorriso -as genisoimage -volid cidata -joliet -rock -graft-points user-data=… meta-data=… (mk/010-qemu.mk:263-279); the provisioning boot attaches it as a read-only virtio-blk CD-ROM (rulegen.py:601-609).
  • The user-data writes /etc/cloud/cloud.cfg.d/99-image-garden.cfg with datasource_list: [NoCloud], "to avoid probing cloud-specific network services" (mk/010-qemu.mk:221-230).
  • The last runcmd is touch /etc/cloud/cloud-init.disabled (mk/010-qemu.mk:246); cloud-init does not run on a boot that finds that file (derived from cloud-init's documentation).
  • On the first boot cloud-init finds the seed by its cidata label (derived: cloud-init's NoCloud data source).

05 What is checked, and what isn't

WHAT IS CHECKED on the host in the guest image, HTTPS checksum list, HTTPS or both through pkgproxy verify mismatch: delete both, try once more the disk the distribution built /etc/apt: *.list, *.sources sed -e 's|https://|http://|g' so a caching proxy can keep the packages apt still checks the signatures but the path sees which packages
On the host, the image and its checksum list come over HTTPS or through pkgproxy, and the image is used only when its checksum matches; a mismatch deletes both and tries once more. In the guest, the user-data rewrites apt's sources from https to http so a proxy can cache packages; apt's signatures still verify them, but the package names are visible on the path

Images and checksum lists come over HTTPS or through pkgproxy, and an image is used only when its checksum matches. In the guest, apt's sources are switched from https to http for caching; apt's signatures still apply.

Now the part that is protected. Every image and its checksum list come over HTTPS, or through your pkgproxy, and nothing is used until the image matches the checksum its distribution publishes. A mismatch throws both files away and tries once more. So the disk you boot is the one the distribution built. Inside the guest it's the other way round: the user-data rewrites apt's sources from https to http, so that a caching proxy can keep the packages. apt still checks the archive's signatures, so the packages are verified, but anyone on the path can see which ones you fetch.

Details and sources

Details

  • Every image and checksum URL in data/*.ini is https, for example ubuntu.ini:237-242.
  • The checksum list is asked from pkgproxy's volatile files first, then from its URL (image-garden:195-269); the image from pkgproxy by URL and checksum, then from its URL (image-garden:271-327). pkgproxy talks to the origin; between image-garden and a local pkgproxy the transfer is plain HTTP or a UNIX socket, and the checksum check below still applies.
  • download-with-sha256sums checks the image with sha256sum; on a mismatch it removes the image and the checksum file and runs the download once more (image-garden:460-559). Systems with SHA512SUMS or a literal SHA256SUM are checked the same way.
  • In the guest, runcmd rewrites https:// to http:// in every .list and deb822 .sources file under /etc/apt (mk/010-qemu.mk:244). apt verifies the archive's signed Release files and the package checksums whatever the transport (derived: apt's behaviour).
  • The README's security notice says the same: guest apt sources are switched from HTTPS to HTTP so that pkgproxy can cache packages, with package signatures protecting their integrity, and images and their checksum lists come over HTTPS, through pkgproxy when there is one, each image checked against its checksum (README.md:29-35).

06 Where to run them

WHERE TO RUN THEM your host the guest QEMU user networking outside your host 127.0.0.1:PORT allocate forwards to SSH every local user a shared host, a shared machine 10.0.2.2: host loopback your own machine or a throwaway runner, no secrets, no ports forwarded further
Inside your host, the guest sits behind QEMU user networking, which takes no connections from outside; allocate forwards 127.0.0.1:PORT to the guest's SSH, which every local user can reach, and the guest reaches the host's loopback at 10.0.2.2. Run garden VMs on your own machine or a throwaway CI runner, keep secrets out, and do not forward their ports further

User-mode networking takes no connections from outside. allocate forwards 127.0.0.1:PORT to the guest's SSH, which every local user can reach; the guest reaches the host's loopback at 10.0.2.2. Use your own machine or an ephemeral runner.

So where should these machines run? Their network is QEMU's user mode: nothing outside your host can reach the guest. A machine started from its .run script has no way in but its console. allocate forwards one port to SSH, on 127.0.0.1 only. But every user of your host can reach 127.0.0.1, and with a known root password, a shared host means a shared machine. The guest can also reach services on the host's own loopback, at 10.0.2.2. So run garden VMs on a machine that's yours or on a throwaway CI runner, keep secrets out of them, and don't forward their ports any further.

Details and sources

Details

  • Every .run script uses -netdev user, QEMU's user-mode network, with no forwarded port of its own (mk/010-qemu-x86_64.mk:8-11); the README notes that a machine started with the .run script cannot be reached with ssh (README.md:85-89). That user-mode networking accepts no connection from outside unless a port is forwarded is QEMU's behaviour (derived).
  • allocate picks a port between 5000 and 9999 and adds hostfwd=tcp:127.0.0.1:PORT-:22 (image-garden:1100-1107). Any process on the host, of any user, can connect to 127.0.0.1 (derived).
  • In user-mode networking 10.0.2.2 is the host's loopback, as the pkgproxy smoke test uses it (tests/smoke-pkgproxy.sh:230-233).
  • With a local pkgproxy, guests also reach it at 10.0.2.100:3142 through a guestfwd (mk/010-qemu.mk:31-34).
  • The README warns that several users on one host may run into problems and suggests per-user installs (README.md:336-340).

07 Where to go from here

ROADS Insecure on purpose allocate the forwarded port The .run script console and persistent disk Users and passwords first boot SSH settings, the seed first boot Download, verify checksums, retries
Roads from insecure on purpose: allocate and its forwarded port, the .run script, the users, SSH settings and seed of the first boot, and download and verify

Next: allocate and its port, the .run script, and the users, SSH settings and seed in the first boot district.

So the trade is simple: fixed passwords and open SSH for machines you can reach at once, and verified images underneath. From here, the allocate deck shows the port that's forwarded and how a machine is found. The run script deck shows the console and the persistent disk. And the first boot district takes the users, the SSH settings and the seed apart line by line. The download deck covers the checksums and the retries.

Details and sources

Read more

Basis of the statements on this page

Read in the image-garden source at the tag in garden.commit ("code"): the common user-data template in mk/010-qemu.mk, the download helpers in image-garden, the network options in mk/010-qemu-*.mk and the README's security notice, which agrees with the code. How QEMU's user network, sshd, cloud-init and apt behave is general knowledge of those programs ("derived"). Nothing was run for this page.

What every cloud system is given

SettingValueWhere
root passwordrootuser-data users, mk/010-qemu.mk:200-204
second userthe group name, such as ubuntu, password the samemk/010-qemu.mk:205-211
sudoALL=(ALL) NOPASSWD:ALL for the second usermk/010-qemu.mk:209
SSH password loginssh_pwauth: truemk/010-qemu.mk:197, :227
sshdUsePam yes, PermitRootLogin yes appended; PermitRootLogin prohibit-password commented outmk/010-qemu.mk:212-243
cloud-init sourcesdatasource_list: [NoCloud]mk/010-qemu.mk:221-230
cloud-init afterwards/etc/cloud/cloud-init.disabledmk/010-qemu.mk:246
apt sourceshttps:// rewritten to http:// in the .list and .sources files under /etc/aptmk/010-qemu.mk:244

Ubuntu Core differs: one user, ubuntu/ubuntu, and no root password login (Ubuntu Core). Per-distribution changes are in per-distro quirks.

Who can reach a machine

FromHowNotes
your terminalthe serial console of ./SYSTEM.run (-nographic)the passwords above
any process on the host127.0.0.1:PORT of an allocated machineallocate's hostfwd, port 5000 to 9999
other machinesno way inuser-mode networking, no forward to other addresses
the guest, outwardthe network through the host, the host's loopback at 10.0.2.2, pkgproxy at 10.0.2.100derived from QEMU's user network

What is verified

  • Images and checksum lists: https URLs, or a pkgproxy; the image must match its checksum before it is used (download and verify).
  • Packages in the guest: plain http to the archive or a proxy; apt checks signatures (derived).

Roads from here

RUNTIME · make rules and the CLI

FIRST BOOT · cloud-init changes