Trusted Email Services

From Halon, SMTP software for hosting providers
Jump to: navigation, search

The Trusted Email Services (TES) initiative helps consumers and businesses to easily identify an email provider which fulfills their trust, security and privacy needs.[1]. It was founded by a consortium of companies, including Open-Xchange and Dovecot, and is governed by openBIT.

The configuration scripts on this page conform to draft v0.4 (2016-03-16).[2]

Shared functions

These function should be put in a include file, in order to be able to update them easily:

Include file
function tes_check_client_policy()
{
    global 
$saslauthed$tlsstarted$tlsprotocol;
    if (!
$tlsstarted)
        return 
false;
    if (
$tlsprotocol == "SSLv2" or
        
$tlsprotocol == "SSLv3" or
        
$tlsprotocol == "TLSv1")
        return 
false;
    if (!
$saslauthed)
        return 
false;
    return 
true;
}
function 
tes_check_member_server_policy()
{
    global 
$tlsstarted$tlsprotocol;
    if (!
$tlsstarted)
        return 
false;
    if (
$tlsprotocol == "SSLv2" or
        
$tlsprotocol == "SSLv3" or
        
$tlsprotocol == "TLSv1" or
        
$tlsprotocol == "TLSv1.1")
        return 
false;
    return 
true;
}
function 
tes_is_member($domain$error_callback)
{
    
$dns dnscname("tes-master.$domain", ["extended_result" => true]);
    if (
$dns["error"] == "NXDOMAIN") return false;
    if (!
$dns["result"]) return $error_callback($dns["error"]);
    
    
$tesmaster $dns["result"][0];
    
    
$dns dnstxt("$domain.tes-member.$tesmaster", ["extended_result" => true]);
    if (
$dns["error"] == "NXDOMAIN") return false;
    if (!
$dns["result"]) return $error_callback($dns["error"]);

    
$dns dnstxt("$tesmaster.tes-member.trusted-email-services.com", ["extended_result" => true]);
    if (
$dns["error"] == "NXDOMAIN") return false;
    if (!
$dns["result"]) return $error_callback($dns["error"]);

    return 
true;

Mail relay (inbound)

Use the following scripts for inbound email delivery:

if (tes_is_member($senderdomain, function ($error) { Defer("TES lookup failed"); }))
    if (!
tes_check_member_server_policy())
        
Reject("Member is not TES compliant"); 

if (tes_is_member($senderdomain, function ($error) { Defer("TES lookup failed"); })) {
    
$result DKIMSDID([$senderdomain]);
    if (
$result[$senderdomain] != "pass")
        
Reject("The messages is not DKIM signed policy of $senderdomain ($messageid)");

    
$result ScanDMARC();
    if (
is_array($result) && $result[$senderdomain] == "reject")
        
Reject("The messages violates the DMARC policy of $senderdomain ($messageid)");

    
AddHeader("X-TES-Status""member");
} else {
    
AddHeader("X-TES-Status""non-member");

Mail submission (outbound)

On client submission port (587) use the following scripts:

if (!tes_check_client_policy())
    
Reject("Client is not TES compliant"); 

DKIMSign($selector$senderdomain$rsakey); 

if (tes_is_member($recipientdomain, function ($error) { Reschedule(3600, ["reason" => "tes_is_member: $error""increment_retry" => false]); }))
    
SetTLS([
        
"tls_protocols" => "!SSLv2,!SSLv3,!TLSv1,!TLSv1.1",
        
"tls" => "dane_require"
    
]);
else
    
SetTLS([
        
"tls" => "dane"
    
]); 

and the following listener configuration settings:

  • A TLS certificate
  • An AUTH flow authentication
  • Require TLS for AUTH

References