Aggiornamento di un Domain Controller Samba: Difference between revisions
Jump to navigation
Jump to search
Created page with "* Verificare il database su *tutti* i DC, ed eventualmente fare fix degli errori samba-tool dbcheck --cross-ncs samba-tool dbcheck --cross-ncs --fix --yes * Sui vari DC pr..." |
mNo edit summary |
||
| Line 133: | Line 133: | ||
=Upgrade del DC FMSO== | =Upgrade del DC FMSO== | ||
* Per l'ultimo DC, trasferire i ruoli FMS su un altro: | * Per l'ultimo DC, trasferire i ruoli FMS su un altro Dc già aggiornato. | ||
* Da un DC aggiornato, verificare che tutti i 7 ruoli siano elencati: | |||
samba-tool fsmo show | cut -f 1 --delimiter=' ' | wc -l | |||
7 | |||
* Verificare che siano assegnati al DC che si pensa: | |||
samba-tool fsmo show | grep -i --color metdc01 | |||
Dal DC a cui si vogliono trasferire i ruoli: | |||
samba-tool fsmo transfer --role=all -U METRICA\\Administrator | |||
* Verificare: | |||
samba-tool fsmo show | |||
* Oppure: | |||
samba-tool fsmo transfer --role=all -U METRICA\\Administrator | |||
<pre> | |||
This DC already has the 'rid' FSMO role | |||
This DC already has the 'pdc' FSMO role | |||
This DC already has the 'naming' FSMO role | |||
This DC already has the 'infrastructure' FSMO role | |||
This DC already has the 'schema' FSMO role | |||
This DC already has the 'domaindns' FSMO role | |||
This DC already has the 'forestdns' FSMO role | |||
</pre> | |||
* Ora è possibile fare l'upgrade anche dell'ultimo DC come al punto precedente. | |||
=Riferimenti= | |||
*[https://wiki.samba.org/index.php/Upgrading_a_Samba_AD_DC Upgrading a Samba AD DC - SambaWiki] | |||
Revision as of 18:28, 7 November 2022
- Verificare il database su *tutti* i DC, ed eventualmente fare fix degli errori
samba-tool dbcheck --cross-ncs samba-tool dbcheck --cross-ncs --fix --yes
- Sui vari DC procedere all'upgrade, lasciando per ultimo quello che possiede i FSMO Roles
- Verificare lo stato delle repliche:
samba-tool drs showrepl
- Deve dare per tutti i NC
Last attempt @ Mon Nov 7 17:45:37 2022 CET was successful
- Se non va, forzare la replica usando
samba-tool drs replicate DC1 DC2 NC
- Dove:
- DC1=domain controller DESTINAZIONE
- DC2=domain controller SORGENTE
- NC=Naming Context, cioè le 5 stringhe che appaiono nelle prime righe di ogni NEGHBOURS del comando samba-tool drs showrepl', ed esempio:
CN=Configuration,DC=ad,DC=metrica,DC=it CN=Schema,CN=Configuration,DC=ad,DC=metrica,DC=it DC=ad,DC=metrica,DC=it DC=DomainDnsZones,DC=ad,DC=metrica,DC=it DC=ForestDnsZones,DC=ad,DC=metrica,DC=it
- L'elenco dei NC si ottiene con
samba-tool drs showrepl grep '^DC\|^CN'| sort | uniq
- Fare il demote del DC:
samba-tool domain demote -U Administrator
- Fermare tutti i servizi samba:
systemctl stop smbd.service systemctl stop nmbd.service systemctl stop winbind.service systemctl stop samba-ad-dc.service
- Verificare:
ps ax | egrep "samba|smbd|nmbd|winbindd"
- Rinominare il file di configurazione:
mv $(smbd -b | grep "CONFIGFILE" | tr -s ' '| cut -f 3 --delimiter=' ') $(smbd -b | grep "CONFIGFILE" | tr -s ' '| cut -f 3 --delimiter=' ').old
- Verificare
ls /etc/samba
- Eliminare i vecchi DB:
for DIR in $(smbd -b | egrep "LOCKDIR|STATEDIR|CACHEDIR|PRIVATE_DIR" | tr -s ' '| cut -f 3 --delimiter=' '); do echo CLEANING $DIR; cd $DIR; find . -name \*.tdb -exec /bin/rm -f '{}' \;; find . -name \*.ldb -exec /bin/rm -f '{}' \;; done
- Aggiornare i pacchetti
- In caso di upgrade
apt update && apt-dist-upgrade
- In caso di installazione da backports:
apt install -t bullseye-backports samba krb5-user krb5-config winbind libpam-winbind libnss-winbind
- se fallisce, fare come dice:
sudo cp /usr/share/samba/smb.conf /etc/samba/smb.conf apt install -t bullseye-backports samba krb5-user krb5-config winbind libpam-winbind libnss-winbind
- Di nuovo:
- Fermare tutti i servizi samba:
systemctl stop smbd.service systemctl stop nmbd.service systemctl stop winbind.service systemctl stop samba-ad-dc.service
- Verificare:
ps ax | egrep "samba|smbd|nmbd|winbindd"
- Rimuovere il file di configurazione:
rm $(smbd -b | grep "CONFIGFILE" | tr -s ' '| cut -f 3 --delimiter=' ')
- Verificare
ls /etc/samba
- Eliminare i vecchi DB:
for DIR in $(smbd -b | egrep "LOCKDIR|STATEDIR|CACHEDIR|PRIVATE_DIR" | tr -s ' '| cut -f 3 --delimiter=' '); do echo CLEANING $DIR; cd $DIR; find . -name \*.tdb -exec /bin/rm -f '{}' \;; find . -name \*.ldb -exec /bin/rm -f '{}' \;; done
- Testare facendo un backup online del dominio dal DC che ha gli FSMO Roles:
mkdir /tmp/testbackup sudo samba-tool domain backup online --targetdir=/tmp/testbackup --server=metdc01 -U METRICA\\Administrator
- SE FALLISCE, NON andare avanti. Vedi Riferimenti per fare in place upgrade.
- Testare un domain Join temporaneo
mkdir /tmp/testjoin samba-tool domain join METRICA DC -U METRICA\\Administrator --option="netbios name = tmpdc" --targetdir=/tmp/testjoin/
- Se va a buon fine, fare il demote del DC temporaneo FORZATO dal DC che i ruoli FMS:
samba-tool domain demote -U METRICA\\Administrator --remove-other-dead-server=tmpdc
- Di nuovo:
- Fermare tutti i servizi samba:
systemctl stop smbd.service systemctl stop nmbd.service systemctl stop winbind.service systemctl stop samba-ad-dc.service
- Verificare:
ps ax | egrep "samba|smbd|nmbd|winbindd"
- Rimuovere il file di configurazione:
rm $(smbd -b | grep "CONFIGFILE" | tr -s ' '| cut -f 3 --delimiter=' ')
- Verificare
ls /etc/samba
- Eliminare i vecchi DB:
for DIR in $(smbd -b | egrep "LOCKDIR|STATEDIR|CACHEDIR|PRIVATE_DIR" | tr -s ' '| cut -f 3 --delimiter=' '); do echo CLEANING $DIR; cd $DIR; find . -name \*.tdb -exec /bin/rm -f '{}' \;; find . -name \*.ldb -exec /bin/rm -f '{}' \;; done
- Fare il join vero:
samba-tool domain join METRICA DC -U METRICA\\Administrator
- Copiare il file di config originale:
cp /etc/samba/smb.conf.old /etc/samba/smb.conf
systemctl enable samba-ad-dc systemctl unmask samba-ad-dc systemctl enable samba-ad-dc systemctl start samba-ad-dc
- Verificare sul Dc locale e quello fmso:
samba-tool drs showrepl
- Verificare il database su *tutti* i DC, ed eventualmente fare fix degli errori
samba-tool dbcheck --cross-ncs samba-tool dbcheck --cross-ncs --fix --yes
Upgrade del DC FMSO=
- Per l'ultimo DC, trasferire i ruoli FMS su un altro Dc già aggiornato.
- Da un DC aggiornato, verificare che tutti i 7 ruoli siano elencati:
samba-tool fsmo show | cut -f 1 --delimiter=' ' | wc -l 7
- Verificare che siano assegnati al DC che si pensa:
samba-tool fsmo show | grep -i --color metdc01
Dal DC a cui si vogliono trasferire i ruoli:
samba-tool fsmo transfer --role=all -U METRICA\\Administrator
- Verificare:
samba-tool fsmo show
- Oppure:
samba-tool fsmo transfer --role=all -U METRICA\\Administrator
This DC already has the 'rid' FSMO role This DC already has the 'pdc' FSMO role This DC already has the 'naming' FSMO role This DC already has the 'infrastructure' FSMO role This DC already has the 'schema' FSMO role This DC already has the 'domaindns' FSMO role This DC already has the 'forestdns' FSMO role
- Ora è possibile fare l'upgrade anche dell'ultimo DC come al punto precedente.