mirror of
https://github.com/chatmail/relay.git
synced 2026-05-20 04:48:06 +00:00
only use explicit server settings if the host resolves to ip address via ssh config
This commit is contained in:
@@ -409,13 +409,16 @@ class ChatmailACFactory:
|
|||||||
def _make_transport(self, domain):
|
def _make_transport(self, domain):
|
||||||
"""Build a transport config dict for the given domain."""
|
"""Build a transport config dict for the given domain."""
|
||||||
addr, password = self.gencreds(domain)
|
addr, password = self.gencreds(domain)
|
||||||
server = self._ssh_config_host_map.get(domain, domain)
|
|
||||||
transport = {
|
transport = {
|
||||||
"addr": addr,
|
"addr": addr,
|
||||||
"password": password,
|
"password": password,
|
||||||
"imapServer": server,
|
|
||||||
"smtpServer": server,
|
|
||||||
}
|
}
|
||||||
|
# To support running against local relays without host DNS resolution
|
||||||
|
# we attempt resolving the domain via ssh-config
|
||||||
|
# because otherwise core fails to find the address
|
||||||
|
server = self._ssh_config_host_map.get(domain)
|
||||||
|
if server is not None:
|
||||||
|
transport.update({"imapServer": server, "smtpServer": server})
|
||||||
if self.chatmail_config.tls_cert_mode == "self":
|
if self.chatmail_config.tls_cert_mode == "self":
|
||||||
transport["certificateChecks"] = "acceptInvalidCertificates"
|
transport["certificateChecks"] = "acceptInvalidCertificates"
|
||||||
return transport
|
return transport
|
||||||
|
|||||||
Reference in New Issue
Block a user