[Uta] Digression on DANE for MTAs implementation difficulty, followups off-list are likely best.

Viktor Dukhovni <ietf-dane@dukhovni.org> Thu, 12 April 2018 01:36 UTC

Return-Path: <ietf-dane@dukhovni.org>
X-Original-To: uta@ietfa.amsl.com
Delivered-To: uta@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 938D11243F6; Wed, 11 Apr 2018 18:36:01 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.2
X-Spam-Level:
X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1HQNCIRwLP6B; Wed, 11 Apr 2018 18:35:59 -0700 (PDT)
Received: from mournblade.imrryr.org (mournblade.imrryr.org [108.5.242.66]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 63F1A120713; Wed, 11 Apr 2018 18:35:59 -0700 (PDT)
Received: from [10.200.0.109] (unknown [8.2.105.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mournblade.imrryr.org (Postfix) with ESMTPSA id F05887A3309; Thu, 12 Apr 2018 01:35:57 +0000 (UTC) (envelope-from ietf-dane@dukhovni.org)
From: Viktor Dukhovni <ietf-dane@dukhovni.org>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\))
Date: Wed, 11 Apr 2018 21:35:56 -0400
References: <CAKHUCzwes5vHjBSDqYXkvGRCGPeSPnqNgsJ2J_tDzF2FG+RuMg@mail.gmail.com> <01QR7KDO3D96000051@mauve.mrochek.com>
To: "ietf@ietf.org Discussion" <ietf@ietf.org>, uta@ietf.org
In-Reply-To: <01QR7KDO3D96000051@mauve.mrochek.com>
Message-Id: <4191D01C-742F-40F4-AD8F-5BADC90F7253@dukhovni.org>
X-Mailer: Apple Mail (2.3445.6.18)
Archived-At: <https://mailarchive.ietf.org/arch/msg/uta/EtXRP4gLCAkv5_v3Yn3WzVfp5VA>
Subject: [Uta] Digression on DANE for MTAs implementation difficulty, followups off-list are likely best.
X-BeenThere: uta@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: UTA working group mailing list <uta.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/uta>, <mailto:uta-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/uta/>
List-Post: <mailto:uta@ietf.org>
List-Help: <mailto:uta-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/uta>, <mailto:uta-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 12 Apr 2018 01:36:02 -0000


> On Apr 11, 2018, at 11:40 AM, ned+uta@mrochek.com wrote:
> 
> I've also looked at implementing DANE, and IMO it's a major PITA to implement,
> so much so that it would take substantial customer interest to make me do it -
> interest that has not materialized.

[ Not really on topic for this LC, so follow-ups off-list if there are further
  questions to either Ned or me. ]

If your TLS library is OpenSSL 1.1.0 or later, then DANE support is included,
all you need to do is locate and retrieve any associated usable TLSA records,
and OpenSSL will verify the peer chain against those.  Since MTAs already have
DNS-specific code for MX records, ... also doing TLSA lookups is fairly simple.

Manpage with code sample at:

  https://www.openssl.org/docs/man1.1.0/ssl/SSL_CTX_dane_enable.html

At which point DANE boils down to, per "MX host":

  * Obtain address (A/AAAA) records for hostname via DNS
  * If the address records are insecure and traversed a CNAME
    perform CNAME query to obtain security status of original name
  * If all (address and any CNAME) are insecure, no DANE
  * If address records at are secure post CNAME expansion, check
    for secure TLSA RRs at _25._tcp + expanded hostname. If found,
    use those.
  * If none found, or only original name is secure check for
    TLSA RRs at _25._tcp + original hostname.  If found use
    those, else no DANE.

If TLSA lookups error out (not NXDOMAIN but SERVFAIL, timeout, ...)
then skip the host and try next MX or defer.

There's no HTTPS callout, no persistent cache, no downgrade on first
contact.  No periodic preemptive policy refresh (to avoid downgrade
near expiration), no expedited policy refresh on authentication
failure, ...   A correct STS implementation has rather a lot of
delicate persistent state.  And the SMTP client needs to not only
do policy lookups against its cache, but also trigger policy
refresh on connection failure, and policy confirmation on initial
success.  It is also not 100% clear whether a policy which
initially fails on the first MX host tried, but succeeds on the
second is a valid policy to cache.  I think the intent is that it
is, but clearly the domain's configuration is degraded, so it is
a bit of a judgement call.

The policy cache needs to avoid retrying too often on failure to
reach the HTTPS server, returning the status quo rather than
timing out the lookup at each delivery.  So there's short-term
state about recent failed attempts, as well as long-term state
for cached policies, ...  So no shortage of moving parts.

Each of DANE and STS has its implementation challenges.  It
rather depends on one's comfort zone.  The DANE footprint in
Exim is quite small, not counting the contributed general-purpose
library for X.509 ala DANE that predates support for same in
OpenSSL 1.1.0, and works with OpenSSL 1.0.0 or later.

In Postfix the DANE code is larger, because that library
was originally developed as part of Postfix, and because we
also used the DANE code to re-implement the pre-existing
support for "fingerprint" based peer authentication, and
support TLS session resumption, which has to ensure that
resumed sessions match the destination policy.

So if Exim is a guide to implementation complexity for
DANE, the DANE story looks pretty good.  The amount of
DANE-specific Exim code is quite modest.
   
-- 
	Viktor.