random-archer / mkinitcpio-systemd-tool

Provisioning tool for systemd in initramfs (systemd-tool)
https://www.archlinux.org/packages/community/any/mkinitcpio-systemd-tool/
Other
113 stars 27 forks source link

initrd-tinysshd: what installs authorized_keys? #61

Closed lachesis closed 4 years ago

lachesis commented 4 years ago

I am trying to get remote-unlocking working with my encrypted root. I ran the commands given in the README Example section (except the debugging tools one, as I don't have mc installed).

When I inspect the generated initramfs, my authorized_keys file is nowhere to be found. When I try to log in to the tinyssh server, I get an error because my key is not authorized. I cannot find any references to copying the authorized_keys file anywhere in this repo.

Andrei-Pozolotin commented 4 years ago

try https://github.com/random-archer/mkinitcpio-systemd-tool/blob/master/README.md

which ssh user keys are used by initramfs sshd server(s)?

they come from host /root/.ssh/authorized_keys
lachesis commented 4 years ago

Interesting, that did not seem to be true on my system. That file exists but a 0-byte file was written to the initramfs.

Andrei-Pozolotin commented 4 years ago

try to confirm if this works https://github.com/random-archer/mkinitcpio-systemd-tool/blob/master/src/initrd-shell.service

# include ssh credentials
InitrdPath=/root/.ssh/authorized_keys source=/root/.ssh/authorized_keys mode=600
lachesis commented 4 years ago

Oho I didn't see that unit at all. That explains where it's being done. That wasn't included in my system for some reason. I just got everything working so I'm a bit hesitant to dig into it right now. I will troubleshoot further this week and get back to you. Thanks!

Andrei-Pozolotin commented 4 years ago

ok, cool :-)