bento/fleet.nix

37 lines
763 B
Nix
Raw Permalink Normal View History

2022-09-04 22:42:02 +00:00
{
lib,
pkgs,
...
}: let
create_users = host: {
users.users."${host.username}" = {
createHome = false;
home = "/home/chroot/" + host.username;
isNormalUser = false;
isSystemUser = true;
group = "sftp_users";
openssh.authorizedKeys.keys = [host.key];
shell = null;
};
2022-09-04 00:07:55 +00:00
};
users = [
2022-09-04 22:42:02 +00:00
{
username = "router";
key = "ssh-ed25519 AAAAC3NzaC2aZGI1OTE5AAAAOIOZKLFCZLM67viQXHYRjraE6WLfvETMkjjgSz0mxMzS root@router";
}
2022-09-04 00:07:55 +00:00
];
2022-09-04 22:42:02 +00:00
in {
2022-09-04 00:07:55 +00:00
imports = builtins.map create_users users;
2022-09-04 22:42:02 +00:00
users.groups = {sftp_users = {};};
2022-09-04 00:07:55 +00:00
services.openssh.extraConfig = ''
Match Group sftp_users
X11Forwarding no
AllowTcpForwarding no
ChrootDirectory %h
ForceCommand internal-sftp
'';
}