Skip to content

Commit

Permalink
Merge pull request #5945 from SailReal/master
Browse files Browse the repository at this point in the history
Don't expose SMTP/IMAP if announced "not provided" via SRV
  • Loading branch information
DerLinkman authored Aug 7, 2024
2 parents fd92785 + 384e5a2 commit b7ed698
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions data/web/autoconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@
<username>%EMAILADDRESS%</username>
<authentication>password-cleartext</authentication>
</incomingServer>
<?php
$records = dns_get_record('_imap._tcp.' . $domain, DNS_SRV); // check if IMAP is announced as "not provided" via SRV record
if (count($records) == 0 || $records[0]['target'] != '') { ?>
<incomingServer type="imap">
<hostname><?=$autodiscover_config['imap']['server']; ?></hostname>
<port><?=$autodiscover_config['imap']['tlsport']; ?></port>
<socketType>STARTTLS</socketType>
<username>%EMAILADDRESS%</username>
<authentication>password-cleartext</authentication>
</incomingServer>
<?php } ?>

<?php
$records = dns_get_record('_pop3s._tcp.' . $domain, DNS_SRV); // check if POP3 is announced as "not provided" via SRV record
Expand Down Expand Up @@ -77,13 +81,17 @@
<username>%EMAILADDRESS%</username>
<authentication>password-cleartext</authentication>
</outgoingServer>
<?php
$records = dns_get_record('_smtp._tcp.' . $domain, DNS_SRV); // check if SMTP is announced as "not provided" via SRV record
if (count($records) == 0 || $records[0]['target'] != '') { ?>
<outgoingServer type="smtp">
<hostname><?=$autodiscover_config['smtp']['server']; ?></hostname>
<port><?=$autodiscover_config['smtp']['tlsport']; ?></port>
<socketType>STARTTLS</socketType>
<username>%EMAILADDRESS%</username>
<authentication>password-cleartext</authentication>
</outgoingServer>
<?php } ?>

<enable visiturl="https://<?=$mailcow_hostname; ?><?php if ($port != 443) echo ':'.$port; ?>/admin.php">
<instruction>If you didn't change the password given to you by the administrator or if you didn't change it in a long time, please consider doing that now.</instruction>
Expand Down

0 comments on commit b7ed698

Please sign in to comment.