You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add --user/--password flags for cloudimg credential injection
- Replace global --root-password with per-VM --user/--password flags
(defaults: root/cocoon). Credentials are transient (json:"-") and
never persisted in the VM record.
- Non-root users are created via cloud-init runcmd (useradd + chpasswd
+ NOPASSWD sudoers). Root stays locked when a custom user is set.
- Validate username (Linux format) and reject shell-unsafe passwords.
- OCI Dockerfiles: add cocoon.ssh.username/password LABELs.
- Remove DefaultRootPassword from global config.
Copy file name to clipboardExpand all lines: KNOWN_ISSUES.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,27 @@ OCI VMs use the kernel `ip=` boot parameter for network configuration. While mul
27
27
28
28
**Workaround**: the post-clone setup hints write persistent MAC-based systemd-networkd configs for **all** NICs. These survive reboots and correctly configure every interface regardless of the kernel `ip=` limitation.
29
29
30
+
## Non-root user creation requires cloud-init final stage
31
+
32
+
When `--user` specifies a non-root username (e.g. `--user admin`), the user is created via cloud-init `runcmd` which runs in the **final stage** — after networking, SSH key generation, and other modules. This means:
33
+
34
+
- The user does not exist until cloud-init fully completes (typically 20-30s after boot)
35
+
- SSH login as the custom user will fail if attempted before cloud-init finishes
36
+
-`cloud-init status` shows `done` when the user is ready
37
+
38
+
The root user's password is set via `chpasswd` (config stage, earlier) and is available sooner, but `--user admin` deliberately does not set a root password — root stays locked for security.
39
+
40
+
**Workaround**: wait for `cloud-init status: done` before attempting SSH. The default `root`/`cocoon` credentials use the faster `chpasswd` path and are available immediately after SSH starts.
41
+
42
+
## Clone preserves guest credentials from snapshot
43
+
44
+
Clone regenerates cidata for **network reconfiguration only** — it does not inject new user or password settings. The cloned VM's credentials are whatever the source VM had in `/etc/shadow` at snapshot time.
45
+
46
+
-`--user`/`--password` flags are not available on `cocoon vm clone`
47
+
- If you need different credentials, change them inside the guest after boot
48
+
49
+
This is by design: clone restores the VM's exact state including all account settings.
50
+
30
51
## Clone/restore disk queue count is immutable
31
52
32
53
When cloning or restoring a VM with a different `--cpu` value, the disk `num_queues` (one queue per vCPU) retains the snapshot's original value. This is because `num_queues` is part of the virtio-blk device state baked into the binary snapshot — changing it in `config.json` causes Cloud Hypervisor to crash on `vm.restore`.
-**Multi-queue virtio-net** — TAP devices created with per-vCPU queue pairs; configurable ring depth (`--queue-size`, default 512); TSO/UFO/csum offload enabled by default
14
14
-**TC redirect I/O path** — veth ↔ TAP wired via ingress qdisc + mirred redirect (no bridge in the data path)
15
15
-**DNS configuration** — custom DNS servers injected into VMs via kernel cmdline (OCI) or cloud-init network-config (cloudimg)
16
-
-**Cloud-init metadata** — automatic NoCloud cidata FAT12 disk for cloudimg VMs (hostname, root password, multi-NIC Netplan v2 network-config); cidata is automatically skipped on subsequent boots
16
+
-**Cloud-init metadata** — automatic NoCloud cidata FAT12 disk for cloudimg VMs (hostname, configurable user/password via `--user`/`--password`, multi-NIC Netplan v2 network-config); cidata is automatically skipped on subsequent boots
17
17
-**Hugepages** — automatic detection of host hugepage configuration; VM memory backed by hugepages when available
18
18
-**Memory balloon** — 25% of memory returned via virtio-balloon (deflate-on-OOM, free-page reporting) when memory >= 256 MiB
19
19
-**Graceful shutdown** — ACPI power-button for UEFI VMs with configurable timeout, fallback to SIGTERM → SIGKILL
@@ -48,7 +48,7 @@ Download pre-built binaries from [GitHub Releases](https://github.com/cocoonstac
|`--root-password`|`COCOON_DEFAULT_ROOT_PASSWORD`|| Default root password for cloudimg VMs |
167
166
|`--dns`|`COCOON_DNS`|`8.8.8.8,1.1.1.1`| DNS servers for VMs (comma separated) |
168
167
169
168
## VM Flags
@@ -182,6 +181,8 @@ Applies to `cocoon vm create`, `cocoon vm run`, and `cocoon vm debug`:
182
181
|`--disk-queue-size`|`0` (default 512) | Virtio-blk ring depth per device (CH only, ignored by FC) |
183
182
|`--network`| empty (default) | CNI conflist name (empty = first conflist) |
184
183
|`--bridge`| empty | TAP-on-bridge mode (value is bridge device, e.g. `cni0`); mutually exclusive with `--network`|
184
+
|`--user`|`root`| Guest username for cloud-init (cloudimg only) |
185
+
|`--password`|`cocoon`| Guest password for cloud-init (cloudimg only) |
185
186
|`--no-direct-io`|`false`| Disable O_DIRECT on writable disks (use page cache; CH only, useful for dev/test with few VMs) |
186
187
|`--windows`|`false`| Windows guest (UEFI boot, kvm_hyperv=on, no cidata) |
187
188
@@ -320,12 +321,14 @@ All `.conflist` files in `--cni-conf-dir` (default `/etc/cni/net.d`) are loaded
320
321
Cloudimg VMs receive a NoCloud cidata disk (FAT12 with `CIDATA` volume label) containing:
321
322
322
323
-**meta-data**: instance ID and hostname
323
-
-**user-data**: `#cloud-config` with optional root password (`--root-password`)
324
+
-**user-data**: `#cloud-config` with configurable user/password (`--user`/`--password`, defaults to `root`/`cocoon`)
324
325
-**network-config**: Netplan v2 format with MAC-matched ethernets, static IP/gateway/DNS per NIC
325
326
-**user-data write_files**: fallback `/etc/systemd/network/15-cocoon-id*.network` files matching current MAC (`MACAddress=`), used when netplan PERM-MAC matching cannot apply
326
327
327
328
The cidata disk is **automatically excluded on subsequent boots** — after the first successful start, the VM record is marked as `first_booted` and the cidata disk is no longer attached, preventing cloud-init from re-running.
328
329
330
+
Note: `--user`/`--password` only apply to **cloudimg** VMs (cloud-init). OCI VM images bake credentials at build time — cocoon OCI Dockerfiles annotate them via `LABEL cocoon.ssh.username` / `cocoon.ssh.password` for external tooling (e.g. glance, vk-cocoon).
331
+
329
332
## Windows Support
330
333
331
334
Cocoon supports Windows guests via the `--windows` flag:
0 commit comments