Re: [Ntp] New I-D: NTP Port Randomization (draft-gont-ntp-port-randomization-00.txt)

Miroslav Lichvar <mlichvar@redhat.com> Thu, 25 April 2019 14:25 UTC

Return-Path: <mlichvar@redhat.com>
X-Original-To: ntp@ietfa.amsl.com
Delivered-To: ntp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 8AA991200F4 for <ntp@ietfa.amsl.com>; Thu, 25 Apr 2019 07:25:43 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.901
X-Spam-Level:
X-Spam-Status: No, score=-6.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-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 54QSdfFqcso4 for <ntp@ietfa.amsl.com>; Thu, 25 Apr 2019 07:25:41 -0700 (PDT)
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 7E2FD1200DE for <ntp@ietf.org>; Thu, 25 Apr 2019 07:25:41 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA4F0314FC00; Thu, 25 Apr 2019 14:25:40 +0000 (UTC)
Received: from localhost (holly.tpb.lab.eng.brq.redhat.com [10.43.134.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 07DF560856; Thu, 25 Apr 2019 14:25:39 +0000 (UTC)
Date: Thu, 25 Apr 2019 16:25:37 +0200
From: Miroslav Lichvar <mlichvar@redhat.com>
To: Fernando Gont <fgont@si6networks.com>
Cc: ntp@ietf.org
Message-ID: <20190425142537.GG26137@localhost>
References: <155544937440.24990.5297599214551671091.idtracker@ietfa.amsl.com> <d0be2bea-0e57-022f-16f1-4e682dcc66ad@si6networks.com> <20190418123648.GF5984@localhost> <ceea9343-496f-2842-8255-158b515106b6@si6networks.com> <20190423084853.GB5188@localhost> <890da574-a283-9ccc-28fc-19d500920d36@si6networks.com> <20190424083440.GB26137@localhost> <ff57c10e-4e59-29b2-c255-dea7392a51f5@si6networks.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <ff57c10e-4e59-29b2-c255-dea7392a51f5@si6networks.com>
User-Agent: Mutt/1.10.1 (2018-07-13)
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 25 Apr 2019 14:25:40 +0000 (UTC)
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/p-U7vNji6mLeAemkor6k08p5agw>
Subject: Re: [Ntp] New I-D: NTP Port Randomization (draft-gont-ntp-port-randomization-00.txt)
X-BeenThere: ntp@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: <ntp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ntp>, <mailto:ntp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ntp/>
List-Post: <mailto:ntp@ietf.org>
List-Help: <mailto:ntp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ntp>, <mailto:ntp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Apr 2019 14:25:44 -0000

On Thu, Apr 25, 2019 at 02:17:18PM +0200, Fernando Gont wrote:
> On 24/4/19 10:34, Miroslav Lichvar wrote:
> > I think most, if not all, rely on the OS to do that. When there is no
> > OS, it seems it's common to use a fixed port, but different from 123.
> 
> Maybe we could make an explicit note that in order to comply with this
> spec, you can normally rely on the underlying OS for doing the
> randomization part?

That's a good idea.

> -- and then learn the selected port to store it in
> the NTP data structure.

NTP clients don't need to know their source port. They should just
use an unbound socket, like with most TCP/UDP-based protocols.

Another thing that might be good to include in the document is a
recommendation for minimum time that the socket should be open.
(Some?) public NTP servers receive large amounts of ICMP packets that
seem to be from implementations not waiting long enough for a
response, so when the response actually gets there, the port is
already closed, which triggers an ICMP response.

> > There are many peaks in the port distribution observed on servers.
> 
> That's interesting. -- any clues if that's an artifact of NATs rewriting
> the local port or something else?

I'm not sure. I think at least some part of it are extremely simple
clients using a fixed source port. There are implementations broken in
unique ways and they have a consistent use of the source port. Some
don't even use a random transmit timestamp, i.e. it's trivial to spoof
a response they will accept.

An NTP usage analysis by NIST has a nice graph showing the
distribution of the source port on page 7:
https://nvlpubs.nist.gov/nistpubs/jres/121/jres.121.003.pdf

> > It depends on the configuration. If a peer has the other peer
> > specified in the config, it's using the active mode.
> 
> So it would be active-mode on both sides, leading to a single association?

Yes.

> > In the general case yes, but it could be enabled in the configuration file.
> 
> Are you assuming symmetric-passive on one side, and symmetric-active on
> the other, with the later employing port randomization? -- that's the
> only case of symmetric mode where it'd seem to me one can randomize the
> port.

Yes.

> Side question: any clues regarding what's the normal deployed model for
> symmetric mode? -- i,.e., is the usual thing to configure one peer with
> passive mode, and the other in active mode? Or is the usual thing to
> configure both peers in active mode? (i.e., have both peers try to
> actively mobilize an association), instead of waiting for the other end
> to do it).

My guess is that it's more common for both peers to be configured in
the active mode. They could be configured as clients and it would work
almost exactly the same. I have not seen the passive mode used very
often. But it can be very useful when the server is behind NAT.

-- 
Miroslav Lichvar