univention-ox-spamrunner Cannot Find Users When Default Sender Address Changed
Problem:
When users change their default sender address in Open-Xchange (OX) settings, the univention-ox-spamrunner may fail to locate the corresponding user. In the system log, the following error appears:
user not found
As a result, spam checks are not applied to these users. This issue commonly occurs in environments with multiple mail domains.
Example scenario:
- UCS environment with domains:
univention.comandunivention.fr. - User is configured as
user@univention.com(primary mail address). - User sets
user@univention.fras default sender address in OX (configured as an alternative address).
In this case, spamrunner fails until the default sender address is reverted to the primary mail address.
Root Cause:
The spamrunner script used the default sender address instead of the user’s UID to locate their Maildir. When the default sender address differs from the primary address, spamrunner cannot find the Maildir.
Reference: Univention Bug 52462
Workaround / Patch:
A patch is available that resolves this issue for UCS 5.0-x and UCS 5.x (including UCS 5.2). The patch ensures that spamrunner uses the user UID instead of the default sender address.
Patch Example:
--- spamrunner.orig 2025-09-01 15:45:07.398834428 +0200
+++ spamrunner 2025-09-01 15:44:44.518686274 +0200
@@ -207,25 +207,25 @@
- if not os.path.exists('%s/Maildir' % (get_user_home(user["send_addr"],))):
+ if not os.path.exists('%s/Maildir' % (get_user_home(user["uid"],))):
...
- maildir = "maildir:%s/Maildir" % get_user_home(user["send_addr"])
+ maildir = "maildir:%s/Maildir" % get_user_home(user["uid"])
...
- cmd = ["/usr/bin/doveadm", "-v", "expunge", "-u", user["send_addr"], "mailbox", user["confirmed_spam"], "all"]
+ cmd = ["/usr/bin/doveadm", "-v", "expunge", "-u", user["uid"], "mailbox", user["confirmed_spam"], "all"]
...
- syslog.syslog(syslog.LOG_ERR, "Failed to copy h/spam mails for user %r.\n%s" % (user["send_addr"], traceback.format_exc()))
+ syslog.syslog(syslog.LOG_ERR, "Failed to copy h/spam mails for user %r.\n%s" % (user["uid"], traceback.format_exc()))
Step 1: Backup Original Script
Before applying the patch, create a backup of the original spamrunner script:
cp /usr/sbin/spamrunner /usr/sbin/spamrunner.bak
Step 2: Install patch Tool
The patch utility is required to apply the patch:
apt updateapt install patch -y
Step 3: Apply the Patch
- Save the patch file as
spamrunner.patch.
wget https://forge.univention.org/bugzilla/attachment.cgi?id=11352mv attachment.cgi\?id\=11352 spamrunner.patch
- Use the command below to patch the
/usr/sbin/spamrunner:
patch /usr/sbin/spamrunner < spamrunner.patch
Output:
patching file /usr/sbin/spamrunner
Step 4: Verify Changes
After applying the patch, run spamrunner in verbose mode to verify that it correctly finds users regardless of the default sender address:
/usr/sbin/spamrunner -v
Check for any remaining errors.
tail -n 10 /var/log/syslog
or
journalctl -u spamrunner
Conclusion
This patch ensures that univention-ox-spamrunner reliably processes spam/ham for all users, even if their default sender address differs from their primary mail address.
See also: