requests/exchangelib SSLError - 主机名'outlook.office.de'不匹配



我在连接Microsoft Exchange时遇到问题。它是最近开始的。问题是我不确定在哪里可以找到解决方案。

问题是我正在尝试连接到office.de,但证书现在似乎不包括此域。

在哪里查找解决方案/错误?:

  1. 我的电脑(Ubuntu 20.04(
  2. python请求
  3. python exchangelib
  4. Microsoft证书(临时颁发(

追溯:

Traceback (most recent call last):
account = Account(
File "/home/milano/.virtualenvs/xx-xxx-xxxx/lib/python3.9/site-packages/exchangelib/account.py", line 126, in __init__
self.protocol = Protocol(config=config)
File "/home/milano/.virtualenvs/xx-xxx-xxxx/lib/python3.9/site-packages/exchangelib/protocol.py", line 405, in __call__
raise e
File "/home/milano/.virtualenvs/xx-xxx-xxxx/lib/python3.9/site-packages/exchangelib/protocol.py", line 400, in __call__
protocol = super().__call__(*args, **kwargs)
File "/home/milano/.virtualenvs/xx-xxx-xxxx/lib/python3.9/site-packages/exchangelib/protocol.py", line 434, in __init__
self.config.auth_type = self.get_auth_type()
File "/home/milano/.virtualenvs/xx-xxx-xxxx/lib/python3.9/site-packages/exchangelib/protocol.py", line 439, in get_auth_type
auth_type, api_version_hint = get_service_authtype(
File "/home/milano/.virtualenvs/xx-xxx-xxxx/lib/python3.9/site-packages/exchangelib/transport.py", line 155, in get_service_authtype
raise TransportError(str(e)) from e
exchangelib.errors.TransportError: HTTPSConnectionPool(host='outlook.office.de', port=443): Max retries exceeded with url: /EWS/Exchange.asmx (Caused by SSLError(SSLCertVerificationError("hostname 'outlook.office.de' doesn't match either of '*.internal.outlook.com', '*.outlook.com', 'outlook.com', 'office365.com', '*.office365.com', '*.outlook.office365.com', '*.office.com', 'outlook.office.com', 'substrate.office.com', 'attachment.outlook.live.net', 'attachment.outlook.office.net', 'attachment.outlook.officeppe.net', 'attachments.office.net', '*.clo.footprintdns.com', '*.nrb.footprintdns.com', 'ccs.login.microsoftonline.com', 'ccs-sdf.login.microsoftonline.com', 'substrate-sdf.office.com', 'attachments-sdf.office.net', '*.live.com', 'mail.services.live.com', 'hotmail.com', '*.hotmail.com'")))

问题是我正在尝试连接到office.de,但证书现在似乎不包括此域。

这是正确的。与浏览器的检查将表明这不是Python的问题,而是网站是以这种方式设置的,即浏览器也会抱怨。

虽然官方记录了在Office 365德国端点上使用,但域office.de似乎没有设置为与此域名的HTTPS一起使用。

由于outlook.office.de目前只是outlook.office.com的别名(DNS CNAME(,我的猜测是,记录的域不打算通过HTTPS直接访问,而是记录它们只是为了获得必要的IP范围。在内部,MS Exchange可能会改用office.com域,从而成功匹配证书。

最新更新