Bug 914433 - sssd pam write_selinux_login_file creating the temp file for SELinux data failed
Summary: sssd pam write_selinux_login_file creating the temp file for SELinux data failed
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: sssd
Version: 6.4
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Jakub Hrozek
QA Contact: Kaushik Banerjee
: 914428 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2013-02-22 10:16 UTC by Maxim Egorushkin
Modified: 2020-05-02 17:16 UTC (History)
9 users (show)

Fixed In Version: sssd-1.9.2-114.el6
Doc Type: Bug Fix
Doc Text:
Cause: The code that writes the login file for the IPA provider did not handle error conditions correctly and was unable to recover if writing the SELinux label failed. Consequence: If the client system did not have the selinux-policy-targeted directory installed at all, the target directory the SSSD writes to would be missing and writing the login file would fail, which would make the whole login operation fail. Fix: The SSSD was amended so that it is able to handle failures to write the SELinux login file Result: Logins work fine even on clients w/o selinux-policy-targeted installed at all
Clone Of:
Last Closed: 2013-11-21 22:14:57 UTC
Target Upstream Version:

Attachments (Terms of Use)
sssd_pam.log (146.63 KB, text/plain)
2013-02-22 10:17 UTC, Maxim Egorushkin
no flags Details

System ID Private Priority Status Summary Last Updated
Github SSSD sssd issues 2859 0 None closed sssd pam write_selinux_login_file creating the temp file for SELinux data failed 2020-05-02 17:16:56 UTC
Red Hat Product Errata RHBA-2013:1680 0 normal SHIPPED_LIVE sssd bug fix and enhancement update 2013-11-20 21:52:37 UTC

Description Maxim Egorushkin 2013-02-22 10:16:13 UTC
Description of problem:

After updating to sssd-1.9.2-82.el6.x86_64 tonight IPA registered users can not login.

Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux Server release 6.4 (Santiago)

How reproducible:

Steps to Reproduce:
1. try to ssh as an IPA registered user
Actual results:
$ ssh xyz
Connection closed by

Expected results:
$ ssh xyz
Last login: Fri Feb 22 09:44:36 2013 from

Additional info:
(Fri Feb 22 10:02:14 2013) [sssd[pam]] [write_selinux_login_file] (0x0040): creating the temp file for SELinux data failed. /etc/selinux/targeted/logins/maxAYGyki(Fri Feb 22 10:02:14 2013) [sssd[pam]] [pam_reply] (0x0100): blen: 40

Comment 1 Maxim Egorushkin 2013-02-22 10:17:33 UTC
Created attachment 701109 [details]

Comment 3 Jenny Severance 2013-02-22 10:50:28 UTC
What version of selinux-policy do you have installed?

Comment 4 Maxim Egorushkin 2013-02-22 10:53:28 UTC
Selinux is disabled:

# getenforce 
# sestatus 
SELinux status:                 disabled

Comment 5 Dmitri Pal 2013-02-22 11:03:07 UTC
The workaround would be to put SELinux into permissive mode.
SSSD is a security software. It is recommended to run with SELinux on. This is how it is developed and tested. Permissive mode is the compromise. 
If it does not work in the permissive mode then this is a real issue which we would look into.

Comment 6 Jakub Hrozek 2013-02-22 11:04:06 UTC
Is the directory /etc/selinux/targeted/logins/ there at all? What permissions does it have?

Comment 7 Jakub Hrozek 2013-02-22 11:04:50 UTC
*** Bug 914428 has been marked as a duplicate of this bug. ***

Comment 8 Maxim Egorushkin 2013-02-22 11:10:10 UTC
Directory /etc/selinux/targeted does not exist.

# ls -l /etc/selinux
total 12
-rw-r--r-- 1 root root  113 Jan 16 14:15 restorecond.conf
-rw-r--r-- 1 root root   76 Jan 16 14:15 restorecond_user.conf
-rw-r--r-- 1 root root 2271 Oct 15 14:08 semanage.conf

It used to work just yesterday with selinux disabled. 

Is there a way to make it work again with selinux disabled please? I am loath to enable it because it used to break our proprietary applications or cause other nasty issues.

Comment 9 Jakub Hrozek 2013-02-22 11:20:07 UTC
Can you check if mkdir -p /etc/selinux/targeted/logins/ fixes the issue for you?

Comment 10 Maxim Egorushkin 2013-02-22 11:22:14 UTC
It does, thanks a lot Jakub.

Comment 11 Jakub Hrozek 2013-02-22 11:33:24 UTC
We still need to fix the problem in SSSD. We should either detect if SELinux is off completely and skip creating the context or just check if the logins directory exists before attempting to write the file there.

Comment 12 Jakub Hrozek 2013-02-22 11:35:33 UTC
Upstream ticket:

Comment 13 Jakub Hrozek 2013-02-26 14:58:14 UTC
btw I think SELinux should always create the directory and just ignore potential contents, so I filed https://bugzilla.redhat.com/show_bug.cgi?id=915811

Comment 14 Maxim Egorushkin 2013-02-26 15:03:50 UTC
Just in case, https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html-single/Identity_Management_Guide/index.html never mentions SELinux as a requirement for either IPA server or client.

Comment 15 Jakub Hrozek 2013-02-26 17:54:51 UTC
Maxim, can you chime in to bug #915811 and describe how exactly you installed your system? Was selinux disabled from anaconda? Do you have selinux-policy-targeted installed at all?

Comment 16 Jakub Hrozek 2013-05-10 15:13:29 UTC
Fixed upstream.

Comment 26 Namita Soman 2013-10-11 13:53:59 UTC
Verified using ipa-server-3.0.0-37.el6.x86_64, ipa-client-3.0.0-37.el6.x86_64, sssd-1.9.2-128.el6.x86_64, selinux-policy-3.7.19-218

On server:
# sestatus 
SELinux status:                 disabled

installed ipa-server

# ls -l /etc/selinux/
total 20
-rw-r--r--. 1 root root  457 Oct 11 08:29 config
-rw-r--r--. 1 root root  113 Sep 18 12:43 restorecond.conf
-rw-r--r--. 1 root root   76 Sep 18 12:43 restorecond_user.conf
-rw-r--r--. 1 root root 2271 Oct 15  2012 semanage.conf
drwxr-xr-x. 6 root root 4096 Oct  8 15:35 targeted_ORIG

On client:
# sestatus 
SELinux status:                 disabled

# ls -l /etc/selinux/
total 20
-rw-r--r--. 1 root root  457 Oct 11 09:06 config
-rw-r--r--. 1 root root  113 Sep 18 12:43 restorecond.conf
-rw-r--r--. 1 root root   76 Sep 18 12:43 restorecond_user.conf
-rw-r--r--. 1 root root 2271 Oct 15  2012 semanage.conf
drwxr-xr-x. 6 root root 4096 Oct  8 15:17 targeted_ORIG

installed client

Then from client ssh'd as an ipa user to server:
# ssh admin@<ipa server name>

Was successful

Comment 27 Maxim Egorushkin 2013-10-17 15:17:29 UTC
That's great, thank you gents!

Comment 28 errata-xmlrpc 2013-11-21 22:14:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.