Subject: Revised Publickey subsystem draft

From: Jon Bright <[email-masked]>
Date: Thu, 24 Jul 2003 20:15:29 +0200

Hi,

Brent sent me the XML source for the Publickey subsystem draft.  I've 
integrated the changes I mentioned earlier, added a reference to RFC1766 
(and changed "References" to be "Normative References") as well as 
converting the restrictions previously under the "restrict" attribute to 
be attributes, as Bill and Nicolas suggested.  Attached is the text of 
the updated version.

I have two questions:

a) Does anyone have some suggested text for a security considerations 
section?  That the protocol assumes it's running over a secure transport 
layer would seem to be fairly standard, for starters.

b) Bill, did you decide to make this a WG work item?  If so, should the 
subsystem name remain as "[email-masked]" or should it just 
become "publickey"?

--
Jon Bright
Lead Programmer, Silicon Circus Ltd.
http://www.siliconcircus.com

Secure Shell Working Group                                  J. Galbraith
Internet-Draft                                               J. Van Dyke
Expires: January 22, 2004                                     B. McClure
                                                        VanDyke Software
                                                               J. Bright
                                                          Silicon Circus
                                                           July 24, 2003

                   Secure Shell Public-Key Subsystem
              draft-galb-secsh-publickey-subsystem-01.txt

Status of this Memo

   This document is an Internet-Draft and is in full conformance with
   all provisions of Section 10 of RFC2026.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups. Note that other
   groups may also distribute working documents as Internet-Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time. It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at http://
   www.ietf.org/ietf/1id-abstracts.txt.

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   This Internet-Draft will expire on January 22, 2004.

Copyright Notice

   Copyright (C) The Internet Society (2003). All Rights Reserved.

Abstract

   SECSH defines an authentication mechanism that is based on public
   keys, but does not define any mechanism for key distribution. No
   common key management solution exists in current implementations.
   This document describes a protocol that can be used to configure
   public keys in an implementation-independent fashion, allowing client
   software to take on the burden of this configuration.

   This protocol is intended to be used from the Secure Shell Connection
   Protocol [4] as a subsystem, as described in	Section ``Starting a

Galbraith, et al.       Expires January 22, 2004                [Page 1]

Internet-Draft     Secure Shell Public-Key Subsystem           July 2003

   Shell or a Command''. The subsystem name used with this protocol is
   "[email-masked]".

   The public-key subsystem provides a server-independent mechanism for
   clients to add public keys, remove public keys, and list the current
   public keys known by the server. Rights to manage public keys are
   specific and limited to the authenticated user.

   A public key may also be associated with various restrictions,
   including a mandatory command or subsystem.

Table of Contents

   1.    Introduction . . . . . . . . . . . . . . . . . . . . . . . .  3
   2.    Public-Key Subsystem Overview  . . . . . . . . . . . . . . .  4
   2.1   Opening the Public-Key Subsystem . . . . . . . . . . . . . .  4
   2.2   Requests . . . . . . . . . . . . . . . . . . . . . . . . . .  5
   2.3   Responses  . . . . . . . . . . . . . . . . . . . . . . . . .  5
   2.3.1 The Status Response  . . . . . . . . . . . . . . . . . . . .  5
   3.    Public-Key Subsystem Operations  . . . . . . . . . . . . . .  7
   3.1   Version Packet . . . . . . . . . . . . . . . . . . . . . . .  7
   3.2   Adding a public key  . . . . . . . . . . . . . . . . . . . .  7
   3.3   Removing a public key  . . . . . . . . . . . . . . . . . . . 10
   3.4   Listing public keys  . . . . . . . . . . . . . . . . . . . . 10
   3.5   Listing server capabilities  . . . . . . . . . . . . . . . . 10
         Normative References . . . . . . . . . . . . . . . . . . . . 12
         Authors' Addresses . . . . . . . . . . . . . . . . . . . . . 12
         Intellectual Property and Copyright Statements . . . . . . . 14

Galbraith, et al.       Expires January 22, 2004                [Page 2]

Internet-Draft     Secure Shell Public-Key Subsystem           July 2003

1. Introduction

   SECSH is a protocol for secure remote login and other secure network
   services over an insecure network. SECSH defines an authentication
   mechanism that is based on public keys, but does not define any
   mechanism for key distribution. Common practice is to authenticate
   once with password authentication and transfer the public key to the
   server.  However, to date no two implementations use the same
   mechanism to configure a public key for use.

   This document describes a subsystem that can be used to configure
   public keys in an implementation-independent fashion. This approach
   allows client software to take on the burden of this configuration.
   The public-key subsystem protocol is designed for extreme simplicity
   in implementation. It is not intended as a PKIX replacement.

   The Secure Shell Public-Key subsystem has been designed to run on top
   of the SECSH transport layer [2] and user authentication	protocols
   [3]. It provides a simple mechanism for the client to manage public
   keys on the server.

   This document should be read only after reading the SECSH
   architecture [1] and SECSH connection [4] documents.

   This protocol requires that the user be able to authenticate in some
   fashion before it can be used. If password authentication is used,
   servers SHOULD provide a configuration option to disable the use of
   password authentication after the first public key is added.

Galbraith, et al.       Expires January 22, 2004                [Page 3]

Internet-Draft     Secure Shell Public-Key Subsystem           July 2003

2. Public-Key Subsystem Overview

   The public-key subsystem provides a server-independent mechanism for
   clients to add public keys, remove public keys, and list the current
   public keys known by the server.  The subsystem name is
   "[email-masked]".

   The public keys added, removed, and listed using this protocol are
   specific and limited to those of the authenticated user.

   The operations to add, remove and list the authenticated user's
   public keys are performed as request packets sent to the server. The
   server sends response packets that indicate success or failure as
   well as provide specific response data.

   The format of public-key blobs are detailed in the SSH Transport
   Protocol document [2].

2.1 Opening the Public-Key Subsystem

   The public-key subsystem is opened when the clients sends a
   SSH_MSG_CHANNEL_REQUEST over an existing session.

   The details of how a session is opened are described in the SSH
   Connection Protocol document [4] in the section "Opening a Session".

   To open the public-key subsystem, the client sends:

   	byte      SSH_MSG_CHANNEL_REQUEST
   	uint32    recipient channel
   	string    "subsystem"
   	boolean   want reply
   	string    "[email-masked]"

   Client implementations SHOULD reject this request; it is normally
   only sent by the client.

   If want reply is TRUE, the server MUST respond with
   SSH_MSG_CHANNEL_SUCCESS if the public-key subsystem was successfully
   started or SSH_MSG_CHANNEL_FAILURE if the server failed to start or
   does not support the public-key subsystem.

   The server SHOULD respond with SSH_MSG_CHANNEL_FAILURE if the user
   authenticated with a restricted public key that does not allow access
   to the publickey subsystem.

   It is RECOMMENDED that clients request and check the reply for this
   request.

Galbraith, et al.       Expires January 22, 2004                [Page 4]

Internet-Draft     Secure Shell Public-Key Subsystem           July 2003

2.2 Requests

   All public-key subsystem requests are sent in the following form:

   	uint32    length
   	string    request-name
   	... request specific data follows

   The length field describes the length of the request-name field and
   the request-specific data, but not of the length field itself.  The
   client MUST receive acknowledgement of each request prior to sending
   a new request.

   All requests described in Section 3 are a description of the
   'request-name' and 'data' portion of the packet.

2.3 Responses

   All public-key subsystem responses are sent in the following form:

   	uint32    length
   	string    response-name
   	... response specific data follows

2.3.1 The Status Response

   A request is acknowledged by sending a status packet. If there is
   data in response to the request, the status packet is sent after all
   data has been sent.

   	string    "status"
   	uint32    status code
   	string    description [RFC-2279]
   	string    language tag [RFC-1766]

   A status message MUST be sent for any unrecognized packets and the
   request SHOULD NOT close the subsystem.

2.3.1.1 Status Codes

   The status code gives the status in a more machine-readable format
   (suitable for localization), and can have the following values:

   	SSH_PUBLICKEY_SUCCESS                      0
   	SSH_PUBLICKEY_ACCESS_DENIED                1
   	SSH_PUBLICKEY_STORAGE_EXCEEDED             2
   	SSH_PUBLICKEY_REQUEST_NOT_SUPPORTED        3

Galbraith, et al.       Expires January 22, 2004                [Page 5]

Internet-Draft     Secure Shell Public-Key Subsystem           July 2003

   	SSH_PUBLICKEY_KEY_NOT_FOUND                4
   	SSH_PUBLICKEY_KEY_NOT_SUPPORTED            5
   	SSH_PUBLICKEY_KEY_ALREADY_PRESENT          6
   	SSH_PUBLICKEY_GENERAL_FAILURE              7

Galbraith, et al.       Expires January 22, 2004                [Page 6]

Internet-Draft     Secure Shell Public-Key Subsystem           July 2003

3. Public-Key Subsystem Operations

   The public-key subsystem currently defines four operations: add,
   remove, list, and command.

3.1 Version Packet

   Both sides MUST start by sending a version packet that indicates the
   version of the protocol they are using.

   	string "version"
   	uint32 protocol-version-number

   The version of the protocol described by this document is version 1.

   Both sides send the highest version that they implement. The lower of
   the version numbers is the version of the protocol to use.  If either
   side can't support the lower version, it should close the subsystem
   and notify the other side by sending an SSH_MSG_CHANNEL_CLOSE
   message.

   Both sides MUST wait to receive this version before continuing.

3.2 Adding a public key

   If the client wishes to add a public key, the client sends:

   	string    "add"
   	string    public-key algorithm name
   	string    public-key blob
   	boolean   overwrite
   	uint32    attribute-count
   	 string    attrib-name
   	 string    attrib-value
   	 bool      mandatory
   	repeated attribute-count times

   The server MUST attempt to store the public key for the user in the
   appropriate location so the public key can be used for subsequent
   public-key authentications.  If the overwrite field is false and the
   specified key already exists, the server MUST return
   SSH_PUBLICKEY_KEY_ALREADY_PRESENT.  If the server returns this, the
   client SHOULD provide an option to the user to overwrite the key.  If
   the overwrite field is true and the specified key already exists but
   cannot be overwritten, the server MUST return
   SSH_PUBLICKEY_ACCESS_DENIED

   Attribute names are defined following the same scheme laid out for

Galbraith, et al.       Expires January 22, 2004                [Page 7]

Internet-Draft     Secure Shell Public-Key Subsystem           July 2003

   algorithm names in [1].  If the server does not implement a mandatory
   attribute, it MUST fail the add. For the purposes of a mandatory
   attribute, storage of the attribute is not sufficient, but requires
   that the server understand and implement the intent of the attribute.

   The following attributes are currently defined:

   "comment"

   The value of the comment attribute contains user-specified text about
   the public key.  The server SHOULD make every effort to preserve this
   value and return it with the key during any subsequent list
   operation. The server MUST NOT attempt to interpret or act upon the
   content of the comment field in any way.  The comment attribute must
   be specified in UTF-8 format [6].

   The comment field is useful so the user can identify the key without
   resorting to comparing its fingerprint.  This attribute SHOULD NOT be
   mandatory.

   "comment-language"

   If this attribute is specified, it MUST immediately follow a
   "comment" attribute and specifies the language for that attribute
   [5].  The client MAY specify more than comment if it additionally
   specifies a different language for each of those comments.  The
   server SHOULD attempt to store each comment, together with that
   comment's lanuage attribute.  This attribute SHOULD NOT be mandatory.

   "command"

   "command" specifies a command which the may be executed (via the
   "exec" channel request) when this key is in use.  More than one
   "command" attribute may be specified.  This attribute SHOULD be
   mandatory.

   "subsystem"

   "subsystem" specifies a comma-separated list of subsystems that may
   be started (using a "subsystem" request) when this key is in use.
   This attribute SHOULD be mandatory.  If the value is empty, no
   subsystems may be started.

   "x11"

   "x11" specifies that X11 forwarding may not be performed when this
   key is in use.  The attribute-value field SHOULD be empty for this
   attribute. This attribute SHOULD be mandatory.

Galbraith, et al.       Expires January 22, 2004                [Page 8]

Internet-Draft     Secure Shell Public-Key Subsystem           July 2003

   "shell"

   "shell" specifies that session channel "shell" requests should be
   denied when this key is in use.  The attribute-value field SHOULD be
   empty for this attribute.  This attribute SHOULD be mandatory.

   "exec"

   "exec" specifies that session channel "exec" requests should be
   denied when this key is in use.  The attribute-value field SHOULD be
   empty for this attribute.  This attribute SHOULD be mandatory.

   "agent"

   "agent" specifies that session channel "auth-agent-req" requests
   should be denied when this key is in use.  The attribute-value field
   SHOULD be empty for this attribute.  This attribute SHOULD be
   mandatory.

   "env"

   "env" specifies that session channel "env" requests should be denied
   when this key is in use.  The attribute-value field SHOULD be empty
   for this attribute.  This attribute SHOULD be mandatory.

   "from"

   "from" specifies a comma-separated list of hosts from which the key
   may be used.  If a host not in this list attempts to use this key for
   authorisation purposes, the authorisation attempt MUST be denied.
   The server SHOULD make a log entry regarding this.

   "port-forward"

   "port-forward" specifies that no "direct-tcpip" requests should be
   accepted, except to those hosts specified in the comma-separated list
   supplied as a value to this attribute.  If the value of this
   attribute is empty, all "direct-tcpip" requests should be refused
   when using this key. This attribute SHOULD be mandatory.

   "reverse-forward"

   "reverse-forward" specifies that no "tcpip-forward" requests should
   be accepted, accept for the port numbers in the comma-separated list
   supplied as a value to this attribute.  If the value of this
   attribute is empty, all "tcpip-forward" requests should be refused
   when using this key.  This attribute SHOULD be mandatory.

Galbraith, et al.       Expires January 22, 2004                [Page 9]

Internet-Draft     Secure Shell Public-Key Subsystem           July 2003

   In addition to the attributes specified by the client, the server MAY
   provide a method for administrators to compulsorily enforce certain
   attributes.

3.3 Removing a public key

   If the client wishes to remove a public key, the client sends:

   	string    "remove"
   	string    public-key algorithm name
   	string    public-key blob

   The server MUST attempt to remove the public key for the user from
   the appropriate location, so that the public key cannot be used for
   subsequent authentications.

3.4 Listing public keys

   If the client wishes to list the known public keys, the client sends:

   	string    "list"

   The server will respond with zero or more of the following responses:

   	string    "publickey"
   	string    public-key algorithm name
   	string    public-key blob
   	uint32    attribute-count
   	 string    attrib-name
   	 string    attrib-value
   	repeated attribute-count times

   Following the last "publickey" response, a status packet MUST be
   sent.

   An implementation MAY choose not to support this request.

3.5 Listing server capabilities

   If the client wishes to know which key attributes the server
   supports, it sends:

   	string    "listattributes"

   The server will respond with zero or more of the following responses:

   	string    "attribute"
   	string    attribute name

Galbraith, et al.       Expires January 22, 2004               [Page 10]

Internet-Draft     Secure Shell Public-Key Subsystem           July 2003

   	boolean   compulsory

   The "compulsory" field indicates whether this attribute will be
   compulsorily applied to any added keys (irrespective of whether the
   attribute has been specified by the client) due to administrative
   settings on the server.  If the server does not support
   administrative settings of this nature, it MUST return false in the
   compulsory field.

   Following the last "attribute" response, a status packet MUST be
   sent.

   An implementation MAY choose not to support this request.

Galbraith, et al.       Expires January 22, 2004               [Page 11]

Internet-Draft     Secure Shell Public-Key Subsystem           July 2003

Normative References

   [1]  Ylonen, T., Kivinen, T., Saarinen, M., Rinne, T. and S.
        Lehtinen, "SSH Protocol Architecture",
        draft-ietf-secsh-architecture-13 (work in progress), January
        2002.

   [2]  Ylonen, T., Kivinen, T., Saarinen, M., Rinne, T. and S.
        Lehtinen, "SSH Transport Layer Protocol",
        draft-ietf-secsh-transport-15 (work in progress), March 2002.

   [3]  Ylonen, T., Kivinen, T., Saarinen, M., Rinne, T. and S.
        Lehtinen, "SSH Authentication Protocol",
        draft-ietf-secsh-userauth-16 (work in progress), February 2002.

   [4]  Ylonen, T., Kivinen, T., Saarinen, M., Rinne, T. and S.
        Lehtinen, "SSH Connection Protocol", draft-ietf-secsh-connect-16
        (work in progress), January 2002.

   [5]  Alvestrand, H., "Tags for the Identification of Languages", RFC
        1766, March 1995.

   [6]  Yergeau, F., "UTF-8, a transformation format of ISO 10646", RFC
        2279, January 1998.

Authors' Addresses

   Joseph Galbraith
   VanDyke Software
   4848 Tramway Ridge Blvd
   Suite 101
   Albuquerque, NM  87111
   US

   Phone: +1 505 332 5700
   EMail: [email-masked]

   Jeff P. Van Dyke
   VanDyke Software
   4848 Tramway Ridge Blvd
   Suite 101
   Albuquerque, NM  87111
   US

   Phone: +1 505 332 5700
   EMail: [email-masked]

Galbraith, et al.       Expires January 22, 2004               [Page 12]

Internet-Draft     Secure Shell Public-Key Subsystem           July 2003

   Brent McClure
   VanDyke Software
   4848 Tramway Ridge Blvd
   Suite 101
   Albuquerque, NM  87111
   US

   Phone: +1 505 332 5700
   EMail: [email-masked]

   Jon Bright
   Silicon Circus
   24 Jubilee Road
   Chichester, West Sussex  PO19 7XB
   UK

   Phone: +49 172 524 0521
   EMail: [email-masked]

Galbraith, et al.       Expires January 22, 2004               [Page 13]

Internet-Draft     Secure Shell Public-Key Subsystem           July 2003

Intellectual Property Statement

   The IETF takes no position regarding the validity or scope of any
   intellectual property or other rights that might be claimed to
   pertain to the implementation or use of the technology described in
   this document or the extent to which any license under such rights
   might or might not be available; neither does it represent that it
   has made any effort to identify any such rights. Information on the
   IETF's procedures with respect to rights in standards-track and
   standards-related documentation can be found in BCP-11. Copies of
   claims of rights made available for publication and any assurances of
   licenses to be made available, or the result of an attempt made to
   obtain a general license or permission for the use of such
   proprietary rights by implementors or users of this specification can
   be obtained from the IETF Secretariat.

   The IETF invites any interested party to bring to its attention any
   copyrights, patents or patent applications, or other proprietary
   rights which may cover technology that may be required to practice
   this standard. Please address the information to the IETF Executive
   Director.

Full Copyright Statement

   Copyright (C) The Internet Society (2003). All Rights Reserved.

   This document and translations of it may be copied and furnished to
   others, and derivative works that comment on or otherwise explain it
   or assist in its implementation may be prepared, copied, published
   and distributed, in whole or in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph are
   included on all such copies and derivative works. However, this
   document itself may not be modified in any way, such as by removing
   the copyright notice or references to the Internet Society or other
   Internet organizations, except as needed for the purpose of
   developing Internet standards in which case the procedures for
   copyrights defined in the Internet Standards process must be
   followed, or as required to translate it into languages other than
   English.

   The limited permissions granted above are perpetual and will not be
   revoked by the Internet Society or its successors or assignees.

   This document and the information contained herein is provided on an
   "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
   TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
   BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION

Galbraith, et al.       Expires January 22, 2004               [Page 14]

Internet-Draft     Secure Shell Public-Key Subsystem           July 2003

   HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Acknowledgement

   Funding for the RFC Editor function is currently provided by the
   Internet Society.

Galbraith, et al.       Expires January 22, 2004               [Page 15]

---

From: "Brent McClure" <[email-masked]>
Date: Fri, 25 Jul 2003 07:22:11 -0600

> layer would seem to be fairly standard, for starters.

What about this for a first pass on Security Considerations. 
Note, this text is inspired by and almost identical to similar 
statements in SFTP's security considerations:

  This protocol assumes that it is run over a secure channel and that
  the endpoints of the channel have been authenticated.  Thus, this
  protocol assumes that it is externally protected from network-level
  attacks.

  This protocol provides a mechanism that allows client authentication
  data to be uploaded and manipulated. It is the responsibility of the 
  server implementation to enforce any access controls that may be 
  required to limit the access allowed for any particular user (the 
  user being authenticated externally to this protocol, typically 
  using the SSH User Authentication Protocol [8].

I was wondering also if something needs to be said about users
applying/erasing "command" attributes in such a way that the publickey
subsystem might be used by a user to override some restrictions on
that user's account that an administrator thought were securely in place.
eg. Once authenticated with a key that always execs some restricted command
shell, the user then uploads a key that has no such restictions. I'm not 
really sure if this is how this "command" feature is used by admins
on servers that support it, but if it were the case then perhaps
some language about implementations needing to allow configuration
to disable access to this subsystem for such users. OTOH, maybe the 
second paragraph above covers that.

--Brent

---

From: "Brent McClure" <[email-masked]>
Date: Fri, 25 Jul 2003 07:34:39 -0600

>    Both sides MUST wait to receive this version before continuing.

I think we need to bump the version to 2.

I also just remembered something that I found awkward about the current protocol:

If there is a version mismatch then the channel gets slammed shut with no
opportunity to communicate what the problem was to the other side. It would
be nice to allow for shoving a status packet down the channel indicating
a version mismatch before sending the SSH_MSG_CHANNEL_CLOSE. This would
be a benefit both to clients trying to figure out why their channel won't
open or to admins reading through a server log.

--Brent

---

From: Joseph Galbraith <[email-masked]>
Date: Fri, 25 Jul 2003 08:08:37 -0600

> open or to admins reading through a server log.

This occurs if one of the sides has dropped support for
older versions, and the other side is still using an
older version.

In this case, the newer-versioned implementation has no
choice but to close the channel (it can't communicate with
the older version.)  The older version will just assume
that, as per the spec, the new version will downgrade to
talk to it.

So, if and only if, the newer-version is willing to
keep support for sending status packets for all older
versions, we could allow either side to send a
status packet at any time describing a general failure
of some sort, and followed immeadiately by a channel
close.

Perhaps we should create a new message that is only
sent during a general failure (i.e, when the failure is
not the failure of a given request.)

If we are going to add a message to handle this case, I
think I need to be able to tell the difference between
'the command you just sent failed' and 'there was a general
failure, not related to the command you just sent, which in
fact, I haven't yet recieved, but you don't know that.'

So, maybe:

	string "general-failure"
	uint32 reason-code [same as for status]
	string human-readable-variant
	string language

	Either side may send "general-failure" at
	any time during the session.

	"general-failure" MUST NOT be sent in
	response to a request, unless the request
	itself is malformed (a protocol conformance
	failure.)

	"general-failure" MUST always be followed
	immediately by the channel closing.

	"general-failure" is used to indicate failure
	on either side that is not related to request
	processing, but that requires communication
	to be aborted.

	One example of such failure is the case where
	one of the sides does not support the version
	of the other side.

	Another example is protocol failures, such as
	short packets, malformed packets, etc.  This
	message MUST NOT be sent in response to a well
	formed, but unrecognized request.  In this case,
	'well formed' means that the packet length
	was at least long enough to hold the request
	string itself.

	A server or client MAY also send this message
	in response to a termination signal.

	The purpose of this message is to give users
	and administrators more information with which
	to troubleshoot a failure.

Implementations of version 1 will not be able to recieve
this message, so this only helps if version 2 becomes
obsolete.

On a different note, we might want to restrict to
request names to us-ascii (probably the same subset
used by DNS.)  This would allow better detection of
protocol error vs. unrecognized request.

- Joseph