Bug 381811 - selinux prevents pam_ssh from working
Summary: selinux prevents pam_ssh from working
Keywords:
Status: CLOSED DUPLICATE of bug 397131
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: 8
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Daniel Walsh
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-11-14 08:39 UTC by Tomasz Kepczynski
Modified: 2007-11-30 22:12 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-11-26 19:08:40 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
audit.log for root logging in, selinux enforcing (4.38 KB, text/plain)
2007-11-15 07:38 UTC, Tomasz Kepczynski
no flags Details
audit.log for root logging in, selinux permissive (5.37 KB, text/plain)
2007-11-15 07:39 UTC, Tomasz Kepczynski
no flags Details
audit.log for normal user (home on nfs) logging in, selinux enforcing (3.29 KB, text/plain)
2007-11-15 07:40 UTC, Tomasz Kepczynski
no flags Details
audit.log for normal user (home on nfs) logging in, selinux permissive (6.05 KB, text/plain)
2007-11-15 07:40 UTC, Tomasz Kepczynski
no flags Details
audit.log for root logging in, selinux enforcing (3.77 KB, text/plain)
2007-11-16 07:35 UTC, Tomasz Kepczynski
no flags Details
audit.log for normal user (home on nfs) logging in, selinux enforcing (2.70 KB, text/plain)
2007-11-16 07:35 UTC, Tomasz Kepczynski
no flags Details
audit.log for root logging in, selinux permissive (3.23 KB, text/plain)
2007-11-19 12:46 UTC, Tomasz Kepczynski
no flags Details
audit.log for normal user (home on nfs) logging in, selinux permissive (4.37 KB, text/plain)
2007-11-19 12:46 UTC, Tomasz Kepczynski
no flags Details
audit.log for root logging in, selinux enforcing (2.63 KB, text/plain)
2007-11-22 11:43 UTC, Tomasz Kepczynski
no flags Details
audit.log for root logging in, selinux permissive (3.18 KB, text/plain)
2007-11-22 11:43 UTC, Tomasz Kepczynski
no flags Details
audit.log for normal user (home on nfs) logging in, selinux enforcing (2.67 KB, text/plain)
2007-11-22 11:43 UTC, Tomasz Kepczynski
no flags Details
audit.log for normal user (home on nfs) logging in, selinux permissive (3.24 KB, text/plain)
2007-11-22 11:43 UTC, Tomasz Kepczynski
no flags Details

Description Tomasz Kepczynski 2007-11-14 08:39:57 UTC
Description of problem:
I use pam_ssh to add ssh keys to ssh-agent during login.
This worked fine in FC6 and is broken in F8 with selinux
enforcing. Problem goes away with selinux permissive.
This affects both command line logins (on vt at least) and
kdm login.

Version-Release number of selected component (if applicable):
pam_ssh-1.92-2.fc8.x86_64
pam_ssh-1.92-2.fc8.i386
selinux-policy-targeted-3.0.8-47.fc8.noarch


How reproducible:
always

This is what I have in system-auth:
auth        required      pam_env.so
auth        required      pam_unix.so nullok try_first_pass
auth        optional      pam_ssh.so use_first_pass

and:
session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
session     [success=2 default=ignore] pam_succeed_if.so service in crond quiet
use_uid
session     required      pam_unix.so
session     optional      pam_ssh.so

Just protect ssh key with your login password and try to login.
ssh-add -l should list that key but it does not. There will
be some setroubleshoot messages and audit messages related
to at least inability to run ssh-agent.

Comment 1 Daniel Walsh 2007-11-14 15:12:37 UTC
What avc's are you seeing?

/var/log/audit/audit.log or /var/log/messages

Comment 2 Tomasz Kepczynski 2007-11-15 07:38:58 UTC
Created attachment 259561 [details]
audit.log for root logging in, selinux enforcing

Comment 3 Tomasz Kepczynski 2007-11-15 07:39:29 UTC
Created attachment 259571 [details]
audit.log for root logging in, selinux permissive

Comment 4 Tomasz Kepczynski 2007-11-15 07:40:03 UTC
Created attachment 259581 [details]
audit.log for normal user (home on nfs) logging in, selinux enforcing

Comment 5 Tomasz Kepczynski 2007-11-15 07:40:26 UTC
Created attachment 259591 [details]
audit.log for normal user (home on nfs) logging in, selinux permissive

Comment 6 Tomasz Kepczynski 2007-11-15 07:43:04 UTC
The above attachments are for console login. KDM has the same
problem (and I think it also applies to gdm). If you need logs
for graphical login please let me know.


Comment 7 Daniel Walsh 2007-11-15 15:16:34 UTC
If you 

chcon -R -t var_auth /var/run/pam_ssh

And update to selinux-policy-3.0.8-53

Does it fix the problem?



Comment 8 Tomasz Kepczynski 2007-11-16 07:34:04 UTC
If think you meant:
chcon -R -t var_auth /var/run/pam_ssh?
If so - running it and updating policy does not help. Login cannot
start ssh-agent and cannot access private keys. I attach two
additional logs from a run with new policy and changes to pam_ssh
context.


Comment 9 Tomasz Kepczynski 2007-11-16 07:35:07 UTC
Created attachment 260821 [details]
audit.log for root logging in, selinux enforcing

Comment 10 Tomasz Kepczynski 2007-11-16 07:35:33 UTC
Created attachment 260831 [details]
audit.log for normal user (home on nfs) logging in, selinux enforcing

Comment 11 Daniel Walsh 2007-11-16 15:06:01 UTC
Could you login in permissive mode and show me all the avcs.

Comment 12 Daniel Walsh 2007-11-16 15:16:52 UTC
You can allow this for now by executing 

# audit2allow -M mypol -i /var/log/audit/audit.log 
# semodule -i mypol.pp



Comment 13 Tomasz Kepczynski 2007-11-19 12:46:31 UTC
Created attachment 263441 [details]
audit.log for root logging in, selinux permissive

Comment 14 Tomasz Kepczynski 2007-11-19 12:46:55 UTC
Created attachment 263451 [details]
audit.log for normal user (home on nfs) logging in, selinux permissive

Comment 15 Daniel Walsh 2007-11-19 15:56:27 UTC
Fixed in selinux-policy-3.0.8-58.fc8

Comment 16 Tomasz Kepczynski 2007-11-22 11:42:28 UTC
It's not. I am getting an extra:
bind: permission denied
when logging in on console.
Logs follow.

Comment 17 Tomasz Kepczynski 2007-11-22 11:43:01 UTC
Created attachment 266701 [details]
audit.log for root logging in, selinux enforcing

Comment 18 Tomasz Kepczynski 2007-11-22 11:43:20 UTC
Created attachment 266711 [details]
audit.log for root logging in, selinux permissive

Comment 19 Tomasz Kepczynski 2007-11-22 11:43:38 UTC
Created attachment 266721 [details]
audit.log for normal user (home on nfs) logging in, selinux enforcing

Comment 20 Tomasz Kepczynski 2007-11-22 11:43:57 UTC
Created attachment 266731 [details]
audit.log for normal user (home on nfs) logging in, selinux permissive

Comment 21 Daniel Walsh 2007-11-26 18:28:25 UTC
Ok relooking at this, I beleive

session     optional      pam_ssh.so

Should not be in the system-auth file at all.  It needs to be in each one of the
login pam modules after the 

pam_selinux open call.

This will ensure that ssh_agent is running on behalf of the user.  

auth        optional      pam_ssh.so use_first_pass
can probably stay in the system-auth although does this need to be run by tools
like su and sudo?

Comment 22 Daniel Walsh 2007-11-26 18:38:59 UTC
With this change, I only need to allow login programs to write to userdomain tmp
sockets.

Comment 23 Patrice Dumas 2007-11-26 19:08:40 UTC
Daniel, could you please look at the fixes that have been proposed 
in the other bug?

Also could it be possible to avoid the dependency on 
policycoreutils?

Last it would be nice if you or somebody knowledgable could
do some policy, especially for 
http://fedoraproject.org/wiki/Packaging/ScriptletSnippets
or in the guidelines proper, it would be nice.

*** This bug has been marked as a duplicate of 397131 ***


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