Bug 989218 - AVC because nsdc try to read something in /root
Summary: AVC because nsdc try to read something in /root
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-28 13:26 UTC by Michael S.
Modified: 2016-07-19 10:16 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-19 10:16:00 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
patch fixing the issue (723 bytes, patch)
2013-07-30 16:19 UTC, Michael S.
no flags Details | Diff

Description Michael S. 2013-07-28 13:26:01 UTC
It seems there is a cron job that produce avc shipped with nsd, a dns server :

type=AVC msg=audit(1375016461.763:348120): avc:  denied  { search } for  pid=29878 comm="nsdc" name="root" dev="dm-1" ino=390153 scontext=system_u:system_r:nsd_crond_t:s0-s0:c0.c1023 tcontext=system_u:object_r:admin_home_t:s0 tclass=dir

type=AVC msg=audit(1375016461.717:348113): avc:  denied  { getattr } for  pid=29861 comm="nsdc" path="/root" dev="dm-1" ino=390153 scontext=system_u:system_r:nsd_crond_t:s0-s0:c0.c1023 tcontext=system_u:object_r:admin_home_t:s0 tclass=dir

the cron job is /etc/cron.hourly/nsd

But I do not know why it try to read anything there, as i cannot find why when running with strace. I am not sure that's a problem in the policy, or a problem in nsdc.

Comment 1 Paul Wouters 2013-07-28 19:55:06 UTC
It looks like it is the shell script /usr/sbin/nsdc that's causing this.

Perhaps add a "cd ~nsd" near the top of that script?

Comment 2 Miroslav Grepl 2013-07-29 08:48:15 UTC
We can either fix a script or add dontuadit rules. I guess everything works correctly.

Comment 3 Michael S. 2013-07-29 14:50:19 UTC
I would choose "fix the script". Let me give a test run, I will report if it worked.

Comment 4 Daniel Walsh 2013-07-29 18:05:43 UTC
It is probably looking at its homedir.

Comment 5 Paul Wouters 2013-07-29 19:13:23 UTC
the homedir of nsd is not /etc/unbound but /etc/nsd/

Comment 6 Michael S. 2013-07-29 21:18:45 UTC
So :

cd ~nsd

just after [ -r /etc/sysconfig/nsd ] && . /etc/sysconfig/nsd

fix the issue. I can cook a proper patch tomorow

Comment 7 Daniel Walsh 2013-07-29 23:56:49 UTC
What I meant is it is probably looking at the homedir of UID=0, which would be /root.

Comment 8 Paul Wouters 2013-07-30 07:38:33 UTC
michael: that would only work for RHEL 5/6 that uses initscripts. It would not fix the issue when using systemd that currently has:

[Service]
Type=simple
PIDFile=/var/run/nsd/nsd.pid
EnvironmentFile=-/etc/sysconfig/nsd
ExecStartPre=/usr/sbin/nsdc -c /etc/nsd/nsd.conf rebuild
ExecStart=/usr/sbin/nsd -D -c /etc/nsd/nsd.conf $OTHER_NSD_OPTS
ExecReload=/usr/sbin/nsdc -c /etc/nsd/nsd.conf rebuild
ExecReload=/usr/sbin/nsdc -c /etc/nsd/nsd.conf reload
# notify blocks on misconfigurations - but does show it very loudly
ExecReload=/usr/sbin/nsdc -c /etc/nsd/nsd.conf notify
ExecStop=/usr/sbin/nsdc -c /etc/nsd/nsd.conf patch
ExecStop=/usr/sbin/nsdc -c /etc/nsd/nsd.conf stop

So I think it's better for this to get into /usr/sbin/nsdc

Comment 9 Michael S. 2013-07-30 16:18:49 UTC
We are speaking of the cronjob, not of the initscript, see the patch I am gonna attach.


I did test on Fedora 19 on my server, a,d I checked there is no AVC at all when systemd start, stop or restart nsd on Fedora 19.

The only issue is the cronjob, and this is fixed with a change of directory.

And adding cd ~nsd in the nsdc tool is gonna break people using relative path with -c.

Comment 10 Michael S. 2013-07-30 16:19:36 UTC
Created attachment 780743 [details]
patch fixing the issue

Comment 11 Fedora End Of Life 2015-01-09 22:13:55 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Jaroslav Reznik 2015-03-03 16:54:12 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 13 Fedora End Of Life 2016-07-19 10:16:00 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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