mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-05-20 13:22:34 +02:00
302f0ceec9
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
23 lines
609 B
Nix
23 lines
609 B
Nix
# SSH configuration
|
|
{config, ...}: let
|
|
username = config.var.username;
|
|
in {
|
|
services.openssh = {
|
|
enable = true;
|
|
ports = [22];
|
|
openFirewall = true;
|
|
settings = {
|
|
PermitRootLogin = "no";
|
|
PasswordAuthentication = false;
|
|
AllowUsers = [username];
|
|
};
|
|
};
|
|
|
|
# Add my public SSH key to my user
|
|
users.users."${username}".openssh.authorizedKeys.keys = [
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPG9SE80ZyBcXZK/f5ypSKudaM5Jo3XtQikCnGo0jI5E hadi@nixy"
|
|
];
|
|
|
|
services.cloudflared.tunnels."${config.var.tunnelId}".ingress."ssh.${config.var.domain}" = "ssh://localhost:22";
|
|
}
|