Bug 991555

Summary: SELinux is preventing /usr/sbin/dovecot from 'name_bind' accesses on the tcp_socket .
Product: [Fedora] Fedora Reporter: Steven Rostedt <srostedt>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: dominick.grift, dwalsh, mgrepl, srostedt
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:7b4c0ebb507ebb059dbbcddc07376b75eddbbab49c17bba5b5f7c6bbd8857a7f
Fixed In Version: selinux-policy-3.11.1-103.fc18 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-23 00:44:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Steven Rostedt 2013-08-02 17:46:35 UTC
Description of problem:
Everytime I boot dovecot fails due to selinux.

I follow the directions given in trouble shooting:

# grep dovecot /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

and it works fine after that. But on next boot, it fails again with the same issue??
SELinux is preventing /usr/sbin/dovecot from 'name_bind' accesses on the tcp_socket .

*****  Plugin bind_ports (92.2 confidence) suggests  *************************

If you want to allow /usr/sbin/dovecot to bind to network port 10993
Then you need to modify the port type.
Do
# semanage port -a -t PORT_TYPE -p tcp 10993
    where PORT_TYPE is one of the following: lmtp_port_t, mail_port_t, pop_port_t, sieve_port_t.

*****  Plugin catchall_boolean (7.83 confidence) suggests  *******************

If you want to allow system to run with NIS
Then you must tell SELinux about this by enabling the 'nis_enabled' boolean.
You can read 'None' man page for more details.
Do
setsebool -P nis_enabled 1

*****  Plugin catchall (1.41 confidence) suggests  ***************************

If you believe that dovecot should be allowed name_bind access on the  tcp_socket by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep dovecot /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:dovecot_t:s0
Target Context                system_u:object_r:unreserved_port_t:s0
Target Objects                 [ tcp_socket ]
Source                        dovecot
Source Path                   /usr/sbin/dovecot
Port                          10993
Host                          (removed)
Source RPM Packages           dovecot-2.1.16-1.fc18.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.11.1-98.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.9.11-200.fc18.x86_64 #1 SMP Mon
                              Jul 22 21:04:50 UTC 2013 x86_64 x86_64
Alert Count                   3
First Seen                    2013-08-02 12:06:22 EDT
Last Seen                     2013-08-02 13:39:34 EDT
Local ID                      5c80a294-1e4c-4d09-89da-c30743fdfc40

Raw Audit Messages
type=AVC msg=audit(1375465174.610:1564): avc:  denied  { name_bind } for  pid=11183 comm="dovecot" src=10993 scontext=system_u:system_r:dovecot_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket


type=SYSCALL msg=audit(1375465174.610:1564): arch=x86_64 syscall=bind success=no exit=EACCES a0=1d a1=7fff0ec67840 a2=10 a3=7fff0ec67838 items=0 ppid=1 pid=11183 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=dovecot exe=/usr/sbin/dovecot subj=system_u:system_r:dovecot_t:s0 key=(null)

Hash: dovecot,dovecot_t,unreserved_port_t,tcp_socket,name_bind

audit2allow

#============= dovecot_t ==============
#!!!! This avc is allowed in the current policy

allow dovecot_t unreserved_port_t:tcp_socket name_bind;

audit2allow -R
require {
	type dovecot_t;
}

#============= dovecot_t ==============
corenet_tcp_bind_generic_port(dovecot_t)


Additional info:
reporter:       libreport-2.1.5
hashmarkername: setroubleshoot
kernel:         3.9.11-200.fc18.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2013-08-05 05:45:59 UTC
Is tcp/10993 used by default?

Comment 2 Daniel Walsh 2013-08-05 16:40:03 UTC
Google 10933 and dovecot shows it described as the way to setup as an IMAP server.

Comment 3 Steven Rostedt 2013-08-05 22:14:23 UTC
I usually use 10993 as it is just a local imap server (only my local box connects to it). I seldom use the default port for security reasons, but then again, 10993 is also common for someone to sniff. I do have both 10993 and 993 blocked from external access via iptables.

Comment 4 Daniel Walsh 2013-08-06 12:23:29 UTC
So lets label it the same.
acff17d6ac79a70f56e93420174c9a5466eb59f5 makes this change in git.

You can put this on your machine for now with

semanage port -a -t pop_port_t -p tcp 10993

Comment 5 Fedora Update System 2013-09-02 15:28:17 UTC
selinux-policy-3.11.1-101.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-101.fc18

Comment 6 Fedora Update System 2013-09-02 23:26:58 UTC
Package selinux-policy-3.11.1-101.fc18:
* should fix your issue,
* was pushed to the Fedora 18 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.11.1-101.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-15645/selinux-policy-3.11.1-101.fc18
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2013-09-10 11:17:08 UTC
selinux-policy-3.11.1-103.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-103.fc18

Comment 8 Fedora Update System 2013-09-23 00:44:09 UTC
selinux-policy-3.11.1-103.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.