Add readonly sftponly data access account
This commit is contained in:
parent
d19ec8b548
commit
e71ae589e0
5 changed files with 34 additions and 2 deletions
|
@ -9,6 +9,15 @@
|
||||||
group = "users";
|
group = "users";
|
||||||
passwordFile = "/run/secrets/password_file";
|
passwordFile = "/run/secrets/password_file";
|
||||||
};
|
};
|
||||||
|
users.users.readonly = {
|
||||||
|
isNormalUser = true;
|
||||||
|
home = "/home/readonly";
|
||||||
|
description = "Readonly data access";
|
||||||
|
uid = 1001;
|
||||||
|
group = "sftponly";
|
||||||
|
passwordFile = "/run/secrets/readonly_password_file";
|
||||||
|
};
|
||||||
|
users.groups.sftponly = { gid = 10000; };
|
||||||
environment.systemPackages = [ pkgs.rsync pkgs.mktorrent (pkgs.writeShellScriptBin "create_torrent" ". /run/secrets/create_torrent") ];
|
environment.systemPackages = [ pkgs.rsync pkgs.mktorrent (pkgs.writeShellScriptBin "create_torrent" ". /run/secrets/create_torrent") ];
|
||||||
security.sudo.enable = false;
|
security.sudo.enable = false;
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
|
@ -20,7 +29,12 @@
|
||||||
];
|
];
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
HostKeyAlgorithms +ssh-rsa
|
HostKeyAlgorithms +ssh-rsa
|
||||||
|
Match group sftponly
|
||||||
|
X11Forwarding no
|
||||||
|
AllowTcpForwarding no
|
||||||
|
AllowAgentForwarding no
|
||||||
|
ForceCommand internal-sftp
|
||||||
'';
|
'';
|
||||||
authorizedKeysFiles = [ "/run/secrets/authorized_keys" ];
|
authorizedKeysFiles = [ "/run/secrets/%u_authorized_keys" ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,10 @@
|
||||||
hostPath = "/srv/data";
|
hostPath = "/srv/data";
|
||||||
isReadOnly = false;
|
isReadOnly = false;
|
||||||
};
|
};
|
||||||
|
"/home/readonly/data" = {
|
||||||
|
hostPath = "/srv/data";
|
||||||
|
isReadOnly = true;
|
||||||
|
};
|
||||||
"/run/secrets" = {
|
"/run/secrets" = {
|
||||||
hostPath = "/run/data-access";
|
hostPath = "/run/data-access";
|
||||||
isReadOnly = true;
|
isReadOnly = true;
|
||||||
|
@ -86,10 +90,22 @@
|
||||||
path = "/run/data-access/password_file";
|
path = "/run/data-access/password_file";
|
||||||
symlink = false;
|
symlink = false;
|
||||||
};
|
};
|
||||||
|
age.secrets."data-access/readonly_password_file" = {
|
||||||
|
file = ../../../secrets/data-access/readonly_password_file.age;
|
||||||
|
path = "/run/data-access/readonly_password_file";
|
||||||
|
symlink = false;
|
||||||
|
};
|
||||||
age.secrets."data-access/authorized_keys" = {
|
age.secrets."data-access/authorized_keys" = {
|
||||||
file = ../../../secrets/data-access/authorized_keys.age;
|
file = ../../../secrets/data-access/authorized_keys.age;
|
||||||
owner = "charlotte";
|
owner = "charlotte";
|
||||||
path = "/run/data-access/authorized_keys";
|
path = "/run/data-access/data_authorized_keys";
|
||||||
|
symlink = false;
|
||||||
|
};
|
||||||
|
age.secrets."data-access/readonly_authorized_keys" = {
|
||||||
|
file = ../../../secrets/data-access/readonly_authorized_keys.age;
|
||||||
|
owner = "1001";
|
||||||
|
group = "65534";
|
||||||
|
path = "/run/data-access/readonly_authorized_keys";
|
||||||
symlink = false;
|
symlink = false;
|
||||||
};
|
};
|
||||||
age.secrets."data-access/create_torrent" = {
|
age.secrets."data-access/create_torrent" = {
|
||||||
|
|
|
@ -82,5 +82,7 @@ in
|
||||||
"secrets/data-access/ssh_host_ed25519_key.pub.age".publicKeys = [ urithiru ] ++ users;
|
"secrets/data-access/ssh_host_ed25519_key.pub.age".publicKeys = [ urithiru ] ++ users;
|
||||||
"secrets/data-access/authorized_keys.age".publicKeys = [ urithiru ] ++ users;
|
"secrets/data-access/authorized_keys.age".publicKeys = [ urithiru ] ++ users;
|
||||||
"secrets/data-access/password_file.age".publicKeys = [ urithiru ] ++ users;
|
"secrets/data-access/password_file.age".publicKeys = [ urithiru ] ++ users;
|
||||||
|
"secrets/data-access/readonly_authorized_keys.age".publicKeys = [ urithiru ] ++ users;
|
||||||
|
"secrets/data-access/readonly_password_file.age".publicKeys = [ urithiru ] ++ users;
|
||||||
"secrets/data-access/create_torrent.age".publicKeys = [ urithiru ] ++ users;
|
"secrets/data-access/create_torrent.age".publicKeys = [ urithiru ] ++ users;
|
||||||
}
|
}
|
||||||
|
|
BIN
secrets/data-access/readonly_authorized_keys.age
Normal file
BIN
secrets/data-access/readonly_authorized_keys.age
Normal file
Binary file not shown.
BIN
secrets/data-access/readonly_password_file.age
Normal file
BIN
secrets/data-access/readonly_password_file.age
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue