Bug 447454 - /usr/libexec/postfix/tlsmgr can't write/create /var/lib/postfix/prng_exch
/usr/libexec/postfix/tlsmgr can't write/create /var/lib/postfix/prng_exch
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
9
All Linux
medium Severity medium
: ---
: ---
Assigned To: Daniel Walsh
Fedora Extras Quality Assurance
: Regression, SELinux
: 447450 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-05-19 19:21 EDT by Nils Philippsen
Modified: 2008-11-17 17:04 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-11-17 17:04:03 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Nils Philippsen 2008-05-19 19:21:45 EDT
Description of problem:
With a Postfix set up for using TLS and SELinux enforcing,
/usr/libexec/postfix/tlsmgr can't write/create /var/lib/postfix/prng_exch

Version-Release number of selected component (if applicable):
selinux-policy-3.3.1-51.fc9.noarch
selinux-policy-targeted-3.3.1-51.fc9.noarch
postfix-2.5.1-2.fc9.x86_64

How reproducible:
Easy

Steps to Reproduce:
1. setenforce 1
2. service postfix restart
3. telnet localhost 25
  
Actual results:
No greeting by postfix in the telnet command, this error message in
/var/log/maillog:

May 20 01:12:02 wombat postfix/smtpd[22849]: initializing the server-side TLS engine
May 20 01:12:02 wombat postfix/tlsmgr[22851]: fatal: tls_prng_exch_open: cannot
open PRNG exchange file /var/lib/postfix/prng_exch: Permission denied
May 20 01:12:03 wombat postfix/master[22844]: warning: process
/usr/libexec/postfix/tlsmgr pid 22851 exit status 1
May 20 01:12:03 wombat postfix/master[22844]: warning:
/usr/libexec/postfix/tlsmgr: bad command startup -- throttling

Expected results:
"220 wombat.tiptoe.de ESMTP Postfix" in the telnet, no error message in the log
(just as it is after `setenforce 0`).

Additional info:
After `setenforce 0`, it works. I don't know why, but I don't get anything out
of setroubleshoot.

root@wombat:~> ls -lZd /usr/libexec/postfix/tlsmgr /var/lib/postfix/
-rwxr-xr-x  root root system_u:object_r:postfix_exec_t:s0
/usr/libexec/postfix/tlsmgr
drwx------  postfix root system_u:object_r:var_lib_t:s0   /var/lib/postfix/
Comment 1 Nils Philippsen 2008-05-19 19:49:38 EDT
After relabeling the system, setroubleshoot speaks to me again:

--- 8< ---
Summary:

SELinux is preventing tlsmgr (postfix_master_t) "write" to ./postfix
(var_lib_t).

Detailed Description:

SELinux is preventing tlsmgr (postfix_master_t) "write" to ./postfix
(var_lib_t). The SELinux type var_lib_t, is a generic type for all files in the
directory and very few processes (SELinux Domains) are allowed to write to this
SELinux type. This type of denial usual indicates a mislabeled file. By default
a file created in a directory has the gets the context of the parent directory,
but SELinux policy has rules about the creation of directories, that say if a
process running in one SELinux Domain (D1) creates a file in a directory with a
particular SELinux File Context (F1) the file gets a different File Context
(F2). The policy usually allows the SELinux Domain (D1) the ability to write,
unlink, and append on (F2). But if for some reason a file (./postfix) was
created with the wrong context, this domain will be denied. The usual solution
to this problem is to reset the file context on the target file, restorecon -v
'./postfix'. If the file context does not change from var_lib_t, then this is
probably a bug in policy. Please file a bug report
(http://bugzilla.redhat.com/bugzilla/enter_bug.cgi) against the selinux-policy
package. If it does change, you can try your application again to see if it
works. The file context could have been mislabeled by editing the file or moving
the file from a different directory, if the file keeps getting mislabeled, check
the init scripts to see if they are doing something to mislabel the file.

Allowing Access:

You can attempt to fix file context by executing restorecon -v './postfix'

Fix Command:

restorecon './postfix'

Additional Information:

Source Context                unconfined_u:system_r:postfix_master_t:s0
Target Context                system_u:object_r:var_lib_t:s0
Target Objects                ./postfix [ dir ]
Source                        tlsmgr
Source Path                   /usr/libexec/postfix/tlsmgr
Port                          <Unknown>
Host                          wombat
Source RPM Packages           postfix-2.5.1-2.fc9
Target RPM Packages           
Policy RPM                    selinux-policy-3.3.1-51.fc9
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   mislabeled_file
Host Name                     wombat
Platform                      Linux wombat 2.6.25.3-18.fc9.x86_64 #1 SMP Tue May
                              13 04:54:47 EDT 2008 x86_64 x86_64
Alert Count                   2
First Seen                    Tue 20 May 2008 01:44:53 AM CEST
Last Seen                     Tue 20 May 2008 01:46:55 AM CEST
Local ID                      0838bcc0-c587-4d8f-a130-920c98c45832
Line Numbers                  

Raw Audit Messages            

host=wombat type=AVC msg=audit(1211240815.811:43): avc:  denied  { write } for 
pid=4941 comm="tlsmgr" name="postfix" dev=dm-3 ino=720990
scontext=unconfined_u:system_r:postfix_master_t:s0
tcontext=system_u:object_r:var_lib_t:s0 tclass=dir

host=wombat type=SYSCALL msg=audit(1211240815.811:43): arch=c000003e syscall=2
success=no exit=-13 a0=7f535ff6e920 a1=42 a2=180 a3=7fff66e03db0 items=0
ppid=4734 pid=4941 auid=500 uid=0 gid=0 euid=89 suid=0 fsuid=89 egid=89 sgid=0
fsgid=89 tty=(none) ses=1 comm="tlsmgr" exe="/usr/libexec/postfix/tlsmgr"
subj=unconfined_u:system_r:postfix_master_t:s0 key=(null)
--- >8 ---
Comment 2 Daniel Walsh 2008-05-19 20:13:05 EDT
chcon -R -t postfix_var_lib_t /var/lib/postfix

should fix.

Fixed in selinux-policy-3.3.1-53.fc9.noarch
Comment 3 Nils Philippsen 2008-05-20 04:18:26 EDT
(In reply to comment #2)
> chcon -R -t postfix_var_lib_t /var/lib/postfix
> 
> should fix.

Tha seems to do it. Thanks for the quick response!
Comment 4 Thomas Woerner 2008-05-20 05:04:22 EDT
*** Bug 447450 has been marked as a duplicate of this bug. ***
Comment 5 Mads Kiilerich 2008-05-20 15:46:30 EDT
I confirm that selinux-policy-3.3.1-53.fc9 fixes the problem for me (Bug 447450).

The fix seems not to be mentioned in the package changelog?
Comment 6 Daniel Walsh 2008-11-17 17:04:03 EST
Closing all bugs that have been in modified for over a month.  Please reopen if the bug is not actually fixed.

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