git subrepo commit (merge) mailcow/src/mailcow-dockerized

subrepo:
  subdir:   "mailcow/src/mailcow-dockerized"
  merged:   "81fb18894"
upstream:
  origin:   "https://github.com/mailcow/mailcow-dockerized.git"
  branch:   "master"
  commit:   "4ca02ecee"
git-subrepo:
  version:  "0.4.6"
  origin:   "???"
  commit:   "???"

Update to upstream 2026-10.  Local patches re-applied by hand
(no Unbound DNS for containers, IPv6 off by default, fake-MySQL
stubs in dockerapi, Postfix overrides, no .env symlink); dropped
the unused dovecot and clamd Dockerfile patches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Change-Id: I2c2c194d1d436b841358685f5f94aef09eb19ae8
diff --git a/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/aliasexp.php b/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/aliasexp.php
index 947a024..814c0d3 100644
--- a/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/aliasexp.php
+++ b/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/aliasexp.php
@@ -25,6 +25,7 @@
 // Init Redis

 $redis = new Redis();

 $redis->connect('redis-mailcow', 6379);

+$redis->auth(getenv("REDISPASS"));

 

 function parse_email($email) {

   if(!filter_var($email, FILTER_VALIDATE_EMAIL)) return false;

@@ -132,7 +133,7 @@
             error_log("ALIAS EXPANDER: http pipe: goto address " . $goto . " is an alias branch for " . $goto_branch . PHP_EOL);

             $goto_branch_array = explode(',', $goto_branch);

           } else {

-            $stmt = $pdo->prepare("SELECT `target_domain` FROM `alias_domain` WHERE `alias_domain` = :domain AND `active` AND '1'");

+            $stmt = $pdo->prepare("SELECT `target_domain` FROM `alias_domain` WHERE `alias_domain` = :domain AND `active` = '1'");

             $stmt->execute(array(':domain' => $parsed_goto['domain']));

             $goto_branch = $stmt->fetch(PDO::FETCH_ASSOC)['target_domain'];

             if ($goto_branch) {

diff --git a/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/forwardinghosts.php b/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/forwardinghosts.php
index 10285b7..2186d7f 100644
--- a/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/forwardinghosts.php
+++ b/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/forwardinghosts.php
@@ -4,6 +4,7 @@
 
 $redis = new Redis();
 $redis->connect('redis-mailcow', 6379);
+$redis->auth(getenv("REDISPASS"));
 
 function in_net($addr, $net) {
   $net = explode('/', $net);
diff --git a/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/settings.php b/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/settings.php
index 274e9da..1b0e6b6 100644
--- a/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/settings.php
+++ b/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/settings.php
@@ -56,7 +56,7 @@
     $email = explode('@', $email);

     $email[0] = str_replace('.', '', $email[0]);

     $email = implode('@', $email);

-  } 

+  }

   $gm_alt = "@googlemail.com";

   if (substr_compare($email, $gm_alt, -strlen($gm_alt)) == 0) {

     $email = explode('@', $email);

@@ -114,7 +114,7 @@
       $rcpt[] = str_replace('/', '\/', $row['address']);

     }

     // Aliases by alias domains

-    $stmt = $pdo->prepare("SELECT CONCAT(`local_part`, '@', `alias_domain`.`alias_domain`) AS `alias` FROM `mailbox` 

+    $stmt = $pdo->prepare("SELECT CONCAT(`local_part`, '@', `alias_domain`.`alias_domain`) AS `alias` FROM `mailbox`

       LEFT OUTER JOIN `alias_domain` ON `mailbox`.`domain` = `alias_domain`.`target_domain`

       WHERE `mailbox`.`username` = :object");

     $stmt->execute(array(

@@ -184,7 +184,7 @@
     rcpt = <?=json_encode($rcpt, JSON_UNESCAPED_SLASHES);?>;

 <?php

   }

-  $stmt = $pdo->prepare("SELECT `option`, `value` FROM `filterconf` 

+  $stmt = $pdo->prepare("SELECT `option`, `value` FROM `filterconf`

     WHERE (`option` = 'highspamlevel' OR `option` = 'lowspamlevel')

       AND `object`= :object");

   $stmt->execute(array(':object' => $row['object']));

@@ -468,4 +468,36 @@
 <?php

 }

 ?>

+

+<?php

+// Start internal aliases

+

+$stmt = $pdo->query("SELECT `id`, `address`, `domain` FROM `alias` WHERE `active` = '1' AND `internal` = '1'");

+$aliases = $stmt->fetchAll(PDO::FETCH_ASSOC);

+while ($alias = array_shift($aliases)) {

+  // build allowed_domains regex and add target domain and alias domains

+  $stmt = $pdo->prepare("SELECT `alias_domain` FROM `alias_domain` WHERE `active` = '1' AND `target_domain` = :target_domain");

+  $stmt->execute(array(':target_domain' => $alias['domain']));

+  $allowed_domains = $stmt->fetchAll(PDO::FETCH_ASSOC);

+  $allowed_domains = array_map(function($item) {

+    return str_replace('.', '\.', $item['alias_domain']);

+  }, $allowed_domains);

+  $allowed_domains[] = str_replace('.', '\.', $alias['domain']);

+  $allowed_domains = implode('|', $allowed_domains);

+?>

+  internal_alias_<?=$alias['id'];?> {

+    priority = 10;

+    rcpt = "<?=$alias['address'];?>";

+    from = "/^((?!.*@(<?=$allowed_domains;?>)).)*$/";

+    apply "default" {

+      MAILCOW_INTERNAL_ALIAS = 9999.0;

+    }

+    symbols [

+      "MAILCOW_INTERNAL_ALIAS"

+    ]

+  }

+<?php

+}

+?>

+

 }