Error while loading /etc/koha/sites/kohadev/plack.psgi: Can't load application from file "/kohadevbox/koha/api/v1/app.pl": Unable to load schema 'paths.json' (paths.json) at /usr/local/share/perl/5.28.1/JSON/Validator.pm line 293. JSON::Validator::_load_schema(JSON::Validator::OpenAPI::Mojolicious=HASH(0x557d435b0668), Mojo::URL=HASH(0x557d439f9570)) called at /usr/local/share/perl/5.28.1/JSON/Validator.pm line 398 JSON::Validator::_resolve(JSON::Validator::OpenAPI::Mojolicious=HASH(0x557d435b0668), Mojo::URL=HASH(0x557d439f9570)) called at /usr/local/share/perl/5.28.1/JSON/Validator.pm line 485 JSON::Validator::_resolve_ref(JSON::Validator::OpenAPI::Mojolicious=HASH(0x557d435b0668), HASH(0x557d43866008), Mojo::URL=HASH(0x557d435b5330)) called at /usr/local/share/perl/5.28.1/JSON/Validator/OpenAPI/Mojolicious.pm line 347 JSON::Validator::OpenAPI::Mojolicious::_resolve_ref(JSON::Validator::OpenAPI::Mojolicious=HASH(0x557d435b0668), HASH(0x557d43866008), Mojo::URL=HASH(0x557d435b5330)) called at /usr/local/share/perl/5.28.1/JSON/Validator.pm line 446 JSON::Validator::_resolve(JSON::Validator::OpenAPI::Mojolicious=HASH(0x557d435b0668), HASH(0x557d43990b70)) called at /usr/local/share/perl/5.28.1/JSON/Validator/OpenAPI/Mojolicious.pm line 61 JSON::Validator::OpenAPI::Mojolicious::load_and_validate_schema(JSON::Validator::OpenAPI::Mojolicious=HASH(0x557d435b0668), Mojo::Home=SCALAR(0x557d43997638), HASH(0x557d435b0f80)) called at /kohadevbox/koha/Koha/REST/V1.pm line 107 Koha::REST::V1::catch {...} ("Duplicate keys not allowed, at character offset 4789 (before "...) called at /usr/share/perl5/Try/Tiny.pm line 123 Try::Tiny::try(CODE(0x557d435b06b0), Try::Tiny::Catch=REF(0x557d3fe78d28)) called at /kohadevbox/koha/Koha/REST/V1.pm line 132 Koha::REST::V1::startup(Koha::REST::V1=HASH(0x557d425daba8)) called at /usr/share/perl5/Mojolicious.pm line 180 Mojolicious::new("Koha::REST::V1") called at /usr/share/perl5/Mojo/Server.pm line 17 Mojo::Server::build_app(Mojo::Server=HASH(0x557d425daa88), "Koha::REST::V1") called at /usr/share/perl5/Mojolicious/Commands.pm line 72 Mojolicious::Commands::start_app("Mojolicious::Commands", "Koha::REST::V1") called at /kohadevbox/koha/api/v1/app.pl line 21 require /kohadevbox/koha/api/v1/app.pl called at (eval 410) line 1 eval 'package Mojo::Server::Sandbox::6e5427f801a8552f3acbea43b397de68; require $path' called at /usr/share/perl5/Mojo/Server.pm line 54 Mojo::Server::load_app(Mojo::Server::PSGI=HASH(0x557d425da470), "/kohadevbox/koha/api/v1/app.pl") called at /etc/koha/sites/kohadev/plack.psgi line 64 Plack::Sandbox::_2fetc_2fkoha_2fsites_2fkohadev_2fplack_2epsgi::__ANON__() called at /usr/share/perl5/Plack/Builder.pm line 118 Plack::Builder::builder(CODE(0x557d3bd895a0)) called at /etc/koha/sites/kohadev/plack.psgi line 66 require /etc/koha/sites/kohadev/plack.psgi called at (eval 16) line 3 eval 'package Plack::Sandbox::_2fetc_2fkoha_2fsites_2fkohadev_2fplack_2epsgi; { my $app = do $_file; if ( !$app && ( my $error = $@ || $! )) { die $error; } $app; } ' called at /usr/share/perl5/Plack/Util.pm line 120 Plack::Util::_load_sandbox("/etc/koha/sites/kohadev/plack.psgi") called at /usr/share/perl5/Plack/Util.pm line 136 Plack::Util::load_psgi("/etc/koha/sites/kohadev/plack.psgi") called at /usr/share/perl5/Plack/Runner.pm line 179 Plack::Runner::__ANON__() called at /usr/share/perl5/Plack/Runner.pm line 24 Plack::Runner::__ANON__() called at /usr/share/perl5/Plack/Runner.pm line 24 Plack::Runner::__ANON__() called at /usr/share/perl5/Plack/Runner.pm line 24 Plack::Runner::__ANON__() called at /usr/share/perl5/Plack/Runner.pm line 24 Plack::Runner::__ANON__() called at /usr/share/perl5/Starman/Server.pm line 174 Starman::Server::child_init_hook(Starman::Server=HASH(0x557d3b6f3df8)) called at /usr/share/perl5/Net/Server/PreFork.pm line 218 Net::Server::PreFork::run_child(Starman::Server=HASH(0x557d3b6f3df8)) called at /usr/share/perl5/Net/Server/PreFork.pm line 183 Net::Server::PreFork::run_n_children(Starman::Server=HASH(0x557d3b6f3df8), 2) called at /usr/share/perl5/Net/Server/PreFork.pm line 107 Net::Server::PreFork::loop(Starman::Server=HASH(0x557d3b6f3df8)) called at /usr/share/perl5/Net/Server.pm line 58 Net::Server::run(Starman::Server=HASH(0x557d3b6f3df8), "port", ARRAY(0x557d3bcfd120), "host", "*", "proto", "tcp", "serialize", ...) called at /usr/share/perl5/Starman/Server.pm line 106 Starman::Server::run(Starman::Server=HASH(0x557d3b6f3df8), CODE(0x557d3b6f3ca8), HASH(0x557d3b6f3a50)) called at /usr/share/perl5/Plack/Handler/Starman.pm line 25 Plack::Handler::Starman::run(Plack::Handler::Starman=HASH(0x557d3b6f3cc0), CODE(0x557d3b6f3ca8)) called at /usr/share/perl5/Plack/Loader/Delayed.pm line 20 Plack::Loader::Delayed::run(Plack::Loader::Delayed=HASH(0x557d3b464db8), Plack::Handler::Starman=HASH(0x557d3b6f3cc0)) called at /usr/share/perl5/Plack/Runner.pm line 277 Plack::Runner::run(Plack::Runner=HASH(0x557d3b3ff348)) called at /usr/bin/starman line 38 Compilation failed in require at (eval 410) line 1. Child process 895 exited with status 2
root@9ff4dd74490d:~$ koha-plack --stop kohadev start-stop-daemon: matching only on non-root pidfile /var/run/koha/kohadev/plack.pid is insecure [FAIL] Error: Plack not running for kohadev: failed! root@9ff4dd74490d:~$ ls -l /var/run/koha/kohadev/ total 20 drwxr-xr-x 2 kohadev-koha kohadev-koha 4096 May 13 11:14 authorities srw-rw-rw- 1 kohadev-koha kohadev-koha 0 May 13 11:15 authoritysocket drwxr-xr-x 2 kohadev-koha kohadev-koha 4096 May 13 11:14 biblios srw-rw-rw- 1 kohadev-koha kohadev-koha 0 May 13 11:15 bibliosocket -rw-r--r-- 1 kohadev-koha kohadev-koha 5 May 13 11:19 kohadev-koha-sip.pid -rw-r--r-- 1 kohadev-koha kohadev-koha 4 May 13 11:15 kohadev-koha-zebra.pid -rw-r--r-- 1 kohadev-koha kohadev-koha 5 May 13 11:20 plack.pid srwxr-xr-x 1 kohadev-koha kohadev-koha 0 May 13 11:20 plack.sock Also note that the error message is wrong, plack is running but says it's not.
Created attachment 104887 [details] [review] Bug 25481: Pass --user to start-stop-daemon when a pidfile is used Since D10, the behaviour of start-stop-daemon changed, see from its manual: """ Warning: using this match option with a world-writable pidfile or using it alone with a daemon that writes the pidfile as an unprivileged (non-root) user will be refused with an error (since version 1.19.3) as this is a security risk, because either any user can write to it, or if the daemon gets compromised, the contents of the pidfile cannot be trusted, and then a privileged runner (such as an init script executed as root) would end up acting on any system process. Using /dev/null is exempt from these checks. """ Test plan: koha-plack --restart kohadev should success with this patch. Without this patch you get: start-stop-daemon: matching only on non-root pidfile /var/run/koha/kohadev/plack.pid is insecure
This is blocker for 20.05
Haven't looked into this in Koha but just a bit of Googled info on start-stop-daemon: Jessie: 1.17.27 https://manpages.debian.org/jessie/dpkg/start-stop-daemon.8.en.html Stretch: 1.18.25 https://manpages.debian.org/stretch/dpkg/start-stop-daemon.8.en.html Buster: 1.19.7 https://manpages.debian.org/buster/dpkg/start-stop-daemon.8.en.html Ubuntu 18.04 (based off buster/sid): 1.19.05 http://manpages.ubuntu.com/manpages/bionic/man8/start-stop-daemon.8.html Issue introduced in 1.19.3? https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=921557 Claimed to be fixed in 1.19.5 in February though... Jonathan, could you report on what version of dpkg is installed in your test environment? Might be that the update hasn't flowed to the Docker images you're using.
(In reply to Jonathan Druart from comment #2) > Since D10, the behaviour of start-stop-daemon changed, see from its > manual: > """ > Warning: using this match option with a world-writable pidfile or using it > alone with a daemon that writes the pidfile as an unprivileged (non-root) > user will be refused with an error (since > version 1.19.3) as this is a security risk, because either any user can > write to it, or if the daemon gets compromised, the contents of the pidfile > cannot be trusted, and then a privileged > runner (such as an init script executed as root) would end up acting on any > system process. Using /dev/null is exempt from these checks. > """ Oh right... that makes sense. Nevermind me... [U+1F613]
I'm getting this error. > root@32f1d65b48bc:kohadevbox$ koha-plack --restart kohadev > start-stop-daemon: user 'kohadev-koha.kohadev-koha' not found > [FAIL] Error: Plack not running for kohadev: failed! Extract of my /etc/passwd file kohadev-koha:x:1000:1000:Koha instance kohadev-koha,,,:/var/lib/koha/kohadev:/bin/bash My dev env is export KOHA_IMAGE=master-buster ; ku
Created attachment 104922 [details] [review] Bug 25481: Pass --user to start-stop-daemon when a pidfile is used Since D10, the behaviour of start-stop-daemon changed, see from its manual: """ Warning: using this match option with a world-writable pidfile or using it alone with a daemon that writes the pidfile as an unprivileged (non-root) user will be refused with an error (since version 1.19.3) as this is a security risk, because either any user can write to it, or if the daemon gets compromised, the contents of the pidfile cannot be trusted, and then a privileged runner (such as an init script executed as root) would end up acting on any system process. Using /dev/null is exempt from these checks. """ Test plan: koha-plack --restart kohadev should success with this patch. Without this patch you get: start-stop-daemon: matching only on non-root pidfile /var/run/koha/kohadev/plack.pid is insecure
Erk, I attached the wrong patch!
Created attachment 104941 [details] [review] Bug 25481: Pass --user to start-stop-daemon when a pidfile is used Since D10, the behaviour of start-stop-daemon changed, see from its manual: """ Warning: using this match option with a world-writable pidfile or using it alone with a daemon that writes the pidfile as an unprivileged (non-root) user will be refused with an error (since version 1.19.3) as this is a security risk, because either any user can write to it, or if the daemon gets compromised, the contents of the pidfile cannot be trusted, and then a privileged runner (such as an init script executed as root) would end up acting on any system process. Using /dev/null is exempt from these checks. """ Test plan: koha-plack --restart kohadev should success with this patch. Without this patch you get: start-stop-daemon: matching only on non-root pidfile /var/run/koha/kohadev/plack.pid is insecure Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 104977 [details] [review] Bug 25481: Pass --user to start-stop-daemon when a pidfile is used Since D10, the behaviour of start-stop-daemon changed, see from its manual: """ Warning: using this match option with a world-writable pidfile or using it alone with a daemon that writes the pidfile as an unprivileged (non-root) user will be refused with an error (since version 1.19.3) as this is a security risk, because either any user can write to it, or if the daemon gets compromised, the contents of the pidfile cannot be trusted, and then a privileged runner (such as an init script executed as root) would end up acting on any system process. Using /dev/null is exempt from these checks. """ Test plan: koha-plack --restart kohadev should success with this patch. Without this patch you get: start-stop-daemon: matching only on non-root pidfile /var/run/koha/kohadev/plack.pid is insecure Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Thanks Jonathan, it works :) (tested with restart_all) It comes at a handy moment when I need to use Debian 10 to test another bug. And also to use Debian 10 by default.
Created attachment 105088 [details] [review] Bug 25481: Pass --user to start-stop-daemon when a pidfile is used Since D10, the behaviour of start-stop-daemon changed, see from its manual: """ Warning: using this match option with a world-writable pidfile or using it alone with a daemon that writes the pidfile as an unprivileged (non-root) user will be refused with an error (since version 1.19.3) as this is a security risk, because either any user can write to it, or if the daemon gets compromised, the contents of the pidfile cannot be trusted, and then a privileged runner (such as an init script executed as root) would end up acting on any system process. Using /dev/null is exempt from these checks. """ Test plan: koha-plack --restart kohadev should success with this patch. Without this patch you get: start-stop-daemon: matching only on non-root pidfile /var/run/koha/kohadev/plack.pid is insecure Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Nice work everyone! Pushed to master for 20.05
pushed to 19.11.x for 19.11.06
is_z3950_enabled() and is_z3950_running() not in 19.05.x, not need to backport.