Bug 36548 - koha-zebra should fix ownership on /var/run/koha/instancename files
Summary: koha-zebra should fix ownership on /var/run/koha/instancename files
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Packaging (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Aleisha Amohia
QA Contact: Testopia
URL:
Keywords:
: 30260 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-04-09 00:53 UTC by Aleisha Amohia
Modified: 2024-11-11 22:35 UTC (History)
3 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This patch ensures the relevant /var/run/koha/instancename/* files are owned by instancename-koha so the zebra service can start and stop as expected.
Version(s) released in:
Circulation function:


Attachments
Bug 36548: koha-zebra should fix ownership on /var/run/koha/instancename files (1.01 KB, patch)
2024-04-09 03:02 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 36548: koha-zebra should fix ownership on /var/run/koha/instancename files (1.37 KB, patch)
2024-11-11 22:34 UTC, Aleisha Amohia
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Aleisha Amohia 2024-04-09 00:53:13 UTC
koha-zebra is unable to stop and start a zebra process if ownership on /var/run/koha/instancename is wrong

it already checks permissions on the relevant log files, it should also check on this directory
Comment 1 Aleisha Amohia 2024-04-09 03:02:35 UTC
Created attachment 164525 [details] [review]
Bug 36548: koha-zebra should fix ownership on /var/run/koha/instancename files

This patch ensures the /var/run/koha/instancename/* files are owned by instancename-koha so zebra can start and stop as expected.

To test, confirm that:

1. starting and stopping zebra using `koha-zebra` works as expected
2. all files in /var/run/koha/instancename/ are owned by instancename-koha

Sponsored-by: Catalyst IT
Comment 2 Aleisha Amohia 2024-04-09 03:07:34 UTC
*** Bug 30260 has been marked as a duplicate of this bug. ***
Comment 3 David Nind 2024-05-02 23:22:23 UTC
Using KTD, the patch also changes the permissions for the file z3950-responder.pid - they are root before the patch is applied. I don't know what effect this will have, or whether it is currently incorrect.

Happy to sign off if you consider there are no issues.

Z3950-responder information: https://wiki.koha-community.org/wiki/Setting_up_the_Z39.50_and_SRU_Server

Before the patch (using KTD), the permissions are:

 ls -la /var/run/koha/kohadev/
total 60
drwxr-xr-x 4 kohadev-koha kohadev-koha 4096 May  2 23:04 .
drwxr-xr-x 3 root         root         4096 May  2 22:58 ..
drwxr-xr-x 2 kohadev-koha kohadev-koha 4096 May  2 22:58 authorities
srw-rw-rw- 1 kohadev-koha kohadev-koha    0 May  2 22:59 authoritysocket
drwxr-xr-x 2 kohadev-koha kohadev-koha 4096 May  2 22:58 biblios
srw-rw-rw- 1 kohadev-koha kohadev-koha    0 May  2 22:59 bibliosocket
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:59 kohadev-koha-indexer.clientpid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:59 kohadev-koha-indexer.pid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:58 kohadev-koha-sip.pid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:59 kohadev-koha-worker.clientpid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:59 kohadev-koha-worker-long_tasks.clientpid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:59 kohadev-koha-worker-long_tasks.pid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:59 kohadev-koha-worker.pid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:59 kohadev-koha-zebra.clientpid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:59 kohadev-koha-zebra.pid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:58 plack.pid
srwxr-xr-x 1 kohadev-koha kohadev-koha    0 May  2 22:58 plack.sock
-rw-r--r-- 1 root         root            4 May  2 22:59 z3950-responder.pid

After the patch, the permissions (after stopping and restarting Zebra) are:

ls -la /var/run/koha/kohadev/
total 60
drwxr-xr-x 4 kohadev-koha kohadev-koha 4096 May  2 23:05 .
drwxr-xr-x 3 root         root         4096 May  2 22:58 ..
drwxr-xr-x 2 kohadev-koha kohadev-koha 4096 May  2 22:58 authorities
srw-rw-rw- 1 kohadev-koha kohadev-koha    0 May  2 23:05 authoritysocket
drwxr-xr-x 2 kohadev-koha kohadev-koha 4096 May  2 22:58 biblios
srw-rw-rw- 1 kohadev-koha kohadev-koha    0 May  2 23:05 bibliosocket
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:59 kohadev-koha-indexer.clientpid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:59 kohadev-koha-indexer.pid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:58 kohadev-koha-sip.pid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:59 kohadev-koha-worker.clientpid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:59 kohadev-koha-worker-long_tasks.clientpid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:59 kohadev-koha-worker-long_tasks.pid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:59 kohadev-koha-worker.pid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 23:05 kohadev-koha-zebra.clientpid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 23:05 kohadev-koha-zebra.pid
-rw-r--r-- 1 kohadev-koha kohadev-koha    5 May  2 22:58 plack.pid
srwxr-xr-x 1 kohadev-koha kohadev-koha    0 May  2 22:58 plack.sock
-rw-r--r-- 1 kohadev-koha kohadev-koha    4 May  2 22:59 z3950-responder.pid
Comment 4 David Nind 2024-05-02 23:30:30 UTC
More information from when trying to restart the z3950 responder:

sudo koha-z3950-responder --restart kohadev
Restarting Z39.50/SRU daemon for kohadev:Stopping Z39.50/SRU daemon for kohadev:start-stop-daemon: matching only on non-root pidfile /var/run/koha/kohadev/z3950-responder.pid is insecure
 failed!
 failed!

If I change it back to being owned by root, it restarts as normal:

sudo koha-z3950-responder --restart kohadev
Restarting Z39.50/SRU daemon for kohadev:Stopping Z39.50/SRU daemon for kohadev:.
Starting Z39.50/SRU daemon for kohadev:.
Comment 5 Magnus Enger 2024-06-19 08:43:17 UTC
Should this be FQA? Sounds like it to me.
Comment 6 Magnus Enger 2024-10-31 09:02:40 UTC
(In reply to Magnus Enger from comment #5)
> Should this be FQA? Sounds like it to me.

No response in ~4 months, setting to FQA.
Comment 7 Aleisha Amohia 2024-11-11 22:34:51 UTC
Created attachment 174390 [details] [review]
Bug 36548: koha-zebra should fix ownership on /var/run/koha/instancename files

This patch ensures the /var/run/koha/instancename/* files are owned by instancename-koha so zebra can start and stop as expected.

Note: /var/run/koha/instancename/z3950-responder.pid must be owned by root:root but the rest should be owned by instancename-koha

To test, confirm that:

1. starting and stopping zebra using `koha-zebra` works as expected
2. all files in /var/run/koha/instancename/ are owned by instancename-koha

Sponsored-by: Catalyst IT