README 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. pam_listfile — deny or allow services based on an arbitrary file
  2. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  3. DESCRIPTION
  4. pam_listfile is a PAM module which provides a way to deny or allow services
  5. based on an arbitrary file.
  6. The module gets the item of the type specified -- user specifies the username,
  7. PAM_USER; tty specifies the name of the terminal over which the request has
  8. been made, PAM_TTY; rhost specifies the name of the remote host (if any) from
  9. which the request was made, PAM_RHOST; and ruser specifies the name of the
  10. remote user (if available) who made the request, PAM_RUSER -- and looks for an
  11. instance of that item in the file=filename. filename contains one line per item
  12. listed. If the item is found, then if sense=allow, PAM_SUCCESS is returned,
  13. causing the authorization request to succeed; else if sense=deny, PAM_AUTH_ERR
  14. is returned, causing the authorization request to fail.
  15. If an error is encountered (for instance, if filename does not exist, or a
  16. poorly-constructed argument is encountered), then if onerr=succeed, PAM_SUCCESS
  17. is returned, otherwise if onerr=fail, PAM_AUTH_ERR or PAM_SERVICE_ERR (as
  18. appropriate) will be returned.
  19. An additional argument, apply=, can be used to restrict the application of the
  20. above to a specific user (apply=username) or a given group (apply=@groupname).
  21. This added restriction is only meaningful when used with the tty, rhost and
  22. shell items.
  23. Besides this last one, all arguments should be specified; do not count on any
  24. default behavior.
  25. No credentials are awarded by this module.
  26. OPTIONS
  27. item=[tty|user|rhost|ruser|group|shell]
  28. What is listed in the file and should be checked for.
  29. sense=[allow|deny]
  30. Action to take if found in file, if the item is NOT found in the file, then
  31. the opposite action is requested.
  32. file=/path/filename
  33. File containing one item per line. The file needs to be a plain file and
  34. not world writable.
  35. onerr=[succeed|fail]
  36. What to do if something weird happens like being unable to open the file.
  37. apply=[user|@group]
  38. Restrict the user class for which the restriction apply. Note that with
  39. item=[user|ruser|group] this does not make sense, but for item=[tty|rhost|
  40. shell] it have a meaning.
  41. quiet
  42. Do not treat service refusals or missing list files as errors that need to
  43. be logged.
  44. EXAMPLES
  45. Classic 'ftpusers' authentication can be implemented with this entry in /etc/
  46. pam.d/ftpd:
  47. #
  48. # deny ftp-access to users listed in the /etc/ftpusers file
  49. #
  50. auth required pam_listfile.so \
  51. onerr=succeed item=user sense=deny file=/etc/ftpusers
  52. Note, users listed in /etc/ftpusers file are (counterintuitively) not allowed
  53. access to the ftp service.
  54. To allow login access only for certain users, you can use a /etc/pam.d/login
  55. entry like this:
  56. #
  57. # permit login to users listed in /etc/loginusers
  58. #
  59. auth required pam_listfile.so \
  60. onerr=fail item=user sense=allow file=/etc/loginusers
  61. For this example to work, all users who are allowed to use the login service
  62. should be listed in the file /etc/loginusers. Unless you are explicitly trying
  63. to lock out root, make sure that when you do this, you leave a way for root to
  64. log in, either by listing root in /etc/loginusers, or by listing a user who is
  65. able to su to the root account.
  66. AUTHOR
  67. pam_listfile was written by Michael K. Johnson <johnsonm@redhat.com> and Elliot
  68. Lee <sopwith@cuc.edu>.