-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Generate ssh host keys on first boot (#140)
This change removes the keys generated by dpkg/debootstrap during configure phase and adds a systemd unit that runs dpkg-reconfigure openssh-server only if ssh host keys are not found. This ensures that every image burned to sd card gets it's own set of ssh host keys, improving the security posture. Co-authored-by: Jan Praczyk <jan@jpraczyk.xyz>
- Loading branch information
Showing
2 changed files
with
14 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
2nd-stage-files/pre-2nd-stage-files/etc/systemd/system/generate-ssh-host-keys.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Unit] | ||
Description=Generate SSH host keys on first boot | ||
ConditionPathExistsGlob=!/etc/ssh/ssh_host_*_key | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/sbin/dpkg-reconfigure -f noninteractive openssh-server | ||
|
||
[Install] | ||
RequiredBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters