Opensearch-reporting-cli: Downloading report failed. TypeError: Cannot read properties of undefined (reading 'toString')

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
@opensearch-project/reporting-cli@1.1.0 (npm on Ubuntu 22.04)
Wazuh v4.7.3 on Ubuntu 22.04

Hello, I’m trying do download a CSV report using opensearch-reporting-cli , opening the URL in the browser the report display without error.

~$ sudo opensearch-reporting-cli -u “https://syslog.$??$.local/goto/d102cc0e6767f2f20c2cd7d59bb758d5” -f csv -a basic -c $USER$:$PASSWORD$ --multitenancy false
:heavy_check_mark: Fetched argument values
:information_source: Credentials are verified
:information_source: Connected to url https://syslog.$??$.local/goto/d102cc0e6767f2f20c2cd7d59bb758d5
:heavy_multiplication_x: Downloading report failed. TypeError: Cannot read properties of undefined (reading ‘toString’)

The same command line works in PDF or PNG.

Any hints?

Many thanks
Riccardo

Configuration:

Relevant Logs or Screenshots:

Hi @df_ric

Could you please execute the following command?

curl -u username:password --insecure -X GET "https://centos-node-003:9200/_plugins/_security/api/account"

Hello Eugene, here it is:

~$ curl -u username:password --insecure -X GET “https://syslog.$$??$$.local:9200/_plugins/_security/api/account
{
“user_name”:“kibanaro”,
“is_reserved”:false,
“is_hidden”:false,
“is_internal_user”:true,
“user_requested_tenant”:null,
“backend_roles”:[
“kibanauser”,
“readall”
],
“custom_attribute_names”:[
“attr.internal.attribute1”,
“attr.internal.attribute2”,
“attr.internal.attribute3”
],
“tenants”:{
“kibanaro”:true,
“global_tenant”:true
},
“roles”:[
“own_index”,
“kibana_user”,
“readall”
]
}

Many thanks
Riccardo

You use the global_tenant and kibanaro tenants for this user.

Could you please try using --tenant global_tenant or --tenant kibanaro instead of --multitenancy false ?

with -tenant:
sudo opensearch-reporting-cli -u “https://syslog.$$??$$.local/goto/d102cc0e6767f2f20c2cd7d59bb758d5” -f csv -a basic -c kibanaro:password --tenant kibanaro
:heavy_check_mark: Fetched argument values
:heavy_multiplication_x: Invalid username or password
:heavy_multiplication_x: Downloading report failed. TypeError: exit is not a function

with global_tenant:

sudo opensearch-reporting-cli -u “https://syslog.$$??$$.local/goto/d102cc0e6767f2f20c2cd7d59bb758d5” -f csv -a basic -c kibanaro:password --tenant global_tenant
:heavy_check_mark: Fetched argument values
:heavy_multiplication_x: Invalid username or password
:heavy_multiplication_x: Downloading report failed. TypeError: exit is not a function

Many thanks
Riccardo

Hey @df_ric

Sorry for my late reply.

To check if the username and password are valid, could you please execute the following command?

curl -k -u kibanaro:password -XGET "https://hostname:9200/_searchguard/authinfo?pretty"

Hello, the password is correct, see screenshot.

image

However this is the reply to curl:

{
  "error" : "no handler found for uri [/_searchguard/authinfo] and method [GET]"
}

Many thanks

Riccardo

1 Like

The command should be as follows:

curl -k -u kibanaro:password -XGET "https://hostname:9200/_plugins/_security/authinfo?pretty"

What version of OpenSearch and OpenSearch Dashboards do you use?

Hello, here is the authinfo output:

{
  "user" : "User [name=kibanaro, backend_roles=[kibanauser, readall], requestedTenant=null]",
  "user_name" : "kibanaro",
  "user_requested_tenant" : null,
  "remote_address" : "192.168.77.235:46596",
  "backend_roles" : [
    "kibanauser",
    "readall"
  ],
  "custom_attribute_names" : [
    "attr.internal.attribute1",
    "attr.internal.attribute2",
    "attr.internal.attribute3"
  ],
  "roles" : [
    "own_index",
    "kibana_user",
    "readall"
  ],
  "tenants" : {
    "kibanaro" : true,
    "global_tenant" : true
  },
  "principal" : null,
  "peer_certificates" : "0",
  "sso_logout_url" : null
}

I don’t know the Opensearch version, I tried to check it with

curl -k -u admin:password2 -XGET “https://syslog.$$??$$.local:9200

{
  "name" : "node-1",
  "cluster_name" : "wazuh-cluster",
  "cluster_uuid" : "xyUYNfHTSWafmGjuj17x2Q",
  "version" : {
    "number" : "7.10.2",
    "build_type" : "rpm",
    "build_hash" : "db90a415ff2fd428b4f7b3f800a51dc229287cb4",
    "build_date" : "2023-06-03T06:24:25.112415503Z",
    "build_snapshot" : false,
    "lucene_version" : "9.6.0",
    "minimum_wire_compatibility_version" : "7.10.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org/"
}

Maybe v7.10.2 ?

The dashboard seems to be v4.7.3
image

Many thanks
Riccardo