mirror of
https://github.com/Ahwxorg/nixos-config.git
synced 2026-07-16 22:21:55 +08:00
feat: further protect smb shares
This commit is contained in:
parent
15461dcbdb
commit
8deb1b122a
1 changed files with 46 additions and 13 deletions
|
|
@ -2,31 +2,54 @@
|
|||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
username,
|
||||
...
|
||||
}:
|
||||
{
|
||||
services = {
|
||||
samba = {
|
||||
# syncPasswordsByPam = true;
|
||||
# If set, we will still need to set users with:
|
||||
# sudo smbpasswd -a yourusername
|
||||
package = pkgs.samba;
|
||||
# ^^ `samba4Full` is compiled with avahi, ldap, AD etc support (compared to the default package, `samba`. samba4Full gives issue, however)
|
||||
# Required for samba to register mDNS records for auto discovery
|
||||
# See https://github.com/NixOS/nixpkgs/blob/592047fc9e4f7b74a4dc85d1b9f5243dfe4899e3/pkgs/top-level/all-packages.nix#L27268
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
shares.main = {
|
||||
path = "/spinners/rootvol/nfs";
|
||||
writable = "true";
|
||||
comment = "Hello world!";
|
||||
settings.global = {
|
||||
"security" = "user";
|
||||
"invalid users" = [ "root" ];
|
||||
"server smb encrypt" = "required";
|
||||
};
|
||||
shares.violet = {
|
||||
path = "/spinners/violet";
|
||||
writable = "true";
|
||||
comment = "Hello world!";
|
||||
};
|
||||
shares.ahwx = {
|
||||
path = "/spinners/ahwx";
|
||||
writable = "true";
|
||||
comment = "Hello world!";
|
||||
shares = {
|
||||
main = {
|
||||
path = "/spinners/rootvol/nfs";
|
||||
writable = "true";
|
||||
comment = "Hello world!";
|
||||
"guest ok" = "no";
|
||||
"read only" = "no";
|
||||
browsable = "no";
|
||||
"valid users" = "access";
|
||||
};
|
||||
violet = {
|
||||
path = "/spinners/violet";
|
||||
writable = "true";
|
||||
comment = "Hello world!";
|
||||
"guest ok" = "no";
|
||||
"read only" = "no";
|
||||
browsable = "no";
|
||||
"valid users" = "liv";
|
||||
};
|
||||
ahwx = {
|
||||
path = "/spinners/ahwx";
|
||||
writable = "true";
|
||||
comment = "Hello world!";
|
||||
"guest ok" = "no";
|
||||
"read only" = "no";
|
||||
browsable = "no";
|
||||
"valid users" = "liv";
|
||||
};
|
||||
};
|
||||
};
|
||||
avahi = {
|
||||
|
|
@ -44,4 +67,14 @@
|
|||
openFirewall = true;
|
||||
};
|
||||
};
|
||||
|
||||
users.users = {
|
||||
"access" = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "samba" ];
|
||||
};
|
||||
${username} = {
|
||||
extraGroups = [ "samba" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue