Bug 989218 - AVC because nsdc try to read something in /root
AVC because nsdc try to read something in /root
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted (Show other bugs)
22
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Miroslav Grepl
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-28 09:26 EDT by Michael Scherer
Modified: 2016-07-19 06:16 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-07-19 06:16:00 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch fixing the issue (723 bytes, patch)
2013-07-30 12:19 EDT, Michael Scherer
no flags Details | Diff

  None (edit)
Description Michael Scherer 2013-07-28 09:26:01 EDT
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 15:55:06 EDT
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 04:48:15 EDT
We can either fix a script or add dontuadit rules. I guess everything works correctly.
Comment 3 Michael Scherer 2013-07-29 10:50:19 EDT
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 14:05:43 EDT
It is probably looking at its homedir.
Comment 5 Paul Wouters 2013-07-29 15:13:23 EDT
the homedir of nsd is not /etc/unbound but /etc/nsd/
Comment 6 Michael Scherer 2013-07-29 17:18:45 EDT
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 19:56:49 EDT
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 03:38:33 EDT
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 Scherer 2013-07-30 12:18:49 EDT
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 Scherer 2013-07-30 12:19:36 EDT
Created attachment 780743 [details]
patch fixing the issue
Comment 11 Fedora End Of Life 2015-01-09 17:13:55 EST
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 11:54:12 EST
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 06:16:00 EDT
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.