Bonjour,

Il m'a été demandé de connecter une machine virtuelle sous CentOS 6 à l'Active Directory d'entreprise pour gérer l'authentification des utilisateurs. .

En m'inspirant d'une procédure du net (lien ) j'ai abouti à celle décrit ci-dessous. Elle rencontre une erreur sur le kinit.


Elle consiste à installer les paquet suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
yum -y install authconfig krb5-workstation pam_krb5 samba-common oddjob-mkhomedir
Puis à lancer :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
authconfig --disablecache --enablewinbind --enablewinbindauth --smbsecurity=ads --smbworkgroup=DOMAIN --smbrealm=DOMAIN.COM.AU --enablewinbindusedefaultdomain --winbindtemplatehomedir=/home/DOMAIN/%U --winbindtemplateshell=/bin/bash --enablekrb5 --krb5realm=DOMAIN.COM.AU --enablekrb5kdcdns --enablekrb5realmdns --enablelocauthorize --enablemkhomedir --enablepamaccess --updateall

A éditer le fichier /etc/krb5.conf tel que :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
[logging]
 default = FILE:/var/log/krb5libs.log
 kdc = FILE:/var/log/krb5kdc.log
 admin_server = FILE:/var/log/kadmind.log
 
[libdefaults]
 default_realm = DOMAIN.LOCAL
 dns_lookup_realm = true
 dns_lookup_kdc = true
 ticket_lifetime = 24h
 renew_lifetime = 7d
 forwardable = true
 
[realms]
 DOMAIN.LOCAL = {
  kdc = ad.domaine.local
  admin_server = ad.domain.local
  default_domain = domain.local
 }
 
[domain_realm]
domaine.local = DOMAIN.LOCAL
 .domaine.local = DOMAIN.LOCAL

Puis à amender le fichier /etc/samba/smb.conf :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
 
#======================= Global Settings =====================================
[global]
#--authconfig--start-line--
 
# Generated by authconfig on 2016/07/07 09:33:55
# DO NOT EDIT THIS SECTION (delimited by --start-line--/--end-line--)
# Any modification may be deleted or altered by authconfig in future
 
   workgroup = DOMAIN
   realm = DOMAIN.LOCAL
   security = ads
   idmap config * : range = 16777216-33554431
   template homedir = /home/DOMAIN/%U
   template shell = /bin/bash
   winbind use default domain = true
   winbind offline logon = false
 
#--authconfig--end-line--
   # ajouter perso
   server services = rpc, nbt, wrepl, ldap, cldap, kdc, drepl, winbind, ntp_signd, kcc, dnsupdate, dns, s3fs
# ----------------------- Network Related Options -------------------------
 
;	workgroup = DOMAIN
	server string = Samba Server Version %v
;	netbios name = ad
 
;	interfaces = lo eth0 XXX.YYY.0.2/24 XXX.YYY.1.2/24 
;	hosts allow = 127. XXX.YYY.0. XXX.YYY.1.
 
# --------------------------- Logging Options -----------------------------
	# logs split per machine
	log file = /var/log/samba/log.%m
	# max 50KB per log file, then rotate
	max log size = 50
 
# ----------------------- Domain Members Options ------------------------
# Use password server option only with security = server or if you can't
# use the DNS to locate Domain Controllers
;	security = ads
;	passdb backend = tdbsam
;	realm = domain.local
#;	password server = <NT-Server-Name>
 
# ----------------------- Domain Controller Options ------------------------
;	security = ads
;	passdb backend = tdbsam
 
;	domain master = yes 
;	domain logons = yes
 
	# the login script name depends on the machine name
;	logon script = %m.bat
	# the login script name depends on the unix user used
;	logon script = %u.bat
;	logon path = \\%L\Profiles\%u
	# disables profiles support by specifing an empty path
;	logon path =          
 
;	add user script = /usr/sbin/useradd "%u" -n -g users
;	add group script = /usr/sbin/groupadd "%g"
;	add machine script = /usr/sbin/useradd -n -c "Workstation (%u)" -M -d /nohome -s /bin/false "%u"
;	delete user script = /usr/sbin/userdel "%u"
;	delete user from group script = /usr/sbin/userdel "%u" "%g"
;	delete group script = /usr/sbin/groupdel "%g"
 
# ----------------------- Browser Control Options ----------------------------
;	local master = no
;	os level = 33
;	preferred master = yes
 
#----------------------------- Name Resolution -------------------------------
;	wins support = yes
;	wins server = w.x.y.z
;	wins proxy = yes
 
;	dns proxy = yes
 
# --------------------------- Printing Options -----------------------------
	load printers = yes
	cups options = raw
 
;	printcap name = /etc/printcap
	#obtain list of printers automatically on SystemV
;	printcap name = lpstat
;	printing = cups
 
# --------------------------- Filesystem Options ---------------------------
;	map archive = no
;	map hidden = no
;	map read only = no
;	map system = no
;	store dos attributes = yes
 
 
#============================ Share Definitions ==============================
 
[homes]
	comment = Home Directories
	browseable = no
	writable = yes
;	valid users = %S
;	valid users = MYDOMAIN\%S
 
[printers]
	comment = All Printers
	path = /var/spool/samba
	browseable = no
	guest ok = no
	writable = no
	printable = yes
 
# Un-comment the following and create the netlogon directory for Domain Logons
;	[netlogon]
;	comment = Network Logon Service
;	path = /var/lib/samba/netlogon
;	guest ok = yes
;	writable = no
;	share modes = no
 
 
# Un-comment the following to provide a specific roving profile share
# the default is to use the user's home directory
;	[Profiles]
;	path = /var/lib/samba/profiles
;	browseable = no
;	guest ok = yes
 
 
# A publicly accessible directory, but read only, except for people in
# the "staff" group
;	[public]
;	comment = Public Stuff
;	path = /home/samba
;	public = yes
;	writable = yes
;	printable = no
;	write list = +staff

Enfin j'ajoute à la fin du fichier /etc/sudoers :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
%staffgroup-it-ssh-linux ALL=(ALL:ALL) ALL
Alors j'arrive à l'étape du kinit :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
[root@KAIROSLIKE xxxx]# kinit cheminade@domain.local
Password for cheminade@domain.local: 
kinit: Preauthentication failed while getting initial credentials
[root@KAIROSLIKE xxxx]# kinit cheminade@domain.local
Password for cheminade@domain.local: 
kinit: KDC reply did not match expectations while getting initial credentials
La première erreur correspond à un mauvais mot de passe. Le lien avec le serveur est donc établi. Le comportement est identique avec le compte administrateur de l'AD.

J'ai trouvé des manips sur le net mais aucune ne m'a débloqué. Quelqu'un aurait t-il une idée?

(A noter j'ai réussi la manip avec une VM sous CentOS 7, le problème doit donc être coté client.)

Par avance merci,

François Cheminade