Bug 745017

Summary: Bacula Catalog Backup Failing Due to umask issue in make_catalog_backup.pl script
Product: Red Hat Enterprise Linux 6 Reporter: Jason Tingle <moongloom>
Component: baculaAssignee: Lukáš Nykrýn <lnykryn>
Status: CLOSED DUPLICATE QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-10-13 08:07:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Jason Tingle 2011-10-11 08:10:39 UTC
Description of problem:
The umask on line 92 of the make_catalog_backup.pl script is incorrectly configured.  A mask is set instead of a umask.

my %args = @_;
    umask(0700);
    unlink("$wd/.my.cnf");
    open(MY, ">$wd/.my.cnf")

This should be
    umask(0077)

The backup of the catalog will fail because of this problem.  MySQL will ignore the .my.cnf file create in /var/spool/bacula since it is world writable

[root@nicodemus bacula]# ./make_catalog_backup.pl MyCatalog
Warning: World-writable config file '/var/spool/bacula/.my.cnf' is ignored
mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) when trying to connect
[root@nicodemus bacula]# ls -l /var/spool/bacula/.my.cnf
----rw-rw-. 1 root root 46 Oct 11 04:04 /var/spool/bacula/.my.cnf

# Now make the change and try again
[root@nicodemus bacula]# rm /var/spool/bacula/.my.cnf
[root@nicodemus bacula]# perl -i.bak -wple 's/0700/0077/;' /usr/libexec/bacula/make_catalog_backup.pl
[root@nicodemus bacula]# ./make_catalog_backup.pl MyCatalog
[root@nicodemus bacula]# echo $?
0
[root@nicodemus bacula]# ls -l /var/spool/bacula/.my.cnf
-rw-------. 1 root root 46 Oct 11 04:07 /var/spool/bacula/.my.cnf


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

[root@nicodemus ~]# rpm -q bacula-director-common
bacula-director-common-5.0.0-7.el6.x86_64

[root@nicodemus ~]# rpm -ql bacula-director-common|grep make_catalog_backup.pl
/usr/libexec/bacula/make_catalog_backup.pl



How reproducible:


Steps to Reproduce:
1. Install the bacula-director rpm and after configuring the mysql database and bacula-dir.conf file try to take a backup of the catalog
2. The catalog backup will fail
  
Actual results:
Backup of Bacula Catalog fails

Expected results:
Backup of Bacula Catalog should be successful

Additional info:

Comment 2 RHEL Program Management 2011-10-11 08:29:23 UTC
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
representative.

Comment 3 Lukáš Nykrýn 2011-10-13 08:07:52 UTC

*** This bug has been marked as a duplicate of bug 651780 ***