-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
autoconfig returns mailcow_hostname for all domains, causing security certificate errors with Outlook clients #6230
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This issue is still occurring. |
Hi,
<?php
// Get the host from the request headers and replace "autoconfig" and "autodiscover" with "mail"
if (str_starts_with($_SERVER['HTTP_HOST'], 'autoconfig.') OR str_starts_with($_SERVER['HTTP_HOST'], 'autodiscover.')) {
$config_host = str_replace('autoconfig', 'mail', $_SERVER['HTTP_HOST']);
$config_host = str_replace('autodiscover', 'mail', $config_host);
} else { // Leave it as is
$config_host = $_SERVER['HTTP_HOST'];
}
$autodiscover_config = array(
// General autodiscover service type: "activesync" or "imap"
// emClient uses autodiscover, but does not support ActiveSync. mailcow excludes emClient from ActiveSync.
// With SOGo disabled, the type will always fallback to imap. CalDAV and CardDAV will be excluded, too.
'autodiscoverType' => 'activesync',
// If autodiscoverType => activesync, also use ActiveSync (EAS) for Outlook desktop clients (>= Outlook 2013 on Windows)
// Outlook for Mac does not support ActiveSync
'useEASforOutlook' => 'no',
// Please don't use STARTTLS-enabled service ports in the "port" variable.
// The autodiscover service will always point to SMTPS and IMAPS (TLS-wrapped services).
// The autoconfig service will additionally announce the STARTTLS-enabled ports, specified in the "tlsport" variable.
'imap' => array(
'server' => $config_host,
'port' => (int)filter_var(substr(getenv('IMAPS_PORT'), strrpos(getenv('IMAPS_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT),
'tlsport' => (int)filter_var(substr(getenv('IMAP_PORT'), strrpos(getenv('IMAP_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT)
),
'pop3' => array(
'server' => $config_host,
'port' => (int)filter_var(substr(getenv('POPS_PORT'), strrpos(getenv('POPS_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT),
'tlsport' => (int)filter_var(substr(getenv('POP_PORT'), strrpos(getenv('POP_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT)
),
'smtp' => array(
'server' => $config_host,
'port' => (int)filter_var(substr(getenv('SMTPS_PORT'), strrpos(getenv('SMTPS_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT),
'tlsport' => (int)filter_var(substr(getenv('SUBMISSION_PORT'), strrpos(getenv('SUBMISSION_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT)
),
'activesync' => array(
'url' => 'https://' . $config_host . ($https_port == 443 ? '' : ':' . $https_port) . '/Microsoft-Server-ActiveSync',
),
'caldav' => array(
'server' => $config_host,
'port' => $https_port,
),
'carddav' => array(
'server' => $config_host,
'port' => $https_port,
),
); After saving this should already be active, there's no need to restart any services. Tested with Thunderbird on Linux. |
@4ntsu I have implemented a very similar workaround. I'm also interested in whether this has any drawbacks or security issues. |
@4ntsu thank you for your contribution. This workaround fixes the issue temporarily indeed, but I believe it should be part of the main implementation of Mailcow. On the other hand, I am not familiarised with the autodiscover specification, and I am unsure whether this is compliant. |
Edit: 26/02/2025 bug still exists.
Contribution guidelines
I've found a bug and checked that ...
Description
Logs:
Steps to reproduce:
Which branch are you using?
master
Which architecture are you using?
x86
Operating System:
N/A
Server/VM specifications:
N/A
Is Apparmor, SELinux or similar active?
N/A
Virtualization technology:
N/A
Docker version:
N/A
docker-compose version or docker compose version:
N/A
mailcow version:
2024-11b
Reverse proxy:
N/A
Logs of git diff:
Logs of iptables -L -vn:
Logs of ip6tables -L -vn:
Logs of iptables -L -vn -t nat:
Logs of ip6tables -L -vn -t nat:
DNS check:
The text was updated successfully, but these errors were encountered: