ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Boris Gulay <boris@boressoft.ru>
To: ALT Linux Community general discussions <community@lists.altlinux.org>
Subject: Re: [Comm] google-authenticator в p6
Date: Fri, 04 Oct 2013 01:24:22 +0400
Message-ID: <524DE086.9050209@boressoft.ru> (raw)
In-Reply-To: <522F4088.1050309@boressoft.ru>

[-- Attachment #1: Type: text/plain, Size: 2853 bytes --]

Так как ответа не последовало, а я всё-таки настроил, то отвечу сам
себе, для архива рассылки.

Итак, проблема в том, что модуль pam_userpass не хочет нормально
работать в паре с гуглом. Если просто добавить гугл в pam.d/sshd, то
независимо от порядка следования модулей, будет выводится только запрос
на одноразовый пароль и всегда будет access denied.

Однако, не смотря на название, userpass не проверяет логин/пароль, он
просто запрашивает их и сохраняет внутри стека pam. А проверяет их
pam_tcb (http://docs.altlinux.org/manpages/pam_tcb.8.html), причём он и
сам умеет запрашивать пароль!

Решение очень простое - выкидываем userpass, вставляем на его место tcb
без параметра use_first_pass. Мой рабочий конфиг sshd выглядит так:

#auth       required    pam_userpass.so
auth        required    pam_tcb.so shadow fork prefix=$2y$ count=8 nullok
auth        required    pam_google_authenticator.so echo_verification_code
#auth       include     common-login-use_first_pass

Весь остальной стек для auth я выкинул, ибо там был тот же tcb (откуда я
и взял соответствующую строку) и всякий ldap, который мне не нужен.

Порядок следования модулей важен, при таком как у меня сначала
запрашивается пароль, затем всегда одноразовый код. Так невозможно
понять, что именно неверно, что хорошо для безопастности. Если хотите,
чтобы авторизация обламывалась сразу, замените required на requisite у
pam_tcb.

PS: Может это на вики?

10.09.2013 19:53, Boris Gulay пишет:
> 09.09.2013 22:29, Boris Gulay пишет:
>> Хочу включить себе такую штуку как google-authenticator. У меня p6.
>>
>> Взял пакет из сизифа, собрал у себя в хешере. Собралось нормально, без
>> ошибок. Настроил всё как написано (например, здесь
>> http://habrahabr.ru/post/133481/). В конфиге SSH "PasswordAuthentication
>> yes", "ChallengeResponseAuthentication yes". Тестовая программа (demo.c)
>> отрабатывает нормально, при входе код запрашивается.
>>
>> Однако, код всегда неверный. При этом в лог сыпятся сообщения " error:
>> PAM: Application needs to call libpam again for [USER] from [IP]"
> Добавлю:
> Если оставить в файле конфигурации PAM только google, то работает
> нормально (запрашивает логин, затем код). Если добавить pam_userpass.so,
> то начинает бесконечно спрашивать код и говорить access denied. Такое
> ощущение, что есть проблема с запросом пароля и userpass постоянно
> сбрасывает процесс авторизации.
> 
>>
>> Вопрос: что я делаю не так?
>>
>>
>>
>> _______________________________________________
>> community mailing list
>> community@lists.altlinux.org
>> https://lists.altlinux.org/mailman/listinfo/community
>>
> 
> 
> 
> 
> _______________________________________________
> community mailing list
> community@lists.altlinux.org
> https://lists.altlinux.org/mailman/listinfo/community
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 261 bytes --]

  reply	other threads:[~2013-10-03 21:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-09 18:29 Boris Gulay
2013-09-10 15:53 ` Boris Gulay
2013-10-03 21:24   ` Boris Gulay [this message]
2013-10-03 22:41     ` Michael Shigorin
2013-10-04 10:47       ` Boris Gulay
2013-10-04 14:17     ` Sergey Vlasov

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=524DE086.9050209@boressoft.ru \
    --to=boris@boressoft.ru \
    --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