Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 795602 - Errors installing katello-selinux and pulp-selinux-server in kickstart.
Summary: Errors installing katello-selinux and pulp-selinux-server in kickstart.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: SELinux
Version: 6.0.0
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: Unspecified
Assignee: Lukas Zapletal
QA Contact: Garik Khachikyan
URL:
Whiteboard:
Depends On:
Blocks: 800505 801752 813911
TreeView+ depends on / blocked
 
Reported: 2012-02-21 01:54 UTC by Forrest Taylor
Modified: 2019-09-25 21:09 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 800505 801752 (view as bug list)
Environment:
Last Closed: 2012-08-22 18:28:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Installation log from kickstart showing errors installing packages (53.24 KB, application/octet-stream)
2012-03-06 17:54 UTC, Forrest Taylor
no flags Details

Description Forrest Taylor 2012-02-21 01:54:14 UTC
Description of problem:
When going through the process of adding an new custom repository, I get to the point where I add a name and URL for the repo (https://SE/katello/providers#panel=provider_2) and I get the following errors:

Pulp::Repository: 403 Forbidden
Forbidden

You don't have permission to access /pulp/api/repositories/ on this server.
Apache/2.2.15 (Red Hat) Server at system-engine0.example.com Port 443
(PUT /pulp/api/repositories/)

/var/log/audit/audit.log shows:
type=AVC msg=audit(1329788642.373:91942): avc:  denied  { getattr } for  pid=2952 comm="httpd" path="/srv/pulp/webservices.wsgi" dev=dm-1 ino=280841 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:var_t:s0 tclass=file

sealert -l says that I should either change the context on the file or create a new policy package that allows the access above.  The former suggestion is probably the best in this case, but I'm not sure if it should be httpd_sys_script_t or something else.


Version-Release number of selected component (if applicable):
katello-all-0.1.238-4.el6.noarch
katello-selinux-0.1.5-2.el6.noarch

Comment 1 John Matthews 2012-02-24 15:47:38 UTC
Please confirm that the pulp selinux policy is loaded.
Example:
 sudo semodule -l | grep pulp
 pulp-server	0.x.x

Please confirm the pulp-selinux rpm is installed:
Example: 
  # rpm -qa | grep pulp-selinux
  pulp-selinux-server-1.0.0-2.el6.noarch

If the above are OK, try running:
restorecon -R /srv/pulp

Then look at the contexts, they should match below:
# ls -larthZ /srv/pulp/
drwxr-xr-x. root   root   system_u:object_r:var_t:s0       ..
-rw-r--r--. apache apache system_u:object_r:httpd_sys_content_t:s0 webservices.wsgi
-rw-r--r--. apache apache system_u:object_r:httpd_sys_content_t:s0 repo_auth.wsgi
drwxr-xr-x. root   root   system_u:object_r:var_t:s0

Comment 2 Forrest Taylor 2012-02-24 19:53:31 UTC
The pulp SELinux policy is not loaded.

The RPM package is installed:
$ rpm -q pulp-selinux-server
pulp-selinux-server-0.0.265-1.el6.noarch

The context on the files in /srv/pulp/ is var_t.


I also installed using the 2012-02-22.1 code, and I get the same result.

Ah, there may be an issue installing the package.  I have setup a repo and I am installing katello-all in the %packages section of my kickstart.  I see these errors in /root/install.log:

Installing pulp-selinux-server-0.0.267-2.el6.noarch
Cannot set persistent booleans without managed policy.
Could not change policy booleans
Cannot set persistent booleans without managed policy.
Could not change policy booleans
/var/tmp/rpm-tmp.6dFUtS: line 9: /usr/sbin/semanage: No such file or directory
/var/tmp/rpm-tmp.6dFUtS: line 10: /usr/sbin/semanage: No such file or directory
warning: %post(pulp-selinux-server-0.0.267-2.el6.noarch) scriptlet failed, exit status 127

Installing katello-selinux-0.1.7-1.el6.noarch
No such file or directory
Cannot set persistent booleans without managed policy.
Could not change policy booleans
warning: %post(katello-selinux-0.1.7-1.el6.noarch) scriptlet failed, exit status 255

Comment 3 John Matthews 2012-02-24 20:12:04 UTC
Would you try installing:  "policycoreutils-python" retrying?

It looks like we are missing a requires on rpm for pulp-selinux-server.

I am not sure this is the only issue, I am troubled why you are not seeing a selinux module for pulp-server reported from semodule -l | grep pulp


Let's try:
1) install policycoreutils-python on the system prior to pulp
2) reinstall pulp RPMs including pulp-selinux-server
3) look for errors
4) past what: semodule -l | grep pulp says
5) please paste: getenforce
6) please paste: ls -larthZ /srv/pulp

Comment 4 Forrest Taylor 2012-02-24 22:30:34 UTC
I just tried a fresh install, but this time I did nothing in kickstart.  I installed katello-all and ran katello-configure after the machine was installed.  policycoreutils-python was already added in kickstart.
The pulp-server SELinux module installs just fine post installation.

So it looks like the issue is that the SELinux policy is not available to load modules, change booleans, etc. during kickstart.  I changed the title of this bug to better match the issue.

We may need to get Dan Walsh to provide guidance in installing modules, changing booleans and the like during kickstart (in RPM %post of pulp-selinux-server and katello-selinux).

The postinstall scriptlet of pulp-selinux-server runs:
/usr/share/pulp/selinux/server/enable.sh, which runs:
  /usr/sbin/semodule -s ${selinuxvariant} -i \
            ${INSTALL_DIR}/selinux/${selinuxvariant}/${NAME}.pp
  (where selinuxvariant="mls strict targeted", INSTALL_DIR=/usr/share and NAME=pulp-server)

  /usr/sbin/setsebool -P httpd_can_network_connect 1
  /usr/sbin/setsebool -P httpd_tmp_exec 1


The postinstall scriptlet of katello-selinux runs:
/usr/sbin/katello-selinux-enable, which runs the same for loop as above (using katello.pp instead of pulp-server.pp).  It also runs:
  /sbin/restorecon -rvvi /var/lib/katello /var/log/katello
  /usr/sbin/setsebool -P httpd_can_network_connect 1

Comment 5 Lukas Zapletal 2012-03-06 16:07:08 UTC
Are you able to reproduce (in the kickstart) and attach full kickstart log? Because I guess it must be the missing policy problem. Clone of:

https://bugzilla.redhat.com/show_bug.cgi?id=800029

Comment 6 Forrest Taylor 2012-03-06 17:53:40 UTC
It is partially an issue of not having policycoreutils-python installed (at least for pulp-selinux-server), but there are other issues as well.  I am attaching the installation log.  Note that on line 821, pulp-selinux-server fails to run post scripts because semanage is not available.  Line 861 installs policycoreutils-python, and line 911 fails on installing katello-selinux.  The semanage command is available there, but it cannot manipulate the policy because it is running the kickstart SELinux policy, not the targeted policy (selinux-policy-targeted gets installed on line 1078).

Comment 7 Forrest Taylor 2012-03-06 17:54:15 UTC
Created attachment 568022 [details]
Installation log from kickstart showing errors installing packages

Comment 8 Forrest Taylor 2012-03-06 18:32:25 UTC
katello-selinux runs the /usr/sbin/katello-selinux-enable script:

#!/bin/bash

# Install SELinux policy modules
for selinuxvariant in mls strict targeted
do
  /usr/sbin/semodule -s ${selinuxvariant} -l > /dev/null 2>&1 \
    && /usr/sbin/semodule -s ${selinuxvariant} -i \
    /usr/share/selinux/${selinuxvariant}/katello.pp || :
done

# allow qpidd to use port 5674
/usr/sbin/semanage port -a -t amqp_port_t -p tcp 5674

/sbin/restorecon -rvvi /var/lib/katello /var/log/katello

# bz 790507 - httpd needs to work as proxy for Katello
/usr/sbin/setsebool -P httpd_can_network_connect 1


BTW, RHEL6 no longer includes the strict policy (it has been integrated with mls), and RHEL6 includes the new minimal policy.  We should change the for loop above accordingly.

Comment 9 Daniel Walsh 2012-03-06 19:51:18 UTC
You need to make sure selinux-policy-targeted is installed before your package if you are going to install a policy module or execute semanage type commands.

Requires(post): policycoreutils-python 
Requires(post): selinux-policy-targeted

Also you should do your boolean changing within a transaction to cut compile time.

/usr/sbin/setsebool -P httpd_can_network_connect=1 httpd_tmp_exec=1

or better yet.

semanage -S $selinuxvariant -i - << _EOF
module -a /usr/share/selinux/${selinuxvariant}/katello.pp 
boolean -m --on httpd_can_network_connect
boolean -m --on httpd_tmp_exec
port -a -t amqp_port_t -p tcp 5674
_EOF

Is 5674 a standard amqp port?

Comment 10 Lukas Zapletal 2012-03-08 17:13:02 UTC
Puttting blocker request, we need to install from a kickstart.

Comment 11 Lukas Zapletal 2012-03-09 12:15:57 UTC
Dan: It is a standard port, but SSL. AMQP is not confiured in SSL mode by default.

Comment 12 Lukas Zapletal 2012-03-09 12:44:21 UTC
Dan: I am getting:

/usr/sbin/semanage: Port tcp/5674 already defined

Does this cancel the transaction? We need to add the port because it is missing in the 6.2 GOLD, but it is now defined with an errata or something.

I guess I need to put it out of the transaction and do semanage -l first and execute it only if it is not defined.

Comment 13 Daniel Walsh 2012-03-09 14:47:25 UTC
If you try -m does that work if the port does not exists?

Comment 14 Lukas Zapletal 2012-03-12 08:59:02 UTC
Unfortunately no.

/usr/sbin/semanage: Port tcp/5674 is not defined

Taking this out of the transaction.

Comment 18 Garik Khachikyan 2012-03-20 12:25:10 UTC
need info on verification. a user scenario?

Comment 19 Lukas Zapletal 2012-03-20 12:40:43 UTC
Scenario:

Install Katello/CFSE/SAM and check if katello and pulp selinux modules are loaded:

[root@el ~]# semodule -l | grep katello
katello	1.0.0	
[root@el ~]# semodule -l | grep pulp 
pulp-server	1.0.0.2	

No AVC denials should be also in the audit.log

Comment 21 Garik Khachikyan 2012-03-20 12:53:56 UTC
# VERIFIED - katello

semodule -l | grep katello
katello	1.0.0	
[root@smqe-sat04 ~]# semodule -l | grep pulp 
pulp-server	1.0.0.6	

cat /var/log/audit/audit.log | grep AVC
(empty)

Comment 22 Garik Khachikyan 2012-03-20 12:57:24 UTC
# VERIFIED - cfse

same here for current Beta5

Comment 23 Garik Khachikyan 2012-03-20 15:31:57 UTC
# VERIFIED - sam

same (ok) is here - and of course pulp is not installed at all :)


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