README 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. pam_faillock — Module counting authentication failures during a specified
  2. interval
  3. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  4. DESCRIPTION
  5. This module maintains a list of failed authentication attempts per user during
  6. a specified interval and locks the account in case there were more than deny
  7. consecutive failed authentications.
  8. Normally, failed attempts to authenticate root will not cause the root account
  9. to become blocked, to prevent denial-of-service: if your users aren't given
  10. shell accounts and root may only login via su or at the machine console (not
  11. telnet/rsh, etc), this is safe.
  12. OPTIONS
  13. {preauth|authfail|authsucc}
  14. This argument must be set accordingly to the position of this module
  15. instance in the PAM stack.
  16. The preauth argument must be used when the module is called before the
  17. modules which ask for the user credentials such as the password. The module
  18. just examines whether the user should be blocked from accessing the service
  19. in case there were anomalous number of failed consecutive authentication
  20. attempts recently. This call is optional if authsucc is used.
  21. The authfail argument must be used when the module is called after the
  22. modules which determine the authentication outcome, failed. Unless the user
  23. is already blocked due to previous authentication failures, the module will
  24. record the failure into the appropriate user tally file.
  25. The authsucc argument must be used when the module is called after the
  26. modules which determine the authentication outcome, succeeded. Unless the
  27. user is already blocked due to previous authentication failures, the module
  28. will then clear the record of the failures in the respective user tally
  29. file. Otherwise it will return authentication error. If this call is not
  30. done, the pam_faillock will not distinguish between consecutive and
  31. non-consecutive failed authentication attempts. The preauth call must be
  32. used in such case. Due to complications in the way the PAM stack can be
  33. configured it is also possible to call pam_faillock as an account module.
  34. In such configuration the module must be also called in the preauth stage.
  35. conf=/path/to/config-file
  36. Use another configuration file instead of the default /etc/security/
  37. faillock.conf.
  38. The options for configuring the module behavior are described in the
  39. faillock.conf(5) manual page. The options specified on the module command line
  40. override the values from the configuration file.
  41. NOTES
  42. Configuring options on the module command line is not recommend. The /etc/
  43. security/faillock.conf should be used instead.
  44. The setup of pam_faillock in the PAM stack is different from the pam_tally2
  45. module setup.
  46. Individual files with the failure records are created as owned by the user.
  47. This allows pam_faillock.so module to work correctly when it is called from a
  48. screensaver.
  49. Note that using the module in preauth without the silent option specified in /
  50. etc/security/faillock.conf or with requisite control field leaks an information
  51. about existence or non-existence of a user account in the system because the
  52. failures are not recorded for the unknown users. The message about the user
  53. account being locked is never displayed for non-existing user accounts allowing
  54. the adversary to infer that a particular account is not existing on a system.
  55. EXAMPLES
  56. Here are two possible configuration examples for /etc/pam.d/login. They make
  57. pam_faillock to lock the account after 4 consecutive failed logins during the
  58. default interval of 15 minutes. Root account will be locked as well. The
  59. accounts will be automatically unlocked after 20 minutes.
  60. In the first example the module is called only in the auth phase and the module
  61. does not print any information about the account being blocked by pam_faillock.
  62. The preauth call can be added to tell users that their logins are blocked by
  63. the module and also to abort the authentication without even asking for
  64. password in such case.
  65. /etc/security/faillock.conf file example:
  66. deny=4
  67. unlock_time=1200
  68. silent
  69. /etc/pam.d/config file example:
  70. auth required pam_securetty.so
  71. auth required pam_env.so
  72. auth required pam_nologin.so
  73. # optionally call: auth requisite pam_faillock.so preauth
  74. # to display the message about account being locked
  75. auth [success=1 default=bad] pam_unix.so
  76. auth [default=die] pam_faillock.so authfail
  77. auth sufficient pam_faillock.so authsucc
  78. auth required pam_deny.so
  79. account required pam_unix.so
  80. password required pam_unix.so shadow
  81. session required pam_selinux.so close
  82. session required pam_loginuid.so
  83. session required pam_unix.so
  84. session required pam_selinux.so open
  85. In the second example the module is called both in the auth and account phases
  86. and the module informs the authenticating user when the account is locked if
  87. silent option is not specified in the faillock.conf.
  88. auth required pam_securetty.so
  89. auth required pam_env.so
  90. auth required pam_nologin.so
  91. auth required pam_faillock.so preauth
  92. # optionally use requisite above if you do not want to prompt for the password
  93. # on locked accounts
  94. auth sufficient pam_unix.so
  95. auth [default=die] pam_faillock.so authfail
  96. auth required pam_deny.so
  97. account required pam_faillock.so
  98. # if you drop the above call to pam_faillock.so the lock will be done also
  99. # on non-consecutive authentication failures
  100. account required pam_unix.so
  101. password required pam_unix.so shadow
  102. session required pam_selinux.so close
  103. session required pam_loginuid.so
  104. session required pam_unix.so
  105. session required pam_selinux.so open
  106. AUTHOR
  107. pam_faillock was written by Tomas Mraz.