Skip to content

Commit e16ce80

Browse files
committed
fix(sshd): use dedicated host key without passphrase for sshd on Android
1 parent eb3c7aa commit e16ce80

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

machines/aarch64/android/common.nix

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
home.file.".ssh/sshd_config" = {
55
text = ''
66
Port 8022
7-
HostKey ${config.home.homeDirectory}/.ssh/id_ed25519
7+
HostKey ${config.home.homeDirectory}/.ssh/sshd_host_ed25519_key
88
AuthorizedKeysFile .ssh/authorized_keys
99
PasswordAuthentication yes
1010
PermitEmptyPasswords no
@@ -14,6 +14,13 @@
1414
'';
1515
};
1616

17+
home.activation.generateSshdHostKey = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
18+
HOST_KEY="${config.home.homeDirectory}/.ssh/sshd_host_ed25519_key"
19+
if [ ! -f "$HOST_KEY" ]; then
20+
${pkgs.openssh}/bin/ssh-keygen -t ed25519 -f "$HOST_KEY" -N ""
21+
fi
22+
'';
23+
1724
home.file.".termux/boot/start-sshd.sh" = {
1825
text = ''
1926
#!/bin/sh

0 commit comments

Comments
 (0)