Bug 201031 - setsebool broken
Summary: setsebool broken
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: policycoreutils
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Daniel Walsh
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-08-02 12:30 UTC by Joe Orton
Modified: 2009-09-12 03:29 UTC (History)
2 users (show)

Fixed In Version: Current
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-01-21 15:51:54 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Joe Orton 2006-08-02 12:30:52 UTC
Recent Raw Hide/FC6test1-ish install.

[root@trash ~]# setsebool httpd_disable_trans=1
libsemanage.semanage_commit_sandbox: Error while renaming
/etc/selinux/targeted/modules/active to /etc/selinux/targeted/modules/previous.
Could not change policy booleans
[root@trash ~]# rpm -qf /usr/sbin/setsebool
policycoreutils-1.30.17-7

Comment 1 Daniel Walsh 2006-08-02 13:59:28 UTC
I believe this is a labeling problem, in /etc/selinux/targeted directory.

Do you see avc messages?

You can relabel with 

restorecon -R -v /etc/selinux/targeted



Comment 2 Joe Orton 2006-08-02 14:09:15 UTC
That works.

[root@trash ~]# echo MARK >> /var/log/audit/audit.log
[root@trash ~]# setsebool httpd_disable_trans=1
libsemanage.semanage_commit_sandbox: Error while renaming
/etc/selinux/targeted/modules/active to /etc/selinux/targeted/modules/previous.
Could not change policy booleans
[root@trash ~]# tail /var/log/audit/audit.log
type=PATH msg=audit(1154528196.407:678): item=0
name="/etc/selinux/targeted/modules/" inode=2087266 dev=03:03 mode=040755 ouid=0
ogid=0 rdev=00:00 obj=system_u:object_r:selinux_config_t:s0
type=PATH msg=audit(1154528196.407:678): item=1
name="/etc/selinux/targeted/modules/previous" inode=2087266 dev=03:03
mode=040755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:selinux_config_t:s0
type=PATH msg=audit(1154528196.407:678): item=2
name="/etc/selinux/targeted/modules/active" inode=2115588 dev=03:03 mode=040700
ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:selinux_config_t:s0
MARK
type=AVC msg=audit(1154528220.246:679): avc:  denied  { rename } for  pid=23427
comm="setsebool" name="active" dev=hda3 ino=2115588
scontext=root:system_r:semanage_t:s0-s0:c0.c255
tcontext=system_u:object_r:selinux_config_t:s0 tclass=dir
type=SYSCALL msg=audit(1154528220.246:679): arch=40000003 syscall=38 success=no
exit=-13 a0=99b0628 a1=99b4ab0 a2=4d38a218 a3=bf8a7878 items=3 ppid=12010
pid=23427 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0
tty=pts2 comm="setsebool" exe="/usr/sbin/setsebool"
subj=root:system_r:semanage_t:s0-s0:c0.c255 key=(null)
type=CWD msg=audit(1154528220.246:679):  cwd="/root"
type=PATH msg=audit(1154528220.246:679): item=0
name="/etc/selinux/targeted/modules/" inode=2087266 dev=03:03 mode=040755 ouid=0
ogid=0 rdev=00:00 obj=system_u:object_r:selinux_config_t:s0
type=PATH msg=audit(1154528220.246:679): item=1
name="/etc/selinux/targeted/modules/previous" inode=2087266 dev=03:03
mode=040755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:selinux_config_t:s0
type=PATH msg=audit(1154528220.246:679): item=2
name="/etc/selinux/targeted/modules/active" inode=2115588 dev=03:03 mode=040700
ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:selinux_config_t:s0
[root@trash ~]#
[root@trash ~]# restorecon -R -v /etc/selinux/targeted
restorecon reset /etc/selinux/targeted/modules/active context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
restorecon reset /etc/selinux/targeted/modules/active/file_contexts context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
restorecon reset /etc/selinux/targeted/modules/active/commit_num context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
restorecon reset /etc/selinux/targeted/modules/active/users_extra context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0restorecon
reset /etc/selinux/targeted/modules/active/modules context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
restorecon reset /etc/selinux/targeted/modules/active/modules/razor.pp context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
restorecon reset /etc/selinux/targeted/modules/active/modules/pyzor.pp context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
restorecon reset /etc/selinux/targeted/modules/active/modules/amavis.pp context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
restorecon reset /etc/selinux/targeted/modules/active/modules/dcc.pp context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
restorecon reset /etc/selinux/targeted/modules/active/modules/nagios.pp context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
restorecon reset /etc/selinux/targeted/modules/active/modules/clamav.pp context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
restorecon reset /etc/selinux/targeted/modules/active/homedir_template context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
restorecon reset /etc/selinux/targeted/modules/active/policy.kern context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0restorecon
reset /etc/selinux/targeted/modules/active/base.pp context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
restorecon reset /etc/selinux/targeted/modules/active/booleans.local context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
restorecon reset /etc/selinux/targeted/modules/active/base.linked context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0restorecon
reset /etc/selinux/targeted/modules/active/seusers.final context
system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
restorecon reset /etc/selinux/targeted/modules/active/file_contexts.template
context system_u:object_r:selinux_config_t:s0->system_u:object_r:semanage_store_t:s0
[root@trash ~]# setsebool httpd_disable_trans=1
zope homedir /opt/zope or its parent directory conflicts with a
defined context in /etc/selinux/targeted/contexts/files/file_contexts,
/usr/sbin/genhomedircon will not create a new context. This usually indicates an
incorrectly defined system account.  If it is a system account please make sure
its login shell is /sbin/nologin.
ptest homedir /local/ptest or its parent directory conflicts with a
defined context in /etc/selinux/targeted/contexts/files/file_contexts,
/usr/sbin/genhomedircon will not create a new context. This usually indicates an
incorrectly defined system account.  If it is a system account please make sure
its login shell is /sbin/nologin.


Comment 3 Daniel Walsh 2006-08-02 17:58:52 UTC
Any idea how it got in this state?

You might want to change the shell on zope and  ptest to /bin/false to eliminate
the genhomedircon warnings.



Comment 4 Joe Orton 2006-08-03 08:20:59 UTC
It's a fresh @Everything install of Raw Hide so presumably you can reproduce
this at will to debug further?

Comment 5 Daniel Walsh 2006-08-03 15:40:51 UTC
Yes the problem was in anaconda policy.  Basically it was not transitioning to
semanage_t so the context was not getting setup correctly.

Fixes in selinux-policy-2.3.3-19

Comment 6 Todd Thomas 2009-09-11 20:21:22 UTC
I have selinux-policy-2.4.6-203 and I'm still seeing this behavior. Example: 

# setsebool -P allow_ftpd_anon_write 1
zimbra homedir /opt/zimbra or its parent directory conflicts with a
defined context in /etc/selinux/targeted/contexts/files/file_contexts,
/usr/sbin/genhomedircon will not create a new context. This usually indicates an incorrectly defined system account.  If it is a system account please make sure its login shell is /sbin/nologin.
===

It really doesn't matter if you try to change allow_ftpd_anon_write or another one, they always error with 'zimbra homedir /opt/zimbra or its parent directory conflicts...'

Comment 7 Daniel Walsh 2009-09-11 20:26:41 UTC
Todd the problem is that /opt/zimbra is not a real login, so the shell should be /sbin/nologin

genhomedircon thinks you have a real user on your system named zimbra, but this is most likely a system account.  If you change the shell to /sbin/nologin, genhomedircon will ignore the account.

Comment 8 Daniel Walsh 2009-09-11 20:34:44 UTC
zimbra should probably install it self as a --system with a UID < 500.  Then SELinux will ignore it also.

Comment 9 Todd Thomas 2009-09-12 03:29:19 UTC
I'll respond for the purposes of posterity:

#7) You're right. But the shell is /bin/bash. /opt/zimbra is the home directory. Here's the layout:
zimbra:x:500:500::/opt/zimbra:/bin/bash
postfix:x:501:501::/opt/zimbra/postfix:/bin/bash

#8) It probably should be < 500 but that's how the install script install both zimbra and posfix accounts. There may be design reasons for doing this. 

I know that Zimbra interacts with the system and there are buzillions of command line tools for the app so /bin/bash is necessary. Setting the home directory just standardizes a starting place to build an environment. I would guess also necessary.

I haven't had time to test it but as I understand it some logging and statistical functionality would be lost by removing /bin/bash but there are better people to ask than me, I'm sure.


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