Я установил обычную аутентификацию Kerberos для своего домена. После этого все работает нормально, без проблем. Но пользователь не может изменить пароль с помощью команды Linux. При анализе этого я получил следующую ошибку в /var/log/auth.log
:
bharathi passwd [3715]: pam_unix (passwd: chauthtok): ошибка аутентификации; logname = test uid = 1000 euid = 0 tty = ruser = rhost = user = test
Ответ от сервера администрирования Kerberos.
May 11 16:44:48 bharathi krb5kdc[28795](info): AS_REQ (4 etypes {18 17 16 23}) 192.168.27.50: NEEDED_PREAUTH: test@ZMEDIA.COM for kadmin/changepw@ZMEDIA.COM, Additional pre-authentication required
May 11 16:44:48 bharathi krb5kdc[28795](info): AS_REQ (4 etypes {18 17 16 23}) 192.168.27.50: ISSUE: authtime 1368270888, etypes {rep=18 tkt=18 ses=18}, test@ZMEDIA.COM for kadmin/changepw@ZMEDIA.COM
May 11 16:45:07 bharathi krb5kdc[28795](info): AS_REQ (4 etypes {18 17 16 23}) 192.168.27.50: NEEDED_PREAUTH: test@ZMEDIA.COM for kadmin/changepw@ZMEDIA.COM, Additional pre-authentication required
May 11 16:45:07 bharathi krb5kdc[28795](info): AS_REQ (4 etypes {18 17 16 23}) 192.168.27.50: ISSUE: authtime 1368270907, etypes {rep=18 tkt=18 ses=18}, test@ZMEDIA.COM for kadmin/changepw@ZMEDIA.COM
Ответ от админ-сервера Kerberos вроде нормальный. Я подозреваю, что проблема может быть в pam.d
конфигурация.
Common-auth
#
# /etc/pam.d/common-auth - authentication settings common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authentication modules that define
# the central authentication scheme for use on the system
# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the
# traditional Unix authentication mechanisms.
#
# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
# To take advantage of this, it is recommended that you configure any
# local modules either before or after the default block, and use
# pam-auth-update to manage selection of other modules. See
# pam-auth-update(8) for details.
auth sufficient pam_krb5.so minimum_uid=1000
# here are the per-package modules (the "Primary" block)
auth [success=3 default=ignore] pam_krb5.so minimum_uid=1000
auth [success=2 default=ignore] pam_unix.so nullok_secure try_first_pass
auth [success=1 default=ignore] pam_lsass.so try_first_pass
# here's the fallback if no module succeeds
auth requisite pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump around
auth required pam_permit.so
# and here are more per-package modules (the "Additional" block)
# end of pam-auth-update config
общий счет
#
# /etc/pam.d/common-account - authorization settings common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authorization modules that define
# the central access policy for use on the system. The default is to
# only deny service to users whose accounts are expired in /etc/shadow.
#
# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
# To take advantage of this, it is recommended that you configure any
# local modules either before or after the default block, and use
# pam-auth-update to manage selection of other modules. See
# pam-auth-update(8) for details.
#
account required pam_krb5.so minimum_uid=1000
# here are the per-package modules (the "Primary" block)
account [success=3 new_authtok_reqd=done default=ignore] pam_unix.so
account [success=ok new_authtok_reqd=ok default=ignore] pam_lsass.so unknown_ok
account [success=1 new_authtok_reqd=done default=ignore] pam_lsass.so
# here's the fallback if no module succeeds
account requisite pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump around
account required pam_permit.so
# and here are more per-package modules (the "Additional" block)
# end of pam-auth-update config
общий пароль
#
# /etc/pam.d/common-password - password-related modules common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of modules that define the services to be
# used to change user passwords. The default is pam_unix.
# Explanation of pam_unix options:
#
# The "sha512" option enables salted SHA512 passwords. Without this option,
# the default is Unix crypt. Prior releases used the option "md5".
#
# The "obscure" option replaces the old `OBSCURE_CHECKS_ENAB' option in
# login.defs.
#
# See the pam_unix manpage for other options.
# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
# To take advantage of this, it is recommended that you configure any
# local modules either before or after the default block, and use
# pam-auth-update to manage selection of other modules. See
# pam-auth-update(8) for details.
# here are the per-package modules (the "Primary" block)
password requisite pam_krb5.so minimum_uid=1000
password [success=2 default=ignore] pam_unix.so obscure use_authtok try_first_pass sha512
password [success=1 default=ignore] pam_lsass.so use_authtok try_first_pass
# here's the fallback if no module succeeds
password requisite pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump around
password required pam_permit.so
# and here are more per-package modules (the "Additional" block)
password optional pam_gnome_keyring.so
# end of pam-auth-update config
Что я здесь делаю не так?
Ваш auth.log содержит следующую подсказку:
bharathi passwd [3715]: pam_unix(passwd: chauthtok): ошибка аутентификации; logname = test uid =1000 euid = 0 tty = ruser = rhost = user = test
При взгляде на common-password соответствующие строки:
пароль реквизит pam_krb5.so minimum_uid = 1000
Модуль Kerberos-PAM будет обрабатывать только пользователей с uid> = 1000, что хорошо для локальных учетных записей, например root
работает даже при сбое сети.
В реквизит помечает этот модуль как всегда требуемый, поэтому в этом случае успех сохраняется как результат, но следующие модули все еще выполняются.
пароль [успех = 2 по умолчанию =игнорировать] pam_unix.so неясный use_authtok try_first_pass sha512
Следующий модуль - неудачный unix модуль, который теперь пытается изменить пароль в /etc/shadow
. Но поскольку это пользователь Kerberos, вероятно, нет записи в /etc/shadow
. Из-за игнорировать этот сбой игнорируется: ошибка все еще регистрируется, но результат для стека PAM не изменяется.
Но затем следует следующий модуль:
реквизит пароля pam_deny.so
Это, наконец, перезапишет предыдущий код результата на Отрицать и тем самым отклонить запрос на изменение пароля.
Если достаточно изменить только пароль Kerbers, измените реквизит для Kerberos в [success = 3 по умолчанию = игнорировать], который пропустит следующие 3 модуля (unix, lsass, deny) в случае успеха и, таким образом, продолжит pam_permit.so, что заставляет стек наконец вернуть успех.
Если, с другой стороны, у вас есть пользователи с обеими записями в / etc / shadow и в Kerberos, и вы хотите, чтобы эти два пароля были синхронизированы, становится намного сложнее получить правильный. Что-то вроде следующего должно работать:
/etc/shadow
.В противном случае require
изменение пароля Unix для успешного выполнения.
password [success=3 user_unknown=ignore default=ignore] pam_krb5.so minimum_uid=1000
password [success=3 default=ignore] pam_unix.so obscure use_authtok try_first_pass sha512
password [success=2 default=ignore] pam_lsass.so use_authtok try_first_pass
password requisite pam_deny.so
password [success=ok default=ignore] pam_unix.so obscure use_authtok use_first_pass sha512
password required pam_permit.so