OPSI/Installation: Unterschied zwischen den Versionen

Aus Vosp.info
Wechseln zu:Navigation, Suche
(/etc/bind/zones/opsi-1.local.zone)
(Grundsystem installieren)
 
(37 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
 +
Zurück zu [[OPSI]]<br>
 +
Dieses HowTo ist obsolet und wird nicht mehr gepflegt.<br>
 +
Die neuste Version ist [[Debian-OPSI-samba4]]<br>
 +
Oder einfach in [[OPSI]] rumstöbern.
 
=== Ziel ===
 
=== Ziel ===
 
Am Ende der Installation wird ein Host mit folgenen Funktionen zur Verfügung stehen.
 
Am Ende der Installation wird ein Host mit folgenen Funktionen zur Verfügung stehen.
Zeile 80: Zeile 84:
 
  mount -o bind /dev /mnt/dev
 
  mount -o bind /dev /mnt/dev
 
  mount -t sysfs sys /mnt/sys
 
  mount -t sysfs sys /mnt/sys
 +
mount —bind /run /mnt/run
 
  chroot /mnt /bin/bash
 
  chroot /mnt /bin/bash
  
Zeile 140: Zeile 145:
 
  vim /etc/hostname
 
  vim /etc/hostname
 
''opsi-1-lnx01'' eintragen
 
''opsi-1-lnx01'' eintragen
 +
 +
==== /etc/network/interfaces ====
 +
Die ''interfaces'' Datei anpassen.
 +
vim /etc/network/interfaces
 +
 +
eth0 ist hier das Interface zum OPSI-Netzwerk
 +
 +
# interfaces(5) file used by ifup(8) and ifdown(8)
 +
auto lo
 +
iface lo inet loopback
 +
 +
auto eth1
 +
iface eth1 inet dhcp
 +
 +
auto eth0
 +
iface eth0 inet static
 +
        address 10.8.190.1
 +
        broadcast 10.8.190.255
 +
        netmask 255.255.255.0
 +
  
 
==== Hosts Datei ====
 
==== Hosts Datei ====
Zeile 151: Zeile 176:
 
Das Ergebniss muss ausehen wie die eingefügte Zeile in ''/etc/hosts''
 
Das Ergebniss muss ausehen wie die eingefügte Zeile in ''/etc/hosts''
 
  10.8.190.1 opsi-1-lnx01.opsi-1.local opsi-1-lnx01
 
  10.8.190.1 opsi-1-lnx01.opsi-1.local opsi-1-lnx01
 +
 +
/etc/nsswitch.conf beachten
  
 
==== Firewall und Forward ====
 
==== Firewall und Forward ====
Zeile 202: Zeile 229:
 
  };
 
  };
  
===== /etc/bind/zones/opsi-1.local.zone =====
+
===== opsi-1.local.zone =====
 +
vim /etc/bind/zones/opsi-1.local.zone
 +
 
 
  ; Kopf Start
 
  ; Kopf Start
 
  ; BIND zone file for opsi-1.local
 
  ; BIND zone file for opsi-1.local
Zeile 217: Zeile 246:
 
  ; Kopf Ende
 
  ; Kopf Ende
 
  ; Ab hier werden die Namen aufgelöst.
 
  ; Ab hier werden die Namen aufgelöst.
gw                      IN A    10.8.190.1
+
 
+
  opsi-1-lnx01            IN A    10.8.190.1
  opsi-1-lnx01            IN A    10.8.190.10
 
 
  server                  CNAME  opsi-1-lnx01
 
  server                  CNAME  opsi-1-lnx01
 
  wpad                    CNAME  opsi-1-lnx01
 
  wpad                    CNAME  opsi-1-lnx01
 
+
 
  printer01              IN A    10.8.190.31
 
  printer01              IN A    10.8.190.31
 
   
 
   
Zeile 231: Zeile 259:
 
  win05                  IN A    10.8.190.105
 
  win05                  IN A    10.8.190.105
  
===== /etc/bind/zones/190.8.10.in-addr.arpa.zone =====
+
===== 190.8.10.in-addr.arpa.zone =====
 +
vim /etc/bind/zones/190.8.10.in-addr.arpa.zone
 +
 
 
  ;
 
  ;
 
  ; BIND zone file for 190.8.10.in-addr.arpa zone
 
  ; BIND zone file for 190.8.10.in-addr.arpa zone
Zeile 245: Zeile 275:
 
  @      IN      NS      opsi-1-lnx01.opsi-1.local.
 
  @      IN      NS      opsi-1-lnx01.opsi-1.local.
 
   
 
   
1                      IN PTR  gw.opsi-1.local.
+
 
+
  1                      IN PTR  opsi-1-lnx01.opsi-1.local.
10                     IN PTR  opsi-1-lnx01.opsi-1.local.
 
 
   
 
   
 
  31                      IN PTR  printer01.opsi-1.local.
 
  31                      IN PTR  printer01.opsi-1.local.
Zeile 270: Zeile 299:
  
 
Damit haben wir noch ein paar weitere ''requests'' abgeschaltet. Sollte nicht schaden.
 
Damit haben wir noch ein paar weitere ''requests'' abgeschaltet. Sollte nicht schaden.
 +
 +
===== resolv.conf =====
 +
 +
vim /etc/resolv.conf
 +
 +
nameserver 127.0.0.1
 +
search opsi-1.local
  
 
==== DHCP ====
 
==== DHCP ====
Zeile 286: Zeile 322:
  
 
===== /etc/dhcp/dhcpd.conf =====
 
===== /etc/dhcp/dhcpd.conf =====
Einträge für die Zone 10.8.190.0/24  
+
Einträge für das Netzwerksegment 10.8.190.0/24.<br>
 +
dhcpd.conf leeren
 +
echo > /etc/dhcp/dhcpd.conf
  
 
  vim /etc/dhcp/dhcpd.conf
 
  vim /etc/dhcp/dhcpd.conf
Zeile 297: Zeile 335:
 
  option domain-name "opsi-1.local";
 
  option domain-name "opsi-1.local";
 
  # Nameserver
 
  # Nameserver
  option domain-name-servers 10.8.190.10;
+
  option domain-name-servers 10.8.190.1;
+
 
 
  default-lease-time 600;
 
  default-lease-time 600;
 
  max-lease-time 7200;
 
  max-lease-time 7200;
 
  log-facility local7;
 
  log-facility local7;
+
 
  subnet 10.8.190.0 netmask 255.255.255.224 {
+
  subnet 10.8.190.0 netmask 255.255.255.0 {
    # Der Range für nicht unten aufgeführte Computer per default abgeschaltet.
+
  # Der Range für nicht unten aufgeführte Computer per default abgeschaltet.
    # range 10.8.190.230 10.8.190.245;
+
  # range 10.8.190.230 10.8.190.245;
    option routers 10.8.190.1;
+
  option routers 10.8.190.1;
    option broadcast-address 10.8.190.255;
+
  option broadcast-address 10.8.190.255;
    default-lease-time 600;
+
  default-lease-time 600;
    max-lease-time 7200;
+
  max-lease-time 7200;
 
  }
 
  }
 
   
 
   
 
   
 
   
 
  # Bei dieser Config werden die IPs über den nameserver aufgelöst.
 
  # Bei dieser Config werden die IPs über den nameserver aufgelöst.
   
+
 
  host win00 { hardware ethernet 08:00:07:26:c0:a5 fixed-address win00.opsi-1.local; }
+
host win01 { hardware ethernet 00:00:00:00:00:00;  fixed-address win01.opsi-1.local; }
 +
host win02 { hardware ethernet 00:00:00:00:00:00; fixed-address win02.opsi-1.local; }
 +
  host win03 { hardware ethernet 00:00:00:00:00:00;  fixed-address win03.opsi-1.local; }
 +
host win04 { hardware ethernet 00:00:00:00:00:00; fixed-address win04.opsi-1.local; }
  
 
==== Abhängigkeiten installieren ====
 
==== Abhängigkeiten installieren ====
Zeile 322: Zeile 363:
 
In diesem Beispiel wird OPSI ohne mysql installiert
 
In diesem Beispiel wird OPSI ohne mysql installiert
  
==== OPSI installieren ====
+
'''winbind''' abstellen
Hinzufügen des Repositories
 
echo "deb http://download.opensuse.org/repositories/home:/uibmz:/opsi:/opsi40/Debian_7.0 ./" >> /etc/apt/sources.list.d/opsi.list
 
Signatur des Repositories importieren
 
wget -O - http://download.opensuse.org/repositories/home:/uibmz:/opsi:/opsi40/Debian_7.0/Release.key | apt-key add -
 
 
 
Der Erfolg kann mit
 
apt-key list
 
überprüft werden<br>
 
Paketliste aktualisieren
 
apt-get update
 
System upgraden
 
apt-get upgrade -y
 
 
 
Die eigentlichen OPSI-Pakete installieren
 
apt-get install -y opsi-atftpd
 
apt-get install -y opsi-depotserver
 
apt-get install -y opsi-configed
 
 
 
 
 
=== MACs der Client-PCs finden ===
 
==== PXE-Boot ====
 
In diesem HowTo wird TinyCore eingesetzt.<br>
 
Der große Vorteil liegt im per default eingesetzten dhcp-Clienten, der ein gebootetes TinyCore automatisch mit einer IP versorgt.<br>
 
 
 
apt-get install syslinux nmap
 
 
 
Folgende Verzeichnisse erstellen
 
 
 
mkdir -p /tftpboot/lookmac/pxelinux.cfg
 
mkdir -p /tftpboot/lookmac/tinycore
 
 
 
cp /usr/lib/syslinux/memdisk /tftpboot/lookmac/
 
cp /usr/lib/syslinux/pxelinux.0 /tftpboot/lookmac/
 
 
 
Im Verzeichniss /tftpboot/lookmac/pxelinux.cfg die Datei ''default'' erstellen.
 
 
 
vim /tftpboot/lookmac/pxelinux.cfg/default
 
 
 
Inhalt
 
default core
 
label core
 
  kernel tinycore/boot/vmlinuz
 
  append  initrd=tinycore/boot/core.gz
 
 
 
Ein TinyCore Iso downloaden.
 
wget http://tinycorelinux.net/5.x/x86/release/Core-current.iso -O /tftpboot/lookmac/core.iso
 
 
 
==== ISO bearbeiten ====
 
Der Timeout des Startmenues liegt bei 300 Sekunden, der soll auf 3 Sekunden verkürzt werden.<br>
 
 
 
Mit Tools wie z.B. ''isomaster'' lässt sich ein ISO einfach bearbeiten.
 
Im Verzeichniss  ''/boot/isolinux/'' liegt die Datei ''isolinux.cfg''<br>
 
 
 
''timeout 300'' ändern in ''timeout 3'' oder weniger.<br>
 
''timeout 0'' ist nicht empfehlenswert, immerhin steht uns jetzt ein TinyCore mit allen Möglichkeiten zur Verfügung.<br>
 
Das sollten wir uns erhalten.
 
 
 
Das ISO mounten
 
mount -o loop  core.iso /tftpboot/lookmac/tinycore
 
 
 
==== /etc/dhcp/dhcp.conf anpassen ====
 
In der /etc/dhcp/dhcp.conf folgendes Änderung durchführen.
 
#      range 10.8.190.15 10.8.190.30;
 
      range 10.8.190.15 10.8.190.254;
 
       
 
#        filename "linux/pxelinux.0";
 
        filename "lookmac/pxelinux.0";
 
 
 
==== MACs finden ====
 
 
 
nmap -sP 10.8.190.0/24 -n|grep MAC|awk '{print $3}'
 
 
 
Das Ergebniss des Scans wird in /etc/dhcp/dhcp.conf eingetragen.<br>
 
 
 
Der folgende Befehl ersetzt NUR den ERSTEN Treffer des Suchstings.
 
sed -i '0,/00:00:00:00:00:00/s//00:1f:16:0d:7d:26/' /etc/dhcp/dhcp.conf
 
 
 
==== /etc/dhcp/dhcp.conf zurück setzen ====
 
In der /etc/dhcp/dhcp.conf folgendes Änderung durchführen.
 
        range 10.8.190.15 10.8.190.30;
 
#      range 10.8.190.15 10.8.190.254;
 
       
 
        filename "linux/pxelinux.0";
 
#        filename "lookmac/pxelinux.0";
 
  
=== samba ===
+
==== samba ====
====/etc/samba/smb.conf ====
+
=====/etc/samba/smb.conf =====
 
Bei der Installation von OPSI werden wir gefragt, ob wir Änderungen an der smb.conf zulassen wollen:<br>
 
Bei der Installation von OPSI werden wir gefragt, ob wir Änderungen an der smb.conf zulassen wollen:<br>
 
Wenn "ja", dann wurde der Block ''OPSI'' eingefügt:<br>
 
Wenn "ja", dann wurde der Block ''OPSI'' eingefügt:<br>
Zeile 415: Zeile 372:
 
Dadurch wird samba zum Domänen-Controller im NT4-Style.<br>
 
Dadurch wird samba zum Domänen-Controller im NT4-Style.<br>
 
Der Name der Domäne ist OPSI-1
 
Der Name der Domäne ist OPSI-1
 +
<br>
 +
smb.conf ist buggy!
 +
<br>
  
 
  #
 
  #
 
  # /etc/samba/smb.conf
 
  # /etc/samba/smb.conf
 
  #
 
  #
 +
 +
#======================= Global Settings =======================
 
   
 
   
 
  [global]
 
  [global]
 
   
 
   
## Browsing/Identification ###
+
  workgroup = OPSI-1
+
  server string = %h server
workgroup = OPSI-1
+
  wins support = no
server string = %h server
+
  wins server = w.x.y.z
   
+
  dns proxy = no
wins support = yes
+
  name resolve order = lmhosts host wins bcast
dns proxy = no
 
name resolve order = wins lmhosts host bcast
 
 
   
 
   
 
  #### Networking ####
 
  #### Networking ####
 
   
 
   
interfaces = 127.0.0.0/8 eth1
+
  interfaces = 127.0.0.0/8 eth0
bind interfaces only = yes
+
  bind interfaces only = yes
 
   
 
   
 
   
 
   
 
  #### Debugging/Accounting ####
 
  #### Debugging/Accounting ####
 
   
 
   
log file = /var/log/samba/log.%m
+
log file = /var/log/samba/log.%m
max log size = 4096
+
  log file = /var/log/samba/log.all
#  syslog only = no
+
  max log size = 1000
syslog = 0
+
  log level = 2
 +
  panic action = /usr/share/samba/panic-action %d
 
   
 
   
panic action = /usr/share/samba/panic-action %d
 
 
   
 
   
 +
####### Authentication #######
 
   
 
   
####### Authentication #######
+
  security = user
 +
  encrypt passwords = true
 +
  passdb backend = tdbsam
 +
  obey pam restrictions = yes
 +
  unix password sync = no
 
   
 
   
security = user
+
  passwd program = /usr/bin/passwd %u
encrypt passwords = true
+
  passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
passdb backend = tdbsam
 
obey pam restrictions = yes
 
pam password change = no
 
unix password sync = no
 
 
   
 
   
passwd program = /bin/false
+
  pam password change = yes
 
   
 
   
 +
  map to guest = bad user
 
   
 
   
 
  ########## Domains ###########
 
  ########## Domains ###########
 
   
 
   
domain logons = yes
+
  domain logons = yes
domain master = yes
+
  logon path = \\%N\profiles\%a\%U
local master = yes
+
  logon drive = H:
+
#  logon home = \\%N\%U
logon path = \\%N\profiles\%a\%U
+
;  logon script = logon.cmd
 
   
 
   
logon drive = Z:
+
  add machine script  = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u
logon home = \\%N\%U
 
   
 
logon script = logon.bat
 
 
add machine script  = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u
 
 
   
 
   
 +
# Hide desktop.ini
 +
  hide files = /desktop.ini/ntuser.ini/NTUSER.*/Thumbs.db/
 
   
 
   
 
  ########## Printing ##########
 
  ########## Printing ##########
 
   
 
   
load printers = yes
+
# If you want to automatically load your printer list rather
 +
# than setting them up individually then you'll need this
 +
load printers = yes
 
   
 
   
printing = cups
+
# lpr(ng) printing. You may wish to override the location of the
printcap name = cups
+
# printcap file
 +
printing = bsd
 +
printcap name = /etc/printcap
 
   
 
   
printer admin = @ntadmin, root
+
# CUPS printing.  See also the cupsaddsmb(8) manpage in the
 +
# cupsys-client package.
 +
;  printing = cups
 +
;  printcap name = cups
 
   
 
   
 +
############ Misc ############
 
   
 
   
+
  usershare allow guests = no
################################################################################
 
#                                Domain stuff                                #
 
################################################################################
 
 
   
 
   
 
  [homes]
 
  [homes]
comment = Home Directories
+
  comment = Home Directories
browseable = no
+
  browseable = no
read only = no
+
  read only = no
create mask = 0640
+
  create mask = 0700
directory mask = 0750
+
  directory mask = 0700
valid users = %S
+
  valid users = %S
 
   
 
   
 
  [netlogon]
 
  [netlogon]
comment = Network Logon Service
+
  comment = Network Logon Service
path = /local/smb/shares/netlogon/
+
  path = /local/samba/netlogon
guest ok = yes
+
  guest ok = yes
read only = yes
+
  read only = yes
write list = domainadmin @ntadmin
 
 
   
 
   
 
  [profiles]
 
  [profiles]
comment = Users profiles
+
  comment = Users profiles
path = /local/smb/profiles/
+
  path = /local/samba/profiles/
guest ok = no
+
  guest ok = no
read only = no
+
  read only = no
browseable = no
+
  browseable = no
create mask = 0600
+
  create mask = 0600
directory mask = 0700
+
  directory mask = 0700
 
 
 
################################################################################
 
#                              Printing stuff                                #
 
################################################################################
 
 
   
 
   
 
  [printers]
 
  [printers]
comment = All Printers
+
  comment = All Printers
browseable = no
+
  browseable = no
path = /var/spool/samba
+
  path = /var/spool/samba
printable = yes
+
  printable = yes
guest ok = no
+
  guest ok = no
read only = yes
+
  read only = yes
create mask = 0700
+
  create mask = 0700
 
   
 
   
 
  [print$]
 
  [print$]
comment = Printer Drivers
+
  comment = Printer Drivers
path = /local/smb/printers/
+
  path = /var/lib/samba/printers
browseable = no
+
  browseable = yes
guest ok = no
+
  read only = yes
write list = root, @ntadmin
+
  guest ok = no
+
  write list = root, @ntadmin
 
 
   
 
   
  ################################################################################
+
  # OPSI
#                                    OPSI                                     #
 
################################################################################
 
 
   
 
   
 
  [opsi_depot]
 
  [opsi_depot]
available = yes
+
  available = yes
comment = opsi depot share (ro)
+
  comment = opsi depot share (ro)
path = /var/lib/opsi/depot
+
  path = /var/lib/opsi/depot
oplocks = no
+
  oplocks = no
follow symlinks = yes
+
  follow symlinks = yes
level2 oplocks = no
+
  level2 oplocks = no
writeable = no
+
  writeable = no
invalid users = root
+
  invalid users = root
 
   
 
   
 
  [opsi_depot_rw]
 
  [opsi_depot_rw]
available = yes
+
  available = yes
comment = opsi depot share (rw)
+
  comment = opsi depot share (rw)
path = /var/lib/opsi/depot
+
  path = /var/lib/opsi/depot
oplocks = no
+
  oplocks = no
follow symlinks = yes
+
  follow symlinks = yes
level2 oplocks = no
+
  level2 oplocks = no
writeable = yes
+
  writeable = yes
invalid users = root
+
  invalid users = root
 
   
 
   
 
  [opsi_images]
 
  [opsi_images]
available = yes
+
  available = yes
comment = opsi ntfs images share (rw)
+
  comment = opsi ntfs images share (rw)
path = /var/lib/opsi/ntfs-images
+
  path = /var/lib/opsi/ntfs-images
oplocks = no
+
  oplocks = no
level2 oplocks = no
+
  level2 oplocks = no
writeable = yes
+
  writeable = yes
invalid users = root
+
  invalid users = root
 
   
 
   
 
  [opsi_config]
 
  [opsi_config]
available = yes
+
  available = yes
comment = opsi config share
+
  comment = opsi config share
path = /var/lib/opsi/config
+
  path = /var/lib/opsi/config
writeable = yes
+
  writeable = yes
invalid users = root
+
  invalid users = root
 
   
 
   
 
  [opsi_workbench]
 
  [opsi_workbench]
available = yes
+
  available = yes
comment = opsi workbench
+
  comment = opsi workbench
path = /home/opsiproducts
+
  path = /home/opsiproducts
writeable = yes
+
  writeable = yes
invalid users = root
+
  invalid users = root
create mask = 0660
+
  create mask = 0660
directory mask = 0770
+
  directory mask = 0770
+
  write list = @opsiadmin
 
 
 
################################################################################
 
#     Data shares       #
 
################################################################################
 
 
   
 
   
 
  [programme]
 
  [programme]
Zeile 612: Zeile 560:
 
  /etc/init.d/samba restart
 
  /etc/init.d/samba restart
  
==== Samba-User ====
+
===== Samba-User =====
===== Maschinenaccount =====
+
====== Maschinenaccount ======
 
Damit ''add machine script'' aus der smb.conf funktioniert, muss die entsprechende Gruppe für die PCs angelegt werden.
 
Damit ''add machine script'' aus der smb.conf funktioniert, muss die entsprechende Gruppe für die PCs angelegt werden.
 
  groupadd machines
 
  groupadd machines
  
===== Benutzer =====
+
====== Benutzer ======
 
Das Setup bekommt drei Samba-User<br>
 
Das Setup bekommt drei Samba-User<br>
 
* domainadmin: Dieser User darf alles,
 
* domainadmin: Dieser User darf alles,
Zeile 633: Zeile 581:
 
Dadurch wird kein Homeverzeichniss angelegt und nach keinem Password gefragt, so dass sich die Benutzer nicht am Server anmelden können.<br>
 
Dadurch wird kein Homeverzeichniss angelegt und nach keinem Password gefragt, so dass sich die Benutzer nicht am Server anmelden können.<br>
 
Mit ''smbpasswd'' werden die Benutzer zu Samba hinzugefügt.<br>
 
Mit ''smbpasswd'' werden die Benutzer zu Samba hinzugefügt.<br>
 
+
<br>
 +
Bug: Homeverzeichniss für aktive Samba-User ist Pflicht!!!!
 +
<br>
 
Durch die dritte Zeile wird der Benutzer ''domainadmin'' zum ''Domain Admin''
 
Durch die dritte Zeile wird der Benutzer ''domainadmin'' zum ''Domain Admin''
 
  useradd domainadmin
 
  useradd domainadmin
Zeile 646: Zeile 596:
 
  useradd domainuser
 
  useradd domainuser
 
  smbpasswd -a domainuser
 
  smbpasswd -a domainuser
 +
 +
==== OPSI installieren ====
 +
Hinzufügen des Repositories
 +
echo "deb http://download.opensuse.org/repositories/home:/uibmz:/opsi:/opsi40/Debian_7.0 ./" >> /etc/apt/sources.list.d/opsi.list
 +
Signatur des Repositories importieren
 +
wget -O - http://download.opensuse.org/repositories/home:/uibmz:/opsi:/opsi40/Debian_7.0/Release.key | apt-key add -
 +
 +
Der Erfolg kann mit
 +
apt-key list
 +
überprüft werden<br>
 +
Paketliste aktualisieren
 +
apt-get update
 +
System upgraden
 +
apt-get upgrade -y
 +
 +
Die eigentlichen OPSI-Pakete installieren
 +
apt-get install -y opsi-atftpd
 +
apt-get install -y opsi-depotserver
 +
apt-get install -y opsi-configed
 +
 +
Es fehlt nocht einiges. <br>
 +
[http://download.uib.de/opsi4.0/doc/html/opsi-getting-started/opsi-getting-started.html opsi-getting-started]
 +
 +
 +
----
 +
 +
----
  
 
=== Anmerkungen ===
 
=== Anmerkungen ===
Zeile 672: Zeile 649:
 
Table 12.1. Well-Known User Default RIDs<br>
 
Table 12.1. Well-Known User Default RIDs<br>
 
[https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/groupmapping.html#id2597519 Samba Docu: Table 12.1. Well-Known User Default RIDs]
 
[https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/groupmapping.html#id2597519 Samba Docu: Table 12.1. Well-Known User Default RIDs]
 +
 +
 +
----
 +
 +
----
  
 
=== Später mal ===
 
=== Später mal ===

Aktuelle Version vom 24. September 2021, 11:00 Uhr

Zurück zu OPSI
Dieses HowTo ist obsolet und wird nicht mehr gepflegt.
Die neuste Version ist Debian-OPSI-samba4
Oder einfach in OPSI rumstöbern.

Ziel

Am Ende der Installation wird ein Host mit folgenen Funktionen zur Verfügung stehen.

Primär

  • OPSI-Server ohne mysql
  • PrimaryDomainController (PDC im NT4 Style)
  • dhcp-Server
  • name-Server
  • Router für das OPSI-Netzwerk


Sekundär

  • openvpn
  • Backup wichtiger Userdaten
  • Squid für Black- & Withelisting

Eckdaten

  • Hostname: opsi-1-lnx01
  • Netzwerkname: opsi-1.local
  • Domain-Name: opsi-1
  • IP zum OPSI-Netzwerk: 10.8.190.1 (optional zusätzlich 10.8.190.10)

Namenskonventionen in AD für Computer, Domänen, Standorte und Organisationseinheiten

Starten mit Livesystem

Rechner mit GRML vom USB-Stick starten

Das Live-System grml bietet mit grml-debootstrap mehr Komfort als das Debian-debotstrap.
grml-debootstrap

Speicher vorbereiten

Festplatten automatisch partitionierern

[1]

sfdisk /dev/sda < my.layout

Nur ein Beispiel
my.layout


# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=     2048, size=   497664, Id=83, bootable
/dev/sda2 : start=   501758, size=1953021954, Id= 5
/dev/sda3 : start=        0, size=        0, Id= 0
/dev/sda4 : start=        0, size=        0, Id= 0
/dev/sda5 : start=   501760, size=1953021952, Id=8e


RAID 1 erzeugen (mirror)

mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sda1 /dev/sdb1

LVM erzeugen

Physical Volume erzeugen.

pvcreate /dev/md0

Wir erzeugen die Volumegroup opsi_system. Diese besteht aus einem physical volume.

vgcreate opsi_system /dev/md0

Danach zwei logical volumes, eins für / und eins für /local

lvcreate -L 20G -n lv_root opsi_system
lvcreate -L 50G -n lv_local opsi_system

-L Größe des Volumes. G für Gigabyte
-n = Name des Volumes

mkfs.ext4 /dev/opsi_system/lv_root
mkfs.ext4 /dev/opsi_system/lv_local

Grundsystem installieren

grml-debootstrap --target /dev/opsi_system/lv_root --grub /dev/sda

grub2 auch auf /dev/sdb installieren

Dafür brauchen wir ein chroot in das neue System.

  • /dev/opsi_system/lv_root auf /mnt mounten


mount -t proc none /mnt/proc
mount -o bind /dev /mnt/dev
mount -t sysfs sys /mnt/sys
mount —bind /run /mnt/run
chroot /mnt /bin/bash

In der Chroot-Umgebung ausführen

grub-install --recheck --no-floppy/dev/sdb

Chroot verlassen

exit

Erststart des Systems

  • USB Stick <Bootmedium> entfernen.
reboot

Keyboard layout einstellen

dpkg-reconfigure console-data

Im ncurses-Menu auswählen.

  • Select keymap from arch list => O.K.
  • qwertz => O.K.
  • German => O.K.
  • Standard => O.K.
  • latin1 => O.K.

Sprache einstellen

dpkg-reconfigure locales

de_DE.UTF-8 auswählen und als default einstellen

Host bequem machen

Bash-completion

apt-get install bash-completion

Farbiges Promt

vim ~/.bashrc

export PS1='\[\033[0;31m\]\u\[\033[0;36m\]@\h:\[\033[0m\]\w\$ '
  • [0;36m] Türkis (cyan)
  • [0;32m] Grün (green)
  • [0;31m] Rot (red)
  • Meine Farbregeln
    • Vor dem Promt: rot für root und grün für user.
    • Hinter dem Promt: rot für Produktivserver, türkis für Testrechner und grün für Privatrechner/Workstations.


Meine .bashrc für root auf einem Testrechner.

# ~/.bashrc: executed by bash(1) for non-login shells.

export PS1='\[\033[0;31m\]\u\[\033[0;36m\]@\h:\[\033[0m\]\w\$ '
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'

# Some more alias to avoid making mistakes:
alias rm='rm -i'
# bash-completion
. /etc/bash_completion

Host vorbereiten

Hostname

Wir nennen diesen Rechner opsi-1-lnx01

vim /etc/hostname

opsi-1-lnx01 eintragen

/etc/network/interfaces

Die interfaces Datei anpassen.

vim /etc/network/interfaces

eth0 ist hier das Interface zum OPSI-Netzwerk

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth1
iface eth1 inet dhcp

auto eth0
iface eth0 inet static
       address 10.8.190.1
       broadcast 10.8.190.255
       netmask 255.255.255.0


Hosts Datei

Der Name wird mit der IP verknüpft, die die Verbindung zum OPSI-Netzwerk bereitstellt.

vim /etc/hosts

Folgene Zeile einfügen (entsprechend Installation#Eckdaten)

10.8.190.1 opsi-1-lnx01.opsi-1.local opsi-1-lnx01

Prüfen mit folgendem Befehl

getent hosts $(hostname -f)

Das Ergebniss muss ausehen wie die eingefügte Zeile in /etc/hosts

10.8.190.1 opsi-1-lnx01.opsi-1.local opsi-1-lnx01

/etc/nsswitch.conf beachten

Firewall und Forward

In die Datei /etc/rc.local folgende Zeilen VOR dem exit 0 als Minimum eintragen.
Dadurch wird das forwarding eingeschaltet, d.h. Pakete, die nicht für den Server sind, werden zu ihrem Ziel weiter geleitet.
iptables schaltet das masquerading ein. Dadurch erscheint das OPSI-Netzwerk nach außen wie ein Rechner. Ankommende Pakete werden anhand der POSTROUTING Tabelle im OPSI-Netzwerk verteilt.
Es existiert kein weiterer Schutz (dieser ist empfohlen!)

vim /etc/rc.local
echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -F
iptables -t nat -F

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

Server Software installieren

nameserver

apt-get -y install bind9 dnsutils
zone file
mkdir /etc/bind/zones

Die Dateien opsi-1.local.zone und 190.8.10.in-addr.arpa im Verzeichniss /etc/bind/zones erzeugen.

  • opsi-1.local.zone => Zuständig für die Namensauflösung (Auflösen eines Namens in eine IP)
  • 190.8.10.in-addr.arpa.zone => Zuständig für reverse mapping (Auflösung der IP in einen Hostnamen)
zones einbinden

Eine Zone wird in

vim /etc/bind/named.conf.local 

eingebunden.

//
// Do any local configuration here
//
 
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918"; 


zone "opsi-1.local" {
        type master;
        file "/etc/bind/zones/opsi-1.local.zone";
};

zone "190.8.10.in-addr.arpa" {
        type master;
        file "/etc/bind/zones/190.8.10.in-addr.arpa.zone";
};
opsi-1.local.zone
vim /etc/bind/zones/opsi-1.local.zone
; Kopf Start
; BIND zone file for opsi-1.local
;
$TTL    604800
@       IN      SOA     opsi-1-lnx01.opsi-1.local. admin.opsi-1.local. (
                        2014091001      ; Serial => JahrMonatTag0-99, ist willkürlich bis 4,294,967,295
                         604800         ; Refresh in Sekunden
                          86400         ; Retry in Sekunden
                        2419200         ; Expire in Sekunden
                         604800 )       ; Negative Cache TTL in Sekunden
;
@       IN      NS      opsi-1-lnx01.opsi-1.local.
; Kopf Ende
; Ab hier werden die Namen aufgelöst.
 
opsi-1-lnx01            IN A    10.8.190.1
server                  CNAME   opsi-1-lnx01
wpad                    CNAME   opsi-1-lnx01

printer01               IN A    10.8.190.31

win01                   IN A    10.8.190.101
win02                   IN A    10.8.190.102
win03                   IN A    10.8.190.103
win04                   IN A    10.8.190.104
win05                   IN A    10.8.190.105
190.8.10.in-addr.arpa.zone
vim /etc/bind/zones/190.8.10.in-addr.arpa.zone
;
; BIND zone file for 190.8.10.in-addr.arpa zone
;
$TTL    604800
@       IN      SOA     opsi-1-lnx01.opsi-1.local. admin.opsi-1.local. (
                       20140601801     ; Serial
                        604800         ; Refresh
                         86400         ; Retry
                       2419200         ; Expire
                        604800 )       ; Negative Cache TTL
;
@       IN      NS      opsi-1-lnx01.opsi-1.local.

 
 1                      IN PTR  opsi-1-lnx01.opsi-1.local.

31                      IN PTR  printer01.opsi-1.local.

101                     IN PTR  win01.opsi-1.local.
102                     IN PTR  win02.opsi-1.local.
103                     IN PTR  win03.opsi-1.local.
104                     IN PTR  win04.opsi-1.local.
DHCP-Client anpassen

Wenn der Server seine incoming IP über dhcp bezieht:
Damit unsere /etc/resolv.conf nicht andauernt überschrieben wird, muss das Verhalten des isc-dhcp-client geändert werden.

vim /etc/dhcp/dhclient.conf

Im Block request auskommentieren:

  • domain-name
  • domain-name-servers
  • domain-search
  • host-name
  • dhcp6.name-servers
  • dhcp6.domain-search,
  • netbios-name-servers

Damit haben wir noch ein paar weitere requests abgeschaltet. Sollte nicht schaden.

resolv.conf
vim /etc/resolv.conf
nameserver 127.0.0.1
search opsi-1.local

DHCP

apt-get install isc-dhcp-server
/etc/default/isc-dhcp-server

In /etc/default/isc-dhcp-server das etsprechende Netzwerkinterface eintragen, auf dem der DHCP-Server auf Anfragen lauschen soll.

vim /etc/default/isc-dhcp-server

In die Zeile

INTERFACES=""

das entsprechende Interface eintragen.
WICHTIG: Nur ein Interface darf rein, da die nc-opsi Tools darauf zurückgreifen!

INTERFACE="eth0"
/etc/dhcp/dhcpd.conf

Einträge für das Netzwerksegment 10.8.190.0/24.
dhcpd.conf leeren

echo > /etc/dhcp/dhcpd.conf
vim /etc/dhcp/dhcpd.conf
ddns-update-style none;
# Ist der offizielle DHCP-Server für alles in 10.8.190.0/24
authoritative;
# DNS-Domain-Name in der /etc/resolv.conf des Clienten
# Das ist nicht die Windows Domain
option domain-name "opsi-1.local";
# Nameserver
option domain-name-servers 10.8.190.1;
 
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
 
subnet 10.8.190.0 netmask 255.255.255.0 {
  # Der Range für nicht unten aufgeführte Computer per default abgeschaltet.
  # range 10.8.190.230 10.8.190.245;
  option routers 10.8.190.1;
  option broadcast-address 10.8.190.255;
  default-lease-time 600;
  max-lease-time 7200;
}


# Bei dieser Config werden die IPs über den nameserver aufgelöst.
 
host win01 { hardware ethernet 00:00:00:00:00:00;  fixed-address win01.opsi-1.local; }
host win02 { hardware ethernet 00:00:00:00:00:00;  fixed-address win02.opsi-1.local; }
host win03 { hardware ethernet 00:00:00:00:00:00;  fixed-address win03.opsi-1.local; }
host win04 { hardware ethernet 00:00:00:00:00:00;  fixed-address win04.opsi-1.local; }

Abhängigkeiten installieren

-y beantwortet die Frage nach dem "Soll installiert werden?" mit "Ja"

apt-get install -y wget lsof host python-mechanize p7zip-full cabextract openbsd-inetd samba samba-common smbclient cifs-utils samba-doc

In diesem Beispiel wird OPSI ohne mysql installiert

winbind abstellen

samba

/etc/samba/smb.conf

Bei der Installation von OPSI werden wir gefragt, ob wir Änderungen an der smb.conf zulassen wollen:
Wenn "ja", dann wurde der Block OPSI eingefügt:
Wir können aber die folgende smb.conf nutzen.
Dadurch wird samba zum Domänen-Controller im NT4-Style.
Der Name der Domäne ist OPSI-1
smb.conf ist buggy!

#
# /etc/samba/smb.conf
#

#======================= Global Settings =======================

[global]

  workgroup = OPSI-1
  server string = %h server
  wins support = no
;   wins server = w.x.y.z
  dns proxy = no
  name resolve order = lmhosts host wins bcast

#### Networking ####

  interfaces = 127.0.0.0/8 eth0
  bind interfaces only = yes


#### Debugging/Accounting ####

#   log file = /var/log/samba/log.%m
  log file = /var/log/samba/log.all
  max log size = 1000
  log level = 2
  panic action = /usr/share/samba/panic-action %d


####### Authentication #######

  security = user
  encrypt passwords = true
  passdb backend = tdbsam
  obey pam restrictions = yes
  unix password sync = no

  passwd program = /usr/bin/passwd %u
  passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

  pam password change = yes

  map to guest = bad user

########## Domains ###########

  domain logons = yes
  logon path = \\%N\profiles\%a\%U
  logon drive = H:
#   logon home = \\%N\%U
;   logon script = logon.cmd

add machine script  = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u

# Hide desktop.ini
  hide files = /desktop.ini/ntuser.ini/NTUSER.*/Thumbs.db/

########## Printing ##########

# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
#   load printers = yes

# lpr(ng) printing. You may wish to override the location of the
# printcap file
;   printing = bsd
;   printcap name = /etc/printcap

# CUPS printing.  See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
;   printing = cups
;   printcap name = cups

############ Misc ############

  usershare allow guests = no

[homes]
  comment = Home Directories
  browseable = no
  read only = no
  create mask = 0700
  directory mask = 0700
  valid users = %S

[netlogon]
  comment = Network Logon Service
  path = /local/samba/netlogon
  guest ok = yes
  read only = yes

[profiles]
  comment = Users profiles
  path = /local/samba/profiles/
  guest ok = no
  read only = no
  browseable = no
  create mask = 0600
  directory mask = 0700

[printers]
  comment = All Printers
  browseable = no
  path = /var/spool/samba
  printable = yes
  guest ok = no
  read only = yes
  create mask = 0700

[print$]
  comment = Printer Drivers
  path = /var/lib/samba/printers
  browseable = yes
  read only = yes
  guest ok = no
  write list = root, @ntadmin

# OPSI

[opsi_depot]
  available = yes
  comment = opsi depot share (ro)
  path = /var/lib/opsi/depot
  oplocks = no
  follow symlinks = yes
  level2 oplocks = no
  writeable = no
  invalid users = root

[opsi_depot_rw]
  available = yes
  comment = opsi depot share (rw)
  path = /var/lib/opsi/depot
  oplocks = no
  follow symlinks = yes
  level2 oplocks = no
  writeable = yes
  invalid users = root

[opsi_images]
  available = yes
  comment = opsi ntfs images share (rw)
  path = /var/lib/opsi/ntfs-images
  oplocks = no
  level2 oplocks = no
  writeable = yes
  invalid users = root

[opsi_config]
  available = yes
  comment = opsi config share
  path = /var/lib/opsi/config
  writeable = yes
  invalid users = root

[opsi_workbench]
  available = yes
  comment = opsi workbench
  path = /home/opsiproducts
  writeable = yes
  invalid users = root
  create mask = 0660
  directory mask = 0770
  write list = @opsiadmin

[programme]
	path = /local/smb/shares/programme/
	comment = Programmdaten
	guest ok = no
	read only = no
	create mask = 0644
	directory mask = 2755
	force user = domainuser

[software]
	path = /local/smb/shares/software/
	comment = Softwarepakete
	guest ok = no
	read only = yes

Damit die neue Config wirksam werden kann, muss samba neu gestartet werden.

/etc/init.d/samba restart
Samba-User
Maschinenaccount

Damit add machine script aus der smb.conf funktioniert, muss die entsprechende Gruppe für die PCs angelegt werden.

groupadd machines
Benutzer

Das Setup bekommt drei Samba-User

  • domainadmin: Dieser User darf alles,
  • domainjoin: Dieser User darf PCs in die Domain aufnehmen
  • domainuser: Einfacher Benutzer, keinerlei administrative Rechte

Bei der Variante groupmap wird eine unix-group einer NT-Group zugewiesen.

groupadd ntadmin
net groupmap add ntgroup="Domain Admins" unixgroup=ntadmin rid=512 type=d

Die Mitglieder der Gruppe ntadmin sind gleichzeitig Domain Admins der Windows NT4-Style Domäne.

Die Benutzer werden mit useradd ohne weitere Optionen angelegt.
Dadurch wird kein Homeverzeichniss angelegt und nach keinem Password gefragt, so dass sich die Benutzer nicht am Server anmelden können.
Mit smbpasswd werden die Benutzer zu Samba hinzugefügt.

Bug: Homeverzeichniss für aktive Samba-User ist Pflicht!!!!
Durch die dritte Zeile wird der Benutzer domainadmin zum Domain Admin

useradd domainadmin
smbpasswd -a domainadmin
addgroup  domainadmin ntadmin

Durch die dritte Zeile bekommt der Benutzer das Recht, Maschinen zur Domain hinzuzufügen

useradd domainjoin
smbpasswd -a domainjoin
net rpc rights grant 'DOMAIN\domainjoin' SeMachineAccountPrivilege -U domainadmin
useradd domainuser
smbpasswd -a domainuser

OPSI installieren

Hinzufügen des Repositories

echo "deb http://download.opensuse.org/repositories/home:/uibmz:/opsi:/opsi40/Debian_7.0 ./" >> /etc/apt/sources.list.d/opsi.list

Signatur des Repositories importieren

wget -O - http://download.opensuse.org/repositories/home:/uibmz:/opsi:/opsi40/Debian_7.0/Release.key | apt-key add -

Der Erfolg kann mit

apt-key list

überprüft werden
Paketliste aktualisieren

apt-get update

System upgraden

apt-get upgrade -y

Die eigentlichen OPSI-Pakete installieren

apt-get install -y opsi-atftpd
apt-get install -y opsi-depotserver
apt-get install -y opsi-configed

Es fehlt nocht einiges.
opsi-getting-started




Anmerkungen

/opt/pcbin und das dazugehörige samba-share [opt_pcbin] ist eine OPSI-Altlast, die der Hersteller los werden will.
Paket winxppro ohne Verzeichnisstruktur in /opt/pcbin/install
Wenn sehr alte OPSI-Pakete eingesetzt werden, könnten wir allerdings darauf angewiesen sein.

Scripte

User automatisch anlegen: Entwurf


login=<USER>
pass=<PASSWRD>
options="" # zum Beispiel das Homeverzeichniss, die shell (/bin/false, /bin/bash)

useradd $login $options
echo -ne "$pass\n$pass\n" | smbpasswd -a -s $login


Mit net rpc rights grant den Benutzern winadmin alle Rechte und joindom "SeMachineAccountPrivilege" geben.
Altetnativ:

net groupmap add ntgroup="Domain Admins" unixgroup=ntadmin rid=512 type=d

Der bekannte winadmin muss alternativ der Gruppe ntadmin angehören.
Dann muss kein net rpc rights grant .... ausgeführt werden.

net groupmap add ntgroup="Domain Users" unixgroup=ntuser rid=513 type=d

Table 12.1. Well-Known User Default RIDs
Samba Docu: Table 12.1. Well-Known User Default RIDs




Später mal

OPSI

OPSI Installation Anleitung
opsi-getting-started-stable-en.pdf Anleitung auf English
opsi-getting-started-stable-de.pdf Anleitung auf Deutsch

/etc/fstab

Herausfinden und weiterverarbeiten der UUID

 blkid /dev/opsi_system/lv_local >> /etc/fstab

Am Ende herauskommen muss in der /etc/fstab etwas in der Art:

UUID=<UUID des lv_local>       /local  ext4    defaults        0       2

lv_local einbinden auf /local

cp -a /var/lib/opsi /local
rm -rf /var/lib/opsi
ln -s /local/opsi/ /var/lib/opsi