Bug 615442 - SELinux is preventing /usr/sbin/sendmail.sendmail "write" access on /var/lib/BackupPC.
SELinux is preventing /usr/sbin/sendmail.sendmail "write" access on /var...
Status: CLOSED INSUFFICIENT_DATA
Product: Fedora
Classification: Fedora
Component: BackupPC (Show other bugs)
13
i386 Linux
low Severity medium
: ---
: ---
Assigned To: Bernard Johnson
Fedora Extras Quality Assurance
setroubleshoot_trace_hash:caf90333eda...
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-16 14:14 EDT by Steven Snyder
Modified: 2011-06-09 22:57 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-06-09 22:57:11 EDT
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 Steven Snyder 2010-07-16 14:14:51 EDT
This is a Fedora installation with BackupPC installed from the Fedora repository, and the service enabled at runlevels 3 and 5. I have not touched the configuration files for either BackupPC or sendmail; I just installed BackupPC from the repository.  I'm not sure why sendmail is trying to -write- to the backups directory, so I don't know which package this problem relates to.

Summary:

SELinux is preventing /usr/sbin/sendmail.sendmail "write" access on
/var/lib/BackupPC.

Detailed Description:

SELinux denied access requested by sendmail. It is not expected that this access
is required by sendmail and this access may signal an intrusion attempt. It is
also possible that the specific version or configuration of the application is
causing it to require additional access.

Allowing Access:

You can generate a local policy module to allow this access - see FAQ
(http://docs.fedoraproject.org/selinux-faq-fc5/#id2961385) Please file a bug
report.

Additional Information:

Source Context                system_u:system_r:sendmail_t:s0
Target Context                system_u:object_r:var_lib_t:s0
Target Objects                /var/lib/BackupPC [ dir ]
Source                        sendmail
Source Path                   /usr/sbin/sendmail.sendmail
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           sendmail-8.14.4-4.fc13
Target RPM Packages           BackupPC-3.1.0-14.fc13
Policy RPM                    selinux-policy-3.7.19-28.fc13
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Plugin Name                   catchall
Host Name                     (removed)
Platform                      Linux gfdatavirtual 2.6.33.5-124.fc13.i686 #1 SMP
                              Fri Jun 11 09:48:40 UTC 2010 i686 i686
Alert Count                   1
First Seen                    Thu 15 Jul 2010 01:00:03 AM PDT
Last Seen                     Thu 15 Jul 2010 01:00:03 AM PDT
Local ID                      16e16a44-5c7d-4357-89ac-bc2be54fee41
Line Numbers                  

Raw Audit Messages            

node=gfdatavirtual type=AVC msg=audit(1279180803.481:21905): avc:  denied  { write } for  pid=15568 comm="sendmail" name="BackupPC" dev=dm-0 ino=262935 scontext=system_u:system_r:sendmail_t:s0 tcontext=system_u:object_r:var_lib_t:s0 tclass=dir

node=gfdatavirtual type=SYSCALL msg=audit(1279180803.481:21905): arch=40000003 syscall=5 success=no exit=-13 a0=bff6a65c a1=4c1 a2=180 a3=0 items=0 ppid=15565 pid=15568 auid=4294967295 uid=490 gid=478 euid=490 suid=490 fsuid=490 egid=478 sgid=485 fsgid=478 tty=(none) ses=4294967295 comm="sendmail" exe="/usr/sbin/sendmail.sendmail" subj=system_u:system_r:sendmail_t:s0 key=(null)



Hash String generated from  catchall,sendmail,sendmail_t,var_lib_t,dir,write
audit2allow suggests:

#============= sendmail_t ==============
#!!!! The source type 'sendmail_t' can write to a 'dir' of the following type:
# var_log_t
#!!!! The source type 'sendmail_t' can write to a 'dir' of the following types:
# var_log_t, sendmail_tmp_t
#!!!! The source type 'sendmail_t' can write to a 'dir' of the following types:
# var_log_t, sendmail_tmp_t, dovecot_spool_t
#!!!! The source type 'sendmail_t' can write to a 'dir' of the following types:
# var_log_t, sendmail_tmp_t, dovecot_spool_t, etc_aliases_t
#!!!! The source type 'sendmail_t' can write to a 'dir' of the following types:
# var_log_t, sendmail_tmp_t, dovecot_spool_t, etc_aliases_t, sendmail_log_t
#!!!! The source type 'sendmail_t' can write to a 'dir' of the following types:
# var_log_t, sendmail_tmp_t, dovecot_spool_t, etc_aliases_t, sendmail_log_t, tmp_t
#!!!! The source type 'sendmail_t' can write to a 'dir' of the following types:
# var_log_t, sendmail_tmp_t, dovecot_spool_t, etc_aliases_t, sendmail_log_t, tmp_t, user_home_dir_t
#!!!! The source type 'sendmail_t' can write to a 'dir' of the following types:
# var_log_t, sendmail_tmp_t, dovecot_spool_t, etc_aliases_t, sendmail_log_t, tmp_t, user_home_dir_t, mail_spool_t
#!!!! The source type 'sendmail_t' can write to a 'dir' of the following types:
# var_log_t, sendmail_tmp_t, dovecot_spool_t, etc_aliases_t, sendmail_log_t, tmp_t, user_home_dir_t, mail_spool_t, mail_spool_t
#!!!! The source type 'sendmail_t' can write to a 'dir' of the following types:
# var_log_t, sendmail_tmp_t, dovecot_spool_t, etc_aliases_t, sendmail_log_t, tmp_t, user_home_dir_t, mail_spool_t, mail_spool_t, mqueue_spool_t
#!!!! The source type 'sendmail_t' can write to a 'dir' of the following types:
# var_log_t, sendmail_tmp_t, dovecot_spool_t, etc_aliases_t, sendmail_log_t, tmp_t, user_home_dir_t, mail_spool_t, mail_spool_t, mqueue_spool_t, etc_t
#!!!! The source type 'sendmail_t' can write to a 'dir' of the following types:
# var_log_t, sendmail_tmp_t, dovecot_spool_t, etc_aliases_t, sendmail_log_t, tmp_t, user_home_dir_t, mail_spool_t, mail_spool_t, mqueue_spool_t, etc_t, var_run_t
#!!!! The source type 'sendmail_t' can write to a 'dir' of the following types:
# var_log_t, sendmail_tmp_t, dovecot_spool_t, etc_aliases_t, sendmail_log_t, tmp_t, user_home_dir_t, mail_spool_t, mail_spool_t, mqueue_spool_t, etc_t, var_run_t, user_home_t

allow sendmail_t var_lib_t:dir write;
Comment 1 Daniel Walsh 2010-07-20 14:02:10 EDT
restorecon -R -v /var/lib/BackupPC

Should fix
Comment 2 Steven Snyder 2010-09-02 12:51:29 EDT
restorecon -R -v /var/lib/BackupPC did not produce any output, so I don't think it changed any file labels in /var/lib/BackupPC.
The error occurs at exactly 1:00AM so I will update this bug report if I encounter the error again tomorrow.
Comment 3 Steven Snyder 2010-09-03 14:25:42 EDT
It didn't occur again after using restorecon. I was able to reproduce the problem by installing BackupPC on a fresh Fedora install, so my guess is that the BackupPC rpm install script is supposed to call restorecon at some point, but doesn't.
Comment 4 Johan Cwiklinski 2010-09-03 17:35:18 EDT
There is no specific BackupPC context for /var/lib/BackupPC ; so the RPM will not call restorecon on that directory.
If the restorecon -v does not produce any output ; labels were already correct and the command did no change anything.

I do not know why sendmail is trying to write in that directory ; that is not BackupPC related as long as I can see.

I've no idea how to solve that.
Comment 5 Steven Snyder 2010-09-07 14:05:00 EDT
Thanks for the input, Johan. I saw the access error again on Sunday morning at 1:00 AM, so you're right that restorecon did not change anything.

According to BackupPC's documentation, there is a configurable minimum period between emails, which is 3 days by default. Last time the problem occurred was 2010-09-02 at 1 AM, and it occurred again 2010-09-05 at 1 AM. Based on the timing this seems to be happening when the BackupPC daemon tries to send emails. 

I just ran BackupPC's email test program; the test email went through and did not cause any SELinux warnings to appear. Still, BackupPC itself can't send any emails due to the SELinux write permission for sendmail on /var/lib/BackupPC.

I'm not sure how to trigger BackupPC to send its email immediately. For now I have reduced the minimum period to 1 day so I expect to get the SELinux error nightly if that worked. This is the first setting I have changed in BackupPC since installing the package.
Comment 6 Daniel Walsh 2010-09-07 14:24:53 EDT
sendmail has its stdout redirected to content in this directory, which is why sendmail is getting this avc.

BackupPC should label this directory to be able to allow sendmail to output there or change sendmails stdout to /var/log/BackupPC
Comment 7 Bug Zapper 2011-06-01 09:41:14 EDT
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '13'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 13's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 13 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 8 Steven Snyder 2011-06-09 17:58:02 EDT
I don't use BackupPC anymore so unfortunately I don't know if this problem was ever fixed.

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