2.0 UDP Encoding: TACACS
This section describes the UDP encoding of the requests that have just been described. It also describes the responses. This UDP encoding forms the basis of the historical TACACS protocol.
This protocol uses port 49. This assignment continues to be confirmed by the IANA in the Assigned Numbers RFCs. (I can't say that it was assigned by the IANA as the assignment preceded the organization.)
The basic packet format is shown here. All multi-bytes values are in network byte order. Unless otherwise specified, all values given are in decimal. Unused fields should be set to zero, but the recipient should not depend on that setting.
As was mentioned earlier, there are both simple and extended forms, of which the simple form is a proper subset of the extended form. A server should support both. I will describe both forms in parallel.
Simple Form
The fields are:
offset length field
0 1 version
1 1 type
2 2 nonce value
4 1 username length (to server) / response (to client)
5 1 password length (to server) / reason (to client)
in the usual packet layout format:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: Version : Type : Nonce :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: User len/Resp : PW len/Reason : data... :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Extended Form
The fields are:
offset length field
0 1 version
1 1 type
2 2 nonce value
4 1 username length
5 1 password length
6 1 response
7 1 reason
8 4 result1
12 4 destination host, IP address
16 2 destination port
18 2 line
20 4 result2
24 2 result3
26 varies data: username + password
in the usual packet layout format:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: Version : Type : Nonce :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: User len : Password len : Response : Reason :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: Result 1 :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: Destination Address :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: Dest Port : Line :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: Result 2 :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: Result 3 : data... :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2.1. Fields
The VERSION field specifies the version number. It must be zero for simple or 128 (80 hexadecimal) for extended.
The TYPE field encodes the request type. Values are:
LOGIN 1
RESPONSE 2 (server to client only)
CHANGE 3
FOLLOW 4
CONNECT 5
SUPERUSER 6
LOGOUT 7
RELOAD 8
SLIPON 9
SLIPOFF 10
SLIPADDR 11
Other values below 128 are reserved for future use. Values from 128 to 255 are reserved for local use.
Note that the semantics of the CHANGE, FOLLOW, RELOAD requests have not been determined.
The NONCE field is set by the client to an arbitrary value. Its purpose is to allow clients that may have multiple outstanding requests to determine which request a response is for. The server must copy this value to the reply unaltered.
The USERNAME LENGTH field is set by the client to the length of the username in characters. Legal values are 0 to 255, inclusive. The server must copy this value to the reply unaltered.
The PASSWORD LENGTH is set by the client to the length of the password in characters. Legal values are 0 to 255, inclusive. The server must copy this value to the reply unaltered.
The RESPONSE field should be set by the client to zero. The server sets the value to one of:
value meaning
1 accepted
2 rejected
Other values below 128 are reserved for future use. Values from 128 to 255 are reserved for local use.
The REASON field should be set by the client to zero, except for LOGOUT and SLIPOFF requests, which may use values of 4, 5, or 6. The server sets the value to one of:
value meaning notes
0 none used for ACCEPTED or if the server
is ornery
1 expiring
2 password
3 denied
4 quit user quit normally
5 idle idle timeout
6 drop carrier dropped
7 bad too many bad passwords
The values from 4 to 6 will only be used for reasons for LOGOUT or SLIPOFF requests: they will not be returned by the server. Other values below 128 are reserved for future use. Values from 128 to 255 are reserved for local use.
The RESULT1 field should be set by the client to zero. For LOGIN or CONNECT requests, it is set by the server as specified in the request description. For all other requests, it should be set by the server to zero.
The DESTINATION HOST field is set by the client. On CONNECT, SLIPON, and SLIPOFF requests it specifies an IP address. It should be set to zero on all other requests. For SLIPON and SLIPOFF request, this value should be the IP address assigned to the line. For CONNECT requests, this value is the IP address of the host that the user is attempting to connect to. The server copies this value to the reply.
The DESTINATION PORT field is set by the client. On CONNECT requests it specifies the port number that the user is attempting to connect to. It should be set to zero on all other requests. The server copies this value to the reply.
The LINE field is set by the client to the line number that the request is for. The server copies this value to the reply.
The RESULT2 field should be set by the client to zero. For LOGIN or CONNECT requests, it is set by the server as specified in the request description. For all other requests, it should be set by the server to zero.
The RESULT3 field should be set by the client to zero. For LOGIN or CONNECT requests, it is set by the server as specified in the request
description. For all other requests, it should be set by the server to zero.
The DATA field contains just the text of the username and password, with no separator characters (you use username length and password length to sort them out). The server does not copy the values to the reply. (However, the server does copy the username length and password length fields to the reply.) The username data may be in upper case: comparisons should be case-insensitive.
2.2. What a Client Does
The client must format and send a UDP request to port 49. It constructs the request by following these steps:
- set the version to 128
- set the type to that of the request
- set the nonce to a unique value that is different from all
outstanding requests
- set the username length
- set the password length
- set the response to zero
- set the reason to zero (except for LOGOUT and SLIPOFF)
- set the result1 to zero
- if CONNECT, SLIPON, or SLIPOFF, set the destination address
to the IP address, otherwise set it to zero
- if CONNECT, set the destination port to the port, otherwise
set it to zero
- set the line
- set the result2 to zero
- set the result3 to zero
- copy the username to the location just after result3
- copy the password to the location just after the end of the
username
Send the request. Wait for a reasonable (and hopefully configurable) period of time. If no response has been received, retry a reasonable (and hopefully configurable) number of times. Reasonable default wait times are 5 seconds and retries are 2.
If a response has been received, use the nonce value (and as many other fields as you like) to match it to an outstanding request. If there is no matching outstanding request, take appropriate (and hopefully configurable) action such as discarding and/or logging the packet.
If the response matches an outstanding request, examine the response and reason codes and take whatever action you deem correct. For
responses to LOGIN and CONNECT requests, also incorporate the result1, result2, and result3 values as you deem correct.
2.3. What a Server Does
Upon receipt of a UDP format request, the server examines the data in the request packet and determines its response. It constructs the reply by following these steps:
- set the version to 128
- set the type to RESPONSE (2)
- copy the nonce value
- copy the username length value
- copy the password length value
- set the response value to the desired response
- set the reason value to the desired reason
- if LOGIN or CONNECT, set the result1 else zero the result1
- copy the destination host value
- copy the destination port value
- copy the line value
- if LOGIN or CONNECT, set the result2 else zero the result2
- if LOGIN or CONNECT, set the result3 else zero the result3
- do NOT copy the username or password data
(As always, be liberal in what you expect and conservative in what you send.) Send the response. Do not attempt to retry, as you have no basis for determining whether a retry is required. Any retries are up to the client. This, of course, implies that requests are idempotent. They aren't, of course, so the retries must be considered when trying to assemble requests into connections.