Hide Forgot
Description of problem: When bcfg2 is used to install RPM packages (using the yum python modules), errors are logged if the package scripts add users or groups: type=SELINUX_ERR msg=audit(1332377695.924:15802): security_compute_sid: invalid context unconfined_u:unconfined_r:useradd_t:s0-s0:c0.c1023 for scontext=unconfined_u:unconfined_r:rpm_script_t:s0-s0:c0.c1023 tcontext=system_u:object_r:useradd_exec_t:s0 tclass=process type=SYSCALL msg=audit(1332377695.924:15802): arch=c000003e syscall=59 success=yes exit=0 a0=282ac10 a1=282acd0 a2=2827600 a3=80 items=0 ppid=12664 pid=12669 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=2 comm="useradd" exe="/usr/sbin/useradd" subj=unconfined_u:unconfined_r:useradd_t:s0-s0:c0.c1023 key=(null) type=ADD_USER msg=audit(1332377695.982:15803): user pid=12669 uid=0 auid=0 ses=2 subj=unconfined_u:unconfined_r:useradd_t:s0-s0:c0.c1023 msg='op=adding user id=25 exe="/usr/sbin/useradd" hostname=? addr=? terminal=? res=success' # ls -lZ /usr/sbin/bcfg2 -rwxr-xr-x. root root system_u:object_r:bin_t:s0 /usr/sbin/bcfg2 Version-Release number of selected component (if applicable): selinux-policy-3.7.19-126.el6_2.10 How reproducible: Always Steps to Reproduce: 1. use bcfg2 to configure new system, including package additions 2. tail -f /var/log/audit/audit.log Actual results: SELinux logs an error, users are not added. Expected results: New user accounts should be added according to rpm preinstall scripts
I'm not familiar with bcfg2* packages. Could you help me a little? I'm able to start bcfg2-server and it runs without errors. How do you invoke bcfg2 to install a package?
It seems that bcfg2-server does not have its own SELinux domain. It runs as initrc_t. # rpm -qa selinux-policy\* selinux-policy-targeted-3.7.19-142.el6.noarch selinux-policy-minimum-3.7.19-142.el6.noarch selinux-policy-3.7.19-142.el6.noarch selinux-policy-doc-3.7.19-142.el6.noarch selinux-policy-mls-3.7.19-142.el6.noarch # sestatus SELinux status: enabled SELinuxfs mount: /selinux Current mode: enforcing Mode from config file: enforcing Policy version: 24 Policy from config file: targeted # ps -efZ | grep bcfg unconfined_u:system_r:initrc_t:s0 root 7002 1 0 05:14 ? 00:00:00 /usr/bin/python /usr/sbin/bcfg2-server -D /var/run/bcfg2-server.pid unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 root 7190 6459 0 05:38 pts/0 00:00:00 grep bcfg #
The problem is bcfg2 was run directly from unconfined_t. How is bcfg2 used in your case?
Hi, I've also been hit by this bug so I can provide a bit more information. Bcfg2 is a configuration management service, and the bcfg2 client is what's actually triggering this issue. It's actually kind of complex to set up an example, but there's documentation here: http://docs.bcfg2.org/appendix/guides/centos.html#appendix-guides-centos The issue isn't with bcfg2-server, but with the bcfg2 package, which uses the yum python libraries to install packages. Most often, bcfg2 is run on the command line or as a cron job. Both instances trigger this problem. See the bcfg2 bug report here: http://trac.mcs.anl.gov/projects/bcfg2/ticket/1095 The issue is that when bcfg2 is invoked, it is capable of installing packages, but any packages that have preinstall scripts that attempt to create users or groups fail. Changing the SELinux type on the bcfg2 executable to rpm_exec_t allows it to transition from the unconfined role to one which is allowed to run useradd and groupadd. The temporary solution is to add that attribute to bcfg2, but it would be nice if /usr/sbin/bcfg2 could have the rpm_exec_t type in the RHEL6 selinux policy.
chcon -t rpm_exec_t /usr/sbin/bcfg2
Daniel Walsh: Yes, that's the temporary solution I proposed in the bcfg2 ticket above. Actually, I'm currently running: semanage fcontext -a -t rpm_exec_t /usr/sbin/bcfg2 and restorecon /usr/sbin/bcfg2 for now, until the selinux policy is updated on RHEL6.
Great.
I added it to Fedora, backporting to RHEL6.3.
Could you also create a new SELinux domain for bcfg2-server ? I noticed that it runs as initrc_t.
(In reply to comment #10) > Could you also create a new SELinux domain for bcfg2-server ? I noticed that it > runs as initrc_t. This issue has nothing to do with the bcfg2-server process.
Milos is this server just running to install packages?
(In reply to comment #12) > Milos is this server just running to install packages? The bcfg2-server process started from the init script doesn't install packages. The client (/usr/sbin/bcfg2) installs packages. This is configuration management software, the server just directs the clients what packages are to be installed, based on the definitions in the configuration.
Ok lets open a separate bugzilla for this.
The /usr/sbin/bcfg2 label has been fixed.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2012-0780.html