This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.(This used to...
[jra/samba/.git] / docs / htmldocs / pam.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >Configuring PAM for distributed but centrally 
6 managed authentication</TITLE
7 ><META
8 NAME="GENERATOR"
9 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
10 "><LINK
11 REL="HOME"
12 TITLE="SAMBA Project Documentation"
13 HREF="samba-howto-collection.html"><LINK
14 REL="UP"
15 TITLE="Optional configuration"
16 HREF="optional.html"><LINK
17 REL="PREVIOUS"
18 TITLE="UNIX Permission Bits and Windows NT Access Control Lists"
19 HREF="unix-permissions.html"><LINK
20 REL="NEXT"
21 TITLE="Hosting a Microsoft Distributed File System tree on Samba"
22 HREF="msdfs.html"></HEAD
23 ><BODY
24 CLASS="CHAPTER"
25 BGCOLOR="#FFFFFF"
26 TEXT="#000000"
27 LINK="#0000FF"
28 VLINK="#840084"
29 ALINK="#0000FF"
30 ><DIV
31 CLASS="NAVHEADER"
32 ><TABLE
33 SUMMARY="Header navigation table"
34 WIDTH="100%"
35 BORDER="0"
36 CELLPADDING="0"
37 CELLSPACING="0"
38 ><TR
39 ><TH
40 COLSPAN="3"
41 ALIGN="center"
42 >SAMBA Project Documentation</TH
43 ></TR
44 ><TR
45 ><TD
46 WIDTH="10%"
47 ALIGN="left"
48 VALIGN="bottom"
49 ><A
50 HREF="unix-permissions.html"
51 ACCESSKEY="P"
52 >Prev</A
53 ></TD
54 ><TD
55 WIDTH="80%"
56 ALIGN="center"
57 VALIGN="bottom"
58 ></TD
59 ><TD
60 WIDTH="10%"
61 ALIGN="right"
62 VALIGN="bottom"
63 ><A
64 HREF="msdfs.html"
65 ACCESSKEY="N"
66 >Next</A
67 ></TD
68 ></TR
69 ></TABLE
70 ><HR
71 ALIGN="LEFT"
72 WIDTH="100%"></DIV
73 ><DIV
74 CLASS="CHAPTER"
75 ><H1
76 ><A
77 NAME="PAM">Chapter 12. Configuring PAM for distributed but centrally 
78 managed authentication</H1
79 ><DIV
80 CLASS="SECT1"
81 ><H1
82 CLASS="SECT1"
83 ><A
84 NAME="AEN1788">12.1. Samba and PAM</H1
85 ><P
86 >A number of Unix systems (eg: Sun Solaris), as well as the 
87 xxxxBSD family and Linux, now utilize the Pluggable Authentication 
88 Modules (PAM) facility to provide all authentication, 
89 authorization and resource control services. Prior to the 
90 introduction of PAM, a decision to use an alternative to 
91 the system password database (<TT
92 CLASS="FILENAME"
93 >/etc/passwd</TT
94 >) 
95 would require the provision of alternatives for all programs that provide 
96 security services. Such a choice would involve provision of 
97 alternatives to such programs as: <B
98 CLASS="COMMAND"
99 >login</B
100 >, 
101 <B
102 CLASS="COMMAND"
103 >passwd</B
104 >, <B
105 CLASS="COMMAND"
106 >chown</B
107 >, etc.</P
108 ><P
109 >PAM provides a mechanism that disconnects these security programs 
110 from the underlying authentication/authorization infrastructure.
111 PAM is configured either through one file <TT
112 CLASS="FILENAME"
113 >/etc/pam.conf</TT
114 > (Solaris), 
115 or by editing individual files that are located in <TT
116 CLASS="FILENAME"
117 >/etc/pam.d</TT
118 >.</P
119 ><P
120 >The following is an example <TT
121 CLASS="FILENAME"
122 >/etc/pam.d/login</TT
123 > configuration file. 
124 This example had all options been uncommented is probably not usable 
125 as it stacks many conditions before allowing successful completion 
126 of the login process. Essentially all conditions can be disabled 
127 by commenting them out except the calls to <TT
128 CLASS="FILENAME"
129 >pam_pwdb.so</TT
130 >.</P
131 ><P
132 ><PRE
133 CLASS="PROGRAMLISTING"
134 >#%PAM-1.0
135 # The PAM configuration file for the `login' service
136 #
137 auth            required        pam_securetty.so
138 auth            required        pam_nologin.so
139 # auth          required        pam_dialup.so
140 # auth          optional        pam_mail.so
141 auth            required        pam_pwdb.so shadow md5
142 # account       requisite       pam_time.so
143 account         required        pam_pwdb.so
144 session         required        pam_pwdb.so
145 # session       optional        pam_lastlog.so
146 # password      required        pam_cracklib.so retry=3
147 password        required        pam_pwdb.so shadow md5</PRE
148 ></P
149 ><P
150 >PAM allows use of replacable modules. Those available on a 
151 sample system include:</P
152 ><P
153 ><PRE
154 CLASS="PROGRAMLISTING"
155 >$ /bin/ls /lib/security
156 pam_access.so    pam_ftp.so          pam_limits.so     
157 pam_ncp_auth.so  pam_rhosts_auth.so  pam_stress.so     
158 pam_cracklib.so  pam_group.so        pam_listfile.so   
159 pam_nologin.so   pam_rootok.so       pam_tally.so      
160 pam_deny.so      pam_issue.so        pam_mail.so       
161 pam_permit.so    pam_securetty.so    pam_time.so       
162 pam_dialup.so    pam_lastlog.so      pam_mkhomedir.so  
163 pam_pwdb.so      pam_shells.so       pam_unix.so       
164 pam_env.so       pam_ldap.so         pam_motd.so       
165 pam_radius.so    pam_smbpass.so      pam_unix_acct.so  
166 pam_wheel.so     pam_unix_auth.so    pam_unix_passwd.so
167 pam_userdb.so    pam_warn.so         pam_unix_session.so</PRE
168 ></P
169 ><P
170 >The following example for the login program replaces the use of 
171 the <TT
172 CLASS="FILENAME"
173 >pam_pwdb.so</TT
174 > module which uses the system 
175 password database (<TT
176 CLASS="FILENAME"
177 >/etc/passwd</TT
178 >,
179 <TT
180 CLASS="FILENAME"
181 >/etc/shadow</TT
182 >, <TT
183 CLASS="FILENAME"
184 >/etc/group</TT
185 >) with 
186 the module <TT
187 CLASS="FILENAME"
188 >pam_smbpass.so</TT
189 > which uses the Samba 
190 database which contains the Microsoft MD4 encrypted password 
191 hashes. This database is stored in either 
192 <TT
193 CLASS="FILENAME"
194 >/usr/local/samba/private/smbpasswd</TT
195 >, 
196 <TT
197 CLASS="FILENAME"
198 >/etc/samba/smbpasswd</TT
199 >, or in 
200 <TT
201 CLASS="FILENAME"
202 >/etc/samba.d/smbpasswd</TT
203 >, depending on the 
204 Samba implementation for your Unix/Linux system. The 
205 <TT
206 CLASS="FILENAME"
207 >pam_smbpass.so</TT
208 > module is provided by 
209 Samba version 2.2.1 or later. It can be compiled by specifying the 
210 <B
211 CLASS="COMMAND"
212 >--with-pam_smbpass</B
213 > options when running Samba's
214 <TT
215 CLASS="FILENAME"
216 >configure</TT
217 > script.  For more information
218 on the <TT
219 CLASS="FILENAME"
220 >pam_smbpass</TT
221 > module, see the documentation
222 in the <TT
223 CLASS="FILENAME"
224 >source/pam_smbpass</TT
225 > directory of the Samba 
226 source distribution.</P
227 ><P
228 ><PRE
229 CLASS="PROGRAMLISTING"
230 >#%PAM-1.0
231 # The PAM configuration file for the `login' service
232 #
233 auth            required        pam_smbpass.so nodelay
234 account         required        pam_smbpass.so nodelay
235 session         required        pam_smbpass.so nodelay
236 password        required        pam_smbpass.so nodelay</PRE
237 ></P
238 ><P
239 >The following is the PAM configuration file for a particular 
240 Linux system. The default condition uses <TT
241 CLASS="FILENAME"
242 >pam_pwdb.so</TT
243 >.</P
244 ><P
245 ><PRE
246 CLASS="PROGRAMLISTING"
247 >#%PAM-1.0
248 # The PAM configuration file for the `samba' service
249 #
250 auth       required     /lib/security/pam_pwdb.so nullok nodelay shadow audit
251 account    required     /lib/security/pam_pwdb.so audit nodelay
252 session    required     /lib/security/pam_pwdb.so nodelay
253 password   required     /lib/security/pam_pwdb.so shadow md5</PRE
254 ></P
255 ><P
256 >In the following example the decision has been made to use the 
257 smbpasswd database even for basic samba authentication. Such a 
258 decision could also be made for the passwd program and would 
259 thus allow the smbpasswd passwords to be changed using the passwd 
260 program.</P
261 ><P
262 ><PRE
263 CLASS="PROGRAMLISTING"
264 >#%PAM-1.0
265 # The PAM configuration file for the `samba' service
266 #
267 auth       required     /lib/security/pam_smbpass.so nodelay
268 account    required     /lib/security/pam_pwdb.so audit nodelay
269 session    required     /lib/security/pam_pwdb.so nodelay
270 password   required     /lib/security/pam_smbpass.so nodelay smbconf=/etc/samba.d/smb.conf</PRE
271 ></P
272 ><P
273 >Note: PAM allows stacking of authentication mechanisms. It is 
274 also possible to pass information obtained within one PAM module through 
275 to the next module in the PAM stack. Please refer to the documentation for 
276 your particular system implementation for details regarding the specific 
277 capabilities of PAM in this environment. Some Linux implmentations also 
278 provide the <TT
279 CLASS="FILENAME"
280 >pam_stack.so</TT
281 > module that allows all 
282 authentication to be configured in a single central file. The 
283 <TT
284 CLASS="FILENAME"
285 >pam_stack.so</TT
286 > method has some very devoted followers 
287 on the basis that it allows for easier administration. As with all issues in 
288 life though, every decision makes trade-offs, so you may want examine the 
289 PAM documentation for further helpful information.</P
290 ></DIV
291 ><DIV
292 CLASS="SECT1"
293 ><H1
294 CLASS="SECT1"
295 ><A
296 NAME="AEN1832">12.2. Distributed Authentication</H1
297 ><P
298 >The astute administrator will realize from this that the 
299 combination of <TT
300 CLASS="FILENAME"
301 >pam_smbpass.so</TT
302 >, 
303 <B
304 CLASS="COMMAND"
305 >winbindd</B
306 >, and <B
307 CLASS="COMMAND"
308 >rsync</B
309 > (see
310 <A
311 HREF="http://rsync.samba.org/"
312 TARGET="_top"
313 >http://rsync.samba.org/</A
314 >)
315 will allow the establishment of a centrally managed, distributed 
316 user/password database that can also be used by all 
317 PAM (eg: Linux) aware programs and applications. This arrangement 
318 can have particularly potent advantages compared with the 
319 use of Microsoft Active Directory Service (ADS) in so far as 
320 reduction of wide area network authentication traffic.</P
321 ></DIV
322 ><DIV
323 CLASS="SECT1"
324 ><H1
325 CLASS="SECT1"
326 ><A
327 NAME="AEN1839">12.3. PAM Configuration in smb.conf</H1
328 ><P
329 >There is an option in smb.conf called <A
330 HREF="smb.conf.5.html#OBEYPAMRESTRICTIONS"
331 TARGET="_top"
332 >obey pam restrictions</A
333 >. 
334 The following is from the on-line help for this option in SWAT;</P
335 ><P
336 >When Samba 2.2 is configure to enable PAM support (i.e. 
337 <TT
338 CLASS="CONSTANT"
339 >--with-pam</TT
340 >), this parameter will 
341 control whether or not Samba should obey PAM's account 
342 and session management directives. The default behavior 
343 is to use PAM for clear text authentication only and to 
344 ignore any account or session management. Note that Samba always 
345 ignores PAM for authentication in the case of 
346 <A
347 HREF="smb.conf.5.html#ENCRYPTPASSWORDS"
348 TARGET="_top"
349 >encrypt passwords = yes</A
350 >. 
351 The reason is that PAM modules cannot support the challenge/response 
352 authentication mechanism needed in the presence of SMB 
353 password encryption. </P
354 ><P
355 >Default: <B
356 CLASS="COMMAND"
357 >obey pam restrictions = no</B
358 ></P
359 ></DIV
360 ></DIV
361 ><DIV
362 CLASS="NAVFOOTER"
363 ><HR
364 ALIGN="LEFT"
365 WIDTH="100%"><TABLE
366 SUMMARY="Footer navigation table"
367 WIDTH="100%"
368 BORDER="0"
369 CELLPADDING="0"
370 CELLSPACING="0"
371 ><TR
372 ><TD
373 WIDTH="33%"
374 ALIGN="left"
375 VALIGN="top"
376 ><A
377 HREF="unix-permissions.html"
378 ACCESSKEY="P"
379 >Prev</A
380 ></TD
381 ><TD
382 WIDTH="34%"
383 ALIGN="center"
384 VALIGN="top"
385 ><A
386 HREF="samba-howto-collection.html"
387 ACCESSKEY="H"
388 >Home</A
389 ></TD
390 ><TD
391 WIDTH="33%"
392 ALIGN="right"
393 VALIGN="top"
394 ><A
395 HREF="msdfs.html"
396 ACCESSKEY="N"
397 >Next</A
398 ></TD
399 ></TR
400 ><TR
401 ><TD
402 WIDTH="33%"
403 ALIGN="left"
404 VALIGN="top"
405 >UNIX Permission Bits and Windows NT Access Control Lists</TD
406 ><TD
407 WIDTH="34%"
408 ALIGN="center"
409 VALIGN="top"
410 ><A
411 HREF="optional.html"
412 ACCESSKEY="U"
413 >Up</A
414 ></TD
415 ><TD
416 WIDTH="33%"
417 ALIGN="right"
418 VALIGN="top"
419 >Hosting a Microsoft Distributed File System tree on Samba</TD
420 ></TR
421 ></TABLE
422 ></DIV
423 ></BODY
424 ></HTML
425 >