Errors while upgrading elasticsearch from version 7 to 9

Hello,

I followed Migrating Elasticsearch from 7 to 9 - Opengist and https://www.youtube.com/watch?v=sb3VBkaHGz4.

After installing all the certificates I still get errors.

Infos:

    • Used Zammad version: 7.1.3-1789383559.f56648e.ubuntu22
    • Used Zammad installation type: Ubuntu package
    • Operating system: Ubuntu 22.04.5 LTS

Expected behavior:

  • no errors

Actual behavior:

{
“error”: {
“root_cause”: [
{
“type”: “security_exception”,
“reason”: “unable to authenticate user [elastic] for REST request [/_migration/deprecations]”,
“header”: {
“WWW-Authenticate”: [
"Basic realm=“security” charset=“UTF-8"”,
“Bearer realm=“security””,
“ApiKey”
]
}
}
],
“type”: “security_exception”,
“reason”: “unable to authenticate user [elastic] for REST request [/_migration/deprecations]”,
“header”: {
“WWW-Authenticate”: [
"Basic realm=“security” charset=“UTF-8"”,
“Bearer realm=“security””,
“ApiKey”
]
}
},
“status”: 401
}

and

{
“error”: {
“root_cause”: [
{
“type”: “security_exception”,
“reason”: “missing authentication credentials for REST request [/_migration/deprecations]”,
“header”: {
“WWW-Authenticate”: [
"Basic realm=“security” charset=“UTF-8"”,
“Bearer realm=“security””,
“ApiKey”
]
}
}
],
“type”: “security_exception”,
“reason”: “missing authentication credentials for REST request [/_migration/deprecations]”,
“header”: {
“WWW-Authenticate”: [
"Basic realm=“security” charset=“UTF-8"”,
“Bearer realm=“security””,
“ApiKey”
]
}
},
“status”: 401
}

Steps to reproduce the behavior:

sudo curl --insecure -uelastic:${es_password} https://127.0.0.1:9200/_migration/deprecations| jq

and

sudo curl --insecure https://127.0.0.1:9200/_migration/deprecations| jq

You have to set `export es_password=“YOURPASSWORD”` to execute the curls afterwards. `sudo` is not required during this operation and will also loose the scope of the temporary environment variable you set. Thus the password variable should be empty which causes the error message of you being not authenticated.

The Gist holds everything you need for copy-pasting, except that password export and might be confusing in order (so the video is basically the needed link). I’ll check if I can improve the gist later this weekend.

Edit: Done.

# bash
read -rsp "Password: " es_password && export es_password

# zsh
read -rs "es_password?Password: " && export es_password

Also sorry for the confusion. In the video variant I wrote it to my `.bashrc`, because it was a throw away host anyway so that might have been confusing.

Thanks MrGeneration!

Now I get the error

curl: (35) error:0A00010B:SSL routines::wrong version number

No matter if I provide a password or not.

That SSL wrong version number error usually happens when curl tries to hit an HTTPS endpoint, but Elasticsearch is either still running on HTTP or your cert paths/ports in the config got messed up during the upgrade steps. Double-check your elasticsearch.yml to make sure xpack.security.http.ssl.enabled is set properly and you aren’t mixing up ports 9200 and 9300.

I am sorry, that was my fault. I disabled the new entries for xpack in the ealsticsearch.yml file after I got the errors.

Activating them again gives me

{
"cluster_settings": ,
"node_settings": ,
"index_settings": {},
"ml_settings": ,
"ccr_auto_followed_system_indices":
}

as espected.