samba:samba

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
Letzte ÜberarbeitungBeide Seiten der Revision
samba:samba [2021/10/06 20:25] – Firewalling stsamba:samba [2021/12/24 23:44] – [Firewalling] st
Zeile 70: Zeile 70:
   /etc/init.d/smb reload   /etc/init.d/smb reload
  
-==== SWAT ==== 
-SWAT ist ein übersichtliches Tool für die Konfiguration, es lauscht auf localhost:901. 
  
-[[http://www.manpage.ch/faq/swat.php|Schnell-Überblick]] 
-[[http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch10_:_Windows,_Linux,_and_Samba#Basic_SWAT_Setup|SWAT-Setup]] 
- 
-manuelle Einrichtung (für [[linux:xinetd]]): 
-  * in ''/etc/xinetd.d/'' eine Datei namens ''swat'' anlegen und mit folgendem Inhalt füllen: 
-<file> 
-service swat 
-{ 
- 
-   port            = 901 
-   socket_type     = stream 
-   protocol        = tcp 
-   wait            = no 
-   user            = root 
-   server          = /usr/sbin/swat 
-   log_on_failure  += USERID 
-   disable         = no 
-   only_from       = localhost 
- 
-} 
-</file> 
  
 ==== Domänencontroller einrichten ==== ==== Domänencontroller einrichten ====
Zeile 138: Zeile 115:
  
 [[https://www.stefanux.de/wiki/doku.php/linux/iptables#iptables-regeln-dauerhaft-sichern|Iptables-Regeln dauerhaft]]: [[https://www.stefanux.de/wiki/doku.php/linux/iptables#iptables-regeln-dauerhaft-sichern|Iptables-Regeln dauerhaft]]:
 +
 +In diesem Beispiel wird netbios und CIFS auf allen Interfaces AUSSER $IP blockiert (deswegen die Negation "!").
  
 ''/etc/iptables/rules.v4'': ''/etc/iptables/rules.v4'':
Zeile 146: Zeile 125:
 :FORWARD ACCEPT [0:0] :FORWARD ACCEPT [0:0]
 :OUTPUT ACCEPT [0:0] :OUTPUT ACCEPT [0:0]
--A INPUT -d $IP/32 -p tcp -m tcp --dport 137:139 -j DROP +-A INPUT -d $IP/32 -p tcp -m tcp --dport 137:139 -j DROP 
--A INPUT -d $IP/32 -p udp -m udp --dport 137:139 -j DROP +-A INPUT -d $IP/32 -p udp -m udp --dport 137:139 -j DROP 
--A INPUT -d $IP/32 -p udp -m udp --dport 445 -j DROP +-A INPUT -d $IP/32 -p udp -m udp --dport 445 -j DROP 
--A INPUT -d $IP/32 -p tcp -m tcp --dport 445 -j DROP+-A INPUT -d $IP/32 -p tcp -m tcp --dport 445 -j DROP
 COMMIT COMMIT
 </file> </file>
-$IP durch die öffentliche IP ersetzen!+ 
 +Hier wird CIFS auf IPv6 gar nicht angeboten: ''/etc/iptables/rules.v6'' 
 +<file> 
 +*filter 
 +:INPUT ACCEPT [0:0] 
 +:FORWARD ACCEPT [0:0] 
 +:OUTPUT ACCEPT [0:0] 
 +-A INPUT -p tcp -m tcp --dport 137:139 -j DROP 
 +-A INPUT -p udp -m udp --dport 137:139 -j DROP 
 +-A INPUT -p udp -m udp --dport 445 -j DROP 
 +-A INPUT -p tcp -m tcp --dport 445 -j DROP 
 +COMMIT 
 +</file> 
 + 
 ==== Samba an AD authentifizieren ==== ==== Samba an AD authentifizieren ====
  
Zeile 158: Zeile 151:
   * [[http://forum.ubuntuusers.de/topic/49746/|Einer Domain beitreten]]   * [[http://forum.ubuntuusers.de/topic/49746/|Einer Domain beitreten]]
   * [[http://www.pro-linux.de/work/server/samba3-domaene.html|Beitritt zu einer Windows 2003-Domäne mit Benutzerübernahme]]   * [[http://www.pro-linux.de/work/server/samba3-domaene.html|Beitritt zu einer Windows 2003-Domäne mit Benutzerübernahme]]
 +
 +
 +==== Schattenkopien mit ZFS ====
 +
 +<file>
 +[global]
 +shadow: snapdir = .zfs/snapshot
 +shadow: sort = desc
 +# Specify snapshot name: frequent, hourly, daily… as desired
 +shadow: format = zfs-auto-snap_hourly-%Y-%m-%d-%H%M"
 +</file>
 +
 +  * https://www.samba.org/samba/docs/current/man-html/vfs_shadow_copy2.8.html
 +  * help.univention.com/t/ucs-samba-with-zfs-via-nfs-working/6865
  
 ==== Verschlüsselung erzwingen ==== ==== Verschlüsselung erzwingen ====
Zeile 191: Zeile 198:
  
  
 +===== Samba als standalone Dateiserver =====
 +
 +Komplexes Beispiel:
 +<code bash>
 +useradd meinUser
 +passwd meinUser
 +smbpasswd -a meinUser
 +# anzeigen lassen zur Kontrolle:
 +# pdbedit -w -L
 +</code>
 +
 +''/etc/samba/smb.conf''
 +<file>
 +# Global parameters
 +[global]
 + log file = /var/log/samba/log.%m
 + logging = file
 + map to guest = Bad User
 + max log size = 1000
 + obey pam restrictions = Yes
 + pam password change = Yes
 + panic action = /usr/share/samba/panic-action %d
 + passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
 + passwd program = /usr/bin/passwd %u
 + server role = standalone server
 + unix password sync = Yes
 + usershare allow guests = Yes
 + idmap config * : backend = tdb
 +
 + store dos attributes = no
 + ea support = no
 + map archive = no
 + map hidden = no
 + map system = no
 + map readonly = no
 +
 + min protocol = SMB2
 + client max protocol = SMB3
 + encrypt passwords = yes
 +# win7 unterstützt die folgenden beiden Einstellungen nicht:
 +# server signing = mandatory
 +# smb encrypt = mandatory
 +
 +#[homes]
 +# browseable = No
 +# comment = Home Directories
 +# create mask = 0700
 +# directory mask = 0700
 +# valid users = %S
 +
 +[meineFreigabe]
 + create mask = 0700
 + directory mask = 0700
 + path = /srv/samba
 + read only = No
 + valid users = meinUser
 +</file>
 +
 +''systemctl restart smbd.service ''
 +
 +Optional:
 +  * siehe oben firewalling
 +  * in [[linux:wireguard]] tunneln
 ===== Samba als DC ===== ===== Samba als DC =====