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