check_hostname requires server_hostname when using container_infra endpoint with HTTPS (2024.2)

Bug #2091103 reported by Piotr Łodej
28
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Magnum
Confirmed
Undecided
Esmerlin Joel Mieses

Bug Description

Openstack: 2024.2
Ubuntu: 22.04
Deployment Tool: Kolla Ansible

Steps to reproduce:
From version 2024.2 of Magnum when using Horizon (navigate to Project->Container Infra->Cluster or Cluster Templates) "/api/container_infra/*" endpoints return 500 Internal Server Error "check_hostname requires server_hostname". Container Infra Endpoint is using HTTPS

Horizon error log:
error invoking apiclient
Traceback (most recent call last):
  File "/var/lib/kolla/venv/lib/python3.12/site-packages/openstack_dashboard/api/rest/utils.py", line 128, in _wrapped
    data = function(self, request, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/kolla/venv/lib/python3.12/site-packages/magnum_ui/api/rest/magnum.py", line 302, in get
    result = magnum.cluster_list(request)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/kolla/venv/lib/python3.12/site-packages/magnum_ui/api/magnum.py", line 193, in cluster_list
    return magnumclient(request).clusters.list(limit, marker, sort_key,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/kolla/venv/lib/python3.12/site-packages/magnumclient/v1/baseunit.py", line 82, in list
    return self._list(self._path(path), self.__class__.template_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/kolla/venv/lib/python3.12/site-packages/magnumclient/common/base.py", line 117, in _list
    resp, body = self.api.json_request('GET', url)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/kolla/venv/lib/python3.12/site-packages/magnumclient/common/httpclient.py", line 240, in json_request
    resp, body_iter = self._http_request(url, method, **kwargs)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/kolla/venv/lib/python3.12/site-packages/magnumclient/common/httpclient.py", line 187, in _http_request
    conn.request(method, conn_url, **kwargs)
  File "/usr/lib/python3.12/http/client.py", line 1336, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.12/http/client.py", line 1382, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.12/http/client.py", line 1331, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.12/http/client.py", line 1091, in _send_output
    self.send(msg)
  File "/usr/lib/python3.12/http/client.py", line 1035, in send
    self.connect()
  File "/var/lib/kolla/venv/lib/python3.12/site-packages/magnumclient/common/httpclient.py", line 310, in connect
    self.sock = context.wrap_socket(sock)
                ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/ssl.py", line 455, in wrap_socket
    return self.sslsocket_class._create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/ssl.py", line 970, in _create
    raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname
Internal Server Error: /api/container_infra/clusters/

After analysis the problem exists in python-magnumclient from version 4.6.0 (https://opendev.org/openstack/python-magnumclient/commit/5d8fd3840052e07418e007f336deb99fd58b7e92)

According to documentation when using check_hostname with CERT_REQUIRED you must also pass server_hostname to wrap_socket
(Python 3.12 doc reference: https://docs.python.org/3.12/library/ssl.html#ssl.SSLContext.check_hostname

description: updated
Mr.R (mrr-tm)
Changed in magnum:
status: New → Confirmed
Revision history for this message
Jake Yip (waipengyip) wrote :

I haven't had the chance to look at this yet. If you are able to fix this, can you send up a patch please?

Revision history for this message
Esmerlin Joel Mieses (symph0nic) wrote :
Changed in magnum:
assignee: nobody → Esmerlin Joel Mieses (symph0nic)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-magnumclient 4.8.1

This issue was fixed in the openstack/python-magnumclient 4.8.1 Epoxy release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.