Bug 1355811 - SELinux: Cannot allow http_port_t to listen on tcp port 8001
Summary: SELinux: Cannot allow http_port_t to listen on tcp port 8001
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 24
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-12 15:04 UTC by Paulo Vital
Modified: 2023-09-14 03:27 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-18 18:59:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Paulo Vital 2016-07-12 15:04:53 UTC
Description of problem:
When trying to start nginx.service by systemd, based on extended configuration file to add reverse proxy to my app, SELinux is not able to allow to listen tcp port 8001. 

When trying to add the port number to enable name_bind of NGINX using semanage or semodule, the return is an error based on the message "Bad boolean declaration at line 148 of /var/lib/selinux/targeted/tmp/modules/100/virt/cil"

How reproducible:

Based on the following AVC of selinux: 

type=AVC msg=audit(1468330300.710:994090): avc:  denied  { name_bind } for  pid=1776 comm="nginx" src=8001 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket permissive=0
type=SERVICE_START msg=audit(1468330300.721:994091): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=nginx comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'

Tried to allow http_port_t to listen on tcp port 8001 using semanage

# semanage port --add -t http_port_t -p tcp 8001
Re-declaration of boolean virt_sandbox_use_fusefs
Failed to create node
Bad boolean declaration at line 148 of /var/lib/selinux/targeted/tmp/modules/100/virt/cil
OSError: [Errno 0] Error

Same happens when creating a new policy and try to install it:

# grep nginx /var/log/audit/audit.log | audit2allow -M mypol
******************** IMPORTANT ***********************
To make this policy package active, execute:

semodule -i mypol.pp

# semodule -i mypol.pp
Re-declaration of boolean virt_sandbox_use_fusefs
Failed to create node
Bad boolean declaration at line 148 of /var/lib/selinux/targeted/tmp/modules/100/virt/cil
semodule:  Failed!

Additional info:
Source Context                system_u:system_r:httpd_t:s0
Target Context                system_u:object_r:unreserved_port_t:s0
Target Objects                [ tcp_socket ]
Source                        nginx
Source Path                   /usr/sbin/nginx
Port                          8001
Source RPM Packages           nginx-1.10.1-1.fc24.x86_64
Policy RPM                    selinux-policy-3.13.1-191.fc24.3.noarch
Selinux Enabled               True
Enforcing Mode                Enforcing
Platform                      Linux 4.6.3-300.fc24.x86_64 #1 SMP 
                              Fri Jun 24 20:52:41 UTC 2016 x86_64 GNU/Linux
Policy CoreUtils:             policycoreutils-*2.5-5.fc24.x86_64

Comment 1 Paulo Vital 2016-07-18 18:59:20 UTC
Found the issue on my systems. They have stable docker (that have packages only for Fedora 23) installed and docker-engine-selinux-1.11.2-1.fc23.noarch was causing the issues on virtualization policies. Docker community is trying to solve it - https://github.com/docker/docker/issues/23981

After remove all docker packages from my systems I could use semanage and allow the necessary ports on my system.

Closing this issue.

Comment 2 Red Hat Bugzilla 2023-09-14 03:27:59 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days


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