To complete this topic. Here is my dropbear installation on CentOS.
I used the following scripts and description:
https://github.com/dracut-crypt-ssh/dracut-crypt-ssh
Following Installation way 2.1.
All commands are executed as root.
- sudo su
- yum update
- yum install epel-release
- yum install vim
- yum install wget
- wget -O /etc/yum.repos.d/rbu-dracut-crypt-ssh-epel-7.repo https://copr.fedorainfracloud.org/coprs/rbu/dracut-crypt-ssh/repo/epel-7/rbu-dracut-crypt-ssh-epel-7.repo
- yum install dracut-crypt-ssh
vim /etc/default/grub -> Changing line "GRUB_CMDLINE_LINUX" (by pressing i in the editor. Text can be changed)
Old line:
GRUB_CMDLINE_LINUX="crashkernel=auto rd.luks.uuid=luks-e0e5a45d-9773-428f-b0b4-79e85395f1e7 rd.luks.uuid=luks-c4d735fb-ce26-43ec-b9fe-2c48acded15c vconsole.font=latarcyrheb-sun16 vconsole.keymap=de rhgb quiet"
New line:
GRUB_CMDLINE_LINUX="crashkernel=auto rd.neednet=1 ip=dhcp rd.luks.uuid=luks-e0e5a45d-9773-428f-b0b4-79e85395f1e7 rd.luks.uuid=luks-c4d735fb-ce26-43ec-b9fe-2c48acded15c vconsole.font=latarcyrheb-sun16 vconsole.keymap=de rhgb quiet"
Always saving the changes by command "ESC -> :wq!" in editor.
vim /etc/dracut.conf.d/crypt-ssh.conf -> Changing port and reference to authorized_keys (press i again)
a. Uncommend port line and change from default port 222 to port 22:
"# dropbear_port="222"" to "dropbear_port="22""
b. Uncomment authorized_keys line and change the path:
"# dropbear_acl="/root/.ssh/authorized_keys"" to "dropbear_acl="/keys/dropbear/authorized_keys""
mkdir /keys
- mkdir /keys/dropbear
vim /keys/dropbear/authorized_keys -> Adding public key
In my case I generated a key pair by running PuTTYgen and copied the public key over ssh to the editor.
grub2-mkconfig --output /etc/grub2.cfg
- dracut --force
- reboot
- Logging into the boot shell on a windows pc with program "PuTTY".
Settings:
a. IP address: server ip address
b. Port: 22
c. Connection->Data->Auto-login username: root
d. Connection->SSH->Auth->Private key file for authentication->Dropbear.ppk
-> Hit Open Button
Should show somethin like:
Using username "root".
Authenticating with public key "rsa-key-20160322"
-sh-4.2#
- console_peek (for some reason this command is always needed before console_auth in order to have a successfull passwort forwarding).
- console_auth
-> Passphrase: -> Type in password of encrypted device and hit enter
Unlock is not usefull in my case because crypttab contains a lot of partitions that can not be unlocked at boot time.