nix-git/modules/ssh.nix

81 lines
2.6 KiB
Nix
Raw Normal View History

2023-09-11 14:05:02 +02:00
{ config, pkgs, ... }:
{
# Enable SSH server.
services.openssh = {
enable = true;
2023-09-15 21:08:53 +02:00
#ports = [ 22 ];
2023-09-11 14:05:02 +02:00
# Forbid root login through SSH.
settings.PermitRootLogin = "no";
# Use authorized keys only.
settings.PasswordAuthentication = false;
};
# SSH public key(s) allowed to connect via SSH.
users.users.yoda = {
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCpgihAg8Qzu5q+AGXHLR7p+rrS1yB0KlZb/Y/EwZT15EhEtsUMqBMRiY0TdjKQU0broyygZnymccLmCXvihEgk3zk/hP8VEDmN5wmE2tRBPR4lSjo8E1R8N79G+gaFkwi93QYh57MsGfa9k4tvGrJy0yaD7GrPqtQf+IIuvV14WJQAqnikTdbFqRjk5JGearYLU7jSKa+9NmR7JQ9NExoyIPgmQ/pd0Xc2qt8k5UGfz3HM9MAmIVQ30whK6m1iYZ8nxEidHrfreQx8NOa7ujo4zQnV1NYvRUjObr/qyIhPU6DYLT2mVRNupQFKx6LI38O4U13heugUFqJ3zvog3aDsriFiv8jzJAJvWXx7Q3TqKhqiG9VTkwBw1NDbCAOXKiEdMfiCYbdCfpNgdepU75bMloJcSQQVUqoH2tQhSbwKLuRFgOnyaHpvWbieXBRcUnfG8gg4p4jqiwx5laweEeOIOD/i7G1Mjx7Dj2ctnT/ILat/xsf+Y0W4eJr3bc5L9ghgw6wsKbNSqwjFUCFcHcARK3gvSH+hO2/BpgMVoyvZjO5PNuUqfsZ7bIIs5cDdyB/ly3irKuaRz1+3x1x4gPgSiOcji7HxPwogzhPsyfoRLHNt9tJ5X4nF2Iz1M5RTJpbZCi6yEj+9Q85FVjD76BEWuZe18kRrwhuLf/XgKdF9tQ== openpgp:0xA8B75370"
];
};
home-manager.users.yoda = { osConfig, config, pkgs, ... }: {
# SSH client configuration.
programs.ssh = {
enable = true;
userKnownHostsFile = "~/.ssh/known_hosts ${../assets/ssh/known_hosts}";
matchBlocks = {
2023-09-14 14:42:49 +02:00
"yodaYoga" = {
2023-09-15 21:20:47 +02:00
hostname = "p1st.de";
#hostname = "192.168.178.99";
2023-09-14 14:42:49 +02:00
user = "yoda";
2023-09-15 21:08:53 +02:00
port = 2223;
2023-09-14 14:42:49 +02:00
compression = false;
};
2023-09-15 14:59:55 +02:00
"unlockYodaYoga" = {
2023-09-15 21:20:47 +02:00
hostname = "p1st.de";
#hostname = "192.168.178.99";
2023-09-15 14:59:55 +02:00
user = "root";
2023-09-15 21:08:53 +02:00
port = 2223;
2023-09-15 14:59:55 +02:00
compression = false;
};
2023-09-11 17:46:27 +02:00
"pi3bplus" = {
hostname = "fckjpbxxim36c1gb.myfritz.net";
user = "yoda";
port = 22;
compression = true;
};
2023-09-15 11:02:44 +02:00
"ejNas" = {
hostname = "cloud.ej-altdorf.de";
#hostname = "ej-altdorf.spdns.de";
user = "yoda";
port = 22;
compression = true;
};
2023-09-15 14:32:15 +02:00
"rootEjNas" = {
hostname = "cloud.ej-altdorf.de";
#hostname = "ej-altdorf.spdns.de";
user = "root";
port = 22;
compression = true;
};
2023-09-15 11:02:44 +02:00
2023-09-11 14:05:02 +02:00
"nas" = {
hostname = "p1st.de";
user = "yoda";
port = 2222;
compression = true;
};
2023-09-15 14:32:15 +02:00
"rootNas" = {
2023-09-11 14:05:02 +02:00
hostname = "p1st.de";
user = "root";
port = 2222;
compression = true;
};
};
};
};
}