Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Outlook] SSL cert verification is attempted when SSL is disabled on some machines #3027

Open
navarone-feekery opened this issue Dec 11, 2024 · 0 comments
Labels
bug Something isn't working outlook v8.17.0

Comments

@navarone-feekery
Copy link
Contributor

Bug Description

When running an Outlook Connector on a Debian machine, SSL verification occurs even if SSL is disabled. This happened both when running from source and when running an official docker image on that machine.

Traceback (most recent call last):
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/protocol.py", line 242, in get_session
    session = self._session_pool.get(block=False)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/queue.py", line 168, in get
    raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/connectors-8.16/connectors/es/sink.py", line 490, in run
    await self.get_docs(generator)
  File "/root/connectors-8.16/connectors/es/sink.py", line 542, in get_docs
    async for count, doc in aenumerate(generator):
  File "/root/connectors-8.16/connectors/utils.py", line 856, in aenumerate
    async for elem in asequence:
  File "/root/connectors-8.16/connectors/logger.py", line 244, in __anext__
    return await self.gen.__anext__()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/connectors/es/sink.py", line 524, in _decorate_with_metrics_span
    async for doc in generator:
  File "/root/connectors-8.16/connectors/sync_job_runner.py", line 457, in prepare_docs
    async for doc, lazy_download, operation in self.generator():
  File "/root/connectors-8.16/connectors/sync_job_runner.py", line 493, in generator
    async for doc, lazy_download in self.data_provider.get_docs(
  File "/root/connectors-8.16/connectors/sources/outlook.py", line 1076, in get_docs
    async for account in self.client._get_user_instance.get_user_accounts():
  File "/root/connectors-8.16/connectors/sources/outlook.py", line 344, in get_user_accounts
    user_account = Account(
                   ^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/account.py", line 205, in __init__
    self.version = self.protocol.version.copy()
                   ^^^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/protocol.py", line 480, in version
    self.config.version = Version.guess(self, api_version_hint=self.api_version_hint)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/version.py", line 202, in guess
    list(ConvertId(protocol=protocol).call([AlternateId(id="DUMMY", format=EWS_ID, mailbox="DUMMY")], ENTRY_ID))
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/services/common.py", line 216, in _elems_to_objs
    for elem in elems:
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/services/common.py", line 278, in _chunked_get_elements
    yield from self._get_elements(payload=payload_func(chunk, **kwargs))
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/services/common.py", line 299, in _get_elements
    yield from self._response_generator(payload=payload)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/services/common.py", line 262, in _response_generator
    response = self._get_response_xml(payload=payload)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/services/common.py", line 395, in _get_response_xml
    r = self._get_response(payload=payload, api_version=api_version)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/services/common.py", line 345, in _get_response
    session = self.protocol.get_session()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/protocol.py", line 246, in get_session
    self.increase_poolsize()
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/protocol.py", line 212, in increase_poolsize
    self._session_pool.put(self.create_session(), block=False)
                           ^^^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/protocol.py", line 318, in create_session
    if self.auth_type == NTLM and self.credentials.type == self.credentials.EMAIL:
       ^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/protocol.py", line 119, in auth_type
    self.config.auth_type = self.get_auth_type()
                            ^^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/protocol.py", line 470, in get_auth_type
    return get_service_authtype(protocol=self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/exchangelib/transport.py", line 87, in get_service_authtype
    r = s.post(
        ^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/requests/sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 789, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 466, in _make_request
    self._validate_conn(conn)
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1095, in _validate_conn
    conn.connect()
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 730, in connect
    sock_and_verified = _ssl_wrap_socket_and_match_hostname(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/connectors-8.16/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 871, in _ssl_wrap_socket_and_match_hostname
    context.verify_mode = resolve_cert_reqs(cert_reqs)
    ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 742, in verify_mode
    super(SSLContext, SSLContext).verify_mode.__set__(self, value)
ValueError: Cannot set verify_mode to CERT_NONE when check_hostname is enabled.

To Reproduce

Steps to reproduce the behavior:

  1. Create a debian machine and set up connectors to run from source
  2. Create an outlook connector, configure it, and disable SSL
  3. Sync
  4. Observe SSL verification error

Expected behavior

SSL should not be verified so no error should occur.

Environment

  • Debian 12 (bookworm)

Additional context

This does not occur when running on a MacOS, or when running a native connector on Cloud.

@navarone-feekery navarone-feekery added bug Something isn't working outlook v8.17.0 labels Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working outlook v8.17.0
Projects
None yet
Development

No branches or pull requests

1 participant