Softpanorama

Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
May the source be with you, but remember the KISS principle ;-)
Skepticism and critical thinking is not panacea, but can help to understand the world better

Selected PAM Modules

News

Authentication and Accounts Security

PAM

Recommended Books

Recommended Links

Linux_PAM
pam_unix2 pam_login pam_nologin pam_listfile pam_require pam_rootok
pam_pwcheck          
SecurID PAM_Wheel pam_xauth pam_cracklib Humor Etc

Suse 10 comes with the complicated cornucopia of 64-bit PAM modules (located in /lib64/security) including some exotic like pam_homecheck.so, pam_wheel,

-rwxr-xr-x 1 root root  13648 May  3  2007 pam_access.so
-rwxr-xr-x 1 root root  19440 May  3  2007 pam_chroot.so
-rwxr-xr-x 1 root root  12704 May  3  2007 pam_cracklib.so
-rwxr-xr-x 1 root root   7552 May  3  2007 pam_debug.so
-rwxr-xr-x 1 root root   4648 May  3  2007 pam_deny.so
-rwxr-xr-x 1 root root  15552 May  3  2007 pam_devperm.so
-rwxr-xr-x 1 root root   7368 May  3  2007 pam_echo.so
-rwxr-xr-x 1 root root  12064 May  3  2007 pam_env.so
-rwxr-xr-x 1 root root   8928 May  3  2007 pam_exec.so
drwxr-xr-x 2 root root   4096 Oct 17 14:33 pam_filter
-rwxr-xr-x 1 root root  13024 May  3  2007 pam_filter.so
-rwxr-xr-x 1 root root   6952 May  3  2007 pam_ftp.so
-rwxr-xr-x 1 root root  12792 May  3  2007 pam_group.so
-rwxr-xr-x 1 root root   8872 May  3  2007 pam_homecheck.so
-rwxr-xr-x 1 root root   9080 May  3  2007 pam_issue.so
-rwxr-xr-x 1 root root   9432 May  3  2007 pam_lastlog.so
-rwxr-xr-x 1 root root  13320 May  3  2007 pam_limits.so
-rwxr-xr-x 1 root root  11072 May  3  2007 pam_listfile.so
-rwxr-xr-x 1 root root   5976 May  3  2007 pam_localuser.so
-rwxr-xr-x 1 root root   6896 May  3  2007 pam_loginuid.so
-rwxr-xr-x 1 root root   9680 May  3  2007 pam_mail.so
-rwxr-xr-x 1 root root   8968 May  3  2007 pam_make.so
-rwxr-xr-x 1 root root  17952 May  3  2007 pam_mkhomedir.so
-rwxr-xr-x 1 root root   7504 May  3  2007 pam_mktemp.so
-rwxr-xr-x 1 root root   5688 May  3  2007 pam_motd.so
-rwxr-xr-x 1 root root  66824 May  3  2007 pam_ncp_auth.so
-rwxr-xr-x 1 root root   6872 May  3  2007 pam_nologin.so
-rwxr-xr-x 1 root root  16032 Apr 27  2007 pam_opensc.so
-rwxr-xr-x 1 root root  32600 Jun 16  2006 pam_opie.so
-rwxr-xr-x 1 root root  44088 May  3  2007 pam_passwdqc.so
-rwxr-xr-x 1 root root   5072 May  3  2007 pam_permit.so
-rwxr-xr-x 1 root root  32952 May  3  2007 pam_pwcheck.so
-rwxr-xr-x 1 root root   7984 Jun 16  2006 pam_resmgr.so
-rwxr-xr-x 1 root root   6072 May  3  2007 pam_rhosts.so
-rwxr-xr-x 1 root root  11352 May  3  2007 pam_rhosts_auth.so
-rwxr-xr-x 1 root root   4856 May  3  2007 pam_rootok.so
-rwxr-xr-x 1 root root  18056 May  4  2007 pam_rpasswd.so
-rwxr-xr-x 1 root root   7264 May  3  2007 pam_securetty.so
-rwxr-xr-x 1 root root   5976 May  3  2007 pam_shells.so
-rwxr-xr-x 1 root root  12528 May  3  2007 pam_stress.so
-rwxr-xr-x 1 root root  12928 May  3  2007 pam_succeed_if.so
-rwxr-xr-x 1 root root  11784 May  3  2007 pam_tally.so
-rwxr-xr-x 1 root root  11312 May  3  2007 pam_time.so
-rwxr-xr-x 1 root root   8448 May  3  2007 pam_umask.so
-rwxr-xr-x 2 root root  55872 May  3  2007 pam_unix.so
-rwxr-xr-x 2 root root  55872 May  3  2007 pam_unix2.so
-rwxr-xr-x 4 root root  42712 May  3  2007 pam_unix_acct.so
-rwxr-xr-x 4 root root  42712 May  3  2007 pam_unix_auth.so
-rwxr-xr-x 4 root root  42712 May  3  2007 pam_unix_passwd.so
-rwxr-xr-x 4 root root  42712 May  3  2007 pam_unix_session.so
-rwxr-xr-x 1 root root  11080 May  3  2007 pam_userdb.so
-rwxr-xr-x 1 root root   6192 May  3  2007 pam_userpass.so
-rwxr-xr-x 1 root root   5736 May  3  2007 pam_warn.so
-rwxr-xr-x 1 root root   7248 May  3  2007 pam_wheel.so
-rwxr-xr-x 1 root root  15496 May  3  2007 pam_xauth.so
			

A list from The PAM  reference guide for available modules:

pam_access - logdaemon style login access control
pam_cracklib - checks the password against dictionary words
pam_debug - debug the PAM stack
pam_deny - locking-out PAM module
pam_echo - print text messages
pam_env - set/unset environment variables
pam_exec - call an external command
pam_faildelay - change the delay on failure per-application
pam_filter - filter module
pam_ftp - module for anonymous access
pam_group - module to modify group access
pam_issue - add issue file to user prompt
pam_keyinit - display the keyinit file
pam_lastlog - display date of last login
pam_limits - limit resources
pam_listfile - deny or allow services based on an arbitrary file
pam_localuser - require users to be listed in /etc/passwd
pam_loginuid - record user's login uid to the process attribute
pam_mail - inform about available mail
pam_mkhomedir - create users home directory
pam_motd - display the motd file
pam_namespace - setup a private namespace
pam_nologin - is a PAM module that prevents users from logging into the system when /etc/nologin exists. The contents of the /etc/nologin file are displayed to the user. The pam_nologin module has no effect on the root user's ability to log in.
pam_permit - the promiscuous module
pam_pwcheck
6.25. pam_rhosts - grant access using .rhosts file
6.26. pam_rootok - gain only root access
6.27. pam_securetty is a PAM module that allows root logins only if the user is logging in on a "secure" tty, as defined by the listing in /etc/securetty. pam_securetty also checks to make sure that /etc/securetty is a plain file and not world writable. This module has no effect on non-root users and requires that the application fills in the PAM_TTY item correctly. For canonical usage, should be listed as a required authentication method before any sufficient authentication methods.
6.28. pam_selinux - set the default security context
6.29. pam_shells - check for valid login shell
6.30. pam_succeed_if - test account characteristics
6.31. pam_tally - login counter (tallying) module
6.32. pam_time - time controled access
6.33. pam_umask - set the file mode creation mask
6.34. pam_unix - traditional password authentication
6.35. pam_userdb - authenticate against a db database
6.36. pam_warn - logs all PAM items
6.37. pam_wheel - only permit root access to members of group wheel
6.38. pam_xauth - forward xauth keys between users

Common Pam modules:

Here is an example of user the ftpusers file to deny access to those listed in the file:

#
# deny ftp-access to users listed in the /etc/ftpusers file
#
ftp auth required pam_listfile.so onerr=succeed item=user sense=deny file=/etc/ftpusers
pam_mail -- [authentication (credential);session (open)]
This module provides the “you have new mail” service to the user. It can be plugged into any application that has credential hooks. It gives a single message indicating the newness of any mail it finds in the user's mail folder. This module also sets the Linux-PAM environment variable, MAIL, to the user's mail directory.

Less common PAM modules

NEWS CONTENTS

Old News ;-)

Tcl PAM

Tcl PAM provides a Tcl interface to Pluggable Authentication Modules as implemented in Linux. It implements a Tcl package that exports the client-side functionality of PAM to the Tcl programming language. This allows Tcl scripts to use PAM for authentication. Pluggable authentication modules or PAM are a mechanism to integrate multiple low-level authentication schemes into a high-level application programming interface (API), which allows for programs that rely on authentication to be written independently of the underlying authentication scheme.

freshmeat.net Project details for pam_require

pam_require is a simple Plugable Authentication Module (PAM) for Linux (and maybe other systems which use PAM). It is an account module that allows you to require a special group or user to access a service.

freshmeat.net Project details for pam_script

pam_script is a PAM that executes a script at the start and end of a session. Any PAM-aware application can use the module to perform arbitrary operations. It was originally written for cleaning up when a user logs out.

Author:
Izak Burger [contact developer]

Recipe 4.3, Creating Access Control Lists with PAM from Linux Security Cookbook
By Daniel J. Barrett,

Author's note: PAM (Pluggable Authentication Modules) is a flexible infrastructure for controlling authentication on Linux systems. In this recipe, taken from Chapter 4, "Authentication Techniques and Infrastructures," we show you how to restrict authentication to a given set of users by creating an access control list.

Problem

You would like to apply an access control list (ACL) to an existing service that does not explicitly support ACLs (e.g., telnetd, imapd, etc.).

Solution

Use the listfile PAM module.

First, make sure the server in question uses PAM for authentication, and find out which PAM service name it uses. This may be in the server documentation, or it may be clear from examining the server itself and perusing the contents of /etc/pam.d. For example, suppose you're dealing with the IMAP mail server. First notice that there is a file called /etc/pam.d/imap. Further, the result of:

# locate imapd
...
/usr/sbin/imapd

shows that the IMAP server is in /usr/sbin/imapd, and:

# ldd /usr/sbin/imapd
libpam.so.0 => /lib/libpam.so.0 (0x40027000)
...

shows that the server is dynamically linked against the PAM library (libpam.so), also suggesting that it uses PAM. In fact, the Red Hat 8.0 IMAP server uses PAM via that service name and control file ("imap").

Continuing with this example, create an ACL file for the IMAP service, let's say /etc/imapd.acl, and make sure it is not world-writable:

# chmod o-w /etc/imapd.acl

Edit this file, and place in it the usernames of those accounts authorized to use the IMAP server, one name per line. Then, add the following to /etc/pam.d/imap:

account required /lib/security/pam_listfile.so file=/etc/imapd.acl \
item=user sense=allow onerr=fail

With this configuration, only those users listed in the ACL file will be allowed access to the IMAP service. If the ACL file is missing, PAM will deny access for all accounts.

Discussion

The PAM "listfile" module is actually even more flexible than we've indicated. Entries in your ACL file can be not only usernames (item=user), but also:

The sense keyword determines how the ACL file is interpreted. sense=allow means that access will be allowed only if the configured item is in the file, and denied otherwise. sense=deny means the opposite: access will be denied only if the item is in the file, and allowed otherwise.

The onerr keyword indicates what to do if some unexpected error occurs during PAM processing of the listfile module - for instance, if the ACL file does not exist. The values are succeed and fail. fail is a more conservative option from a security standpoint, but can also lock you out of your system because of a configuration mistake!

Another keyword, apply=[user|@group], limits the restriction in question to apply only to particular users or groups. This is intended for use with the tty, rhost, and shell items. For example, using item=rhost and apply=@foo would restrict access to connections from hosts listed in the ACL file, and furthermore only to local accounts in the foo group.

To debug problems with PAM modules, look for PAM-specific error messages in /var/log/messages and /var/log/secure. (If you don't see the expected messages, check your system logger configuration. [Recipe 9.28])

Note that not all module parameters have defaults. Specifically, the file, item, and sense parameters must be supplied; if not, the module will fail with an error message like:

Dec  2 15:49:21 localhost login: PAM-listfile: Unknown sense or sense not specified

You generally do not need to restart servers using PAM: they usually re-initialize the PAM library for every authentication and reread your changed files. However, there might be exceptions.

There is no standard correspondence between a server's name and its associated PAM service. For instance, logins via Telnet are actually mediated by /bin/login, and thus use the login service. The SSH server sshd uses the same-named PAM service (sshd), whereas the IMAP server imapd uses the imap (with no "d") PAM service. And many services in turn depend on other services, notably system-auth.

See Also

See /usr/share/doc/pam-*/txts/README.pam_listfile for a list of parameters to tweak.

Recommended Links

Google matched content

Softpanorama Recommended

Top articles

Sites

The Linux-PAM Administration and Developer Guides

6. A reference guide for available modules
6.1. pam_access - logdaemon style login access control
6.2. pam_cracklib - checks the password against dictionary words
6.3. pam_debug - debug the PAM stack
6.4. pam_deny - locking-out PAM module
6.5. pam_echo - print text messages
6.6. pam_env - set/unset environment variables
6.7. pam_exec - call an external command
6.8. pam_faildelay - change the delay on failure per-application
6.9. pam_filter - filter module
6.10. pam_ftp - module for anonymous access
6.11. pam_group - module to modify group access
6.12. pam_issue - add issue file to user prompt
6.13. pam_keyinit - display the keyinit file
6.14. pam_lastlog - display date of last login
6.15. pam_limits - limit resources
6.16. pam_listfile - deny or allow services based on an arbitrary file
6.17. pam_localuser - require users to be listed in /etc/passwd
6.18. pam_loginuid - record user's login uid to the process attribute
6.19. pam_mail - inform about available mail
6.20. pam_mkhomedir - create users home directory
6.21. pam_motd - display the motd file
6.22. pam_namespace - setup a private namespace
6.23. pam_nologin - prevent non-root users from login
6.24. pam_permit - the promiscuous module
6.25. pam_rhosts - grant access using .rhosts file
6.26. pam_rootok - gain only root access
6.27. pam_securetty - limit root login to special devices
6.28. pam_selinux - set the default security context
6.29. pam_shells - check for valid login shell
6.30. pam_succeed_if - test account characteristics
6.31. pam_tally - login counter (tallying) module
6.32. pam_time - time controled access
6.33. pam_umask - set the file mode creation mask
6.34. pam_unix - traditional password authentication
6.35. pam_userdb - authenticate against a db database
6.36. pam_warn - logs all PAM items
6.37. pam_wheel - only permit root access to members of group wheel
6.38. pam_xauth - forward xauth keys between users



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2018 by Dr. Nikolai Bezroukov. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) in the author free time and without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to make a contribution, supporting development of this site and speed up access. In case softpanorama.org is down you can use the at softpanorama.info

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: October 03, 2017