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

enable host key generation on first boot #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ with lib;
root:x:0:
nixbld:x:30000:nixbld1,nixbld10,nixbld2,nixbld3,nixbld4,nixbld5,nixbld6,nixbld7,nixbld8,nixbld9
'';
"ssh/ssh_host_rsa_key.pub".source = ./ssh/ssh_host_rsa_key.pub;
"ssh/ssh_host_rsa_key" = { mode = "0600"; source = ./ssh/ssh_host_rsa_key; };
"ssh/ssh_host_ed25519_key.pub".source = ./ssh/ssh_host_ed25519_key.pub;
"ssh/ssh_host_ed25519_key" = { mode = "0600"; source = ./ssh/ssh_host_ed25519_key; };
};
boot.kernelParams = [ "systemConfig=${config.system.build.toplevel}" ];
boot.kernelPackages = lib.mkDefault (if pkgs.system == "armv7l-linux" then pkgs.linuxPackages_rpi1 else pkgs.linuxPackages);
Expand Down
4 changes: 0 additions & 4 deletions gen_keys

This file was deleted.

8 changes: 7 additions & 1 deletion runit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

let
sshd_config = pkgs.writeText "sshd_config" ''
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
Port 22
PidFile /run/sshd.pid
Expand Down Expand Up @@ -30,6 +29,13 @@ in
{
"runit/1".source = pkgs.writeScript "1" ''
#!${pkgs.runtimeShell}

ED25519_KEY="/etc/ssh/ssh_host_ed25519_key"

if [ ! -f $ED25519_KEY ]; then
${pkgs.openssh}/bin/ssh-keygen -t ed25519 -f $ED25519_KEY -N ""
fi

${lib.optionalString config.not-os.simpleStaticIp ''
ip addr add 10.0.2.15 dev eth0
ip link set eth0 up
Expand Down
7 changes: 0 additions & 7 deletions ssh/ssh_host_ed25519_key

This file was deleted.

1 change: 0 additions & 1 deletion ssh/ssh_host_ed25519_key.pub

This file was deleted.

51 changes: 0 additions & 51 deletions ssh/ssh_host_rsa_key

This file was deleted.

1 change: 0 additions & 1 deletion ssh/ssh_host_rsa_key.pub

This file was deleted.