筆者について
FreeBSDを通じてOSSにささかな貢献を。
- 日本xrdpユーザ会発起人
- xrdp developer
- FreeBSD developer
OSS活動をご支援いただける方を募集しています
2014-10-16 FreeBSD 10.1-BETA1 から BETA2 の間で xrdp の PAM 認証ができなくなった(調査編)
■ FreeBSD 10.1-BETA1 から BETA2 の間で xrdp の PAM 認証ができなくなった(調査編)
FreeBSD 10-STABLE に xrdp でデスクトップ環境を構築した環境で普段生活してるんですが、stable ブランチを追いかけていて 10.1-BETA1 から BETA2 にしたタイミングで PAM 認証が通らず接続できなくなった。
リビジョンでいうと r271848 と r271444 の間の変更で何かが変わったのが原因なので、中間のリビジョンをチェックアウトして buildworld して、ダメならまたその中間をチェックアウト…という手順で特定。
やはり r271766 でPAM まわりのコードで変更があったのが原因ぽい。該当する Bugzilla は Bug 83099 で、なんと2005年8月に報告されたバグが9年越しで修正されて MFC された結果、影響を受けてしまったらしい。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- stable/10/lib/libpam/modules/pam_login_access/pam_login_access.c 2014/09/18 14:16:14 271765 | |
+++ stable/10/lib/libpam/modules/pam_login_access/pam_login_access.c 2014/09/18 14:27:37 271766 | |
@@ -79,7 +79,14 @@ | |
gethostname(hostname, sizeof hostname); | |
- if (rhost == NULL || *(const char *)rhost == '\0') { | |
+ if (rhost != NULL && *(const char *)rhost != '\0') { | |
+ PAM_LOG("Checking login.access for user %s from host %s", | |
+ (const char *)user, (const char *)rhost); | |
+ if (login_access(user, rhost) != 0) | |
+ return (PAM_SUCCESS); | |
+ PAM_VERBOSE_ERROR("%s is not allowed to log in from %s", | |
+ user, rhost); | |
+ } else if (tty != NULL && *(const char *)tty != '\0') { | |
PAM_LOG("Checking login.access for user %s on tty %s", | |
(const char *)user, (const char *)tty); | |
if (login_access(user, tty) != 0) | |
@@ -87,12 +94,8 @@ | |
PAM_VERBOSE_ERROR("%s is not allowed to log in on %s", | |
user, tty); | |
} else { | |
- PAM_LOG("Checking login.access for user %s from host %s", | |
- (const char *)user, (const char *)rhost); | |
- if (login_access(user, rhost) != 0) | |
- return (PAM_SUCCESS); | |
- PAM_VERBOSE_ERROR("%s is not allowed to log in from %s", | |
- user, rhost); | |
+ PAM_VERBOSE_ERROR("PAM_RHOST or PAM_TTY required"); | |
+ return (PAM_AUTHINFO_UNAVAIL); | |
} | |
return (PAM_AUTH_ERR); |
差分 をざっと見ると pam_sm_acct_mgmt は PAM_TTY か PAM_RLOGIN のどちらかに何かをセットしていないとエラーになるように変更されたみたいなので、このへんで pam_acct_mgmt を実行する前に pam_set_item(pamh, PAM_TTY, something) みたいなコードを追加すればいいっぽい。
[ツッコミを入れる]