Re: [netmod] SSH keys - draft-ietf-netmod-system-mgmt

nisse@lysator.liu.se (Niels Möller ) Mon, 05 May 2014 06:57 UTC

Return-Path: <nisse@lysator.liu.se>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 7AB111A0262 for <netmod@ietfa.amsl.com>; Sun, 4 May 2014 23:57:33 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.122
X-Spam-Level:
X-Spam-Status: No, score=-1.122 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HELO_EQ_SE=0.35, MIME_8BIT_HEADER=0.3, RP_MATCHES_RCVD=-0.651, SPF_NEUTRAL=0.779] autolearn=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 a-MO_NpbUEtQ for <netmod@ietfa.amsl.com>; Sun, 4 May 2014 23:57:31 -0700 (PDT)
Received: from bacon.lysator.liu.se (bacon.lysator.liu.se [IPv6:2001:6b0:17:f0a0::ce]) by ietfa.amsl.com (Postfix) with ESMTP id 7A6D41A0019 for <netmod@ietf.org>; Sun, 4 May 2014 23:57:31 -0700 (PDT)
Received: from bacon.lysator.liu.se (localhost [127.0.0.1]) by bacon.lysator.liu.se (8.14.5+Sun/8.14.5) with ESMTP id s456vLM1027931; Mon, 5 May 2014 08:57:21 +0200 (MEST)
Received: (from nisse@localhost) by bacon.lysator.liu.se (8.14.5+Sun/8.14.5/Submit) id s456vHVK027925; Mon, 5 May 2014 08:57:17 +0200 (MEST)
X-Authentication-Warning: bacon.lysator.liu.se: nisse set sender to nisse@lysator.liu.se using -f
From: nisse@lysator.liu.se
To: Martin Bjorklund <mbj@tail-f.com>
References: <nnlhunqplp.fsf@bacon.lysator.liu.se> <1398875570.20380.20.camel@destiny.pc.cs.cmu.edu> <nnha5ar39t.fsf@bacon.lysator.liu.se> <20140505.075720.274914921.mbj@tail-f.com>
Date: Mon, 05 May 2014 08:57:17 +0200
In-Reply-To: <20140505.075720.274914921.mbj@tail-f.com> (Martin Bjorklund's message of "Mon, 05 May 2014 07:57:20 +0200 (CEST)")
Message-ID: <nneh08pvaq.fsf@bacon.lysator.liu.se>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (usg-unix-v)
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
Archived-At: http://mailarchive.ietf.org/arch/msg/netmod/IUkL6ICTQv4E_RNaC2mwJ--ywfo
Cc: ietf-ssh@NetBSD.org, netmod@ietf.org, jhutz@cmu.edu
Subject: Re: [netmod] SSH keys - draft-ietf-netmod-system-mgmt
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 05 May 2014 06:57:33 -0000

Martin Bjorklund <mbj@tail-f.com> writes:

> nisse@lysator.liu.se (Niels Möller) wrote:

>> So then the right choice is 1),
>> 
>> : 1)  Clarify that the leaf "key-data" contains:
>> : 
>> :          string    certificate or public key format identifier
>> :          byte[n]   key/certificate data
>> : 
>> :     This allows for simple copy-and-paste from normal open ssh and
>> :     rfc4716 files.
>
> But Jeffrey Hutzelman wrote:
>
>    But yes, I believe RFC4716 is broken, because it relies on the
>    encoding described above, rather than being consistent with the
>    requirement "The key type MUST always be explicitly known."

It would have made some sense for the RFC 4716 public key format to
include some other header for the algorithm, but I'm not sure it's
"broken". I think one reasonable interpretation of "The key type MUST
always be explicitly known." is that it's inappropriate to define
mechanisms *within* the ssh protocol which accept a key of arbitrary
type, without any algorithm negotiation or advertisement, so that the
receiver has to take the key apart and then do some dispatch on the
embedded algorithm type.

But that doens't necessarily rule out passing around arbitrary keys
*outside* of the ssh wire protocol, without specifying key type
explicitly.

> I am a bit confused by the terminology.  What is the difference
> between "key", "key data", and "key blob"?

Sorry about that. I think the data for the "key-data" leaf should be as
you specify it above. E.g., for an RSA key, the ssh transport encoding
of

      string    "ssh-rsa"
      mpint     e
      mpint     n

The one thing that seems clear to me is that you shouldn't strip that
algorithm field from your "key-data" leaf.

> So if we introduce the clarification (1) above, aren't we doing the
> same mistake as RFC 4716?

If you also include the string "ssh-rsa" in the "algorithm" leaf, you
*do* have that extra information, missing from RFC 4716. So if it's a
mistake, it's a different mistake.

A small practical problem is that if you want to do simple
copy-and-paste from rfc4716 files, you also need a tool to extract the
algorithm identifier, so you can set the "algorithm" leaf correctly. And
I see nothing wrong in doing that; it is properly specified in both RFC
4716 and RFC4253 how to do that, and any tools handing RFC4716 files at
all can be expected to have some knowledge of ssh specifics.

I have to admit I'm also a bit confused at this point... it's getting
less and less clear to me if it really is the right thing to include
algorithm info separately. My gut reaction was no, and then Jeffrey
convinced me it's necessary, and now I just don't know.

Pro: Having the algorithm separately simplifies some use cases. Say, you
want to compare the information in your files to the configuration of an
ssh implementation to see if available keys are supported.

Cons: You could get subtle failure modes if you do the above, and the
data is inconsistent. Say some program ignores your algorithm leaf
(e.g., you export the key data in RFC 4716 format), and some doesn't
(e.g., the algorithm leaf makes it through to the ssh configuration, and
then the key is invalid, and results in an error locally or remotely).

Probably no *big* problems either way.

In case you use this data to keep track of authorized user or host keys,
I think it's prudent to make sure than any key-data leaf not matching
the corresponding "algorithm" leafs is treated as an invalid key. And,
e.g., refuse to export it in RFC 4716 format.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.