Installazione di Samba AD

Vieni qui per parlare della tua esperienza con Samba4, della tua opinione e dei tuoi desideri.
Dohakor
Messaggi: 13
Registrazione: 9 maggio 2020 - 14:59
Posizione: Nantes

14 maggio 2020 - 17:30

Ciao a tutti :)

Voglio installare un server Samba AD su un Raspberry Pi. Questo articolo serve per saperne di più sulla gestione di Active Directory.

Tuttavia, l'installazione non funziona.

Contesto:

Per fare questo ho un Raspberry Pi 3 B+ con Raspbian Buster Lite.

La mia rete è gestita dal mio Orange box (Router, DNS, ecc...)

Il sistema operativo del Raspberry Pi è pulito (nuova installazione).

Mi connetto al Raspberry Pi tramite SSH (prima: 192.168.1.19 / dopo: 192.168.1.150).

Collocamento :

Ecco il contenuto dei file:

/etc/nomehost :

Codice: Seleziona tutto

127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.1.1               raspberrypi
192.168.1.150           srvads.dohakor.lan      srvads
/etc/nomehost :

Codice: Seleziona tutto

srvads.dohakor.lan
Per l'indirizzo IP ho utilizzato il file /etc/dhcpcd.conf :

Codice: Seleziona tutto

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# Most distributions have NTP support.
#option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private

# Example static IP configuration:
interface eth0
static ip_address=192.168.1.150/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.1.1
static domain_name_servers=192.168.1.150 8.8.8.8

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0
Ma quello che ho cambiato è questo:

Codice: Seleziona tutto

# Example static IP configuration:
interface eth0
static ip_address=192.168.1.150/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.1.1
static domain_name_servers=192.168.1.150 8.8.8.8
/etc/krb5.conf :

Codice: Seleziona tutto

[libdefaults]
  default_realm = DOHAKOR.LAN
  dns_lookup_kdc = true
  dns_lookup_realm = false

/etc/samba/smb.conf :

Codice: Seleziona tutto

# Global parameters
[global]
        dns forwarder = 192.168.1.150
        netbios name = SRVADS
        realm = DOHAKOR.LAN
        server role = active directory domain controller
        workgroup = DOHAKOR

[netlogon]
        path = /var/lib/samba/sysvol/dohakor.lan/scripts
        read only = No

[sysvol]
        path = /var/lib/samba/sysvol
        read only = No
/etc/samba/smb.conf
Riguardo al fascicolo /etc/resolv.confAggiungo le seguenti righe:

Codice: Seleziona tutto

search dohakor.lan
nameserver 127.0.0.1
Tuttavia, dopo un riavvio, le mie modifiche sono sparite :/

Infine, il mio problema è questo: quando eseguo il comando amministratore kinit O sudo kinit administrator Ecco cosa ottengo:

Codice: Seleziona tutto

kinit: Cannot find KDC for realm "DOHAKOR.LAN" while getting initial credentials
E dopo un scavare @localhost srvads.dohakor.lan :

Codice: Seleziona tutto

; <<>> DiG 9.11.5-P4-5.1-Raspbian <<>> @localhost srvads.dohakor.lan
; (2 servers found)
;; global options: +cmd
;; connection timed out; no servers could be reached
Se qualcuno può aiutarmi, mi farebbe davvero piacere. Sto lavorando su questo problema da diversi giorni e non riesco a capire cosa lo stia causando.

grazie in anticipo :)
Avatar utente
vcardon
Esperto WAPT
Messaggi: 272
Registrazione: 06/10/2017 - 22:55
Posizione: Nantes, Francia

14 maggio 2020 - 19:44

Dohakor ha scritto: 14 maggio 2020 - 17:30 Voglio installare un server Samba AD su un Raspberry Pi. Questo per imparare di più sulla gestione di Active Directory.

Tuttavia, l'installazione non funziona.

Ho un Raspberry Pi 3 B+ con Raspbian Buster Lite.
Ciao, se è la prima volta che usi Samba-AD, ti consiglio di iniziare con una distribuzione supportata nella documentazione.

In questo modo eliminerai l'incertezza iniziale dal tuo ambito di ricerca.

Anche un vecchio PC di seconda mano da meno di 50 euro ti permetterà di usare CentOS o Debian e di fare un po' di pratica.

Il tuo approccio è intrigante e saremmo interessati a vederti raggiungere il tuo obiettivo. Temo solo che non avrai molto aiuto oltre a mettere in pratica questo primo consiglio.

Sinceramente.

Vincenzo
Vincent CARDON
Tranquillo IT
Dohakor
Messaggi: 13
Registrazione: 9 maggio 2020 - 14:59
Posizione: Nantes

14 maggio 2020 - 20:06

Ciao :)

. Benissimo. In effetti ho un vecchio PC su cui posso installare Debian.
Proverò lì.

Volevo prima fare una prova con un'installazione locale e pensavo che avrebbe funzionato su un Raspberry Pi.

Ho anche un server presso OVH (piano Starter, 1 vCore - 2 GB di RAM) ma sono un po' preoccupato per la sicurezza del mio server.
Avatar utente
vcardon
Esperto WAPT
Messaggi: 272
Registrazione: 06/10/2017 - 22:55
Posizione: Nantes, Francia

14 maggio 2020 - 20:16

Dohakor ha scritto: 14 maggio 2020 - 20:06 Anch'io ho un server presso OVH (offerta Starter 1 vCore - 2 GB di RAM) ma sono un po' preoccupato per la sicurezza del mio server.
Conservare le password vicino a casa è una buona abitudine :D

Vincenzo
Vincent CARDON
Tranquillo IT
Dohakor
Messaggi: 13
Registrazione: 9 maggio 2020 - 14:59
Posizione: Nantes

14 maggio 2020 - 20:42

Ho iniziato a provare a installarlo su una macchina virtuale Debian 10, ma ho già riscontrato alcuni problemi.

Dopo aver aggiunto il repository apt, quando eseguo `apt-get update` ottengo quanto segue:

Codice: Seleziona tutto

root@srvads:/home/jbwittner# apt-get update
Hit:1 http://security.debian.org/debian-security buster/updates InRelease
Ign:2 https://samba.tranquil.it/debian/samba-4.10 buster InRelease
Err:3 https://samba.tranquil.it/debian/samba-4.10 buster Release
  404  Not Found [IP: 195.154.18.18 443]
Hit:4 http://deb.debian.org/debian buster InRelease
Hit:5 http://deb.debian.org/debian buster-updates InRelease
Reading package lists... Done
E: The repository 'https://samba.tranquil.it/debian/samba-4.10 buster Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Dohakor
Messaggi: 13
Registrazione: 9 maggio 2020 - 14:59
Posizione: Nantes

14 maggio 2020 - 20:50

Inizialmente ho quindi effettuato una piccola installazione su una VM.

Ho ancora problemi con il comando amministratore kinit :

Codice: Seleziona tutto

kinit: Cannot find KDC for realm "DOHAKOR.LAN" while getting initial credentials
Tuttavia, ottengo risultati migliori per la parte del test DNS:

dig @localhost google.fr :

Codice: Seleziona tutto

; <<>> DiG 9.11.5-P4-5.1-Debian <<>> @localhost google.fr
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38950
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;google.fr.                     IN      A

;; ANSWER SECTION:
google.fr.              67      IN      A       172.217.22.131

;; Query time: 12 msec
;; SERVER: ::1#53(::1)
;; WHEN: Thu May 14 20:48:09 CEST 2020
;; MSG SIZE  rcvd: 43
scavare @localhost srvads.dohakor.lan

Codice: Seleziona tutto

; <<>> DiG 9.11.5-P4-5.1-Debian <<>> @localhost srvads.dohakor.lan
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23041
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;srvads.dohakor.lan.            IN      A

;; ANSWER SECTION:
srvads.dohakor.lan.     900     IN      A       192.168.1.150

;; AUTHORITY SECTION:
dohakor.lan.            3600    IN      SOA     srvads.dohakor.lan. hostmaster.dohakor.lan. 1 900 600 86400 3600

;; Query time: 0 msec
;; SERVER: ::1#53(::1)
;; WHEN: Thu May 14 20:48:21 CEST 2020
;; MSG SIZE  rcvd: 99
dig -t SRV @localhost _ldap._tcp.dohakor.lan

Codice: Seleziona tutto

; <<>> DiG 9.11.5-P4-5.1-Debian <<>> -t SRV @localhost _ldap._tcp.dohakor.lan
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46905
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;_ldap._tcp.dohakor.lan.                IN      SRV

;; ANSWER SECTION:
_ldap._tcp.dohakor.lan. 900     IN      SRV     0 100 389 srvads.dohakor.lan.

;; AUTHORITY SECTION:
dohakor.lan.            3600    IN      SOA     srvads.dohakor.lan. hostmaster.dohakor.lan. 1 900 600 86400 3600

;; Query time: 0 msec
;; SERVER: ::1#53(::1)
;; WHEN: Thu May 14 20:50:31 CEST 2020
;; MSG SIZE  rcvd: 114
Penso che la differenza sia che non ho cambiato il DNS e lo lascio puntare al mio router:

/etc/network/interfaces

Codice: Seleziona tutto

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp0s3
iface enp0s3 inet static
    address 192.168.1.150/24
    gateway 192.168.1.1

# This is an autoconfigured IPv6 interface
iface enp0s3 inet6 auto
/etc/samba/smb.conf

Codice: Seleziona tutto

# Global parameters
[global]
        dns forwarder = 192.168.1.1
        netbios name = SRVADS
        realm = DOHAKOR.LAN
        server role = active directory domain controller
        workgroup = DOHAKOR

[netlogon]
        path = /var/lib/samba/sysvol/dohakor.lan/scripts
        read only = No

[sysvol]
        path = /var/lib/samba/sysvol
        read only = No
Dohakor
Messaggi: 13
Registrazione: 9 maggio 2020 - 14:59
Posizione: Nantes

14 maggio 2020 - 22:29

Dopo aver tentato un'installazione su Debian 9 (VM), riscontro ancora lo stesso errore.
Avatar utente
dcardon
Esperto WAPT
Messaggi: 1908
Registrazione: 18 giugno 2014 - 09:58
Ubicazione: Saint Sébastien sur Loire
Contatto:

15 maggio 2020 - 11:38

Un controller di dominio non dovrebbe essere configurato con DHCP. La documentazione TIS indica chiaramente di assegnargli un indirizzo IP statico. La configurazione di resolv viene sovrascritta da dhclient. Sebbene sia possibile configurare dhclient per impedirlo, è fortemente sconsigliato farlo su un server Active Directory.

Cordiali saluti,

Denis
Denis Cardon - Tranquil IT
Condividi le tue esperienze su WAPT! Inviaci gli URL dei tuoi blog e articoli nella "La tua opinione del forum e li pubblicheremo sul di WAPT
Dohakor
Messaggi: 13
Registrazione: 9 maggio 2020 - 14:59
Posizione: Nantes

15 maggio 2020 - 12:18

Buongiorno,

Grazie per la risposta :).

È esattamente quello che ho fatto sulle mie VM, ho un indirizzo IP statico:

Codice: Seleziona tutto

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp0s3
iface enp0s3 inet static
    address 192.168.1.150/24
    gateway 192.168.1.1

# This is an autoconfigured IPv6 interface
iface enp0s3 inet6 auto
Avatar utente
dcardon
Esperto WAPT
Messaggi: 1908
Registrazione: 18 giugno 2014 - 09:58
Ubicazione: Saint Sébastien sur Loire
Contatto:

15 maggio 2020 - 14:09

Stranamente, il più delle volte è dhclient a sovrascrivere il file /etc/resolv.conf.

Altri due potenziali colpevoli sono resolvconf (il programma con il suo file di configurazione in /etc/resolvconf/resolv.conf.d/) e NetworkManager.

Puoi provare ad aggiungere qualcosa del genere a /etc/network/interfaces

Codice: Seleziona tutto

    dns-search example.com
    dns-nameservers 127.0.0.1
La tua installazione è un'installazione pulita, ma è un'installazione minima? La documentazione su https://dev.tranquil.it/samba/fr/index.html Si basa su un'installazione minimalista con solo ssh abilitato.

Sinceramente,

Denis
Denis Cardon - Tranquil IT
Condividi le tue esperienze su WAPT! Inviaci gli URL dei tuoi blog e articoli nella "La tua opinione del forum e li pubblicheremo sul di WAPT
Bloccato