Bug 957716 - Selinux is preventing /usr/bin/net from read and getattr on the directory /var/cache/realmd
Summary: Selinux is preventing /usr/bin/net from read and getattr on the directory /va...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-04-29 11:27 UTC by David Spurek
Modified: 2015-03-02 05:27 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-02-18 11:17:02 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description David Spurek 2013-04-29 11:27:49 UTC
Description of problem:
Realmd join fails.

When I run realm join in permissive mode then I see these avc's:

ausearch -m avc -ts recent
----
time->Mon Apr 29 11:55:35 2013
type=SYSCALL msg=audit(1367229335.001:263): arch=c000003e syscall=4 success=yes exit=0 a0=14c1b10 a1=7fff3c562d30 a2=7fff3c562d30 a3=7fff3c562af0 items=0 ppid=10871 pid=10894 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm="net" exe="/usr/bin/net" subj=system_u:system_r:samba_net_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1367229335.001:263): avc:  denied  { getattr } for  pid=10894 comm="net" path="/var/cache/realmd/realmd-smb-conf.Z31QVW" dev="dm-1" ino=307536 scontext=system_u:system_r:samba_net_t:s0-s0:c0.c1023 tcontext=system_u:object_r:realmd_var_cache_t:s0 tclass=file
----
time->Mon Apr 29 11:55:35 2013
type=SYSCALL msg=audit(1367229335.013:264): arch=c000003e syscall=2 success=yes exit=3 a0=14c1b10 a1=0 a2=0 a3=7fff3c562b80 items=0 ppid=10871 pid=10894 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm="net" exe="/usr/bin/net" subj=system_u:system_r:samba_net_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1367229335.013:264): avc:  denied  { open } for  pid=10894 comm="net" path="/var/cache/realmd/realmd-smb-conf.Z31QVW" dev="dm-1" ino=307536 scontext=system_u:system_r:samba_net_t:s0-s0:c0.c1023 tcontext=system_u:object_r:realmd_var_cache_t:s0 tclass=file
type=AVC msg=audit(1367229335.013:264): avc:  denied  { read } for  pid=10894 comm="net" name="realmd-smb-conf.Z31QVW" dev="dm-1" ino=307536 scontext=system_u:system_r:samba_net_t:s0-s0:c0.c1023 tcontext=system_u:object_r:realmd_var_cache_t:s0 tclass=file
----
time->Mon Apr 29 11:55:39 2013
type=SYSCALL msg=audit(1367229339.484:266): arch=c000003e syscall=2 success=yes exit=3 a0=1872b40 a1=0 a2=0 a3=7fff74199850 items=0 ppid=10871 pid=10920 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm="net" exe="/usr/bin/net" subj=system_u:system_r:samba_net_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1367229339.484:266): avc:  denied  { open } for  pid=10920 comm="net" path="/var/cache/realmd/realmd-smb-conf.Z31QVW" dev="dm-1" ino=307537 scontext=system_u:system_r:samba_net_t:s0-s0:c0.c1023 tcontext=system_u:object_r:realmd_var_cache_t:s0 tclass=file
type=AVC msg=audit(1367229339.484:266): avc:  denied  { read } for  pid=10920 comm="net" name="realmd-smb-conf.Z31QVW" dev="dm-1" ino=307537 scontext=system_u:system_r:samba_net_t:s0-s0:c0.c1023 tcontext=system_u:object_r:realmd_var_cache_t:s0 tclass=file
----
time->Mon Apr 29 11:55:39 2013
type=SYSCALL msg=audit(1367229339.472:265): arch=c000003e syscall=4 success=yes exit=0 a0=1872b40 a1=7fff74199a00 a2=7fff74199a00 a3=7fff741997c0 items=0 ppid=10871 pid=10920 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm="net" exe="/usr/bin/net" subj=system_u:system_r:samba_net_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1367229339.472:265): avc:  denied  { getattr } for  pid=10920 comm="net" path="/var/cache/realmd/realmd-smb-conf.Z31QVW" dev="dm-1" ino=307537 scontext=system_u:system_r:samba_net_t:s0-s0:c0.c1023 tcontext=system_u:object_r:realmd_var_cache_t:s0 tclass=file


Version-Release number of selected component (if applicable):
selinux-policy-3.12.1-37.fc19.noarch
realmd-0.13.3-2.fc19

How reproducible:
always


Steps to Reproduce:
1.realm join to AD
2.
3.
  
Actual results:
avc messages

Expected results:
no avc messages

Additional info:

Comment 3 David Spurek 2013-05-02 07:10:22 UTC
Try reproduce bug with realmd-0.13.90-1.fc19 because in previous versions realmd join fail due to another bug - https://bugzilla.redhat.com/show_bug.cgi?id=913457

Comment 4 Miroslav Grepl 2013-05-03 11:52:22 UTC
commit 0054516f8b9b6ac4e0eb145c2f6acc091833abbf
Author: Miroslav Grepl <mgrepl>
Date:   Fri May 3 13:52:03 2013 +0200

    Allow samba-net to read realmd cache files

Comment 5 Fedora Update System 2013-05-03 12:45:31 UTC
selinux-policy-3.12.1-39.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-39.fc19

Comment 6 Patrik Kis 2013-05-03 13:49:11 UTC
It seems this was not fixed properly.

# rpm -q realmd selinux-policy selinux-policy-targeted
realmd-0.13.91-1.fc19.x86_64
selinux-policy-3.12.1-39.fc19.noarch
selinux-policy-targeted-3.12.1-39.fc19.noarch
# 
# getenforce 
Enforcing
# 
# realm -v --user=Administrator join ad.baseos.qe
 * Resolving: _ldap._tcp.dc._msdcs.ad.baseos.qe
 * Sending MS-CLDAP ping to: 10.34.25.20
 * Successfully discovered: ad.baseos.qe
Password for Administrator: 
 * Required files: /usr/sbin/sss_cache, /usr/sbin/sssd, /usr/bin/net
 * LANG=C LOGNAME=root /usr/bin/net -s /var/cache/realmd/realmd-smb-conf.OO3QWW -U Administrator ads join ad.baseos.qe
Invalid configuration.  Exiting....
Host is not configured as a member server.
Failed to join domain: This operation is only allowed for the PDC of the domain.
 ! Joining the domain ad.baseos.qe failed
realm: Couldn't join realm: Joining the domain ad.baseos.qe failed

// No AVCs appeared

# setenforce 0
# realm -v --user=Administrator join ad.baseos.qe
 * Resolving: _ldap._tcp.dc._msdcs.ad.baseos.qe
 * Sending MS-CLDAP ping to: 10.34.25.20
 * Successfully discovered: ad.baseos.qe
Password for Administrator: 
 * Required files: /usr/sbin/sss_cache, /usr/sbin/sssd, /usr/bin/net
 * LANG=C LOGNAME=root /usr/bin/net -s /var/cache/realmd/realmd-smb-conf.RO6NWW -U Administrator ads join ad.baseos.qe
Enter Administrator's password:
DNS update failed: NT_STATUS_UNSUCCESSFUL
Using short domain name -- AD
Joined 'FED1' to dns domain 'ad.baseos.qe'
 * LANG=C LOGNAME=root /usr/bin/net -s /var/cache/realmd/realmd-smb-conf.RO6NWW -U Administrator ads keytab create
Enter Administrator's password:
 * /usr/bin/systemctl enable sssd.service
ln -s '/usr/lib/systemd/system/sssd.service' '/etc/systemd/system/multi-user.target.wants/sssd.service'
 * /usr/bin/systemctl restart sssd.service
 * /usr/sbin/authconfig --update --enablesssd --enablesssdauth --enablemkhomedir --nostart
 * Successfully enrolled machine in realm

// This time realm join pass through and there AVC denials were logged:

type=AVC msg=audit(1367588701.307:452): avc:  denied  { getattr } for  pid=1204 comm="net" path="/var/cache/realmd/realmd-smb-conf.RO6NWW" dev="dm-0" ino=262380 scontext=system_u:system_r:samba_net_t:s0-s0:c0.c1023 tcontext=system_u:object_r:realmd_var_cache_t:s0 tclass=file
type=AVC msg=audit(1367588701.308:453): avc:  denied  { read } for  pid=1204 comm="net" name="realmd-smb-conf.RO6NWW" dev="dm-0" ino=262380 scontext=system_u:system_r:samba_net_t:s0-s0:c0.c1023 tcontext=system_u:object_r:realmd_var_cache_t:s0 tclass=file
type=AVC msg=audit(1367588701.308:453): avc:  denied  { open } for  pid=1204 comm="net" path="/var/cache/realmd/realmd-smb-conf.RO6NWW" dev="dm-0" ino=262380 scontext=system_u:system_r:samba_net_t:s0-s0:c0.c1023 tcontext=system_u:object_r:realmd_var_cache_t:s0 tclass=file
type=USER_AVC msg=audit(1367588776.901:454): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  received setenforce notice (enforcing=0)  exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'

Comment 7 Fedora Update System 2013-05-03 15:21:05 UTC
Package selinux-policy-3.12.1-39.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-39.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-7338/selinux-policy-3.12.1-39.fc19
then log in and leave karma (feedback).

Comment 8 Miroslav Grepl 2013-05-03 15:22:00 UTC
You are right. There is a typo.

Fixed in selinux-policy-3.12.1-40.fc19

Comment 9 Fedora Update System 2013-05-04 18:55:00 UTC
Package selinux-policy-3.12.1-40.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-40.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-7338/selinux-policy-3.12.1-40.fc19
then log in and leave karma (feedback).

Comment 10 Patrik Kis 2013-05-06 10:00:51 UTC
There is still problem with /usr/bin/net and realmd.

realmd-0.13.91-1.fc19
selinux-policy-targeted-3.12.1-40.fc19
selinux-policy-3.12.1-40.fc19

[root@fed1 ~]# getenforce 
Enforcing
[root@fed1 ~]# realm -v --user=Administrator join ad.baseos.qe
 * Resolving: _ldap._tcp.dc._msdcs.ad.baseos.qe
 * Sending MS-CLDAP ping to: 10.34.25.20
 * Successfully discovered: ad.baseos.qe
Password for Administrator: 
 * Required files: /usr/sbin/sss_cache, /usr/sbin/sssd, /usr/bin/net
 * LANG=C LOGNAME=root /usr/bin/net -s /tmp/realmd-smb-conf.91ZIWW -U Administrator ads join ad.baseos.qe
Invalid configuration.  Exiting....
Host is not configured as a member server.
Failed to join domain: This operation is only allowed for the PDC of the domain.
 ! Joining the domain ad.baseos.qe failed
realm: Couldn't join realm: Joining the domain ad.baseos.qe failed
[root@fed1 ~]# 
[root@fed1 ~]# ps -efZ |grep realmd |grep -v grep
system_u:system_r:realmd_t:s0-s0:c0.c1023 root 2800 1  0 11:55 ?       00:00:00 /usr/lib64/realmd/realmd


NOTE: The test sometime pass due to the bug 959954.

Comment 11 Miroslav Grepl 2013-05-06 11:39:01 UTC
(In reply to comment #10)
> There is still problem with /usr/bin/net and realmd.
> 

Any AVC?

Comment 12 Patrik Kis 2013-05-06 12:12:20 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > There is still problem with /usr/bin/net and realmd.
> > 
> 
> Any AVC?

Of course there are! Sorry, in hurry I forgot to copy them here:

type=AVC msg=audit(1367842295.234:610): avc:  denied  { open } for  pid=3779 comm="net" path="/tmp/realmd-smb-conf.JZDHWW" dev="tmpfs" ino=38397 scontext=system_u:system_r:samba_net_t:s0-s0:c0.c1023 tcontext=system_u:object_r:realmd_tmp_t:s0 tclass=file


# grep AVC /var/log/audit/audit.log | tail -1 | audit2allow


#============= samba_net_t ==============
allow samba_net_t realmd_tmp_t:file open;

Comment 13 Miroslav Grepl 2013-05-06 12:16:27 UTC
Ok, added.

Comment 14 Patrik Kis 2013-05-07 07:43:56 UTC
Verified with: selinux-policy-3.12.1-42.fc19
realmd can join and no AVCs appear in logs.

Comment 15 Fedora End Of Life 2015-01-09 22:38:49 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 16 Fedora End Of Life 2015-02-18 11:17:02 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 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.