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
01 Insecure on purpose
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).
Read more
02 Fixed passwords
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
- The common user-data template creates
rootwithplain_text_passwd: rootand a user named by the template's second argument, the group (ubuntuhere), with the same word as password,groups: usersandsudo: ["ALL=(ALL) NOPASSWD:ALL"], both withlock_passwd: falseand/bin/bash(mk/010-qemu.mk:200-211). X.run --queryprintsvm.memory_mbandsystem.users.N.usernameand.password: root then the distribution user, or onlyubuntufor Ubuntu Core (mk/010-qemu.mk:57-92). Cloud systems passroot distro(rulegen.py:127), Ubuntu Coreonly:ubuntu(mk/050-ubuntu-core.mk:25).- snapcraft-vm reads
system.users.0from--queryto log in (snapcraft-gitlab-ci bin/snapcraft-vm:374-376). - Ubuntu Core creates
ubuntuwith--extrausersand allows no root password login (mk/050-ubuntu-core.mk:166-167, README.md:699-709). - The values are examples from
ubuntu-cloud-24.04.x86_64;vm.memory_mb=2048is the defaultQEMU_MEM_SIZE(mk/010-qemu.mk:9).
Read more
03 SSH with passwords, root included
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: trueis 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.APPENDholdsUsePam yesandPermitRootLogin yes(mk/010-qemu.mk:212-220); runcmd appends it to/etc/ssh/sshd_config, removes it, and comments outPermitRootLogin prohibit-passwordwith 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 appendedyesapply (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 asubuntu/ubuntuorroot/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).
Read more
04 cloud-init hears only the seed
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.isois made withxorriso -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.cfgwithdatasource_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
cidatalabel (derived: cloud-init's NoCloud data source).
Read more
05 What is checked, and what isn't
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/*.iniis 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-sha256sumschecks the image withsha256sum; on a mismatch it removes the image and the checksum file and runs the download once more (image-garden:460-559). Systems withSHA512SUMSor a literalSHA256SUMare checked the same way.- In the guest, runcmd rewrites
https://tohttp://in every.listand deb822.sourcesfile 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
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
.runscript 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.runscript 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).
Read more
07 Where to go from here
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
| Setting | Value | Where |
|---|---|---|
| root password | root | user-data users, mk/010-qemu.mk:200-204 |
| second user | the group name, such as ubuntu, password the same | mk/010-qemu.mk:205-211 |
| sudo | ALL=(ALL) NOPASSWD:ALL for the second user | mk/010-qemu.mk:209 |
| SSH password login | ssh_pwauth: true | mk/010-qemu.mk:197, :227 |
| sshd | UsePam yes, PermitRootLogin yes appended; PermitRootLogin prohibit-password commented out | mk/010-qemu.mk:212-243 |
| cloud-init sources | datasource_list: [NoCloud] | mk/010-qemu.mk:221-230 |
| cloud-init afterwards | /etc/cloud/cloud-init.disabled | mk/010-qemu.mk:246 |
| apt sources | https:// rewritten to http:// in the .list and .sources files under /etc/apt | mk/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
| From | How | Notes |
|---|---|---|
| your terminal | the serial console of ./SYSTEM.run (-nographic) | the passwords above |
| any process on the host | 127.0.0.1:PORT of an allocated machine | allocate's hostfwd, port 5000 to 9999 |
| other machines | no way in | user-mode networking, no forward to other addresses |
| the guest, outward | the network through the host, the host's loopback at 10.0.2.2, pkgproxy at 10.0.2.100 | derived 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
- image-garden allocate — the one port allocate forwards, and how a machine is reached
- The .run script — the .run script, its serial console and persistent disk
- Downloading and checking images — how images and checksum lists are fetched and verified
FIRST BOOT · cloud-init changes
- The users every system gets — the users and passwords cloud-init creates, line by line
- SSH logins and apt sources — the SSH server settings and the apt sources the first boot changes
- The NoCloud seed — the seed ISO and the meta-data cloud-init reads