Bug 728697

Summary: Bacula uses /var/spool/bacula/log rather /var/log/bacula.log by default as log file
Product: Red Hat Enterprise Linux 6 Reporter: Robert Scheck <redhat-bugzilla>
Component: baculaAssignee: Lukáš Nykrýn <lnykryn>
Status: CLOSED ERRATA QA Contact: Tomas Dolezal <todoleza>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: azelinka, bsingh, mgrepl, ovasik, rdassen, robert.scheck, todoleza
Target Milestone: rcKeywords: SELinux
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: bacula-5.0.0-10.el6 Doc Type: Bug Fix
Doc Text:
Cause: Bacula creates itself /var/spool/bacula/log. Consequence: /var/spool/bacula/log has wrong selinux context. Fix: Create /var/spool/bacula/log in package. Result: /var/spool/bacula/log has correct selinux context.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-18 23:15:08 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 782183, 840699    

Description Robert Scheck 2011-08-06 10:25:04 EDT
Description of problem:
Bacula uses "/var/spool/bacula/log" rather "/var/log/bacula.log" by default as
log file. From my point this violates FHS, because logs should go to /var/log
instead of /var/spool. This might even be caused by a broken upstream default.

Version-Release number of selected component (if applicable):

How reproducible:
Everytime, see below:

Steps to Reproduce:
1. yum install bacula-common bacula-director-common
2. grep /var/spool/bacula/log /etc/bacula/bacula-dir.conf
   RESULT: append = "/var/spool/bacula/log" = all, !skipped
   EXPECTED: append = "/var/log/bacula.log" = all, !skipped
3. grep /var/spool/bacula/log /etc/logwatch/conf/logfiles/bacula.conf
   RESULT: LogFile = /var/spool/bacula/log
   EXPECTED: LogFile = bacula.log
4. grep /var/spool/bacula/log /etc/logrotate.d/bacula
   RESULT: /var/log/bacula/*.log /var/spool/bacula/log /var/log/bacula.log {
   EXPECTED: /var/log/bacula/*.log /var/log/bacula.log {
Actual results:
Bacula uses /var/spool/bacula/log rather /var/log/bacula.log by default as
log file.

Expected results:
Bacula should use /var/log/bacula.log by default as log file.

Additional info:
Violating FHS causes SELinux avc denied errors, because neither logwatch nor
logrotate are allowed by default via selinux-policy to handle (read, write, 
follow) elements labeled with var_spool_t.
Comment 1 Robert Scheck 2011-08-06 10:28:16 EDT
I have cross-filed case 00515390 for this issue in the Red Hat customer portal.
Comment 3 RHEL Product and Program Management 2011-08-06 10:57:52 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
Comment 4 Robert Scheck 2011-10-11 08:04:02 EDT
Filled as case 00545706 as well, because affects another customer, too.
Comment 5 Robert Scheck 2011-10-13 06:59:01 EDT
Same for case 00547366, yet another customer.
Comment 6 Lukáš Nykrýn 2011-10-17 08:33:30 EDT
I really don't want to move location of log file, for example it can break some monitoring scripts. Are there some concrete issues, which are caused by this location?
Comment 7 Robert Scheck 2011-10-17 08:37:32 EDT
1. It's an FHS violation - that should be already reason enough
2. SELinux policy causes AVC denied for at least logwatch + logrotate, because
   it's labeled with var_spool_t instead of var_log_t
Comment 8 Lukáš Nykrýn 2011-10-17 10:48:40 EDT
1. You can take messages from this log as unread mail, this file contains all mails sended to administrator.
2. Added mgrepl to CC
Comment 9 Miroslav Grepl 2011-10-18 03:48:24 EDT
We have in the policy

/var/spool/bacula/log(/.*)? 	gen_context(system_u:object_r:var_log_t,s0)

Is "/var/spool/bacula/log" owned by the bacula package?
Comment 10 Robert Scheck 2011-10-18 04:55:28 EDT
In which version of the policy? That version that comes with RHEL 6.1 with all
standard updates?
Comment 11 Lukáš Nykrýn 2011-10-18 05:23:39 EDT
(In reply to comment #9)
> We have in the policy
> /var/spool/bacula/log(/.*)?  gen_context(system_u:object_r:var_log_t,s0)
> Is "/var/spool/bacula/log" owned by the bacula package?

Only dir /var/spool/bacula is included in package. All files in it aren't.
Comment 12 Miroslav Grepl 2011-10-18 05:27:34 EDT
RHEL6.2 policy which you can grab from

Comment 13 Robert Scheck 2011-10-18 05:35:50 EDT
That is not really the RHEL 6.2 policy, that is latest build which likely
gets in RHEL 6.2, but from what I know in the past, it should not be used
for productive environments so far - right?
Comment 14 Lukáš Nykrýn 2011-10-27 04:53:37 EDT
I think that easiest solution, would be to include this file to bacula-common package. Then if you install bacula it will create empty file with correct selinux context and logwatch and logrotate will be able to work with it. Disadvantage of this solution is that when you uninstall bacula it will also remove this file, but this can be bypassed by making copy of it in uninstall process.
Comment 25 errata-xmlrpc 2012-11-18 23:15:08 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.