Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve dropbear key detection and creation #15

Closed
wants to merge 1 commit into from

Conversation

ahesford
Copy link

@ahesford ahesford commented Jan 24, 2022

It is not a great idea to copy host keys into an initramfs because an initramfs is often readable by the world (and will always be so when installed on, e.g., an EFI system partition with systemd-boot). Generating keys is good for testing but is not good in production because each new initramfs will have unique keys and trigger warnings or hard failures on the client. The best option is to maintain a second set of host keys only for initramfs images, which can be stored in dropbear format in /etc/dropbear.

To allow this possibility, this PR alters the installation script to simply copy the /etc/dropbear directory of that directory contains at least one recognized key. If not, the old behavior is preserved: converting OpenSSH host keys if possible, generating new ones if not.

While we're refactoring key management, let's add (optional) support for ed25519, ignoring failures in case the version of dropbear used by the hook does not support that type.

This supersedes #13 with a cleaner implementation that doesn't break the hook with older versions of dropbear.

- If at least one key already exists in /etc/dropbear, use that
  directory without trying to copy OpenSSH keys or generate new ones

- Add (optional) support for ed25519, ignoring failures in case the
  version of dropbear used by the hook does not support that type
@ahesford
Copy link
Author

Incorporated in ahesford@48e496a

@ahesford ahesford closed this Aug 23, 2023
@ahesford ahesford deleted the keyfix branch August 23, 2023 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant