O Ubuntu 16.04 contém um pacote chamado dropbear-initramfs
que deve fornecer esse recurso.
Lightweight SSH2 server and client - initramfs integration dropbear is a SSH 2 server and client designed to be small enough to be used in small memory environments, while still being functional and secure enough for general use.
It implements most required features of the SSH 2 protocol, and other features such as X11 and authentication agent forwarding.
This package provides initramfs integration.
Os únicos itens que eu precisava ajustar além de instalar o pacote, onde:
- Remova o comentário do comentado
DROPBEAR=y
dentro de/etc/initramfs-tools/conf-hooks.d/dropbear
- Converter minhas chaves de host existentes (veja abaixo)
- Crie e preencha
/etc/initramfs-tools/root/.ssh/authorized_keys
. Para isso, optei por vincular-montar/root/.ssh
em/etc/initramfs-tools/root/.ssh
- Um
update-initramfs -u -k all
final recriou todas as imagens initrd
Para converter as chaves, executei estes comandos:
/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_rsa_key /etc/initramfs-tools/etc/dropbear/dropbear_rsa_host_key
/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_dsa_key /etc/initramfs-tools/etc/dropbear/dropbear_dss_host_key
/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_ecdsa_key /etc/initramfs-tools/etc/dropbear/dropbear_ecdsa_host_key
Observação: os nomes dos arquivos de origem e de destino são diferentes. Então não faça suposições aqui. Além disso, /usr/lib/dropbear
não está no meu PATH
, então eu precisei fornecer o caminho completo para executar dropbearconvert
.