Notifications
Clear all

[BUG] HTML Domain Disclaimer Not Inserted by AlterMIME Unless --force-for-bad-html Is Enabled

1 Posts
1 Users
0 Reactions
15 Views
(@suletom)
New Member
Joined: 3 days ago
Posts: 1
Topic starter  

Issue Type: [BUG]

Summary: HTML domain disclaimer is not inserted into Carbonio WebClient messages unless AlterMIME uses --force-for-bad-html

Affected Components: carbonio-altermime, carbonio-amavisd, carbonio-mta, Domain Disclaimer, Carbonio WebClient

Description:

HTML domain disclaimers are not inserted into outgoing HTML messages generated by Carbonio WebClient when using Carbonio's default Amavis/AlterMIME configuration.

The Domain Disclaimer feature is enabled both globally and for the affected domain. The domain has both HTML and plain-text disclaimer content configured, the generated AlterMIME files are present, and Amavis correctly resolves and passes the domain-specific disclaimer files to AlterMIME.

Despite this, the disclaimer is not inserted.

Adding --force-for-bad-html to the AlterMIME disclaimer arguments fixes the issue immediately.

Server OS: Ubuntu 24.04.4 LTS (Noble)

Carbonio Version:

carbonio-core           4.5.14-2noble
carbonio-mta            4.2.8-1noble
carbonio-amavisd        2.14.0-4noble
carbonio-altermime      0.3.10-7noble
carbonio-mailbox-jar    4.27.13-1noble
carbonio-appserver-conf 4.27.13-1noble
carbonio-webui          4.5.14-1noble
carbonio-mails-ui       1.34.20-1ubuntu

The affected messages identify the WebClient as:

Carbonio 4.27.13_ZEXTRAS_202606
CarbonioWebClient
Carbonio 202606 FOSS

Current Behavior:

The Domain Disclaimer feature is enabled globally:

carbonio prov gacf | grep -i zimbraDomainMandatoryMailSignatureEnabled

Output:

zimbraDomainMandatoryMailSignatureEnabled: TRUE

It is also explicitly enabled for the affected domain:

carbonio prov gd <domain> | grep -i -E 'zimbraAmavisDomainDisclaimer|zimbraDomainMandatory'

Relevant output:

zimbraAmavisDomainDisclaimerHTML: <h2>----</h2>
zimbraAmavisDomainDisclaimerText: plugin-teszttxt
zimbraDomainMandatoryMailSignatureEnabled: TRUE

The domain also has the AlterMIME disclaimer option configured:

carbonio prov gd <domain> | grep -i amavisDisclaimerOptions

Output:

amavisDisclaimerOptions: <domain>

The domain disclaimer files are generated under:

/opt/zextras/data/altermime/<domain>.b64
/opt/zextras/data/altermime/<domain>.html
/opt/zextras/data/altermime/<domain>.txt

The files exist, are readable by Carbonio, and contain the configured disclaimer.

The disclaimer files can also be regenerated successfully using:

su - zextras -c "/opt/zextras/libexec/zmaltermimeconfig"

which reports:

Generating disclaimers for domain <domain>.

The automatic disclaimer configuration synchronization is enabled:

systemctl status carbonio-altermime-config.timer

and carbonio-altermime-config.timer is active and waiting.

The generated Amavis configuration contains the standard Carbonio AlterMIME disclaimer configuration:

$altermime='/opt/zextras/common/bin/altermime';

@altermime_args_disclaimer = qw(
    --verbose
    --disclaimer-b64= removed link 
    --disclaimer= removed link 
    --disclaimer-html= removed link 
);

$defang_maps_by_ccat{+CC_CATCHALL} = ['disclaimer'];

The Amavis ORIGINATING policy also explicitly allows disclaimers:

$policy_bank{'ORIGINATING'} = {
    originating => 1,
    allow_disclaimers => 1,
    ...
};

Outgoing messages from Carbonio WebClient are correctly processed through this policy.

Amavis logs:

Checking: ... ORIGINATING/MYNETS ... <sender@domain> -> <external-recipient>

mangling by altermime (disclaimer) done, new size: ..., orig ... bytes

Passed CLEAN {RelayedOutbound}, ORIGINATING/MYNETS LOCAL ...

However, the delivered message does not contain either the HTML or plain-text disclaimer.

The affected message generated by Carbonio WebClient is a standard:

Content-Type: multipart/alternative

message containing:

Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

and:

Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

During troubleshooting, the actual command-line arguments passed from Amavis to AlterMIME were captured using a temporary wrapper.

The invocation contains the correct resolved domain instead of _OPTION_:

/opt/zextras/common/bin/altermime
--input= removed link 
--verbose
--disclaimer-b64=/opt/zextras/data/altermime/<domain>.b64
--disclaimer=/opt/zextras/data/altermime/<domain>.txt
--disclaimer-html=/opt/zextras/data/altermime/<domain>.html

This confirms that:

  • the sender/domain lookup works;

  • amavisDisclaimerOptions is resolved correctly;

  • _OPTION_ is substituted with the correct domain;

  • the correct .txt, .html, and .b64 files are passed to AlterMIME;

  • AlterMIME exits successfully;

  • Amavis selects the modified replacement message and reports successful mangling.

Nevertheless, no disclaimer is inserted with the default arguments.

Workaround / additional finding:

Adding the following AlterMIME option:

--force-for-bad-html

fixes the issue.

For testing, the Carbonio AlterMIME executable was temporarily wrapped so that the same Amavis invocation is executed with:

--force-for-bad-html

added.

No other disclaimer configuration was changed.

With this single additional option, the disclaimer is correctly inserted into messages generated by Carbonio WebClient.

Therefore the effective working AlterMIME arguments are:

@altermime_args_disclaimer = qw(
    --verbose
    --force-for-bad-html
    --disclaimer-b64= removed link 
    --disclaimer= removed link 
    --disclaimer-html= removed link 
);

Expected Behavior:

When:

zimbraDomainMandatoryMailSignatureEnabled: TRUE

is enabled, the domain has valid:

zimbraAmavisDomainDisclaimerHTML
zimbraAmavisDomainDisclaimerText
amavisDisclaimerOptions

attributes, and Amavis has:

allow_disclaimers => 1

then Carbonio should insert the configured domain disclaimer into HTML messages generated by Carbonio WebClient using the standard Carbonio configuration.

A custom AlterMIME wrapper or manual addition of --force-for-bad-html should not be necessary for messages generated by Carbonio's own WebClient.

Steps to Reproduce:

  1. Enable Domain Disclaimer globally:

zimbraDomainMandatoryMailSignatureEnabled: TRUE
  1. Enable it for the test domain:

carbonio prov md <domain> zimbraDomainMandatoryMailSignatureEnabled TRUE
  1. Configure both an HTML and plain-text disclaimer for the domain:

zimbraAmavisDomainDisclaimerHTML: <h2>Test disclaimer</h2>
zimbraAmavisDomainDisclaimerText: Test disclaimer
  1. Generate/synchronize the AlterMIME disclaimer configuration:

su - zextras -c "/opt/zextras/libexec/zmaltermimeconfig"
  1. Verify the domain option:

carbonio prov gd <domain> | grep -i amavisDisclaimerOptions

Expected:

amavisDisclaimerOptions: <domain>
  1. Verify that the generated files exist:

/opt/zextras/data/altermime/<domain>.b64
/opt/zextras/data/altermime/<domain>.html
/opt/zextras/data/altermime/<domain>.txt
  1. Verify that the ORIGINATING Amavis policy has:

allow_disclaimers => 1
  1. Send an HTML email from Carbonio WebClient to an external recipient.

  2. Observe that Amavis reports:

mangling by altermime (disclaimer) done
  1. Check the delivered message. The disclaimer is missing.

  2. Add only:

--force-for-bad-html

to the AlterMIME disclaimer invocation.

  1. Send the same type of message again.

  2. The disclaimer is now inserted correctly.

Expected result:

The disclaimer should be inserted in step 8 using Carbonio's default configuration.

Actual result:

The disclaimer is only inserted after adding --force-for-bad-html to the AlterMIME invocation.

Possible cause / suggested investigation:

The results indicate that carbonio-altermime 0.3.10-7noble considers the HTML generated by Carbonio WebClient unsuitable for normal HTML disclaimer insertion.

AlterMIME nevertheless returns exit status 0, causing carbonio-amavisd 2.14.0-4noble to report:

mangling by altermime (disclaimer) done

even though no disclaimer was inserted.

Please investigate whether:

  1. --force-for-bad-html should be included in Carbonio's default @altermime_args_disclaimer; or

  2. the HTML generated by Carbonio WebClient should be changed so that AlterMIME accepts it without this option; and

  3. Amavis should detect/report when AlterMIME returns successfully but does not actually insert a disclaimer.

Tagged: @arman, @sharif

 


   
Quote