Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
linux:service:samba:installer-controleur-domaine [03/11/2018 17:54]
thierry ↷ Liens modifiés en raison d'un déplacement.
linux:service:samba:installer-controleur-domaine [04/11/2018 18:42] (Version actuelle)
thierry ↷ Liens modifiés en raison d'un déplacement.
Ligne 56: Ligne 56:
 ==== Config réseau ==== ==== Config réseau ====
 Apparement, la version 18 d'​Ubuntu utilise [[linux:​service:​netplan|cloud-init]] pour gérer le réseau... Apparement, la version 18 d'​Ubuntu utilise [[linux:​service:​netplan|cloud-init]] pour gérer le réseau...
 +<​note>​Le nom de fichier peut etre different de ''​50-cloud-init.yml''​
 +
 +''​config.yaml''​ par exemple </​note>​
 <file bash /​etc/​netplan/​50-cloud-init.yml>​ <file bash /​etc/​netplan/​50-cloud-init.yml>​
 # This file is generated from information provided by # This file is generated from information provided by
Ligne 77: Ligne 80:
 Ressources => [[linux:​service:​netplan|Netplan et Cloud-Init]] Ressources => [[linux:​service:​netplan|Netplan et Cloud-Init]]
  
-Heureusement [[:​ifconfig]] fonctionne toujours.+Heureusement [[linux:commandes:​ifconfig|ifconfig]] fonctionne toujours.
 <code bash> <code bash>
 thierry@bino:/​$ ifconfig thierry@bino:/​$ ifconfig
Ligne 128: Ligne 131:
 Donc, apparement, il y aurait un [[:dns]] sur l'​adresse locale 127.0.0.53 ? Donc, apparement, il y aurait un [[:dns]] sur l'​adresse locale 127.0.0.53 ?
  
-On va tester avec un [[:dig]]+On va tester avec un [[linux:​commandes:dig]]
 <code bash> <code bash>
 thierry@bino:/​$ dig google.fr thierry@bino:/​$ dig google.fr
Ligne 189: Ligne 192:
  
 ===== Installation ===== ===== Installation =====
->><​code bash> 
-sudo apt-get install samba smbclient krb5-user dnsutils krb5-config winbind libpam-winbind libnss-winbind 
-</​code>​ 
 <code bash> <code bash>
 sudo apt -y install samba krb5-config winbind smbclient krb5-user dnsutils sudo apt -y install samba krb5-config winbind smbclient krb5-user dnsutils
 </​code>​ </​code>​
 ''​smbclient''​ ''​krb5-user''​ ''​dnsutils''​ seront utiles pour les tests ''​smbclient''​ ''​krb5-user''​ ''​dnsutils''​ seront utiles pour les tests
 +
 +
  
 {{::​capture2610181403.jpg}} {{::​capture2610181403.jpg}}
-{{::​2610181413.jpg}} 
  
-{{::2610181405.jpg}}+On saisie le nom du "​royaume",​ ici BINOVA.LAN en MAJUSCULES (et non BINOVA.COM, comme indiqué sur l'​image,​ car ce domaine existe déjà...) 
 + 
 +{{:linux:​service:​samba:​binovalan5.jpg?​nolink|}} 
 + 
 +{{:​linux:​service:​samba:binovalan6.jpg?nolink|}}
  
  
Ligne 304: Ligne 309:
 # Global parameters # Global parameters
 [global] [global]
-        dns forwarder = 127.0.0.53+        dns forwarder = 192.168.1.1
         netbios name = BINO         netbios name = BINO
         realm = BINOVA.LAN         realm = BINOVA.LAN
Ligne 345: Ligne 350:
 nameserver 127.0.0.1 nameserver 127.0.0.1
 </​file>​ </​file>​
 +
 +A ce niveau la ni [[linux:​commandes:​nslookup]] ni [[linux:​commandes:​dig]] ne sont capable de résoudre une adresse Internet.
 +
 +Normal car le DNS en 127.0.0.1 ne fonctionne pas encore.
 ==== Démarrer le service ==== ==== Démarrer le service ====
 Avec les commandes: Avec les commandes:
Ligne 385: Ligne 394:
  
 </​code>​ </​code>​
- +=== Erreurs rencontrées ​=== 
-==== Kerberos ==== +  * ERREUR : [[##​failed_to_listen_on_000053_-_nt_status_address_already_associat|Failed ​to listen on 0.0.0.0:​53 ​NT_STATUS_ADDRESS_ALREADY_ASSOCIAT]]
-configurer et tester Kerberos +
-[[https://​linoxide.com/​ubuntu-how-to/​setup-ubuntu-active-directory-domain-controller-samba/]]+
  
  
Ligne 495: Ligne 502:
 ==== Kerberos ==== ==== Kerberos ====
 === krb5.conf === === krb5.conf ===
-Verifions le fichier de configuration de Kerberos+Verifions le fichier de configuration de [[linux:​service:​kerberos|Kerberos]]
 <code bash>​thierry@bino:​~$ cat /​etc/​krb5.conf <code bash>​thierry@bino:​~$ cat /​etc/​krb5.conf
 [libdefaults] [libdefaults]
Ligne 503: Ligne 510:
 </​code>​ </​code>​
 === Test de connexion === === Test de connexion ===
-Avec [[:kinit]]+Avec [[linux:​commandes:kinit]]
 <code bash> <code bash>
 thierry@bino:​~$ kinit administrator@BINOVA.LAN thierry@bino:​~$ kinit administrator@BINOVA.LAN
Ligne 518: Ligne 525:
 </​note>​ </​note>​
 ===== Et ensuite... ===== ===== Et ensuite... =====
-  *[[:connection_domaine|Connexion d'une station de travail Windows au domaine]]+  *[[windows:domaine:​se_connecter|Connexion d'une station de travail Windows au domaine]]
   *[[linux:​service:​samba:​admin_samba4_depuis_windows|Administration distante de Samba4 PDC]]   *[[linux:​service:​samba:​admin_samba4_depuis_windows|Administration distante de Samba4 PDC]]
-  *[[:​partage_de_fichiers_avec_samba|Mettre en place le partage de fichiers]]+  *[[linux:​service:​samba:​partage_de_fichiers_avec_samba|Mettre en place le partage de fichiers]]
  
  
Ligne 537: Ligne 544:
 thierry@binova:​~$ sudo systemctl restart samba-ad-dc thierry@binova:​~$ sudo systemctl restart samba-ad-dc
 </​code>​ </​code>​
 +
 +==== Failed to listen on 0.0.0.0:53 - NT_STATUS_ADDRESS_ALREADY_ASSOCIAT ====
 +=== L'​erreur ===
 +Lors du lancement du service on voit cette erreur:
 +
 +<code bash>
 +thierry@binova-srv:​~$ sudo systemctl status samba-ad-dc.service
 +● samba-ad-dc.service - Samba AD Daemon
 +   ​Loaded:​ loaded (/​lib/​systemd/​system/​samba-ad-dc.service;​ disabled; vendor preset: enabled)
 +   ​Active:​ active (running) since Sat 2018-11-03 18:34:54 CET; 8s ago
 +     Docs: man:​samba(8)
 +           ​man:​samba(7)
 +           ​man:​smb.conf(5)
 + Main PID: 11506 (samba)
 +   ​Status:​ "smbd: ready to serve connections..."​
 +    Tasks: 24 (limit: 3820)
 +   ​CGroup:​ /​system.slice/​samba-ad-dc.service
 +           ​├─11506 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11526 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11529 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11530 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11531 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11533 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11534 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11535 /​usr/​sbin/​smbd -D --option=server role check:​inhibit=yes --foreground
 +           ​├─11536 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11537 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11538 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11539 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11540 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11541 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11542 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11543 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11544 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11545 /​usr/​sbin/​winbindd -D --option=server role check:​inhibit=yes --foreground
 +           ​├─11548 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─11549 /​usr/​bin/​python2.7 /​usr/​sbin/​samba_dnsupdate
 +           ​├─11554 /​usr/​sbin/​smbd -D --option=server role check:​inhibit=yes --foreground
 +           ​├─11555 /​usr/​sbin/​smbd -D --option=server role check:​inhibit=yes --foreground
 +           ​├─11557 /​usr/​sbin/​winbindd -D --option=server role check:​inhibit=yes --foreground
 +           ​└─11559 /​usr/​sbin/​smbd -D --option=server role check:​inhibit=yes --foreground
 +
 +nov. 03 18:34:53 binova-srv samba[11544]: ​  ​Failed to listen on 0.0.0.0:53 - NT_STATUS_ADDRESS_ALREADY_ASSOCIAT
 +nov. 03 18:34:53 binova-srv samba[11544]:​ [2018/11/03 18:​34:​53.275324, ​ 0] ../​source4/​dns_server/​dns_server.c:​6
 +nov. 03 18:34:53 binova-srv samba[11544]: ​  ​Failed to bind to 0.0.0.0:53 TCP - NT_STATUS_ADDRESS_ALREADY_ASSOCI
 +</​code>​
 +Cela signifie que le port 53 est déjà utilisé !!!
 +
 +=== Diagnostique ===
 +
 +
 +Si je regarde qui utilise ce port avec une **[[linux:​commandes:​netstat]] -lnp | [[linux:​commandes:​grep]] :53**
 +<code bash Config qui marche pas>
 +thierry@binova-srv:​~$ sudo netstat -lnp | grep :53
 +tcp        0      0 127.0.0.53:​53 ​          ​0.0.0.0:​* ​              ​LISTEN ​     1870/​systemd-resolv
 +tcp6       ​0 ​     0 :::53                   :::​* ​                   LISTEN ​     1243/samba
 +udp        0      0 127.0.0.53:​53 ​          ​0.0.0.0:​* ​                          ​1870/​systemd-resolv
 +udp6       ​0 ​     0 :::53                   :::​* ​                               1243/samba
 +</​code>​
 +
 +On constate que j'ai un ''​systemd-resolv''​ qui est présent, alors qu'il n'est pas présent dans une config qui tourne déjà...
 +<code bash Comparaison avec une config qui marche...>​
 +thierry@bino:​~$ sudo netstat -nlp | grep :53
 +tcp        0      0 0.0.0.0:​53 ​             0.0.0.0:​* ​              ​LISTEN ​     3317/samba
 +tcp6       ​0 ​     0 :::53                   :::​* ​                   LISTEN ​     3317/samba
 +udp    43776      0 0.0.0.0:​53 ​             0.0.0.0:​* ​                          ​3317/​samba
 +udp6    2304      0 :::53                   :::​* ​                               3317/samba
 +</​code>​
 +=== Résolution ===
 +
 +
 +On supprime systemd-resolved
 +
 +Source: [[https://​askubuntu.com/​questions/​907246/​how-to-disable-systemd-resolved-in-ubuntu]]
 +
 +<code bash>
 +# On désactive le service
 +thierry@binova-srv:​~$ sudo systemctl disable systemd-resolved.service
 +Removed /​etc/​systemd/​system/​multi-user.target.wants/​systemd-resolved.service.
 +Removed /​etc/​systemd/​system/​dbus-org.freedesktop.resolve1.service.
 +
 +# On stop le service
 +thierry@binova-srv:​~$ sudo systemctl stop systemd-resolved
 +
 +# On verifie...
 +thierry@binova-srv:​~$ sudo netstat -lnp | grep :53
 +tcp6       ​0 ​     0 :::53                   :::​* ​                   LISTEN ​     1243/samba
 +udp6       ​0 ​     0 :::53                   :::​* ​                               1243/samba
 +</​code>​
 +
 +Donc le problème a disparu, relançons le service Samba pour voir si ça marche...
 +<code bash>
 +thierry@bino:​~$ sudo systemctl restart samba-ad-dc.service
 +</​code>​
 +
 +=== Vérifications ===
 +<code bash>
 +thierry@bino:​~$ sudo systemctl status samba-ad-dc.service
 +● samba-ad-dc.service - Samba AD Daemon
 +   ​Loaded:​ loaded (/​lib/​systemd/​system/​samba-ad-dc.service;​ enabled; vendor preset: enabled)
 +   ​Active:​ active (running) since Sat 2018-11-03 18:14:04 UTC; 10s ago
 +     Docs: man:​samba(8)
 +           ​man:​samba(7)
 +           ​man:​smb.conf(5)
 + Main PID: 28122 (samba)
 +   ​Status:​ "smbd: ready to serve connections..."​
 +    Tasks: 24 (limit: 2320)
 +   ​CGroup:​ /​system.slice/​samba-ad-dc.service
 +           ​├─28122 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28143 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28144 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28145 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28146 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28147 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28148 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28150 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28151 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28153 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28154 /​usr/​sbin/​smbd -D --option=server role check:​inhibit=yes --foreground
 +           ​├─28155 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28156 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28157 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28158 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28159 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28160 /​usr/​sbin/​samba --foreground --no-process-group
 +           ​├─28161 /​usr/​sbin/​winbindd -D --option=server role check:​inhibit=yes --foreground
 +           ​├─28169 /​usr/​sbin/​smbd -D --option=server role check:​inhibit=yes --foreground
 +           ​├─28170 /​usr/​sbin/​smbd -D --option=server role check:​inhibit=yes --foreground
 +           ​├─28171 /​usr/​sbin/​winbindd -D --option=server role check:​inhibit=yes --foreground
 +           ​├─28173 /​usr/​sbin/​winbindd -D --option=server role check:​inhibit=yes --foreground
 +           ​├─28175 /​usr/​sbin/​winbindd -D --option=server role check:​inhibit=yes --foreground
 +           ​└─28176 /​usr/​sbin/​smbd -D --option=server role check:​inhibit=yes --foreground
 +
 +nov. 03 18:14:01 bino samba[28122]: ​  ​Copyright Andrew Tridgell and the Samba Team 1992-2017
 +nov. 03 18:14:02 bino samba[28122]:​ [2018/11/03 18:​14:​02.198210, ​ 0] ../​source4/​smbd/​server.c:​620(binary_smbd_main)
 +nov. 03 18:14:02 bino samba[28122]: ​  ​samba:​ using '​standard'​ process model
 +nov. 03 18:14:03 bino winbindd[28161]:​ [2018/11/03 18:​14:​03.032310, ​ 0] ../​source3/​winbindd/​winbindd_cache.c:​3170(initialize_w
 +nov. 03 18:14:03 bino winbindd[28161]: ​  ​initialize_winbindd_cache:​ clearing cache and re-creating with version number 2
 +nov. 03 18:14:04 bino systemd[1]: Started Samba AD Daemon.
 +nov. 03 18:14:05 bino winbindd[28161]:​ [2018/11/03 18:​14:​04.923125, ​ 0] ../​lib/​util/​become_daemon.c:​124(daemon_ready)
 +nov. 03 18:14:05 bino winbindd[28161]: ​  ​STATUS=daemon '​winbindd'​ finished starting up and ready to serve connections
 +nov. 03 18:14:09 bino smbd[28154]:​ [2018/11/03 18:​14:​09.556902, ​ 0] ../​lib/​util/​become_daemon.c:​124(daemon_ready)
 +nov. 03 18:14:09 bino smbd[28154]: ​  ​STATUS=daemon '​smbd'​ finished starting up and ready to serve connections
 +</​code>​
 +
 +
 +On verifie avec [[linux:​commandes:​netstat|NetStat]]
 +<code bash>
 +thierry@bino:​~$ sudo netstat -nlp | grep :53
 +tcp        0      0 0.0.0.0:​53 ​             0.0.0.0:​* ​              ​LISTEN ​     28159/samba
 +tcp6       ​0 ​     0 :::53                   :::​* ​                   LISTEN ​     28159/samba
 +udp    36864      0 0.0.0.0:​53 ​             0.0.0.0:​* ​                          ​28159/​samba
 +udp6       ​0 ​     0 :::53                   :::​* ​                               28159/samba
 +</​code>​
 +Et on verifie la résolution des nom avec un [[linux:​commandes:​nslookup|NSLookup]]
 +<code bash>
 +thierry@binova-srv:​~$ nslookup google.fr
 +Server: ​        ​127.0.0.1
 +Address: ​       127.0.0.1#​53
 +
 +Non-authoritative answer:
 +Name:   ​google.fr
 +Address: 216.58.206.227
 +</​code>​
 +Notre serveur DNS est bien **127.0.0.1#​53**
 +===== Voir aussi =====
 +  * [[linux:​service:​kerberos|Service Kerberos]]
 +
 +
 +
 +