<?xml version='1.0' encoding='utf-8'?>
<!-- -*- indent-with-tabs: 0 -*- -->
<?xml-model href="rfc7991bis.rnc"?>
<!-- <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?> -->
<!-- This third-party XSLT can be enabled for direct transformations in XML processors, including most browsers -->
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<rfc docName="draft-dahm-tacacs-security-00"
     category="std"
     ipr="trust200902"
     submissionType='IETF'
     consensus="true"
     updates="RFC8097" 
     xmlns:xi="http://www.w3.org/2001/XInclude" version="3"
     sortRefs="true"
     indexInclude="false"
     tocDepth="3">


   <front>
     <title abbrev="TACACS+ Security">
            TACACS+ Security, TLS, and SSH Public Keys
     </title>
     <author fullname="Thorsten Dahm" initials="T." surname="Dahm">
       <address>
         <postal>
           <street></street>
           <code></code>
           <city></city>
           <country></country>
         </postal>
         <email>thorsten.dahm@gmail.com</email>
       </address>
     </author>
        
     <author fullname="Douglas Gash" initials="D." surname="Gash">
       <organization>Cisco Systems, Inc.</organization>
       <address>
         <postal>
           <street></street>
           <code></code>
           <city></city>
           <country></country>
         </postal>
         <email>dcmgash@cisco.com</email>
       </address>
     </author>

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

     <author fullname="John Heasley" initials="J." surname="Heasley">
       <organization abbrev="NTT">NTT</organization>
       <address>
         <postal>
           <street></street>
           <code></code>
           <city></city>
           <country></country>
         </postal>
         <email>heas@shrubbery.net</email>
       </address>
     </author>

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

     <keyword>TACACS+</keyword>

     <abstract>
     <t>
       The <xref target="RFC8907">TACACS+ Protocol</xref> provides device administration for routers, network access servers and other networked computing devices via one or more centralized servers.
       This document, a companion to the <xref target="RFC8907">TACACS+ protocol</xref>, adds new packet formats to improve security and function, Transport Layer Security (currently defined by <xref target="RFC8446">TLS 1.3</xref>) support, and support for <xref target="RFC4716">SSH</xref> public keys and deprecates former inferior security mechanisms.
     </t>
     </abstract>
     <note title="Requirements Language">
       <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 <xref target="BCP14"/> when, and only when, they appear in all capitals, as shown here.
       </t>
     </note>
   </front>

   <middle>
     <section title="Introduction">
       <t>
         The <xref target="RFC8907">TACACS+ Protocol</xref> provides device administration for routers, network access servers and other networked computing devices via one or more centralized servers.
         The protocol provides authentication, authorization and accounting services for TACACS+ clients.
       </t>
       <t>
	 While the content of the protocol is highly sensitive, TACACS+ lacks modern and/or effective confidentiality, integrity, and authentication of the connection and network traffic between the server and client.
	 The existing mechanisms of TACACS+ are extremely weak and the Security Considerations section of the <xref target="RFC8907">TACACS+ Protocol</xref> adequately describes this.
       </t>
       <t>
	 To address these deficiencies, this document updates the <xref target="RFC8907">TACACS+ Protocol</xref> to use <xref target="RFC8446">TLS 1.3</xref> authentication and encryption, and deprecates the use of its former mechanisms.
       </t>
       <t>
	 To support SSH authentication using public keys, highly desired by the operator community, this document introduces a method to support sending public keys to a TACACS+ client, allowing centralized management.
       </t>
       <t>
	 To accomplish these goals and improve security and functionality when a network proxy is involved in a TACACS+ connection, new and uniform packet formats are introduced.
       </t>
     </section>

     <section title="Technical Definitions">
       <t>
         The Technical Definitions section of the <xref target="RFC8907">TACACS+ Protocol</xref> is fully applicable here and will not be repeated, though may be augmented.
         The following terms are also used in this document.
       </t>
       <section title="AVP">
         <t>
           An Attribute-Value Pair or AVP is another name a TACACS+ argument as defined in <xref target="RFC8907"/> Sections 6.1 and 8.
         </t>
       </section>
       <section title="Empty Value">
         <t>
           An empty or zero-length value of an AVP as defined in <xref target="RFC8907"/> Sections 8.1.
         </t>
       </section>
       <section title="Unsecure Connection">
         <t>
           This is another term for a Connection as defined in <xref target="RFC8907">TACACS+ Protocol</xref>.
           It is a Connection without TLS and therefore being plaintext or possibly using unsecure TACACS+ authentication and obfuscation.
         </t>
       </section>
       <section title="Peer">
         <t>
           This refers to a TACACS+ Server or Client.
         </t>
       </section>
       <section title="TLS Connection">
         <t>
           A TLS Connection is a TCP/IP connection with TLS authentication and encryption used by TACACS+ for transport, similar to a Connection as defined in <xref target="RFC8907">TACACS+ Protocol</xref>.
         </t>
       </section>
     </section>

     <section title="TLS for TACACS+">
       <t>
         TACACS+ connections are TCP/IP connections initiated by the Client to the Server.
         The well-known TCP/IP port 49 on the Server is used for unencrypted and encrypted connections as defined in the <xref target="RFC8907">TACACS+ Protocol</xref>.
         A connection may be used for only a single Session or the multiplexing of multiple Sessions in TACACS+ Single Connection Mode.
       </t>
       <t>TLS is introduced into TACACS+ to fulfill the following requirements:
       </t>
       <ol>
       <li>Confidentiality and Integrity: The MD5 obfuscation specified in the original protocol definition is not fit for purpose, requiring that TACACS+ be 
       deployed over a secured network. Securing TACACS+ protocol with TLS is intended to provide confidentiality and integrity without requiring the provision of a secured network.</li>
       <li>Peer authentication: The use of shared keys to add and remove the MD5 obfuscation was intended to provide a form of Peer authentication for the TACACS+ protocol. This document deprecates the MD5 obfuscation,
       and specifies that the authentication capabilities of TLS are used to allow the Peers to authenticate each other.</li>
       </ol>
       <section title="Well-Known TCP/IP Port" anchor="TLSPport">
         <t>
           All data exchanged by TACACS+ Peers MUST be encrypted, including the authentication of the Peers.
           Therefore, TLS Hello MUST be initiated by the client immediately upon the establishment of the TCP/IP connection.
         </t>
         <t>
           This document favors the predictable use of TLS security for a deployment, see (<xref target="wellknown"/>). 
           TACACS+ TLS will therefore follow <xref target="RFC7605"/>, where a different well-known system TCP/IP port is assigned by IANA, port <xref target="ICTBD">[TBD]</xref> with the service name <xref target="ICTBD">[TBDN]</xref>, for TLS connections.
         </t>
       </section>
       <section title="TLS Connection" anchor="TLSConn">
         <t>
           A TACACS+ Client initiates a TLS connection by making a TCP connection to a configured Server on the tacacss well-known port (<xref target="TLSPport"/>).
           Once the TCP connection is established, the Client MUST immediately begin the TLS negotiation before sending any TACACS+ protocol data.
         </t>
         <t>
	   Implementations MUST support <xref target="RFC8446">TLS 1.3</xref> and MAY permit TLS 1.3 session resumption.
	   If resumption is supported, the resumption ticket_lifetime SHOULD be configurable, including a zero seconds lifetime.
         </t>
         <t>
	   Once the TLS connection is established, the exchange of TACACS+ data proceeds as normal, except that it is transmitted over TLS as TLS application data and without TACACS+ obfuscation (see <xref target="DeprecationofTACACSEncryption"/>)
         </t>
         <t>
	   The connection persists until the Server or Client closes it.
	   It might be closed due to an error or at the conclusion of the TACACS+ Session.
	   If Single Connection Mode has been negotiated, it might remain open after a successful Session, until an error or a timeout occurs.
	   Why it closed has no bearing on TLS resumption, unless closed by a TLS error, in which case the ticket might be invalidated.
         </t>
       <section title="Cipher Requirements">
         <t>
	   Implementations MUST support the TLS 1.3 mandatory cipher suites (See RFC8446 Section 9.1).
	   The cipher suites offered or accepted SHOULD be configurable so that operators can adapt.
         </t>
         <t>
	   This document makes no cipher suite recommendations, but recommendations can be found in the TLS Cipher Suites section of the <xref target="TLSCSREC"/>.
         </t>
       </section>
       <section title="TLS Authentication">
         <t>
	  Implementations MUST support certificate-based TLS authentication and certificate revocation bi-directionally for authentication, identity verification and policy purposes.
          Certificate path verification as described in <xref target="CertPV"/> MUST be supported.
         </t>
         <t>
           If this succeeds, the authentication is successful and the connection is permitted.
           Policy MAY impose further constraints upon the Peer, allowing or denying the connection based on certificate fields or any other parameters exposed by the implementation.
         </t>
         <t>
	   Unless disabled by configuration, a Peer MUST disconnect a Peer that offers an invalid TLS Certificate.
         </t>
         <section title="TLS Certificate Path Verification" anchor="CertPV">
         <t>
           Implementations MUST support certificate Path verification as described in <xref target="RFC5280"/>.
         </t>
         </section>
       </section>
       </section>
       <section title="TLS Identification">
         <t>
           In addition to authentication of TLS certificates, implementations MUST support policy consideration of Peer-identifying certificate fields and policy used to verify that the Peer is a valid source for the received certificate and that it is permitted access to TACACS+.
           Implementations MUST support either:
	 </t>
	 <t>Network location based validation methods as described in <xref target="RFC5425" section="5.2." sectionFormat="comma"/>
	 </t>
         <t>or</t>
         <t>
 	   Device Identity based validation methods where the peer’s identity is used in the certificate subjectName. This is applicable in deployments where the device securely supports an identity which is shared with its peer.
           This approach allows a peer's network location to be reconfigured without issuing a new client certificate.
           Only the local server mapping needs to be updated.
         </t>
       </section>
     </section>

     <section title="TACACS+ Extended Authentication Packet Types" anchor="ExtendedAuthenticationPacketType">
       <t>
                Versions 1 and 2 of the TACACS+ Protocol, as defined in <xref target="RFC8907"/>, specify the TACACS+ Authentication Packets for START, REPLY and CONTINUE which support the credential validation use case but does not accommodate any further arguments
which may be used to give context to the request.
       </t>
       <t>
         One use-case where this shortcoming inhibits correct operation is for the TACACS+ proxy.
         Because the originating client is not encoded in the regular Authentication START Packet, TACACS+ Servers generally attempt to determine the client from the TCP connection.
         This is effective only for the first step: proxied TACACS+ servers can no longer securely enforce policy based upon the end client IP-Address.
       </t>
       <t>
         Further, advanced use cases (such as SSH key distribution) would otherwise rely on embedding structured information into the single data fields, obfuscating the content of the protocol.
       </t>
       <t>
         To support these use cases, and allow clients to add environment information to the request, the Extended Authentication Packets brings the Authentication phase of the protocol inline with the Authorization and Accounting Phase by incorporating extensible argument
s.
       </t>
       <t>
         The server should expect Extended Authentication Packet Bodies if the minor version in the Packet Header is: 0x2
       </t>

       <section anchor="ExtendedAuthenticationSTARTPacketBody" title="The Extended Authentication START Packet Body">
         <figure>
           <artwork><![CDATA[
 1 2 3 4 5 6 7 8  1 2 3 4 5 6 7 8  1 2 3 4 5 6 7 8  1 2 3 4 5 6 7 8
+----------------+----------------+----------------+----------------+
|    action      |    priv_lvl    |  authen_type   | authen_service |
+----------------+----------------+----------------+----------------+
|    user_len    |    port_len    |  rem_addr_len  |    data_len    |
+----------------+----------------+----------------+----------------+
|    arg_cnt                                                        |
+----------------+----------------+----------------+----------------+
|    arg_1_len                                                      |
+----------------+----------------+----------------+----------------+
|      ...                                                          |
+----------------+----------------+----------------+----------------+
|    arg_N_len                                                      |
+----------------+----------------+----------------+----------------+
|    user ...
+----------------+----------------+----------------+----------------+
|    port ...
+----------------+----------------+----------------+----------------+
|    rem_addr ...
+----------------+----------------+----------------+----------------+
|    data...
+----------------+----------------+----------------+----------------+
|    arg_1 ...
+----------------+----------------+----------------+----------------+
|    arg_2 ...
+----------------+----------------+----------------+----------------+
|    ...
+----------------+----------------+----------------+----------------+
|    arg_N ...
+----------------+----------------+----------------+----------------+
]]></artwork>
         </figure>
         <t>
           The action, priv_level, authen_type, authen_service, user_len, port_len, rem_addr_len, data_len, user, port, rem_addr and data fields are used exactly as defined in the Authentication START Packet Body in <xref target="RFC8907"/>.
         </t>
         <t>The following fields contain the arguments that may be used to extend the authentication process. These are common to the Extended Authentication START, Extended Authentication REPLY, and Extended Authentication CONTINUE packet bodies; these fields represent the sole update from the previous START, REPLY and CONTINUE packet bodies.</t>
         <t>The new fields are as follows:</t>
         <t>arg_cnt</t>
         <t>This represents the number of arguments in the packet.</t>

         <t>arg_1_len ... arg_N_len, arg_1 ... arg_N</t>

         <t>
           Each argument is encoded in the packet as a single arg field (arg_1 ... arg_N) with a corresponding length field that indicates the length of each argument in bytes.
         </t>
         <t>
           The arguments are argument-value pairs.
           The argument and the value are in a single string and are separated by either a "=" (0X3D) or a "*" (0X2A).
           The equals sign indicates a mandatory argument. The asterisk indicates an optional one.
           For the rules regarding optional and mandatory arguments, refer to <xref target="RFC8907"/>
         </t>
         <t>
           Multiple arguments with the same name are permitted within a packet, a common example is cmd-arg.
           The handling of repeated arguments is specific to the semantics of the argument and so are documented with that argument.
           Order is significant when processing arguments.
         </t>
	       
         <t>
           The addition of arguments to the authentication packets is intended to permit the flexibility for the TACACS+ authentication phase that has been available previously for authorization and accounting.
           These fields are intended to be used as needed in deployment, they are used in this document in the enhancements for <xref target="SSH">SSH</xref>, and to support the origin client to enhance TACACS+ Proxy:
         </t>

         <t>origin_client</t>
         <t>
           The IP-Address of the originating TACACS+ client.
           This is text encoded in line with the rest of the TACACS+ protocol, and may be IPv4 or IPv6.
           This argument is optional.
           IPv4 addresses are specified as octet numeric values separated by dots ('.').
           IPv6 address text representation is defined in <xref target="RFC5952"/>.
         </t>
       </section>

       <section anchor="ExtensionAuthenticationREPLYPacketBody" title="The Extension Authentication REPLY Packet Body">
         <t>
           The TACACS+ server sends only one type of extended authentication packet to the client.
         </t>
         <figure>
           <artwork><![CDATA[
 1 2 3 4 5 6 7 8  1 2 3 4 5 6 7 8  1 2 3 4 5 6 7 8  1 2 3 4 5 6 7 8
+----------------+----------------+----------------+----------------+
|     status     |      flags     |        server_msg_len           |
+----------------+----------------+----------------+----------------+
|           data_len              |
+----------------+----------------+----------------+----------------+
|    arg_cnt                                                        |
+----------------+----------------+----------------+----------------+
|    arg_1_len                                                      |
+----------------+----------------+----------------+----------------+
|      ...                                                          |
+----------------+----------------+----------------+----------------+
|    arg_N_len                                                      |
+----------------+----------------+----------------+----------------+
|    data ...
+----------------+----------------+----------------+----------------+
|    server_msg ...
+----------------+----------------+----------------+----------------+
|    arg_1 ...
+----------------+----------------+----------------+----------------+
|    arg_2 ...
+----------------+----------------+----------------+----------------+
|    ...
+----------------+----------------+----------------+----------------+
|    arg_N ...
+----------------+----------------+----------------+----------------+
]]></artwork>
         </figure>
         <t>
           The status, flags, server_msg_len, data_len, server_msg, and data fields are used exactly as defined in the Authentication REPLY Packet Body in <xref target="RFC8907"/>].
         </t>
         <t>
           The new arg_cnt, arg_1 ... arg_N, and arg_1_len .... arg_N_len fields are used as defined in <xref target="ExtendedAuthenticationSTARTPacketBody">The Extended Authentication START Packet Body</xref>.
         </t>
       </section>

       <section anchor="ExtendedAuthenticationCONTINUEPacketBody" title="The Extended Authentication CONTINUE Packet Body">
         <t>
           This packet is sent from the client to the server following the receipt of an Extended REPLY packet.
         </t>
         <figure>
           <artwork><![CDATA[
 1 2 3 4 5 6 7 8  1 2 3 4 5 6 7 8  1 2 3 4 5 6 7 8  1 2 3 4 5 6 7 8
+----------------+----------------+----------------+----------------+
|             status              |           user_msg len          |
+----------------+----------------+----------------+----------------+
|            data_len             |
+----------------+----------------+----------------+----------------+
|    arg_cnt                                                        |
+----------------+----------------+----------------+----------------+
|    arg_1_len                                                      |
+----------------+----------------+----------------+----------------+
|      ...                                                          |
+----------------+----------------+----------------+----------------+
|    arg_N_len                                                      |
+----------------+----------------+----------------+----------------+
|  user_msg ...
+----------------+----------------+----------------+----------------+
|    data ...
+----------------+----------------+----------------+----------------+
|    arg_1 ...
+----------------+----------------+----------------+----------------+
|    arg_2 ...
+----------------+----------------+----------------+----------------+
|    ...
+----------------+----------------+----------------+----------------+
|    arg_N ...
+----------------+----------------+----------------+----------------+
]]></artwork>
         </figure>
         <t>
           The user_msg len, data_len, user_msg, and data fields are used exactly as defined in the Authentication REPLY Packet Body in <xref target="RFC8907"/>.
	   However, the status field replaces the flags field and has the following enumeration:
         </t>
	 <ul>	 
	  <li>TAC_PLUS_AUTHEN_CONTINUE_STATUS_NONE := 00 </li> 
	  <li>TAC_PLUS_AUTHEN_CONTINUE_STATUS_PASS := 01 </li> 
          <li>TAC_PLUS_AUTHEN_CONTINUE_STATUS_FAIL := 02 </li>
	  <li>TAC_PLUS_AUTHEN_CONTINUE_STATUS_FRAGMENT := 03 </li>
          <li>TAC_PLUS_AUTHEN_CONTINUE_STATUS_ERROR := 04 </li>
          <li>TAC_PLUS_AUTHEN_CONTINUE_STATUS_ABORT := 05 </li>
	  </ul> 
	 <t>
            TAC_PLUS_AUTHEN_CONTINUE_STATUS_NONE or TAC_PLUS_AUTHEN_CONTINUE_STATUS_ABORT MUST be used when the Extended Authentication Packets are used for the continuation of authentication flows documented in <xref target="RFC8907"/>.
	 </t>
	 <t>
	   The client may prematurely terminate a session by setting the TAC_PLUS_AUTHEN_CONTINUE_STATUS_ABORT or TAC_PLUS_AUTHEN_CONTINUE_STATUS_ERROR status in the CONTINUE message.
	   The remainder are detailed in <xref target="SSH">SSH</xref>.
	 </t>
	 <t>
           The new arg_cnt, arg_1 ... arg_N, and arg_1_len .... arg_N_len fields are used as defined in <xref target="ExtendedAuthenticationSTARTPacketBody">The Extended Authentication START Packet Body</xref>.
         </t>
       </section>
     </section>

     <section anchor="SSH" title="SSH">
       <t>
         Most network equipment now support <xref target="RFC4251">SSH</xref> for Command Line Interface (CLI) and <xref target="RFC6242">NETCONF</xref>.
         Operators SHOULD use SSH public keys for authentication.
         Some devices support public keys in native configuration, but there is desire to centrally manage keys and SSH subsystem authorization.
       </t>

       <section title="New Enumerated TACACS+ Protocol Values and well-known AVPs">
         <t>
           The following new enumerated TACACS+ protocol values and well-known AVPs are needed to support SSH in the subsequent sections.
           These new values augment those in <xref target="RFC8907"/> Sections 5.1 - 5.3, 6.1, and 8.2 as follows:
         </t>
	 <dl newline="true">
	   <dt>TAC_PLUS_AUTHEN_TYPE_SSHPK := 0x07</dt>
           <dd>Extended Authentication START Packet authen_type for SSH pubkeys.</dd>

	   <dt>TAC_PLUS_AUTHEN_STATUS_GETSSHPKTYPE := 0x22</dt>
           <dd>Extended Authentication REPLY Packet status to solicit SSH pubkey type.</dd>
	   <dt>TAC_PLUS_AUTHEN_STATUS_SSHPK := 0x23</dt>
           <dd>Extended Authentication REPLY Packet status to provide SSH pubkeys.</dd>

	   <dt>TAC_PLUS_REPLY_FLAG_FRAGMENT := 0x02</dt>
           <dd>Extended Authentication REPLY Packet flag indicating the REPLY is incomplete.</dd>
	   <dt>TAC_PLUS_AUTHEN_CONTINUE_STATUS_PASS := 0x01</dt>
           <dd>Extended Authentication CONTINUE Packet flag indicating authentication success.</dd>
	   <dt>TAC_PLUS_AUTHEN_CONTINUE_STATUS_FAIL := 0x08</dt>
           <dd>Extended Authentication CONTINUE Packet flag indicating authentication failure.</dd>
	   <dt>TAC_PLUS_AUTHEN_CONTINUE_STATUS_FRAGMENT := 0x03</dt>
           <dd>Extended Authentication CONTINUE Packet flag requesting the next REPLY packet of an incomplete REPLY.</dd>
	   <dt>TAC_PLUS_AUTHEN_CONTINUE_STATUS_ERROR := 0x04</dt>
           <dd>Extended Authentication CONTINUE Packet flag indicating authentication error.</dd>

	   <dt>AVP ssh_pubkey_type (String)</dt>
           <dd>Attribute to carry SSH public key type names.</dd>

	   <dt>AVP ssh_pubkey (String)</dt>
           <dd>Attribute to carry SSH public keys.</dd>

           <dt>TAC_PLUS_AUTHEN_METH_SSHPK := 0x21</dt>
           <dd>Authorization REQUEST Packet authen_method for SSH pubkey authentication.</dd>

           <dt>AVP ssh_subsystem (String)</dt>
           <dd>Attribute to carry SSH subsystem name for authorization</dd>
         </dl>
       </section>

       <section title="SSH Public Key Support">
         <t>
	   To support central management of SSH public keys via TACACS+, the Authentication sequence of <xref target="RFC8907"/> Section 5.4 is extended using <xref target="ExtendedAuthenticationPacketType">Extended Authentication Packet</xref> sequences to deliver SSH public keys to devices for local verification.
	 </t>
         <t>
           Besides new header values and flags and AVPs for Extended Authentication Packets, the SSH public key authentication process differs from other TACACS+ authentication types in that there may be more Authentication Reply and Authentication Continue Packets pairs than previously.
         </t>
         <t>The process follows:</t>
         <ol>
         <li>
           The client begins an authentication session with an Extended Authentication START Packet.
           The START packet MUST include a non-zero-length username and the server MUST send an Authentication REPLY Packet with status TAC_PLUS_AUTHEN_STATUS_ERROR, if the client fails to do so.
           <br/><br/>
           The client MAY include one or more instances of the ssh_pubkey_type AVP, indicating the SSH public key types that it wants.
           The set of permissible values for this AVP are the SSH public algorithm names defined in the <xref target="SSHALGS">IANA SSH Protocol Parameters Registry</xref>, which are case-sensitive as specified and otherwise constrained by <xref target="RFC4250"/> Section 4.6.1.
	   Multiple values MUST be separated by a comma, therefore multiple ssh_pubkey_type AVPs MUST include commas for separation when the Peer concatenates them and the Peer MUST be prepared to ignore a leading or trailing comma in the concatenated value.
           The server MUST NOT reply with status TAC_PLUS_AUTHEN_STATUS_ERROR if it receives an algorithm name that it does not recognize.
           If the client marks a ssh_pubkey_type AVP as mandatory, the server MUST reply with at least one key of that type for the given user or reply with status TAC_PLUS_AUTHEN_STATUS_SSHNOPK with the relevant ssh_pubkey_type AVP.
           <br/><br/>
           The client MAY send an Empty Value for the algorithm name to request all types available for the given user.
           <br/><br/>
           The process ends and the client MUST start a new authentication session if it receives status SSHNOPK or ERROR.
         </li>

         <li>
           If a ssh_pubkey_type AVP was not provided in the START packet, the server replies with the status code TAC_PLUS_AUTHEN_STATUS_GETSSHPKTYPE.
           The client MUST send a CONTINUE packet with one or more ssh_pubkey_type AVPs, else the server sends a REPLY packet with status TAC_PLUS_AUTHEN_STATUS_ERROR.
         </li>

         <li>
           If the server has none of the requested ssh_pubkey_type(s) or any of the mandatory ssh_pubkey_types for the user or no pubkeys at all, the server MUST send a REPLY packet with status TAC_PLUS_AUTHEN_STATUS_SSHNOPK with the ssh_pubkey_type AVP(s) that it received.
           <br/><br/>
           The process ends and the client MUST start a new authentication session if it receives status SSHNOPK or ERROR.
         </li>

         <li>
           The server sends REPLY packets with status TAC_PLUS_AUTHEN_STATUS_SSHPK and includes one or more ssh_pubkey optional AVPs, each containing one or more keys.
           The ssh_pubkey AVPs are formatted according to the rules of <xref target="RFC4716">SSH Public Key File Format</xref>.
           As such, the client MUST be prepared to accept keys with Key File Markers.
	   To address concatenation of multiple ssh_pubkey AVPs or multiple keys in a single AVP, the server MUST terminate each key file End Marker with a Line Termination sequence as specified in RFC4716 Section 3.1.
           <br/><br/>
           Since it is possible to have more ssh_pubkey AVPs than fit in a REPLY packet, the server SHOULD set the REPLY packet flag TAC_PLUS_REPLY_FLAG_FRAGMENT if two or more packets are required, indicating that the client SHOULD request the remainder.
           <br/><br/>
           An AVP SHALL NOT span multiple fragments; each must be contained entirely in the fragment in which it begins.
         </li>

         <li>
           If the TAC_PLUS_REPLY_FLAG_FRAGMENT flag is set, the client MAY reply with the same CONTINUE packet as before with the TAC_PLUS_AUTHEN_CONTINUE_STATUS_FRAGMENT flag set.
           The server replies with the next REPLY fragment as before, clearing the TAC_PLUS_REPLY_FLAG_FRAGMENT flag of the last REPLY fragment.
           This repeats until the last REPLY fragment is received, the client aborts the authentication process, or an error occurs.
           The client MUST NOT set TAC_PLUS_AUTHEN_CONTINUE_STATUS_FRAGMENT if the REPLY packet did not have the TAC_PLUS_REPLY_FLAG_FRAGMENT flag set and the server MUST reply with TAC_PLUS_AUTHEN_STATUS_ERROR if it does so.
         </li>

         <li>
           Once the client has all of the pubkeys, it performs the ssh pubkey authentication with its ssh client.
           The client MUST then reply to the server with the status of that authentication by sending a CONTINUE packet with one of the following new or existing CONTINUE flags: TAC_PLUS_CONTINUE_FLAG_ABORT, TAC_PLUS_AUTHEN_CONTINUE_STATUS_PASS, TAC_PLUS_AUTHEN_CONTINUE_STATUS_FAIL, or TAC_PLUS_AUTHEN_CONTINUE_STATUS_ERROR.
         </li>

         <li>
           The client MUST give the server the final consent, by waiting for a REPLY packet with one of the status: TAC_PLUS_AUTHEN_STATUS_PASS, TAC_PLUS_AUTHEN_STATUS_FAIL, or TAC_PLUS_AUTHEN_STATUS_ERROR, thus ending the authentication session.
         </li>
         </ol>
       </section>

       <section title="SSH Authorization and Accounting">
         <t>
           To support central management of SSH and SSH subsystem authorization and accounting via TACACS+, this document adds a new authen_method to <xref target="RFC8907">RFC8907 Section 6.1 Authorization REQUEST</xref> and a well-known AVP to <xref target="RFC8907">Section 8.2 Authorization Arguments</xref>.
         </t>
         <t>
           The new authen_method TAC_PLUS_AUTHEN_METH_SSHPUBKEY indicates that the user was authenticated with a SSH public key.
         </t>
         <t>
           The well-known ssh_subsystem AVP defines the SSH subsystem for which the authorization is requested and MUST be present any time the authorization is for a SSH connection.
         </t>
         <t>
           The set of permissible values for this AVP are the SSH Subsystem Names defined in the <xref target="SSHSUBSYS">IANA SSH Connection Protocol Subsystem Names Registry</xref>, which are case-sensitive as specified and otherwise constrained by <xref target="RFC4250"/> Section 4.6.1.
           The client MAY send an Empty Value for the subsystem name to indicate no subsystem, also known as a shell or CLI.
           The server MUST NOT reply with status TAC_PLUS_AUTHOR_STATUS_ERROR if it receives a subsystem name whose syntax is valid but whose value is not recognized.
           Subsystems might need additional data for authorization or accounting that will be particular to that subsystem and are therefore out of scope for this document.
         </t>
         <t>
           These new authen_methods and AVPs apply equally to accounting.
         </t>
       </section>
     </section>

     <section title="Deprecation of TACACS+ Encryption" anchor="DeprecationofTACACSEncryption">
       <t>
         The original draft of TACACS+ described an encryption mechanism built into the protocol.
         This is insufficient for modern purposes and the document <xref target="RFC8907">TACACS+ Protocol</xref> reclassified the mechanism as one capable only of obfuscation.
       </t>
       <t>   
         The introduction of TLS PSK and certificate Peer authentication and TLS encryption to TACACS+ obsolesces these former mechanisms and so are hereby deprecated.
         This section describes how the TACACS+ client and servers MUST operate with regards to the obfuscation mechanism.
       </t>
       <t>
         The TACACS+ server or client receiving TACACS+ Packets MUST process the packet as if TAC_PLUS_UNENCRYPTED_FLAG was set.
         The actual value of TAC_PLUS_UNENCRYPTED_FLAG flag in the TACACS+ header MUST be ignored.
       </t>
       <t>
         Peers SHOULD set the TAC_PLUS_UNENCRYPTED_FLAG flag in the Packet Header of packets on TLS Connections, indicating that the data obfuscation is not used.
       </t>
     </section>

     <section title="Protocol Deprecations" anchor="ProtocolDeprecation">
       <t>
           This section deprecates features from the TACACS+ Protocol.
       </t>
       <t>
           MS-CHAPv1: has been replaced by MS-CHAPv2 in most deployments, the intent of this deprecation is to complete the transition. MD4 is still required to 
	   support MS-CHAPv2 so cannot be deprecated at this point It should be noted that the use of MD4 is purely to allow compatible MS-CHAPv2 operation and
	   not for security; the TLS transport is intended to provide that function.
       </t>
       <t>
           TAC_PLUS_AUTHEN_SENDAUTH: the sendauth mechanism can not be supported, as it permits the leak of sensitive information.
       </t>
     </section>

     <section title="Security Considerations">
       <section title="TLS">
         <t>
           This document improves the confidentiality, integrity, and authentication of the connection and network traffic between TACACS+ Peers by adding TLS support.
           This does not in itself protect the server nor clients; the operator and equipment vendors have a role.
           That role is to diligently follow current best practices for maintaining the integrity of network devices and selection of TLS key and encryption algorithms.
         </t>
         <section title="TLS Use">
           <t>
             TLS encryption SHOULD be used in deployments when both the Clients and Servers support it.
             Servers that support TLS encryption MAY be configured to allow Unsecure Connections when TLS encryption is not supported by the Client, but this is NOT RECOMMENDED because of the threat of downgrade attacks, as described in <xref target="wellknown"/>.
             Unsecure Connections would be better served by separate Servers from the TLS Servers.
           </t>
           <t>
             It is NOT RECOMMENDED to deploy TACACS+ without TLS authentication and encryption, including TLS using the NULL algorithm, except for within test and debug environments.
             Also see <xref target="RFC3365"/>.
           </t>
         </section>
         <section title="TLS 0-RTT">
           <t>
	     TLS 1.3 resumption and PSK techniques make it possible to send Early Data, aka. 0-RTT data, data that is sent before the TLS handshake completes.
	     Replay of this data is possible.
	     Given the sensitivity of TACACS+ data, a Client MUST NOT send data until the full TLS handshake completes; that is, Clients MUST NOT send 0-RTT data and Servers MAY abruptly disconnect Clients that do.
           </t>
         </section>
         <section title="TLS PSK">
           <t>
	     Implementations MAY support TLS authentication with Pre-Shared Keys (PSKs), also known as external PSKs in TLS 1.3, which are not resumption PSKs.
	     PSKs SHOULD NOT be shared among Clients or Servers to limit exposure of a compromised key and to ease key rotation.
	     Also see <xref target="RFC8773"/> and <xref target="I-D.ietf-tls-external-psk-guidance"/>.
           </t>
           <t>
	     PSKs are otherwise considered out-of-scope for this document.
           </t>
         </section>
         <section title="TLS Options">
           <t>
	     Unfortunately, no single and timely TLS recommendations document exists.
	     Therefore, implementers and operators SHOULD make use of the various RFCs to determine which TLS versions and algorithms should be supported, deprecated, or abandoned, in the absence of updates to this document.
	     Useful examples are the TLS specifications themselves (<xref target="RFC8446">TLS 1.3</xref>), which prescribes mandatory support in Section 9, and TLS Recommendations <xref target="RFC7525"/>.
           </t>
         </section>
         <section title="Unreachable TLS CA" anchor="CAcache">
           <t>
	     Operators SHOULD be cognizant of the potential of Server and/or Client isolation from their Peer's Certificate Authority (CA) by network failures.
	     Isolation from a public key certificate's CA will cause the verification of the certificate to fail and thus TLS authentication of the Peer to fail.
	     Certificate caching and <xref target="RFC7250">Raw Public Keys</xref> are methods to address this, but both are out of scope for this document.
             Certificate fingerprints are another option.
           </t>
         </section>
       </section>

       <section title="Well-Known TCP/IP Port" anchor="wellknown">
         <t>
           A new port is considered appropriate and superior to a "STARTTLS" command or other negotiation method because it allows:
         </t>
         <ul>
           <li>ease of blocking the unencrypted or inferiorly encrypted connections by the TCP/IP port number,</li>
           <li>passive Intrusion Detection Systems (IDSs) monitoring the unencrypted version to be unaffected by the introduction of TLS,</li>
           <li>avoidance of Man in the Middle (MitM) attacks that can interfere with STARTTLS,</li>
           <li>and helps prevent the accidental exposure of sensitive information due to misconfiguration.</li>
         </ul>
         <t>
           However, co-existence of inferior authentication and encryption, whether an Unsecure Connection or deprecated parts that compose TLS, also presents opportunity for down-grade attacks.
           Causing failure of connections to the TLS-enabled service or the negotiation of shared algorithm support are two such down-grade attacks.
           The simplest way to address the exposure from Unsecure Connection methods is to refuse Unsecure Connections at the server entirely, perhaps using separate servers for Unsecure Connections and TLS.
           Another approach is mutual configuration that requires TLS.
           Clients and Servers SHOULD support configuration that requires Peers, globally and individually, use TLS.
           Furthermore, Peers SHOULD be configurable to limit offered or recognized TLS versions and algorithms to those recommended by standards bodies and implementers.
         </t>
         <t>
           Servers and Clients could also maintain a cache of Peers that have engaged in TACACS+ TLS connections and demand TLS from that point forward.
           However, this has potential to be a Denial of Service (DoS) vector, whereby an attacker causes a server to believe that a client that does not support TLS has successfully connected with TLS.
         </t>
       </section>
       <section title="SSH Public Key Caching" anchor="pubkeycache">
         <t>
	   A Client MUST NOT cache SSH public keys received from a Server for future SSH client authentication.
	   Doing so would deny the Server the opportunity to deny authentication for other reasons than key validity or to revoke a key.
	   The Server has no method to revoke a key, except by not offering the key in future authentication sessions.
         </t>
       </section>
     </section>

     <section title="IANA Considerations" anchor="ICTBD">
       <t>
         The authors request that, when this draft is accepted by the working group, the OPSAWG Chairs submit a request to IANA for an early allocation, per <xref target="RFC4020"/> and <xref target="RFC6335"/>, of a new well-known system TCP/IP port number for the service name "tacacss", described as "TACACS+ over TLS".
         The service name "tacacss" follows the common practice of appending an "s" to the name given of the non-TLS well-known port.
         This allocation is justified in <xref target="wellknown"/>.
       </t>
       <t>
         RFC EDITOR: this port number should replace "[TBD]" and the service name should replace "[TBDN]" within this document.
       </t>
     </section>

     <section title="Acknowledgments">
       <t>
         The author(s) would like to thank Russ Housley, Steven M. Bellovin, Stephen Farrell, Alan DeKok, Warren Kumari, and Tom Petch for their support, insightful review, and/or comments.
         <xref target="RFC5425"/> was also used as a basis for the approach to TLS.
       </t>
     </section>

   </middle>

   <back>
     <references title="Normative References">
       <referencegroup anchor="BCP14" target="https://www.rfc-editor.org/bcp/bcp14.txt">
         <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
         <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
       </referencegroup>
       <?rfc include="reference.RFC.4250.xml"?>
       <?rfc include="reference.RFC.4716.xml"?>
       <?rfc include="reference.RFC.5280.xml"?>
       <?rfc include="reference.RFC.5425.xml"?>
       <?rfc include="reference.RFC.7525.xml"?>
       <?rfc include="reference.RFC.8446.xml"?>
       <?rfc include="reference.RFC.8773.xml"?>
       <?rfc include="reference.RFC.8907.xml"?>
       <reference anchor="SSHALGS" target="https://www.iana.org/assignments/ssh-parameters/ssh-parameters.xhtml#ssh-parameters-19">
         <front>
           <title>Public Key Algorithm Names</title>
           <author fullname="IANA"></author>
         </front>
       </reference>
       <reference anchor="SSHSUBSYS" target="https://www.iana.org/assignments/ssh-parameters/ssh-parameters.xhtml#ssh-parameters-15">
         <front>
           <title>SSH Protocol Subsystem Names</title>
           <author fullname="IANA"></author>
         </front>
       </reference>
     </references>
     <references title="Informative References">
       <xi:include href="http://xml2rfc.ietf.org/public/rfc/bibxml-ids/reference.I-D.ietf-tls-external-psk-guidance.xml"/>
       <?rfc include="reference.RFC.3365.xml"?>
       <?rfc include="reference.RFC.4020.xml"?>
       <?rfc include="reference.RFC.4251.xml"?>
       <?rfc include="reference.RFC.5952.xml"?>
       <?rfc include="reference.RFC.6242.xml"?>
       <?rfc include="reference.RFC.6335.xml"?>
       <?rfc include="reference.RFC.7250.xml"?>
       <?rfc include="reference.RFC.7605.xml"?>
       <reference anchor="TLSCSREC" target="https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4">
         <front>
           <title>Transport Layer Security (TLS) Parameters</title>
           <author fullname="IANA"></author>
         </front>
       </reference>
     </references>

   </back>
</rfc>
