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
samba:samba [2021/04/29 16:00] – [WINS-Unterstützung] stsamba:samba [2022/04/10 22:43] (aktuell) – ansible 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 131: Zeile 108:
   * Passwort ändern: <code bash>ssmbpasswd TOM</code>   * Passwort ändern: <code bash>ssmbpasswd TOM</code>
   * existierende Benutzer auflisten: <code bash>pdbedit -w -L</code>   * existierende Benutzer auflisten: <code bash>pdbedit -w -L</code>
 +
 +
 +==== Firewalling ====
 +
 +Samba (bzw. netbios und CIFS) sollten nicht frei aus dem Internet erreichbar sein.
 +
 +[[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'':
 +<file>
 +# Generated by iptables-save
 +*filter
 +:INPUT ACCEPT [0:0]
 +:FORWARD 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 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 tcp -m tcp --dport 445 -j DROP
 +COMMIT
 +</file>
 +
 +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>
  
  
Zeile 138: 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 171: 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 =====
  
Zeile 341: Zeile 431:
   * Neuen DNS-Record setzen: ''samba-tool dns add localhost neofonie.de asp.neofonie.de A 81.17.211.122 -U (anyAD-Adminuser)''   * Neuen DNS-Record setzen: ''samba-tool dns add localhost neofonie.de asp.neofonie.de A 81.17.211.122 -U (anyAD-Adminuser)''
  
 +
 +===== ansible =====
 +
 +  * [[https://stackoverflow.com/questions/44762488/non-interactive-samba-user-creation-via-ansible|Non interactive samba user creation via ansible]]
 +  * https://github.com/stefanux/ansible-role-samba