[Koha-bugs] [Bug 22143] New: Fix permission and owner of configuration backups

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Jan 16 18:01:23 CET 2019


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22143

            Bug ID: 22143
           Summary: Fix permission and owner of configuration backups
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Packaging
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: magnus at libriotech.no
        QA Contact: testopia at bugs.koha-community.org
                CC: mirko at abunchofthings.net
  Target Milestone: ---

If you install Koha with the Debian packages you get backups in
/var/spool/koha/<instance>/ that look like this:

-rw------- 1 root root            6616261 jan.  12 03:11
xxxxxxxx-2019-01-12.tar.gz
-rw-r----- 1 root xxxxxxxx-koha 109473282 jan.  13 03:10
xxxxxxxx-2019-01-13.sql.gz
-rw------- 1 root root            6677496 jan.  13 03:10
xxxxxxxx-2019-01-13.tar.gz
-rw-r----- 1 root xxxxxxxx-koha 109473283 jan.  14 03:20
xxxxxxxx-2019-01-14.sql.gz
-rw------- 1 root root            6721580 jan.  14 03:20
xxxxxxxx-2019-01-14.tar.gz
-rw-r----- 1 root xxxxxxxx-koha 109473282 jan.  15 03:16
xxxxxxxx-2019-01-15.sql.gz
-rw------- 1 root root            6723809 jan.  15 03:16
xxxxxxxx-2019-01-15.tar.gz
-rw-r----- 1 root xxxxxxxx-koha 109473283 jan.  16 03:17
xxxxxxxx-2019-01-16.sql.gz
-rw------- 1 root root            6770890 jan.  16 03:17
xxxxxxxx-2019-01-16.tar.gz

Notice the difference in the permissions and the ownership of the files. 

Recently, I tried to turn on download of backups from the "Export" tool, with
these settings in koha-conf.xml: 

 <backup_db_via_tools>1</backup_db_via_tools>
 <backup_conf_via_tools>1</backup_conf_via_tools>

This worked nicely for the db files, but not for the conf files, where the page
just said "Unfortunately, no backups are available."

I found a workaround was to do the following: 

  $ sudo chmod 0640 /var/spool/koha/<instance>/*
  $ sudo chown root:<instance>-koha /var/spool/koha/<instance>/*

After this, the files showed up as expected. This is due to the check on line
342 of /usr/share/koha/intranet/cgi-bin/tools/export.pl:

  return unless ( -f $filename && -r $filename );

The -r mens "File is readable by effective uid/gid."

Looking around in Bugzilla, I found a patch for this problem, by Dobrica
Pavlinusic, on bug 8437. That bug is mainly about downloading large files with
Plack, and the permissions issue described here is fixed in a followup patch. I
will try and move that patch to this bug, so the discussion about Plack does
not block fixing the permissions.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list