Bug 708897 - puppetmaster_t needs usermanage_domtrans_passwd
Summary: puppetmaster_t needs usermanage_domtrans_passwd
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 699330 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-05-30 04:43 UTC by Ricky Zhou
Modified: 2012-02-10 08:47 UTC (History)
6 users (show)

Fixed In Version: selinux-policy-3.9.16-27.fc15
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-10 08:47:23 UTC
Type: ---


Attachments (Terms of Use)
puppetmaster avcs (11.35 KB, application/octet-stream)
2011-05-30 10:16 UTC, Ricky Zhou
no flags Details

Description Ricky Zhou 2011-05-30 04:43:38 UTC
Description of problem:

puppetmaster needs to run chage, which results in the following denial:

type=AVC msg=audit(1306723316.360:211): avc:  denied  { getattr } for  pid=22769 comm="puppetmasterd" path="/usr/bin/chage" dev=dm-1 ino=1444742 scontext=system_u:system_r:puppetmaster_t:s0 tcontext=system_u:object_r:passwd_exec_t:s0 tclass=file

I was able to fix this with a custom local policy granting usermanage_domtrans_passwd(puppetmaster_t).

Comment 2 Miroslav Grepl 2011-05-30 08:10:45 UTC
*** Bug 699330 has been marked as a duplicate of this bug. ***

Comment 3 Miroslav Grepl 2011-05-30 08:13:15 UTC
Ricky,
could you just try to disable your local policy

# semodule -d your_module
# semanage permissive -a puppetmaster_t

re-test it and run

# ausearch -m avc -ts recent

Comment 4 Ricky Zhou 2011-05-30 10:16:29 UTC
Created attachment 501762 [details]
puppetmaster avcs

Here's the output.  The duplicate entries are because I'm running several instances of the puppetmaster process.

Comment 5 Dominick Grift 2011-05-30 10:24:37 UTC
Looks like it is actually not running it in those avc denials but checking for execute (open X_ok) and its getting attributes of the chage executable file.

If it was actually running chage we would also have seen an execute_no_trans avc denial.

Comment 6 Dominick Grift 2011-05-30 10:26:41 UTC
i think we need a: 

usermanage_check_exec_passwd()

allow $1 passwd_exec_t:file { getattr_file_perms execute };

Comment 7 Ricky Zhou 2011-05-30 10:34:44 UTC
Ahh, good catch, that makes a lot more sense than actually executing chage (I was fooled by the "execute" in the denial message).  I've confirmed that a policy with just

allow puppetmaster_t passwd_exec_t:file { getattr_file_perms execute };

is sufficient.  Since I think the same code in puppet is what caused previous useradd denials in puppetmaster, the

usermanage_domtrans_useradd(puppetmaster_t)

in the current selinux-policy can probably be restricted more as well.

Comment 8 Dominick Grift 2011-05-30 10:41:36 UTC
I actually added the usermanage_check_exec_passwd(puppetmaster_t)  in my "puppetca" patch: https://bugzilla.redhat.com/show_bug.cgi?id=703813

dwalsh merged it but changed it to use audit-access which i am not sure will do the trick (i am actually pretty sure it doesnt do the trick)

Comment 10 Miroslav Grepl 2011-05-30 10:56:50 UTC
# ausyscall 21
access

Ricky,

# rpm -q selinux-policy

Comment 11 Dominick Grift 2011-05-30 11:08:20 UTC
If audit_access works we will still need to add getattr i suspect. We may also be able to replace the other usermanage_domtrans.* interface calls in puppet.te

Comment 12 Miroslav Grepl 2011-05-30 11:14:57 UTC
Yes.

Comment 13 Ricky Zhou 2011-05-30 14:58:59 UTC
(In reply to comment #10)
> # ausyscall 21
> access
> 
> Ricky,
> 
> # rpm -q selinux-policy
selinux-policy-3.9.16-24.fc15.noarch

Comment 14 Dominick Grift 2011-05-31 08:56:55 UTC
Edited the "access_check" interfaces to include get attributes, and changed all usermanage calls by puppetmaster to access check.

http://git.fedorahosted.org/git/?p=selinux-policy.git;a=commitdiff;h=884c081a90563159afc3d6b88ca35a25313e69c4

Comment 15 Miroslav Grepl 2011-05-31 10:05:53 UTC
I am fine with this in Rawhide. But will wait with all changes in F15. I am just adding fixes for passwd_exec_t.

Fixed in selinux-policy-3.9.16-27.fc15


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