ostree

Full encrypted Proxmox installation

Jan 2nd, 2022 (edited)
1,838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.31 KB | None | 0 0
  1. https://proxmox.com/en/downloads
  2.  
  3. Enabling password unlock via ssh and network
  4.  
  5. Dropbear SSH implementation is used within initramfs to provide the possibility to unlock the encryption of system during the boot process.
  6.  
  7. Let’s install dropbear and do some configuration.
  8.  
  9. # install dropber and add the ssh key which should be able to login to initramfs
  10. $ apt install dropbear
  11. ...
  12. # add your authorized_keys to the dropbear-initramfs module
  13. # command before the key allows your to directly type the password without to invoke additional commands
  14. $ cat <<EOF > /etc/dropbear-initramfs/authorized_keys
  15. command="cryptroot-unlock" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSZhDcyw9YZagLrSKlAAa1s/YNO9X2aTUVI8A7rgWLehDASckE2IZzd3G/S7j6RXz8jZRelbO3NuGy+LBXc2aJL04+nw5yq7vwbFjkaL4bwbyZmJSasIRbZc8GduHgAT4/NCr2/+4Pvcyt14JkVquIBTlpqfMBtrCWjL1dLrfcvtpJYlxq21v5BWdTZBV0I6Bq8NtB67ly7LgcygtJe38zNuySVkaIyYu0cJ1snnKZjT6V8IdecT4kjeypAzOQZ52UVHLcYvar7FOgD5kIf9R/TStM9zgDa0OFy/XhB8Tx4KTt9wKbgp+1rjEd0yMvJJpq3Vy5QHCC1fWnAoAJ3B0/
  16. EOF
  17.  
  18. Ssh host keys within initramfs and on the system itself should be the same, otherwise you will be regularly annoyed by ssh client warnings.
  19.  
  20. In the same time, dropbear has it’s own ssh key format which isn’t compatible to the OpenSSH of the system. Usually dropbearconvert can be used for key conversion from OpenSSH in such cases, however dropbearconvert doesn’t support the modern RFC4716 format used by OpenSSH and expects the keys to be in the PEM format. ssh-keygen supports both formats, RFC4716 and PEM, but there is no way to convert the private key between different formats with ssh-keygen. So we are going to use puttygen for RFC4716 -> PEM conversion and dropbearconvert for PEM -> DROPBEAR conversion.
  21.  
  22. # install puttygen
  23. $ apt install putty-tools
  24. ...
  25. # convert the keys from RFC4716 to PEM
  26. $ puttygen /etc/ssh/ssh_host_rsa_key -O private-openssh -o ssh_host_rsa_key.pem
  27. $ puttygen /etc/ssh/ssh_host_ecdsa_key -O private-openssh -o ssh_host_ecdsa_key.pem
  28. # convert the keys from PEM to Dropbear format
  29. $ /usr/lib/dropbear/dropbearconvert openssh dropbear ssh_host_rsa_key.pem /etc/dropbear-initramfs/dropbear_rsa_host_key
  30. $ /usr/lib/dropbear/dropbearconvert openssh dropbear ssh_host_ecdsa_key.pem /etc/dropbear-initramfs/dropbear_ecdsa_host_key
  31. # cleanup
  32. $ rm ssh_host_*
  33.  
  34. And some final steps for encryption:
  35.  
  36. # rebuild the initramfs to include the keys
  37. $ update-initramfs -u -k all
  38. # and try it out
  39. $ reboot
  40.  
  41. Install proxmox software
  42.  
  43. Official wiki describes the procedure pretty good, here is the summary of commands:
  44.  
  45. # add a proper entry to /etc/hosts
  46. $ echo "192.168.67.68 debian" >> /etc/hosts
  47. # add repositories
  48. $ echo "deb http://download.proxmox.com/debian/pve buster pve-no-subscription" > /etc/apt/sources.list.d/pve-install-repo.list
  49. $ wget http://download.proxmox.com/debian/proxmox-ve-release-6.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg
  50. $ chmod +r /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg
  51. # update the repos and upgrade the system
  52. $ apt update && apt full-upgrade
  53. # install proxmox
  54. $ apt install proxmox-ve postfix open-iscsi
  55. $ apt remove os-prober
  56. # reboot to the new proxmox kernel
  57. $ reboot
  58. # cleanup
  59. $ apt remove linux-image-amd64 'linux-image-4.19*'
  60. $ update-grub
  61.  
  62. That’s it, now go to the https://youripaddress:8006 to see the proxmox interface.
Add Comment
Please, Sign In to add comment