Files
bfds-configuration.nix/modules/smb.nix
T

120 lines
2.8 KiB
Nix

{ config, ... }:
{
services.samba-wsdd = {
# make shares visible for Windows clients
enable = true;
openFirewall = true;
};
# Curiously, `services.samba` does not automatically open
# the needed ports in the firewall.
networking.firewall.allowedTCPPorts = [ 445 139 ];
networking.firewall.allowedUDPPorts = [ 137 138 ];
services.samba = {
enable = true;
enableNmbd = true;
securityType = "user";
extraConfig = ''
# Server-seitige SMB-Signatur erzwingen
server signing = mandatory
client signing = mandatory
# Aktiviert die Unterstützung für SMB2 und SMB3
server min protocol = SMB2
server max protocol = SMB3
# Erlaubt sichere Negotation von Verbindungen
client min protocol = SMB2
client max protocol = SMB3
workgroup = WORKGROUP
server string = BFDS
netbios name = BFDS
server role = standalone server
map to guest = bad user
log file = /var/log/samba/smbd.%m
max log size = 50
# dns proxy = no
# security = user
# use sendfile = yes
# max protocol = smb2
# note: localhost is the ipv6 localhost ::1
# hosts allow = 192.168.0. 127.0.0.1 localhost
# hosts deny = 0.0.0.0/0
# guest account = nobody
'';
shares = {
Rob = {
path = "/bfds-nix/rob";
browseable = "yes";
"writable" = "yes";
"guest ok" = "yes";
# "public" = "yes";
"create mask" = "0644";
"directory mask" = "0755";
"force user" = "smbuser";
"force group" = "smbuser";
};
Peggy = {
path = "/bfds-nix/peggy";
browseable = "yes";
"writable" = "yes";
"guest ok" = "yes";
"public" = "yes";
};
Musik = {
path = "/bfds-nix/music";
browseable = "yes";
"writable" = "yes";
"guest ok" = "yes";
"public" = "yes";
};
Filme = {
path = "/bfds-nix/movies";
browseable = "yes";
"writable" = "yes";
"guest ok" = "yes";
"public" = "yes";
};
"Hörbücher" = {
path = "/bfds-nix/hoerbuecher";
browseable = "yes";
"writable" = "yes";
# "guest ok" = "yes";
# "public" = "yes";
"create mask" = "0644";
"directory mask" = "0755";
"force user" = "smbuser";
"force group" = "smbuser";
};
Ebooks = {
path = "/bfds-nix/ebooks";
browseable = "yes";
"writable" = "yes";
"guest ok" = "yes";
"public" = "yes";
};
Ablage = {
path = "/bfds-nix/ablage";
browseable = "yes";
"writable" = "yes";
"guest ok" = "yes";
"public" = "yes";
};
};
};
}