Skip to content

Commit 567524c

Browse files
committed
Debian: Add dropbear instructions
The dropbear-initramfs package can be used to add dropbear SSH support to the initramfs. That can be used to remotely unlock the root pool using the `zfsunlock` script. Closes #46 Signed-off-by: Richard Laager <[email protected]>
1 parent db8b190 commit 567524c

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

docs/Getting Started/Debian/Debian Bullseye Root on ZFS.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,52 @@ Step 4: System Configuration
720720
vi /etc/ssh/sshd_config
721721
# Set: PermitRootLogin yes
722722

723+
#. Optional: For ZFS native encryption or LUKS, configure Dropbear for remote
724+
unlocking::
725+
726+
apt install --yes --no-install-recommends dropbear-initramfs
727+
728+
# Optional: Convert OpenSSH server keys for Dropbear
729+
for type in ecdsa ed25519 rsa ; do
730+
cp /etc/ssh/ssh_host_${type}_key /tmp/openssh.key
731+
ssh-keygen -p -N "" -m PEM -f /tmp/openssh.key
732+
dropbearconvert openssh dropbear \
733+
/tmp/openssh.key \
734+
/etc/dropbear-initramfs/dropbear_${type}_host_key
735+
done
736+
rm /tmp/openssh.key
737+
738+
# Add user keys in the same format as ~/.ssh/authorized_keys
739+
vi /etc/dropbear-initramfs/authorized_keys
740+
741+
# If using a static IP, set it for the initramfs environment:
742+
vi /etc/initramfs-tools/initramfs.conf
743+
# The syntax is: IP=ADDRESS::GATEWAY:MASK:HOSTNAME:NIC
744+
# For example:
745+
# IP=192.168.1.100::192.168.1.1:255.255.255.0:myhostname:ens3
746+
# HOSTNAME and NIC are optional.
747+
748+
# Rebuild the initramfs (required when changing any of the above):
749+
update-initramfs -u -k all
750+
751+
**Notes:**
752+
753+
- Converting the server keys makes Dropbear use the same keys as OpenSSH,
754+
avoiding host key mismatch warnings. Currently, `dropbearconvert doesn't
755+
understand the new OpenSSH private key format
756+
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=955384>`__, so the
757+
keys need to be converted to the old PEM format first using
758+
``ssh-keygen``. The downside of using the same keys for both OpenSSH and
759+
Dropbear is that the OpenSSH keys are then available on-disk, unencrypted
760+
in the initramfs.
761+
- Later, to use this functionality, SSH to the system (as root) while it is
762+
prompting for the passphrase during the boot process. For ZFS native
763+
encryption, run ``zfsunlock``. For LUKS, run ``cryptroot-unlock``.
764+
- You can optionally add ``command="/usr/bin/zfsunlock"`` or
765+
``command="/bin/cryptroot-unlock"`` in front of the ``authorized_keys``
766+
line to force the unlock command. This way, the unlock command runs
767+
automatically and is all that can be run.
768+
723769
#. Optional (but kindly requested): Install popcon
724770

725771
The ``popularity-contest`` package reports the list of packages install

0 commit comments

Comments
 (0)