From: "Dmitry V. Levin" <ldv@altlinux.org> To: ALT Linux Community general discussions <community@lists.altlinux.org> Subject: Re: [Comm] "pam_mount password:" - неаккуратненько как-то Date: Mon, 22 Jun 2009 20:48:24 +0400 Message-ID: <20090622164824.GA7698@wo.int.altlinux.org> (raw) In-Reply-To: <d77783290906212341n3ab5be5fna1e6030eb00aac59@mail.gmail.com> [-- Attachment #1: Type: text/plain, Size: 6239 bytes --] On Mon, Jun 22, 2009 at 11:41:36AM +0500, Денис Черносов wrote: > 20 июня 2009 г. 4:38 пользователь Dmitry V. Levin (ldv@altlinux.org) написал: > > On Fri, Jun 19, 2009 at 11:46:36AM +0500, Денис Черносов wrote: > >> День добрый всем! > >> > >> auth optional pam_mount.so > >> auth sufficient pam_tcb.so shadow fork prefix=$2a$ count=8 > >> nullok use_first_pass > >> auth requisite pam_succeed_if.so uid >= 500 quiet > >> auth required pam_ldap.so use_first_pass > >> > >> В пятом бранче pam_mount, будучи поставленный первым в auth (а > >> по-другому его заставить работать у меня не получилось), меняет строку > >> запроса пароля и вместо просто "password:" пишет "pam_mount > >> password:". > > > > Не надо помещать pam_mount.so в стеке аутентификации до pam_tcb.so, > > это не правильно по сути. > > Согласен, мне это тоже кажется "неправильным по сути". Но в примере > явно указано, что при аутентификации через ldap или winbind нужно > модуль pam_mount ставить впереди... > ---------------------- > #man pam_mount > .... > When "sufficient" is used in the second column, you must make > sure that pam_mount is added > before this entry. Otherwise pam_mount will not get executed > should a previous PAM module suc‐ > ceed. Also be aware of the "include" statements. These make PAM > look into the specified file. > If there is a "sufficient" statement, then the pam_mount > entry must either be in the included > file before the "sufficient" statement or before the "include" statement. > > If you use pam_ldap, pam_winbind, or any other authentication > services that make use of PAM's > sufficient keyword, model your configuration on the following order: > > ・・・ > account sufficient pam_ldap.so > auth required pam_mount.so > auth sufficient pam_ldap.so use_first_pass > auth required pam_unix.so use_first_pass > session optional pam_mount.so > ・・・ > > This allows for: > > 1. pam_mount, as the first "auth" module, will prompt for a > password and export it to the PAM > system. > > 2. pam_ldap will use the password from the PAM system to try > and authenticate the user. If > this succedes, the user will be authenticated. If it > fails, pam_unix will try to authenti‐ > cate. > .... > ------------------------------ Тут написано, что если вы добавляете что-то в стек после sufficient, то есть ненулевая вероятность того, что это что-то не будет выполнено. Это утерждение верно, однако из него не следует, что необходимо что-то добавлять перед sufficient. > А второй вариант (см. ниже) указывается именно для таких как мы с вами :) > ----------------------------- > ... > Alternatively, the following is possible (thanks to Andrew > Morgan for the hint!): > > auth [success=2 default=ignore] pam_unix2.so > auth [success=1 default=ignore] pam_ldap.so use_first_pass > auth requisite pam_deny.so > auth optional pam_mount.so > > It may seem odd, but the first three lines will make it so > that at least one of pam_unix2 or > pam_ldap has to succeed. As you can see, pam_mount will be run > after successful authentifica‐ > tion with these subsystems. > ... > ----------------------------- > > Причем, оба этих варианта - рабочие. Да, конечно. > А вот если попытаться без затей > поставить pam_mount после остальных модулей, то пароль запрашивается > два раза. Причем даже при перезапуске демонов (веселуха service > network restart - введи пароль...). И это не решается использованием > опции use_first_pass. Вы хотите сказать, что pam_mount не поддерживает use_first_pass? > Единственное, что я не пробовал - это ставить строчку с account > впереди строчек с auth. Потому что, насколько я понимаю, от этого > ничего не изменится... Конечно. > >> auth [success=2 default=ignore] pam_tcb.so shadow fork prefix=$2a$ count=8 nullok > >> auth requisite pam_succeed_if.so uid >= 500 quiet > >> auth [success=1 default=ignore] pam_ldap.so use_first_pass > >> auth optional pam_mount.so > > > > Вы неправильно списали с pam_mount(8). Чтобы понять, в чём ошибка, > > придётся прочитать и понять pam.conf(5). > > Ошибки нет. Этот вариант работает. Мой вопрос касается скорее > эстетики, чем функциональности... В этом варианте есть семантическая ошибка. Попробуйте - залогиниться ldap-пользователем; - залогиниться несуществующим пользователем. Дело в том, что формат pam.conf(5) желательно изучить для того, чтобы понимать, как работает та или иная конструкция. -- ldv [-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2009-06-22 16:48 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-06-19 6:46 Денис Черносов 2009-06-19 23:38 ` Dmitry V. Levin 2009-06-22 6:41 ` Денис Черносов 2009-06-22 16:48 ` Dmitry V. Levin [this message] 2009-06-24 8:31 ` Денис Черносов 2009-06-24 11:12 ` Dmitry V. Levin 2009-06-25 6:27 ` Денис Черносов 2009-06-25 21:19 ` Dmitry V. Levin 2009-06-25 23:23 ` Dmitry V. Levin 2009-06-26 7:41 ` Денис Черносов 2009-06-26 19:10 ` Dmitry V. Levin 2009-06-26 21:48 ` [Comm] pam-config-1.5.0-alt1 Dmitry V. Levin 2009-06-26 7:21 ` [Comm] "pam_mount password:" - неаккуратненько как-то Денис Черносов 2009-06-26 19:05 ` Dmitry V. Levin 2009-06-22 10:06 ` Andrew V. Stepanov 2009-06-24 9:02 ` Денис Черносов
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090622164824.GA7698@wo.int.altlinux.org \ --to=ldv@altlinux.org \ --cc=community@lists.altlinux.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
ALT Linux Community general discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 community community/ http://lore.altlinux.org/community \ mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com public-inbox-index community Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.community AGPL code for this site: git clone https://public-inbox.org/public-inbox.git