CachyOS Luks install mit remote ssh unlock
CachyOS als Server mit luks Verschlüsselung
Software Install¶
sudo pacman -S mkinitcpio-dropbear mkinitcpio-netconf mkinitcpio-utils dropbearHooks in mkinitcpio.conf setzen¶
sudo sed -i 's/^HOOKS=.*/HOOKS=(base udev autodetect microcode kms modconf keyboard keymap consolefont block netconf dropbear encryptssh filesystems)/' /etc/mkinitcpio.confInitramfs-Dropbear-Konfig (Port 222, nur Key-Login, Idle-Timeout 60s)¶
sudo install -d -m 0755 /etc/dropbear/initramfs
printf '%s\n' 'DROPBEAR_OPTIONS="-p 222 -s -j -k -I 60"' | sudo sed -n 'w /etc/dropbear/initramfs/dropbear.conf'Dropbear-Keys (Root-Authorized-Key + Hostkeys)¶
Dein SSH-Key auf Server übertragen.
cat ~/.ssh/id_ed25519.pub | sudo tee /etc/dropbear/root_key >/dev/null
sudo chmod 600 /etc/dropbear/root_keyLoader anpassen und LUKS device einfügen¶
Systemd¶
ROOT_UUID="$(findmnt -no UUID /)"
CRYPTDEVICE_UUID="$(cryptsetup luksUUID /dev/nvme0n1p2)"
sudo tee /boot/loader/entries/linux-cachyos.conf >/dev/null <<EOF
title Linux Cachyos
linux /vmlinuz-linux-cachyos
initrd /initramfs-linux-cachyos.img
options ip=192.168.8.191::192.168.8.1:255.255.255.0::eth0:none cryptdevice=UUID=${CRYPTDEVICE_UUID}:luks-${CRYPTDEVICE_UUID} root=UUID=${ROOT_UUID} rw netconf_timeout=30 nowatchdog splash
EOFGrub¶
0) sudo mkinitcpio -P
1) Grub Eintrag:
sudo sed -i 's/^GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="ip=192.168.8.191::192.168.8.1:255.255.255.0::eth0:none cryptdevice=UUID=${CRYPTDEVICE_UUID}:cryptroot root=\/dev\/mapper\/cryptroot rw rootfstype=xfs netconf_timeout=30 nowatchdog splash"/' /etc/default/grub
2) sudo grub-mkconfig -o /boot/grub/grub.cfg
Initramfs für linux-cachyos bauen (oder explizit zieldatei erzeugen)¶
sudo mkinitcpio -p linux-cachyos || sudo mkinitcpio -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-cachyos.imgVerifizieren, dass Dropbear + Keys im Image sind¶
lsinitcpio /boot/initramfs-linux-cachyos.img | grep -i -E 'hooks/dropbear|usr/bin/dropbear|root_key|authorized_keys'Als Standard setzen und prüfen¶
sudo bootctl set-default linux-cachyos.conf bootctl status | sed -n ‘1,120p’ grep -nE ‘^(linux|initrd|options)’ /boot/loader/entries/*.conf