Fulltextsearch 26.0.0 seems to ignore credentials for ROR on elasticsearch

Dear fellows,

my setup didn’t change except an update for Fulltextsearch to version 26.0.0.
From that point on, indexing results in an error message:

In Index.php line 388:

failed platform test.

Elasticsearch logs read the following for any attempt to connect:

[2023-05-03T07:30:09,308][INFO ][t.b.r.a.l.AccessControlLoggingDecorator] [xyz-cloud] ^[[35mFORBIDDEN by default req={ ID:1664987438-1978385692#12350, TYP:MainRequest,
CGR:<N/A>, USR:[no info about user], BRS:true, KDX:null, ACT:cluster:monitor/main, OA:127.0.0.1/32, XFF:null, DA:127.0.0.1/32, IDX:<N/A>, MET:HEAD, PTH:/, CNT:<N/A>,
HDR:Accept=application/vnd.elasticsearch+json; compatible-with=8, Host=localhost:9200, User-Agent=elasticsearch-php/8.6.1 (Linux 5.15.104-1-pve; PHP 8.0.28), content-length=0,
x-elastic-client-meta=es=8.6.1,php=8.0.28,t=8.6.0,a=0,gu=, HIS:[Accept requests from xyz-cloud on xyz_index-> RULES:[groups_or->false]], }^[[0m

As far as I understand, the “no info about user” part is the problem as the same message is generated when trying to connect without any credentials as all.

I supply my credentials in GUI as http://user:password@localhost:9200/
The user is called “fraggle” and as far as I remember, it always appeared in the logs before.

Any help is greatly appreciated.

We cannot run without authentication as it must be a little secure for the chieftains.

Kind regards,

christian

Yeah, same problem here. In my case I installed Kibana and wanted authentication on my ES server because of that, and then nextcloud fulltext search stopped working :confused:

It looks like some stuff has changed with the libs fulltextsearch_elasticsearch uses: You are not supposed to enter your username and password in the host field but instead use a second argument for this.

Changed the following:

line 385 of fulltextsearch_elasticsearch/lib/Platform/ElasticSearchPlatform.php no reads:

$cb = ClientBuilder::create()
							   ->setHosts($hosts)
							   ->setBasicAuthentication('username', 'password')
							   ->setRetries(3);

and not:

$cb = ClientBuilder::create()
							   ->setHosts($hosts)
							   ->setRetries(3);

Ofcourse this is just some ducktape, but for now the module works again :slight_smile:

I think the best fix here would be to add 2 fields to the config form and use them like I did above. THe suggestion to use your creds in the url like they do in the example just doesn’t work anymore. BUt those are just my 2 cents, this is not my project and I’m not a nextcloud developer :wink:

2 Likes

That solved my problem temporarily.

This seems to be still an issue. Im getting the same error with 27.01 and the abovementioned workaound does only help with hardcoded PW in the file. Elasticsearch is up and running but Nextcloud can’t connect.

sudo -u next php occ fulltextsearch:test

.Testing your current setup:
Creating mocked content provider. ok
Testing mocked provider: get indexable documents. (2 items) ok
Loading search platform. (Elasticsearch) ok
Testing search platform. fail

curl http://elastic:<PW>@localhost:9200/
{
“name” : “myserver-n1”,
“cluster_name” : “myserver-c1”,
“cluster_uuid” : “JejLYSFXT6icVKqyzphMUg”,
“version” : {
“number” : “7.17.12”,
“build_flavor” : “default”,
“build_type” : “deb”,
“build_hash” : “e3b0c3d3c5c130e1dc6d567d6baef1c73eeb2059”,
“build_date” : “2023-07-20T05:33:33.690180787Z”,
“build_snapshot” : false,
“lucene_version” : “8.11.1”,
“minimum_wire_compatibility_version” : “6.8.0”,
“minimum_index_compatibility_version” : “6.0.0-beta1”
},
“tagline” : “You Know, for Search”
}