Bug 36134 - Elasticsearch authentication using userinfo parameter crashes about.pl
Summary: Elasticsearch authentication using userinfo parameter crashes about.pl
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: About (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low minor (vote)
Assignee: Lari Taskula
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-20 01:41 UTC by Lari Taskula
Modified: 2024-03-19 20:06 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.04,23.05.10


Attachments
Bug 36134: Read complete Elasticsearch configuration in about.pl (1.49 KB, patch)
2024-02-20 01:57 UTC, Lari Taskula
Details | Diff | Splinter Review
Bug 36134: Read complete Elasticsearch configuration in about.pl (1.54 KB, patch)
2024-02-20 03:40 UTC, David Cook
Details | Diff | Splinter Review
Bug 36134: Read complete Elasticsearch configuration in about.pl (1.60 KB, patch)
2024-02-23 09:17 UTC, Julian Maurice
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lari Taskula 2024-02-20 01:41:15 UTC
Following Bug 33563, if you enable Elasticsearch authentication using "userinfo" parameter in koha-conf (David's method in comment 3 of Bug 33563), about.pl page breaks and gives an internal server error.
Comment 1 Lari Taskula 2024-02-20 01:57:51 UTC
Created attachment 162286 [details] [review]
Bug 36134: Read complete Elasticsearch configuration in about.pl

When enabling Elasticsearch authentication in Koha using userinfo
parameter of Search::Elasticsearch, about.pl breaks and gives an
internal server error.

This patch reads the complete Elasticsearch configuration for
about.pl including userinfo causing about.pl to recover.

To test:
1. In Elasticsearch 7 settings, set "xpack.security.enabled: true"
2. Add <userinfo>elastic:password</userinfo> to KOHA_CONF elasticsearch
   settings
3. Restart plack and navigate to about.pl
4. Observe internal server error
5. Apply patch
6. Refresh about.pl
7. Observe it working again
Comment 2 Lari Taskula 2024-02-20 02:01:31 UTC Comment hidden (obsolete)
Comment 3 Lari Taskula 2024-02-20 02:05:31 UTC
Above patch should not change about.pl behavior for Kohas using Basic authentication within "server" setting or no authentication at all for Elasticsearch, but helps those using the "userinfo" setting.
Comment 4 David Cook 2024-02-20 03:39:02 UTC
The test plan needs some modifications for koha-testing-docker:

1. In the docker-compose.yml file, change xpack.security.enabled=false to xpack.security.enabled=true
2. In the docker-compose.yml file, add another environment variable for the "es" container like the following:
ELASTIC_PASSWORD=awesomepassword

You'll end up with a koha-conf.xml element like the following then:

<userinfo>elastic:awesomepassword</userinfo>
Comment 5 David Cook 2024-02-20 03:40:08 UTC
Good catch, Lari. Thanks for taking the time to do this.

QA tools look good too.
Comment 6 David Cook 2024-02-20 03:40:30 UTC
Created attachment 162287 [details] [review]
Bug 36134: Read complete Elasticsearch configuration in about.pl

When enabling Elasticsearch authentication in Koha using userinfo
parameter of Search::Elasticsearch, about.pl breaks and gives an
internal server error.

This patch reads the complete Elasticsearch configuration for
about.pl including userinfo causing about.pl to recover.

To test:
1. In Elasticsearch 7 settings, set "xpack.security.enabled: true"
2. Add <userinfo>elastic:password</userinfo> to KOHA_CONF elasticsearch
   settings
3. Restart plack and navigate to about.pl
4. Observe internal server error
5. Apply patch
6. Refresh about.pl
7. Observe it working again

Signed-off-by: David Cook <dcook@prosentient.com.au>
Comment 7 Julian Maurice 2024-02-23 09:17:56 UTC
Created attachment 162366 [details] [review]
Bug 36134: Read complete Elasticsearch configuration in about.pl

When enabling Elasticsearch authentication in Koha using userinfo
parameter of Search::Elasticsearch, about.pl breaks and gives an
internal server error.

This patch reads the complete Elasticsearch configuration for
about.pl including userinfo causing about.pl to recover.

To test:
1. In Elasticsearch 7 settings, set "xpack.security.enabled: true"
2. Add <userinfo>elastic:password</userinfo> to KOHA_CONF elasticsearch
   settings
3. Restart plack and navigate to about.pl
4. Observe internal server error
5. Apply patch
6. Refresh about.pl
7. Observe it working again

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 8 Katrin Fischer 2024-03-07 16:37:28 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 9 Fridolin Somers 2024-03-11 10:20:19 UTC
Pushed to 23.11.x for 23.11.04
Comment 10 Lucas Gass 2024-03-19 20:06:29 UTC
Backported to 23.05.x for upcoming 23.05.10