Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion elements/bluefin-server/os-k0s-first-boot.bst
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
kind: import
description: Install the first-boot k0s sysext activation unit.
description: |
Install the systemd units from files/os/systemd/system: the first-boot k0s
sysext activation units, var.mount, and first-start SSH host key generation
(ssh-host-keygen.service plus its sshd.service drop-in).

sources:
- kind: local
Expand Down
19 changes: 17 additions & 2 deletions elements/flatcar/flatcar-zfs.bst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ description: |

build-depends:
- base/base-stack.bst
- freedesktop-sdk.bst:components/sed.bst
- freedesktop-sdk.bst:components/squashfs-tools.bst

variables:
Expand All @@ -28,6 +29,20 @@ config:
# Extract the SquashFS sysext directly into the element install root
unsquashfs -no-xattrs -f -d "%{install-root}" flatcar-zfs.raw

# Also preserve the raw sysext image under /usr/lib/sysexts for runtime sysext usage
# Drop Flatcar's udevd sysext ordering override. In Flatcar, ZFS is loaded as
# a runtime sysext, so udevd was ordered After=systemd-sysext.service.
# In Bluefin Server, ZFS is extracted directly into the OS rootfs at build time.
# Leaving this drop-in causes systemd-udevd to wait for systemd-sysext.service,
# which waits for local-fs.target, which waits for var.mount, which waits for
# the udev device unit — creating a boot deadlock.
rm -rf "%{install-root}/usr/lib/systemd/system/systemd-udevd.service.d"
if [ -f "%{install-root}/usr/lib/tmpfiles.d/10-zfs.conf" ]; then
sed -i "/systemd-udevd\.service\.d/d" "%{install-root}/usr/lib/tmpfiles.d/10-zfs.conf"
fi

# Preserve a raw sysext image under /usr/lib/sysexts for runtime sysext usage.
# Rebuild it from the cleaned tree rather than shipping the upstream image, so
# the udevd ordering override above cannot reappear if the raw is ever merged.
mksquashfs "%{install-root}" zfs-cleaned.raw -noappend -no-xattrs -all-root
mkdir -p "%{install-root}/usr/lib/sysexts"
install -D -m 0644 flatcar-zfs.raw "%{install-root}/usr/lib/sysexts/zfs.raw"
install -D -m 0644 zfs-cleaned.raw "%{install-root}/usr/lib/sysexts/zfs.raw"
9 changes: 4 additions & 5 deletions elements/oci/bluefin-server-ddi.bst
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@ config:
printf 'root:x:0:\n' > /layer/etc/group
chmod 0644 /layer/etc/group

# Pre-generate SSH host keys for first boot remote diagnostics
# SSH host keys are generated per device on first sshd start
# (ssh-host-keygen.service), never at build time: this DDI is published
# as a public release asset, so baked-in keys would expose every
# deployment's host private keys.
mkdir -p /layer/etc/ssh
ssh-keygen -q -N "" -t ed25519 -f /layer/etc/ssh/ssh_host_ed25519_key
ssh-keygen -q -N "" -t rsa -b 3072 -f /layer/etc/ssh/ssh_host_rsa_key
chmod 0600 /layer/etc/ssh/ssh_host_*_key
chmod 0644 /layer/etc/ssh/ssh_host_*.pub

# Sum actual file sizes across bind mounts (du -sb reports content bytes, not overlay blocks).
ROOT_BYTES=$(du -sb /layer | cut -f1)
Expand Down
12 changes: 12 additions & 0 deletions files/os/systemd/system/ssh-host-keygen.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Generate SSH host keys on first sshd start
Documentation=man:ssh-keygen(1)
# Host keys are deliberately NOT baked into the DDI: the release artifact is
# public, so build-time keys would hand every deployment's host identity to
# anyone who downloads the image. Generate them per device instead.
ConditionPathExists=!/etc/ssh/ssh_host_ed25519_key
Before=sshd.service

[Service]
Type=oneshot
ExecStart=/usr/bin/ssh-keygen -A
6 changes: 6 additions & 0 deletions files/os/systemd/system/sshd.service.d/10-host-keygen.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ensure per-device host keys exist before sshd starts. See
# ssh-host-keygen.service: keys are generated on the device, never at image
# build time, so the public release DDI carries no private key material.
[Unit]
Wants=ssh-host-keygen.service
After=ssh-host-keygen.service