pam_tty_auditを他の非標準モジュールと併用した場合にエラーになる問題

Bug #1583444 reported by Toru Ikezoe
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Japanese Kaizen Project
New
Undecided
Unassigned

Bug Description

pam_tty_auditをpam_ldap等と併用した際に、pam_tty_auditに潜在的にあるバグが発現し、pam_tty_auditが正常に機能しません。
※ 発現はTrustyで確認しましたが、ソースコードを見る限りではXenialでも同様の問題があると考えられます。

環境
Ubuntu 14.04.4 LTS
linux-image-3.16.0-71-generic 3.16.0-71.92~14.04.1
libpam-ldap:amd64 184-8.5ubuntu3
libpam-modules:amd64 1.1.8-1ubuntu2.2

再現方法
1.インストールしたての状態でlibpam-ldapをインストール
2./etc/pam.d/common-sessionsの末尾に下記を追記
session required pam_tty_audit.so enable=* open_only
3.ssh等でログインするとpam_tty_auditがエラーになりログイン失敗となる
#pam_ldap等の非標準モジュールを導入しない場合 再現困難です

原因
pam_tty_auditのソースコードでconfig.hがインクルードされていないため、pam_sm_open_session実行時にstruct audit_tty_status.log_passwdの初期化・設定がされない。
結果、log_passwdの値が不定になり(スタックの状態に左右される)、条件によりカーネル内ハンドラでエラーになる。

解決方法
pam_tty_audit.cでconfig.hをインクルードしビルドしなおす。
or
アップストリームの修正を取り込む。
https://git.fedorahosted.org/cgit/linux-pam.git/commit/modules/pam_tty_audit/pam_tty_audit.c?id=c5f829931a22c65feffee16570efdae036524bee

ログ
-- auth.log --
May 18 14:47:03 vm sshd[2272]: Accepted publickey for test from 10.99.0.1 port 51398 ssh2: RSA 8f:39:1c:3a:f4:9d:ca:99:67:fc:e3:fd:1e:0c:5b:a8
May 18 14:47:03 vm sshd[2272]: pam_unix(sshd:session): session opened for user test by (uid=0)
May 18 14:47:03 vm sshd[2272]: pam_tty_audit(sshd:session): error setting current audit status: Invalid argument
May 18 14:47:03 vm sshd[2272]: error: PAM: pam_open_session(): Cannot make/remove an entry for the specified session
May 18 14:47:03 vm sshd[2297]: Received disconnect from 10.99.0.1: 11: disconnected by user

-- syslog --
May 18 14:47:03 vm audispd: node=vm type=USER_ACCT msg=audit(1463550423.399:58): pid=2272 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:accounting acct="test" exe="/usr/sbin/sshd" hostname=10.99.0.1 addr=10.99.0.1 terminal=ssh res=success'
May 18 14:47:03 vm audispd: node=vm type=CRED_ACQ msg=audit(1463550423.403:59): pid=2272 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:setcred acct="test" exe="/usr/sbin/sshd" hostname=10.99.0.1 addr=10.99.0.1 terminal=ssh res=success'
May 18 14:47:03 vm audispd: node=vm type=LOGIN msg=audit(1463550423.403:60): pid=2272 uid=0 old-auid=4294967295 auid=20299 old-ses=4294967295 ses=3 res=1
May 18 14:47:03 vm audispd: node=vm type=CONFIG_CHANGE msg=audit(1463550423.403:61): pid=2272 uid=0 auid=20299 ses=3 op=tty_set old-enabled=0 new-enabled=1 old-log_passwd=0 new-log_passwd=32743 res=0
May 18 14:47:03 vm audispd: node=vm type=USER_START msg=audit(1463550423.447:62): pid=2272 uid=0 auid=20299 ses=3 msg='op=PAM:session_open acct="test" exe="/usr/sbin/sshd" hostname=10.99.0.1 addr=10.99.0.1 terminal=ssh res=failed'
May 18 14:47:03 vm audispd: node=vm type=CRED_ACQ msg=audit(1463550423.447:63): pid=2297 uid=0 auid=20299 ses=3 msg='op=PAM:setcred acct="test" exe="/usr/sbin/sshd" hostname=10.99.0.1 addr=10.99.0.1 terminal=ssh res=success'
May 18 14:47:03 vm audispd: node=vm type=CRED_DISP msg=audit(1463550423.451:64): pid=2272 uid=0 auid=20299 ses=3 msg='op=PAM:setcred acct="test" exe="/usr/sbin/sshd" hostname=10.99.0.1 addr=10.99.0.1 terminal=ssh res=success'

Revision history for this message
Toru Ikezoe (toru-ikezoe) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.