From ca9384623054fde64510edfbee3fc291f1d09fb9 Mon Sep 17 00:00:00 2001 From: John Terpstra Date: Wed, 16 Jul 2003 05:42:10 +0000 Subject: Documentation Update for Beta3. (This used to be commit a88dc502cb3b6b2d905106675f50680bf22e2cfa) --- docs/htmldocs/pam.html | 81 +++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 40 deletions(-) (limited to 'docs/htmldocs/pam.html') diff --git a/docs/htmldocs/pam.html b/docs/htmldocs/pam.html index a0221b57e0..b3d0314add 100644 --- a/docs/htmldocs/pam.html +++ b/docs/htmldocs/pam.html @@ -1,4 +1,5 @@ -Chapter 25. PAM based Distributed Authentication

Chapter 25. PAM based Distributed Authentication

John H. Terpstra

Samba Team

Stephen Langasek

May 31, 2003

+ +Chapter 25. PAM based Distributed Authentication

Chapter 25. PAM based Distributed Authentication

John H. Terpstra

Samba Team

Stephen Langasek

May 31, 2003

This chapter you should help you to deploy winbind based authentication on any PAM enabled Unix/Linux system. Winbind can be used to enable user level application access authentication from any MS Windows NT Domain, MS Windows 200x Active Directory based domain, or any Samba @@ -9,7 +10,7 @@ In addition to knowing how to configure winbind into PAM, you will learn generic possibilities and in particular how to deploy tools like pam_smbpass.so to your advantage.

Note

The use of Winbind require more than PAM configuration alone. Please refer to the Winbind chapter. -

Features and Benefits

+

Features and Benefits

A number of Unix systems (eg: Sun Solaris), as well as the xxxxBSD family and Linux, now utilize the Pluggable Authentication Modules (PAM) facility to provide all authentication, authorization and resource control services. Prior to the introduction of PAM, a decision @@ -67,12 +68,12 @@ of distributed samba domain controllers that can provide wide are network bandwi efficient authentication services for PAM capable systems. In effect, this allows the deployment of centrally managed and maintained distributed authentication from a single user account database. -

Technical Discussion

+

Technical Discussion

PAM is designed to provide the system administrator with a great deal of flexibility in configuration of the privilege granting applications of their system. The local configuration of system security controlled by PAM is contained in one of two places: either the single system file, /etc/pam.conf; or the /etc/pam.d/ directory. -

PAM Configuration Syntax

+

PAM Configuration Syntax

In this section we discuss the correct syntax of and generic options respected by entries to these files. PAM specific tokens in the configuration file are case insensitive. The module paths, however, are case sensitive since they indicate a file's name and reflect the case dependence of typical file-systems. @@ -86,22 +87,22 @@ If the PAM authentication module (loadable link library file) is located in the default location then it is not necessary to specify the path. In the case of Linux, the default location is /lib/security. If the module is located outside the default then the path must be specified as: -

-

+

+
 auth  required  /other_path/pam_strange_module.so
-

-

Anatomy of /etc/pam.d Entries

+

+

Anatomy of /etc/pam.d Entries

The remaining information in this subsection was taken from the documentation of the Linux-PAM project. For more information on PAM, see http://ftp.kernel.org/pub/linux/libs/pam The Official Linux-PAM home page.

A general configuration line of the /etc/pam.conf file has the following form: -

-

+

+
 service-name   module-type   control-flag   module-path   args
-

-

+

+

Below, we explain the meaning of each of these tokens. The second (and more recently adopted) way of configuring Linux-PAM is via the contents of the /etc/pam.d/ directory. Once we have explained the meaning of the above tokens, we will describe this method. @@ -218,8 +219,8 @@ Once we have explained the meaning of the above tokens, we will describe this me

Each of the four keywords: required; requisite; sufficient; and optional, have an equivalent expression in terms of the [...] syntax. They are as follows: -

-

  • +

    +
    • required is equivalent to [success=ok new_authtok_reqd=ok ignore=ignore default=bad]

    • requisite is equivalent to [success=ok new_authtok_reqd=ok ignore=ignore default=die] @@ -227,8 +228,8 @@ Once we have explained the meaning of the above tokens, we will describe this me sufficient is equivalent to [success=done new_authtok_reqd=done default=ignore]

    • optional is equivalent to [success=ok new_authtok_reqd=ok default=ignore] -

    -

    +

+

Just to get a feel for the power of this new syntax, here is a taste of what you can do with it. With Linux-PAM-0.63, the notion of client plug-in agents was introduced. This is something that makes it possible for PAM to support machine-machine authentication using the transport protocol inherent to the client/server application. With the @@ -260,13 +261,13 @@ squid auth required pam_mysql.so user=passwd_query passwd=mada \ Any line in (one of) the configuration file(s), that is not formatted correctly, will generally tend (erring on the side of caution) to make the authentication process fail. A corresponding error is written to the system log files with a call to syslog(3). -

Example System Configurations

+

Example System Configurations

The following is an example /etc/pam.d/login configuration file. This example had all options been uncommented is probably not usable as it stacks many conditions before allowing successful completion of the login process. Essentially all conditions can be disabled by commenting them out except the calls to pam_pwdb.so. -

PAM: original login config

+

PAM: original login config

 #%PAM-1.0
 # The PAM configuration file for the `login' service
 #
@@ -281,10 +282,10 @@ session      required    pam_pwdb.so
 # session    optional    pam_lastlog.so
 # password   required    pam_cracklib.so retry=3
 password     required    pam_pwdb.so shadow md5
-

PAM: login using pam_smbpass

+

PAM: login using pam_smbpass

PAM allows use of replaceable modules. Those available on a sample system include: -

$/bin/ls /lib/security -

+

$/bin/ls /lib/security +
 pam_access.so    pam_ftp.so          pam_limits.so     
 pam_ncp_auth.so  pam_rhosts_auth.so  pam_stress.so     
 pam_cracklib.so  pam_group.so        pam_listfile.so   
@@ -360,7 +361,7 @@ authentication to be configured in a single central file. The
 on the basis that it allows for easier administration. As with all issues in 
 life though, every decision makes trade-offs, so you may want examine the 
 PAM documentation for further helpful information.
-

smb.conf PAM Configuration

+

smb.conf PAM Configuration

There is an option in smb.conf called obey pam restrictions. The following is from the on-line help for this option in SWAT;

@@ -375,7 +376,7 @@ ignores PAM for authentication in the case of The reason is that PAM modules cannot support the challenge/response authentication mechanism needed in the presence of SMB password encryption. -

Default: obey pam restrictions = no

Remote CIFS Authentication using winbindd.so

+

Default: obey pam restrictions = no

Remote CIFS Authentication using winbindd.so

All operating systems depend on the provision of users credentials acceptable to the platform. Unix requires the provision of a user identifier (UID) as well as a group identifier (GID). These are both simple integer type numbers that are obtained from a password backend such @@ -401,7 +402,7 @@ Microsoft Active Directory Service (ADS) in so far as reduction of wide area net The rid to unix id database is the only location where the user and group mappings are stored by winbindd. If this file is deleted or corrupted, there is no way for winbindd to determine which user and group ids correspond to Windows NT user and group rids. -

Password Synchronization using pam_smbpass.so

+

Password Synchronization using pam_smbpass.so

pam_smbpass is a PAM module which can be used on conforming systems to keep the smbpasswd (Samba password) database in sync with the unix password file. PAM (Pluggable Authentication Modules) is an API supported @@ -412,21 +413,21 @@ This module authenticates a local smbpasswd user database. If you require support for authenticating against a remote SMB server, or if you're concerned about the presence of suid root binaries on your system, it is recommended that you use pam_winbind instead. -

+

Options recognized by this module are as follows: -

Table 25.1. Options recognized by pam_smbpass

debuglog more debugging info
auditlike debug, but also logs unknown usernames
use_first_passdon't prompt the user for passwords; take them from PAM_ items instead
try_first_passtry to get the password from a previous PAM module, fall back to prompting the user
use_authtoklike try_first_pass, but *fail* if the new PAM_AUTHTOK has not been previously set. (intended for stacking password modules only)
not_set_passdon't make passwords used by this module available to other modules.
nodelaydon't insert ~1 second delays on authentication failure.
nulloknull passwords are allowed.
nonullnull passwords are not allowed. Used to override the Samba configuration.
migrateonly meaningful in an "auth" context; used to update smbpasswd file with a password used for successful authentication.
smbconf=filespecify an alternate path to the smb.conf file.

-

+

Table 25.1. Options recognized by pam_smbpass

debuglog more debugging info
auditlike debug, but also logs unknown usernames
use_first_passdon't prompt the user for passwords; take them from PAM_ items instead
try_first_passtry to get the password from a previous PAM module, fall back to prompting the user
use_authtoklike try_first_pass, but *fail* if the new PAM_AUTHTOK has not been previously set. (intended for stacking password modules only)
not_set_passdon't make passwords used by this module available to other modules.
nodelaydon't insert ~1 second delays on authentication failure.
nulloknull passwords are allowed.
nonullnull passwords are not allowed. Used to override the Samba configuration.
migrateonly meaningful in an "auth" context; used to update smbpasswd file with a password used for successful authentication.
smbconf=filespecify an alternate path to the smb.conf file.
+ Thanks go to the following people: -

Andrew Morgan, for providing the Linux-PAM +
Andrew Morgan, for providing the Linux-PAM framework, without which none of this would have happened
Christian Gafton and Andrew Morgan again, for the pam_pwdb module upon which pam_smbpass was originally based
Luke Leighton for being receptive to the idea, and for the occasional good-natured complaint about the project's status - that keep me working on it :)

. -

+ that keep me working on it :)

. +

The following are examples of the use of pam_smbpass.so in the format of Linux /etc/pam.d/ files structure. Those wishing to implement this tool on other platforms will need to adapt this appropriately. -

Password Synchronisation Configuration

+

Password Synchronisation Configuration

A sample PAM configuration that shows the use of pam_smbpass to make sure private/smbpasswd is kept in sync when /etc/passwd (/etc/shadow) is changed. Useful when an expired password might be changed by an @@ -442,7 +443,7 @@ password requisite pam_cracklib.so retry=3 password requisite pam_unix.so shadow md5 use_authtok try_first_pass password required pam_smbpass.so nullok use_authtok try_first_pass session required pam_unix.so -

Password Migration Configuration

+

Password Migration Configuration

A sample PAM configuration that shows the use of pam_smbpass to migrate from plaintext to encrypted passwords for Samba. Unlike other methods, this can be used for users who have never connected to Samba shares: @@ -461,7 +462,7 @@ password requisite pam_cracklib.so retry=3 password requisite pam_unix.so shadow md5 use_authtok try_first_pass password optional pam_smbpass.so nullok use_authtok try_first_pass session required pam_unix.so -

Mature Password Configuration

+

Mature Password Configuration

A sample PAM configuration for a 'mature' smbpasswd installation. private/smbpasswd is fully populated, and we consider it an error if the smbpasswd doesn't exist or doesn't match the Unix password. @@ -476,7 +477,7 @@ password requisite pam_cracklib.so retry=3 password requisite pam_unix.so shadow md5 use_authtok try_first_pass password required pam_smbpass.so use_authtok use_first_pass session required pam_unix.so -

Kerberos Password Integration Configuration

+

Kerberos Password Integration Configuration

A sample PAM configuration that shows pam_smbpass used together with pam_krb5. This could be useful on a Samba PDC that is also a member of a Kerberos realm. @@ -492,13 +493,13 @@ password requisite pam_cracklib.so retry=3 password optional pam_smbpass.so nullok use_authtok try_first_pass password required pam_krb5.so use_authtok try_first_pass session required pam_krb5.so -

Common Errors

+

Common Errors

PAM can be a very fickle and sensitive to configuration glitches. Here we look at a few cases from the Samba mailing list. -

pam_winbind problem

+

pam_winbind problem

I have the following PAM configuration: -

-

+	

+
 auth required /lib/security/pam_securetty.so
 auth sufficient /lib/security/pam_winbind.so
 auth sufficient /lib/security/pam_unix.so use_first_pass nullok
@@ -507,8 +508,8 @@ auth required /lib/security/pam_nologin.so
 account required /lib/security/pam_stack.so service=system-auth
 account required /lib/security/pam_winbind.so
 password required /lib/security/pam_stack.so service=system-auth
-

-

+

+

When I open a new console with [ctrl][alt][F1], then I cant log in with my user "pitie". I've tried with user "scienceu+pitie" also.

-- cgit