Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Image contains pregenerated SSH host keys #3

Closed
djmaze opened this issue Jan 17, 2016 · 3 comments
Closed

Image contains pregenerated SSH host keys #3

djmaze opened this issue Jan 17, 2016 · 3 comments

Comments

@djmaze
Copy link
Contributor

djmaze commented Jan 17, 2016

Each host should have its own set of SSH keys. As of now, the SSH keys are generated during the install of the package openssh-server. That means the keys end up in the image.

For a clean solution, we should probably remove the pregenerated keys during build of the rootfs. Additionally, we have to make sure the keys are regenerated on first boot.

@StefanScherer
Copy link
Member

@djmaze Very good point! So a rm /etc/ssh/ssh_host_* should be done here and a test should proof this that the files no longer exist.

@djmaze
Copy link
Contributor Author

djmaze commented Jan 19, 2016

There is no need to do the key regeneration on a per-device basis. And the aim should be to do as much as possible inside the (device-independent) rootfs, right? So I think we need to add a first-time boot service here which runs the dpkg-reconfigure openssh-server, as opposed to duplicating this effort in every device-specific builder script (see hypriot/image-builder-rpi#9).

We also need to figure out a clean way to run a one-time service on bootup. I am not very comfortable with the fact that the root partition (at least in the C1 image) is resized on every boot. The easiest way would probably be to just append an entry to an env file after the first run. That would be checked before running the service another time.

@Govinda-Fichtner
Copy link
Collaborator

@djmaze @StefanScherer I created a generic first-boot service in PR #7 to address this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants