<?xml version="1.0" encoding="utf-8"?>
<?xml-model href="rfc7991bis.rnc"?>  <!-- Required for schema validation and schema-aware editing -->

<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>

<rfc
  xmlns:xi="http://www.w3.org/2001/XInclude"
  category="std"
  consensus="true"
  docName="draft-dahm-tacacs-sshpk-00"
  ipr="trust200902"
  obsoletes=""
  updates="RFC8907"
  submissionType="IETF"
  sortRefs="true"
  indexInclude="false"
  xml:lang="en"
  version="3">

  <front>
    <title abbrev="TACACS+ SSH Public Keys">SSH Public Key Distribution for Device Administration using Terminal Access Controller Access-Control System Plus (TACACS+)</title>

    <seriesInfo name="Internet-Draft" value="draft-dahm-tacacs-sshpk-00"/>

    <author fullname="Thorsten Dahm" initials="T." surname="Dahm">
      <organization/>
      <address>
        <email>thorsten.dahm@gmail.com</email>
      </address>
    </author>

    <author fullname="John Heasley" initials="J." surname="Heasley">
      <organization>NTT</organization>
      <address>
        <email>heas@shrubbery.net</email>
      </address>
    </author>

    <author fullname="Douglas C. Medway Gash" initials="D. C." surname="Medway Gash">
      <organization>Cisco Systems, Inc.</organization>
      <address>
        <postal>
          <street>170 West Tasman Dr.</street>
          <city>San Jose</city>
          <region>CA</region>
          <code>95134</code>
          <country>United States of America</country>
        </postal>
        <email>dcmgash@cisco.com</email>
      </address>
    </author>

    <author fullname="Andrej Ota" initials="A." surname="Ota">
      <address>
        <postal>
          <street></street>
          <city></city>
          <region></region>
          <code></code>
          <country></country>
        </postal>
        <email>andrej@ota.si</email>
      </address>
    </author>

    <date/>

    <area>Operations and Management (ops)</area>
    <workgroup>Operations and Management Area Working Group</workgroup>

    <keyword>TACACS+</keyword>
    <keyword>SSH</keyword>
    <keyword>Public Key</keyword>

    <abstract>
      <t>
        SSH <xref target="RFC4251"/> provides a robust and reliable mechanism to connect to
   network devices for administration.  Conventionally, the public keys
   required to authenticate SSH sessions are provisioned directly on the
   network devices.  This document adds an extension to Terminal
   Access Controller Access-Control System Plus (TACACS+) to eliminate the
   need for the direct provisioning of SSH public keys onto the Network
   Devices.
        </t>
    </abstract>
  </front>

  <middle>
    <section anchor="introduction">
      <name>Introduction</name>
      <t>
 SSH provides a robust and reliable mechanism to connect to Network
   Devices for administration.  The common approach to provisioning
   the public keys required to authenticate SSH sessions is to upload
   them via some administration interface onto the network devices
   which are acting as SSH server.  Once an SSH connection has been
   established, the Device Administration session is then often mediated
   (authorized and audited) through protocols such as Terminal Access
   Controller Access-Control System Plus (TACACS+) Protocol via one or
   more centralised servers.
      </t>
      <t>
        This document describes an enhancement of the secured version of the TACACS+ protocol <xref target="RFC9887"/> to facilitate the download of the
   applicable public keys from a central TACACS+ server so that the
   TACACS+ Client can use it to complete SSH authentication.  The intent
   is to shift the burden of distribution of SSH public keys from the
   network devices to the central TACACS+ server.  Note that this model
   does NOT extend the SSH authentication flow out from the SSH server
   (the TACACS+ Client), to the TACACS+ server:  The authentication
   remains completely in the SSH server (The TACACS+ Client).  It is
   important to keep this in mind, as the phase of the AAA protocol that
   is used to download the public keys is actually the TACACS+
   Authentication phase.
      </t>
      <t>
       Specifically, this document adds a new authentication action value
   into TACACS+ authentication flow which allows the
   TACACS+ server to send the relevant SSH public keys to the device.
      </t>

      <section anchor="requirements">
        <name>Requirements Language</name>
        <t>
        The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.
        </t>
      </section>
    </section>

    <section anchor="technical-definitions">
      <name>Technical Definitions</name>
      <t>
        The terms defined in Section 2 of <xref target="RFC9887"/> are fully applicable here and will not be repeated.
        The following terms are also used in this document.
      </t>

      <section anchor="sshst-plus">
        <name>SSHServer/TACACS+Client</name>
        <t>
        This is the device that is running the SSH server and is configured
   as a TACACS+ Client.
        </t>
      </section>
    </section>

    <section anchor="ssh-public-key-distribution">
      <name>SSH Public Key Distribution</name>
      <t>
        The following mechanism describes the process.
        This enhancement of TACACS+ Protocol is only applicable to the TLS TACACS+ protocol.
      </t>

      <section anchor="authentication-start-packet">
        <name>Authentication START Packet</name>
        <t>
        A new enumerated value is added for use within the action field of the Authentication START Packet:
        </t>
        <sourcecode><![CDATA[TAC_PLUS_AUTHEN_SEND_PUBLIC_KEYS := 0x05]]></sourcecode>
          <t>
        A new enumerated value is added for use within the authen_type field of the Authentication START Packet:
        </t>
        <sourcecode><![CDATA[TAC_PLUS_AUTHEN_TYPE_SSH := 0x07]]></sourcecode>
      </section>

      <section anchor="authentication-reply-packet">
        <name>Authentication REPLY Packet</name>
        <t>
        A New enumerated value is added for use within the status section of the Authentication REPLY Packet:
        </t>
        <sourcecode><![CDATA[TAC_PLUS_AUTHEN_STATUS_MORE := 0x22]]></sourcecode>
      </section>

      <section anchor="ssh-key-download-process">
        <name>SSH Key download process</name>
        <t>
        During the SSH_MSG_USERAUTH_REQUEST phase of SSH authentication, the SSH
   server retrieves the set of public keys related to the user. These keys
   are used to determine if the public keys sent by the client in turn can
   be used to perform the actual login. This section describes the TACACS+
   protocol process that the SSHServer/TACACS+Client uses to request the
   public keys associated with the user from the TACACS+ server.
        </t>
        <t>
        The SSHServer/TACACS+Client MUST send an Authentication Start packet to
   the TACACS+ server with the following fields:
        </t>
        <ul>
          <li><t><tt>user</tt> = <tt>The username for which public keys are requested.</tt></t></li>
          <li><t><tt>action</tt> = <tt>TAC_PLUS_AUTHEN_SEND_PUBLIC_KEYS</tt></t></li>
          <li><t><tt>authen_type</tt> = <tt>TAC_PLUS_AUTHEN_TYPE_SSH</tt></t></li>
          <li><t><tt>service</tt> = <tt>TAC_PLUS_AUTHEN_SVC_LOGIN</tt></t></li>
        </ul>
        <t>
        Upon receipt of the Authentication Start packet, the TACACS+ server
   extracts the username and determines the set of applicable public keys.
   The mechanism for key storage and retrieval is outside the scope of this document.
        </t>
        <t>
        If public keys are not available, the server responds with <tt>status=TAC_PLUS_AUTHEN_STATUS_FAIL</tt>.
        </t>
        <t>
        The TACACS+ server assembles the applicable public keys and encodes
   them into one or more data fields as defined in <xref target="encoding-ssh-public-key"/>.  The
   status of the response depends on whether the remaining keys can be fit into the data field of
            the reply packet that the server is preparing, or if additional packets will be
   required to transmit the remaining keys in their data fields.
        </t>
        <t>
        If additional keys remain after this packet, the server MUST respond with:
        </t>
        <ul>
          <li><t><tt>status</tt> = <tt>TAC_PLUS_AUTHEN_STATUS_MORE</tt></t></li>
          <li><t><tt>data</tt> = <tt>the next block of keys.</tt></t></li>
        </ul>
        <t>
        If this is the final block of keys and at least one key was
   identified, the server MUST respond with:
        </t>
         <ul>
          <li><t><tt>status</tt> = <tt>TAC_PLUS_AUTHEN_STATUS_PASS</tt></t></li>
          <li><t><tt>data</tt> = <tt>the final block of keys.</tt></t></li>
        </ul>
        <t>
        The SSHServer/TACACS+Client receives the Authentication Reply packet
   and extracts the public keys from the data field. It then compares
            the public key presented by the SSH client with the public keys returned by the TACACS+ server.
            If a matching key is found, the SSH server continues the SSH public-key authentication
            procedure and verifies proof of possession of the corresponding private key.
        </t>
        <t>
        If authentication is not successful and the status is
   TAC_PLUS_AUTHEN_STATUS_MORE, the SSHServer/TACACS+Client MAY send an
   Authentication CONTINUE packet with an empty data field to request
   the next block of keys.  This cycle continues until authentication
   succeeds or the server indicates no further keys are available.  When
   the TACACS+ server sends the final key(s), it MUST respond with
   status = TAC_PLUS_AUTHEN_STATUS_PASS.
        </t>
        <t>
  Following successful authentication, subsequent authorization and
   accounting procedures proceed as if the SSH key had been provisioned
   locally by an administrator.
        </t>
      </section>

      <section anchor="encoding-ssh-public-key">
        <name>Encoding of SSH Public Key in Authentication Reply Packet</name>
        <t>
          The Public Key is encoded in the data field of the Authentication Reply Packet as follows:
        </t>
          <t>
              Key Text: Two options of public keys are supported: the SSH public key format
   defined in <xref target="RFC4716"/> and the OpenSSH public key format.
          </t>
<t>
   Encoding Format: Each key string MUST be encoded as base-64 ASCII text.
   The total length of the base64-encoding plus one delimiter byte MUST be less than the maximum size of the TACACS+ data field (64K).
   If the encoding exceeds this limit, it MUST be treated as if the key were not present.</t>
        <t>
        Delimitation:  A delimiter is placed into the data field after each base-64 encoded key (even if there is only one present in a data field).
      The delimiter is decimal 1 byte if the key is in <xref target="RFC4716"/> format or  decimal 0 byte if Open SSH format is used. Base-64 encoding will never include these byte values.
        </t>
          <t>
             Segmentation: The total payload is subject to the 64K size limitation
   of the TACACS+ data field.  Keys MUST be encapsulated such that only
   complete key encoding strings (and separators) are
   contained within a single data field.  If a key encoding cannot be
   accommodated within the remaining space of the current data field,
   the implementation MUST assign a new packet and utilize its data
   field to continue the sequence.
          </t>
          <t>
         The resulting payload consists of one or more data fields, one per reply, each
   containing one or more ASCII Text keys delimited by byte (0 or 1).
          </t>
      </section>
    </section>

    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>
        Configuration for this feature on the SSHServer/TACACS+Client MUST include a
   setting for the maximum lifetime of stored public keys, which MUST default to 5 minutes.
      </t>
    </section>

    <section anchor="operational-considerations">
      <name>Operational Considerations</name>
      <t>Public SSH Keys downloaded using this mechanism MUST NOT be stored permanently.</t>
    </section>

    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>TBD</t>
    </section>
  </middle>

  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8907.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9887.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4716.xml"/>
      </references>
      <references>
        <name>Informative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4251.xml"/>
      </references>
    </references>

    <section anchor="appendix-1" numbered="true">
      <name>Appendix 1 [REPLACE/DELETE]</name>
      <t>This becomes an Appendix [REPLACE]</t>
    </section>

    <section anchor="acknowledgements" numbered="false">
      <name>Acknowledgements</name>
      <t>This template uses extracts from templates written by Pekka Savola, Elwyn Davies and Henrik Levkowetz. [REPLACE]</t>
    </section>

    <section anchor="contributors" numbered="false">
      <name>Contributors</name>
      <t>Thanks to all of the contributors. [REPLACE]</t>
    </section>
  </back>
</rfc>