Bug 904672 - SELinux is preventing /usr/sbin/nmbd from using the 'dac_override' capabilities.
Summary: SELinux is preventing /usr/sbin/nmbd from using the 'dac_override' capabilities.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 18
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:07bb5abcb6c641f72d0e15a6e1a...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-01-27 00:22 UTC by Paul Lipps
Modified: 2013-02-20 04:00 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-20 04:00:30 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Output of "ausearch -m avc -ts recent" (2.65 KB, text/plain)
2013-02-15 14:49 UTC, Pat Gardner
no flags Details

Description Paul Lipps 2013-01-27 00:22:54 UTC
Description of problem:
SELinux is preventing /usr/sbin/nmbd from using the 'dac_override' capabilities.

*****  Plugin dac_override (91.4 confidence) suggests  ***********************

If you want to help identify if domain needs this access or you have a file with the wrong permissions on your system
Then turn on full auditing to get path information about the offending file and generate the error again.
Do

Turn on full auditing
# auditctl -w /etc/shadow -p w
Try to recreate AVC. Then execute
# ausearch -m avc -ts recent
If you see PATH record check ownership/permissions on file, and fix it, 
otherwise report as a bugzilla.

*****  Plugin catchall (9.59 confidence) suggests  ***************************

If you believe that nmbd should have the dac_override capability by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep nmbd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:nmbd_t:s0
Target Context                system_u:system_r:nmbd_t:s0
Target Objects                 [ capability ]
Source                        nmbd
Source Path                   /usr/sbin/nmbd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           samba-4.0.0-174.fc18.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.11.1-73.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.7.4-204.fc18.x86_64 #1 SMP Wed
                              Jan 23 16:44:29 UTC 2013 x86_64 x86_64
Alert Count                   4
First Seen                    2013-01-26 17:30:01 CST
Last Seen                     2013-01-26 18:10:04 CST
Local ID                      09889cc0-7397-4467-940d-adf237dd4551

Raw Audit Messages
type=AVC msg=audit(1359245404.374:369): avc:  denied  { dac_override } for  pid=3662 comm="nmbd" capability=1  scontext=system_u:system_r:nmbd_t:s0 tcontext=system_u:system_r:nmbd_t:s0 tclass=capability


type=AVC msg=audit(1359245404.374:369): avc:  denied  { dac_read_search } for  pid=3662 comm="nmbd" capability=2  scontext=system_u:system_r:nmbd_t:s0 tcontext=system_u:system_r:nmbd_t:s0 tclass=capability


type=SYSCALL msg=audit(1359245404.374:369): arch=x86_64 syscall=open success=no exit=EACCES a0=33d9823860 a1=0 a2=0 a3=7fffd7684140 items=0 ppid=1278 pid=3662 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=nmbd exe=/usr/sbin/nmbd subj=system_u:system_r:nmbd_t:s0 key=(null)

Hash: nmbd,nmbd_t,nmbd_t,capability,dac_override

audit2allow

#============= nmbd_t ==============
allow nmbd_t self:capability { dac_read_search dac_override };

audit2allow -R

#============= nmbd_t ==============
allow nmbd_t self:capability { dac_read_search dac_override };


Additional info:
hashmarkername: setroubleshoot
kernel:         3.7.4-204.fc18.x86_64
type:           libreport

Potential duplicate: bug 829139

Comment 1 Miroslav Grepl 2013-01-28 11:16:22 UTC
If you want to help identify if domain needs this access or you have a file with the wrong permissions on your system
Then turn on full auditing to get path information about the offending file and generate the error again.
Do

Turn on full auditing
# auditctl -w /etc/shadow -p w
Try to recreate AVC. Then execute
# ausearch -m avc -ts recent

Comment 2 Paul Lipps 2013-02-11 21:20:04 UTC
I'm not sure how to undo my policy change that the SELinux Troubleshooter suggested. Is there a log I could look at that would help?

I just enabled nmbd to run at startup, and started reciving policy errors.

Comment 3 Daniel Walsh 2013-02-12 17:30:34 UTC
What policy did you add?


Something like

semodule -r mypol

If you named the policy mypol

Comment 4 Paul Lipps 2013-02-13 02:26:49 UTC
Thanks Daniel. Yes that was it, mypol. I have removed that policy, but now I cannot replicate the error. I have been pushed samba and policy updates, so I'm not sure if it's possible that one of those updates corrected the issue.

Do I need to relabel the system after removing my policy?

Comment 5 Miroslav Grepl 2013-02-13 09:31:27 UTC
You don't need to do it in this case.

Let's close this bug for now and please reopen if this happens again. Thank you.

Comment 6 Pat Gardner 2013-02-14 21:49:15 UTC
It too am getting exactly the same alert, a couple of times a day. Nothing obvious seems to be prompting this.

Comment 7 Daniel Walsh 2013-02-15 14:20:04 UTC
Pat can you try the auditctl commands above and the next time the AVC happens attach it.

Comment 8 Pat Gardner 2013-02-15 14:49:08 UTC
Created attachment 697831 [details]
Output of "ausearch -m avc -ts recent"

Output of "ausearch -m avc -ts recent"

Comment 9 Daniel Walsh 2013-02-15 20:23:22 UTC
Any reason why nmbd would need to read /etc/shadow?

Comment 10 Daniel Walsh 2013-02-15 20:28:32 UTC
Ok I think we should allow these capabilities if you turn on the

samba_export_all_ro
or
samba_export_all_rw
booleans.

Not sure if we should allow it otherwise.

Comment 11 Pat Gardner 2013-02-15 20:47:13 UTC
(In reply to comment #9)
> Any reason why nmbd would need to read /etc/shadow?

I was hoping you'd tell me :)

Anyway, I've set samba_export_all_rw boolean. Could it perhaps be because there is a disk mounted on /data which is shared via samba without the correct selinux labelling?

In any case, the sealert shows up with sufficient regularity that I should know if that solved it within a day or two I should think.

Comment 12 Paul Lipps 2013-02-15 23:50:33 UTC
Also should allow for samba_enable_home_dirs as well.

Comment 13 Pat Gardner 2013-02-16 18:29:06 UTC
Ok, still getting alerts with:

time->Sat Feb 16 18:16:01 2013
type=SYSCALL msg=audit(1361038561.654:184): arch=c000003e syscall=2 success=no exit=-13 a0=331302394c a1=0 a2=0 a3=7fffdb362970 items=0 ppid=1235 pid=5773 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm="nmbd" exe="/usr/sbin/nmbd" subj=system_u:system_r:nmbd_t:s0 key=(null)
type=AVC msg=audit(1361038561.654:184): avc:  denied  { read } for  pid=5773 comm="nmbd" name="urandom" dev="devtmpfs" ino=1033 scontext=system_u:system_r:nmbd_t:s0 tcontext=system_u:object_r:urandom_device_t:s0 tclass=chr_file

I've noticed a boolean called "global_ssp" which enables reading of urandom from all domains. Should I enable this?

Comment 14 Miroslav Grepl 2013-02-18 09:36:18 UTC
I added fixes.

Comment 15 Fedora Update System 2013-02-19 09:29:10 UTC
selinux-policy-3.11.1-79.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-79.fc18

Comment 16 Pat Gardner 2013-02-19 09:35:35 UTC
I see the changelog for selinux-policy-3.11.1-79.fc18 shows "Allow nmbd to read /dev/random" while my audit log showed a denial for urandom - was that just a typo in the chagelog?

Comment 17 Miroslav Grepl 2013-02-19 09:53:04 UTC
Yes, this is a typo.

We have these rules now

dev_read_rand(nmbd_t)
dev_read_urand(nmbd_t)

Comment 18 Pat Gardner 2013-02-19 10:13:46 UTC
Ok. Installed the updated package so I'll have to wait and see if the alert re-occurs.

Comment 19 Fedora Update System 2013-02-20 04:00:32 UTC
selinux-policy-3.11.1-79.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.


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