4 069
contributi
Riga 1 254: | Riga 1 254: | ||
</pre> | </pre> | ||
A questo punto la procedura di unione al dominio procede sulla falsariga di quella valida per Windows XP. | A questo punto la procedura di unione al dominio procede sulla falsariga di quella valida per Windows XP. | ||
== Unire un server Samba al dominio == | |||
Nel caso si disponga di un secondo server e si voglia utilizzare un unico database degli utenti è possibile seguire 2 strade differenti: | |||
# Configurare il secondo server per accedere a LDAP seguendo le indicazioni esposte per il server di dominio, ovviamente senza farlo diventare server di dominio, ma con autenticazione degli utenti | |||
# Usare il server di dominio per l'autenticazione | |||
Il primo caso non verrà trattato, mentre per il secondo occorre eseguire le seguenti operazioni sul server da aggiungere. | |||
<br/> | |||
Innanzitutto occorre configurare correttamente le ricerche DNS e installare i servizi necessari:<br/> | |||
'''/etc/resolv.conf'''<br/> | |||
<pre> | |||
search dominio.local | |||
nameserver 10.0.0.11 | |||
</pre> | |||
Per testare il corretto funzionamento del DNS potete provare il comando: | |||
<pre> | |||
# host 10.0.0.11 | |||
</pre> | |||
che deve restituire: | |||
<pre> | |||
> 11.0.0.10.in-addr.arpa domain name pointer | |||
> server.dominio.local. | |||
</pre> | |||
Installiamo ora samba e winbind: | |||
<pre> | |||
# apt-get install samba winbind | |||
</pre> | |||
Winbind è un software che permette agli utenti di accedere alla macchina Linux (e a quei servizi che prevedono l'autenticazione PAM) usando le informazioni di account già presenti in un Domain Controller Windows. Più in dettaglio winbindd fornisce informazioni su utenti e gruppi NT a nsswitch, che è un servizio presente ormai in tutte le moderne librerie C e che permette di ottenere i dati relativi ad utenti, gruppi ed host da vari tipi di fonti diverse (NIS, DNS e adesso anche Winbind); il servizio di autenticazione viene invece garantito dalla presenza di un apposito modulo PAM.<br/> | |||
Quindi stoppiamo i demoni appena installati: | |||
<pre> | |||
# /etc/init.d/samba stop | |||
# /etc/init.d/winbind stop | |||
</pre> | |||
e modifichiamo il file <tt>/etc/samba/smb.conf</tt> con le seguenti direttive: | |||
<pre> | |||
[global] | |||
# Impostazioni per il dominio | |||
security = domain | |||
workgroup = DOMINIO | |||
realm = DOMINIO.LOCAL | |||
server string = Server Samba | |||
netbios name = FILESERVER | |||
# os level deve essere inferiore a quello del PDC | |||
os level = 20 | |||
preferred master = False | |||
domain master = False | |||
# Impostazioni Wins e DNS | |||
wins server = 10.0.0.11 | |||
dns proxy = no | |||
name resolve order = wins hosts bcast | |||
# Impostazioni LDAP e utenti | |||
ldap suffix = dc=dominio,dc=local | |||
ldap machine suffix = ou=Computers | |||
ldap group suffix = ou=Groups | |||
ldap user suffix = ou=Users | |||
ldap idmap suffix = ou=Idmap | |||
ldap admin dn=cn=admin,dc=dominio,dc=local | |||
idmap backend = ldap:"ldap://10.0.0.11" | |||
# Rimappo gli utenti remoti con uid e gid diversi | |||
winbind uid = 10000-90000 | |||
winbind gid = 10000-90000 | |||
winbind enum users = yes | |||
winbind enum groups = yes | |||
winbind separator = + | |||
password server = server | |||
winbind use default domain = Yes | |||
encrypt passwords = yes | |||
# Samba LOG | |||
syslog = 0 | |||
log level = 3 passdb:1 auth:1 winbind:1 | |||
panic action = /usr/share/samba/panic-action %d | |||
max log size = 1000 | |||
log file = /var/log/samba/log.%m | |||
;template primary group = "Domain Users" | |||
# Files/Directories | |||
map acl inherit = yes | |||
case sensitive = no | |||
directory mask = 0770 | |||
[condivisione] | |||
comment = Dati Condivisi | |||
path = /dominio/dati | |||
read only = No | |||
create mask = 0660 | |||
directory mask = 2770 | |||
hide special files = yes | |||
hide files = /lost+found/ | |||
acl group control = yes | |||
inherit acls = yes | |||
map acl inherit = yes | |||
inherit permissions = yes | |||
map archive = no | |||
</pre> | |||
Fare ripartire Samba con: | |||
<pre> | |||
/etc/init.d/samba start | |||
</pre> | |||
Affinché un utente sia riconosciuto correttamente da Samba deve essere anche un utente di sistema, pertanto occorre configurare il sistema affinché peschi la lista degli utenti dal server di dominio via LDAP, esattamente come era avvenuto per il server di dominio.<br/> | |||
Installare il pacchetto '''libnss-ldap''' e configurarlo in modo da puntare al server LDAP installato sul PDC (<tt>ldap://10.0.0.11</tt>) e fornendo la base LDAP corretta (dc=dominio,dc=local) e la corretta password dell'amministratore del database ldap. | |||
<pre> | |||
# apt-get install libnss-ldap | |||
</pre> | |||
Registriamo la password di root di OpenLDAP con il comando: | |||
<pre> | |||
echo -n "password" > /etc/libnss-ldap.secret | |||
</pre> | |||
Modificate i seguenti files:<br/> | |||
'''/etc/nsswitch.conf''': | |||
<pre> | |||
passwd: compat ldap winbind | |||
group: compat ldap winbind | |||
shadow: compat ldap | |||
</pre> | |||
'''/etc/ldap/ldap.conf''': | |||
<pre> | |||
BASE dc=domimio,dc=local | |||
URI ldap://10.0.0.11:389 | |||
</pre> | |||
'''/etc/libnss-ldap.conf''': | |||
<pre> | |||
base dc=dominio,dc=local | |||
uri ldap://10.0.0.11/ | |||
ldap_version 3 | |||
# The ldap-admin account. The appropriate password is in /etc/libnss-ldap.secret. Keep the permissions right. | |||
rootbinddn cn=admin,dc=dominio,dc=local | |||
</pre> | |||
L'installazione del pacchetto libpam-ldap viene eseguita allo stesso modo di quella precedente: | |||
<pre> | |||
# apt-get install libpam-ldap | |||
# dpkg-reconfigure libpam-ldap | |||
</pre> | |||
rispondendo in questo modo alle domande poste dall'installer: | |||
* Server LDAP: 127.0.0.1 | |||
* Distinguished name (DN): dc=dominio,dc=local | |||
* LDAP version: 3 | |||
* Make local root Database admin: sí | |||
* Si richiede utente per database LDAP: no | |||
* LDAP account for root cn=admin,dc=dominio,dc=local | |||
* LDAP root password: password | |||
* Local crypt to use when changing passwords: md5 | |||
Ora è necessario andare a modificare i quattro files che gestiscono la configurazione di pam per LDAP in modo che il loro contenuto sia:<br/><br/> | |||
'''/etc/pam.d/common-account'''<br/> | |||
<pre> | |||
# | |||
#/etc/pam.d/common-account - authorization settings common to all services | |||
## | |||
This file is included from other service-specific PAM config files, | |||
# and should contain a list of the authorization modules that define | |||
# the central access policy for use on the system. The default is to | |||
# only deny service to users whose accounts are expired in /etc/shadow. | |||
# | |||
#account required pam_unix.so | |||
account sufficient pam_ldap.so | |||
account required pam_unix.so try_first_pass | |||
</pre> | |||
<br/> | |||
'''/etc/pam.d/common-auth'''<br/> | |||
<pre> | |||
# | |||
# /etc/pam.d/common-auth - authentication settings common to all services | |||
# | |||
# This file is included from other service-specific PAM config files, | |||
# and should contain a list of the authentication modules that define | |||
# the central authentication scheme for use on the system | |||
# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the | |||
# traditional Unix authentication mechanisms. | |||
# | |||
#auth required pam_unix.so nullok_secure | |||
auth sufficient pam_ldap.so | |||
auth required pam_unix.so nullok_secure use_first_pass | |||
</pre> | |||
<br/> | |||
'''/etc/pam.d/common-password'''<br/> | |||
<pre> | |||
# /etc/pam.d/common-password - password-related modules common to all services | |||
# | |||
#This file is included from other service-specific PAM config files, | |||
# and should contain a list of modules that define the services to be | |||
#used to change user passwords. The default is pam_unix | |||
# The "nullok" option allows users to change an empty password, else | |||
# empty passwords are treated as locked accounts. | |||
# | |||
# (Add `md5' after the module name to enable MD5 passwords) | |||
# | |||
# The "obscure" option replaces the old `OBSCURE_CHECKS_ENAB' option in | |||
# login.defs. Also the "min" and "max" options enforce the length of the | |||
# new password. | |||
#password required pam_unix.so nullok obscure min=4 max=8 md5 | |||
# Alternate strength checking for password. Note that this | |||
# requires the libpam-cracklib package to be installed. | |||
# You will need to comment out the password line above and | |||
# uncomment the next two in order to use this. | |||
# (Replaces the `OBSCURE_CHECKS_ENAB', `CRACKLIB_DICTPATH') | |||
# | |||
# password required pam_cracklib.so retry=3 minlen=6 difok=3 | |||
# password required pam_unix.so use_authtok nullok md5 | |||
password sufficient pam_ldap.so | |||
password required pam_unix.so nullok obscure min=4 max=8 md5 use_first_pass | |||
</pre> | |||
<br/> | |||
'''/etc/pam.d/common-session'''<br/> | |||
<pre> | |||
session sufficient pam_ldap.so | |||
session required pam_unix.so | |||
</pre> | |||
Non dimenticate di aggiungre gli utenti di sistema, per evitare l'errore udev visto in precedenza: | |||
<pre> | |||
addgroup --system tss | |||
addgroup --system kvm | |||
addgroup --system rdma | |||
addgroup --system fuse | |||
addgroup --system scanner | |||
addgroup --system nvram | |||
adduser --system tss | |||
</pre> | |||
Ora facciamo ripartire i demoni: | |||
<pre> | |||
# /etc/init.d/samba restart | |||
# /etc/init.d/winbind restart | |||
</pre> | |||
Per unire il server al dominio e creare l'utente relativo al pc è necessario dare il seguente comando: | |||
<pre> | |||
net rpc join -D dominio.local -U Administrator%password | |||
</pre> | |||
Per controllare che tutto sia andato a buon fine si può riavviare il PC e eseguire il comando: | |||
<pre> | |||
getent passwd | |||
</pre> | |||
che dovrebbe restituire sia le utenze locali sia quelle definite nel database LDAP. | |||
A questo punto è possibile creare share e assegnare permessi in base a utenti e gruppi definiti nel dominio. |