Wednesday, 17 September 2014

Diameter Connections vs. Sessions

   This section attempts to provide the reader with an understanding of  the difference between "connection" and "session", which are terms
   used extensively throughout this document.

   A connection refers to a transport-level connection between two peers  that is used to send and receive Diameter messages.  A session is a
   logical concept at the application layer that exists between the  Diameter client and the Diameter server; it is identified via the
   Session-Id AVP.

         +--------+          +-------+          +--------+
         | Client |          | Relay |          | Server |
         +--------+          +-------+          +--------+
                  <---------->       <---------->
               peer connection A   peer connection B 
                  <----------------------------->
                          User session x

                Figure 1: Diameter Connections and Sessions

   In the example provided in Figure 1, peer connection A is established  between the client and the relay.  Peer connection B is established
   between the relay and the server.  User session X spans from the client via the relay to the server.  Each "user" of a service causes
   an auth request to be sent, with a unique session identifier.  Once  accepted by the server, both the client and the server are aware of
   the session.

   It is important to note that there is no relationship between a connection and a session, and that Diameter messages for multiple
   sessions are all multiplexed through a single connection.  Also, note that Diameter messages pertaining to the session, both application-
   specific and those that are defined in this document such as ASR/ASA, RAR/RAA, and STR/STA, MUST carry the Application Id of the
   application.  Diameter messages pertaining to peer connection establishment and maintenance such as CER/CEA, DWR/DWA, and DPR/DPA
   MUST carry an Application Id of zero (0).

Tuesday, 9 September 2014

Diameter Agents

   In addition to clients and servers, the Diameter protocol introduces relay, proxy, redirect, and translation agents, each of which is
   defined in Section 1.2.  Diameter agents are useful for several reasons:

   o  They can distribute administration of systems to a configurable grouping, including the maintenance of security associations.

   o  They can be used for concentration of requests from a number of co-located or distributed NAS equipment sets to a set of like user
      groups.

   o  They can do value-added processing to the requests or responses.

   o  They can be used for load balancing.

   o  A complex network will have multiple authentication sources, they can sort requests and forward towards the correct target.

   The Diameter protocol requires that agents maintain transaction state, which is used for failover purposes.  Transaction state
   implies that upon forwarding a request, its Hop-by-Hop Identifier is saved; the field is replaced with a locally unique identifier, which
   is restored to its original value when the corresponding answer is received. The request's state is released upon receipt of the
   answer.  A stateless agent is one that only maintains transaction state.

   The Proxy-Info AVP allows stateless agents to add local state to a Diameter request, with the guarantee that the same state will be
   present in the answer.  However, the protocol's failover procedures require that agents maintain a copy of pending requests.

   A stateful agent is one that maintains session state information by keeping track of all authorized active sessions.  Each authorized
   session is bound to a particular service, and its state is considered active until either the agent is notified otherwise or the session
   expires.  Each authorized session has an expiration, which is communicated by Diameter servers via the Session-Timeout AVP.

   Maintaining session state may be useful in certain applications, such as:

   o  Protocol translation (e.g., RADIUS <-> Diameter)

   o  Limiting resources authorized to a particular user

   o  Per-user or per-transaction auditing

   A Diameter agent MAY act in a stateful manner for some requests and be stateless for others.  A Diameter implementation MAY act as one
   type of agent for some requests and as another type of agent for others.

Relay Agents

Relay agents are Diameter agents that accept requests and route messages to other Diameter nodes based on information found in the messages (e.g., the value of the Destination-Realm AVP Section 6.6). This routing decision is performed using a list of supported realms and known peers. This is known as the routing table, as is defined further in Section 2.7. Relays may, for example, be used to aggregate requests from multiple Network Access Servers (NASes) within a common geographical area (Point of Presence, POP). The use of relays is advantageous since it eliminates the need for NASes to be configured with the necessary security information they would otherwise require to communicate with Diameter servers in other realms. Likewise, this reduces the configuration load on Diameter servers that would otherwise be necessary when NASes are added, changed, or deleted. Relays modify Diameter messages by inserting and removing routing information, but they do not modify any other portion of a message. Relays SHOULD NOT maintain session state but MUST maintain transaction state. +------+ ---------> +------+ ---------> +------+ | | 1. Request | | 2. Request | | | NAS | | DRL | | HMS | | | 4. Answer | | 3. Answer | | +------+ <--------- +------+ <--------- +------+ example.net example.net example.com Figure 2: Relaying of Diameter messages The example provided in Figure 2 depicts a request issued from a NAS, which is an access device, for the user bob@example.com. Prior to issuing the request, the NAS performs a Diameter route lookup, using "example.com" as the key, and determines that the message is to be relayed to a DRL, which is a Diameter relay. The DRL performs the same route lookup as the NAS, and relays the message to the HMS, which is example.com's home server. The HMS identifies that the request can be locally supported (via the realm), processes the authentication and/or authorization request, and replies with an answer, which is routed back to the NAS using saved transaction state. Since relays do not perform any application-level processing, they provide relaying services for all Diameter applications; therefore, they MUST advertise the Relay Application Id. Proxy Agents Similar to relays, proxy agents route Diameter messages using the Diameter routing table. However, they differ since they modify messages to implement policy enforcement. This requires that proxies maintain the state of their downstream peers (e.g., access devices) to enforce resource usage, provide admission control, and provide provisioning. Proxies may, for example, be used in call control centers or access ISPs that provide outsourced connections; they can monitor the number and type of ports in use and make allocation and admission decisions according to their configuration. Since enforcing policies requires an understanding of the service being provided, proxies MUST only advertise the Diameter applications they support. Redirect Agents 
 
    Redirect agents are useful in scenarios where the Diameter routing configuration needs to be centralized.  An example is a redirect
   agent that provides services to all members of a consortium, but does not wish to be burdened with relaying all messages between realms.
   This scenario is advantageous since it does not require that the consortium provide routing updates to its members when changes are
   made to a member's infrastructure.

   Since redirect agents do not relay messages, and only return an answer with the information necessary for Diameter agents to
   communicate directly, they do not modify messages.  Since redirect agents do not receive answer messages, they cannot maintain session
   state.

   The example provided in Figure 3 depicts a request issued from the access device, NAS, for the user bob@example.com.  The message is
   forwarded by the NAS to its relay, DRL, which does not have a routing entry in its Diameter routing table for example.com.  The DRL has a
   default route configured to DRD, which is a redirect agent that returns a redirect notification to DRL, as well as the HMS' contact
   information.  Upon receipt of the redirect notification, the DRL establishes a transport connection with the HMS, if one doesn't
   already exist, and forwards the request to it.


                                  +------+
                                  |      |
                                  | DRD  |
                                  |      |
                                  +------+
                                   ^    |
                       2. Request  |    | 3. Redirection
                                   |    |    Notification
                                   |    v
       +------+    --------->     +------+     --------->    +------+
       |      |    1. Request     |      |     4. Request    |      |
       | NAS  |                   | DRL  |                   | HMS  |
       |      |    6. Answer      |      |     5. Answer     |      |
       +------+    <---------     +------+     <---------    +------+
      example.net                example.net               example.com

                 Figure 3: Redirecting a Diameter Message

   Since redirect agents do not perform any application-level processing, they provide relaying services for all Diameter
   applications; therefore, they MUST advertise the Relay Application ID.

Translation Agents

A translation agent is a device that provides translation between two protocols (e.g., RADIUS<->Diameter, TACACS+<->Diameter). Translation agents are likely to be used as aggregation servers to communicate with a Diameter infrastructure, while allowing for the embedded systems to be migrated at a slower pace. Given that the Diameter protocol introduces the concept of long-lived authorized sessions, translation agents MUST be session stateful and MUST maintain transaction state. Translation of messages can only occur if the agent recognizes the application of a particular request; therefore, translation agents MUST only advertise their locally supported applications.
+------+ ---------> +------+ ---------> +------+ | | RADIUS Request | | Diameter Request | | | NAS | | TLA | | HMS | | | RADIUS Answer | | Diameter Answer | | +------+ <--------- +------+ <--------- +------+ example.net example.net example.com Figure 4: Translation of RADIUS to Diameter
 
RFC : 6733 

Monday, 1 September 2014

Introduction to Diameter Protocol


What is Diameter Protocol?

Well, your ISP uses the standard Authentication, Authorization, and Accounting (AAA) before allowing you to connect to the network by using their services. So what is AAA and how does it affects you as a network user? AAA is simply a process inside an application that filters information before granting any access. It is where applications are based in order to provide a secure and reliable output. This is where RADUIS gateway takes place. There are plenty of AAA applications that we are using right now. This includes the one used when connecting for a wireless network and on some mobile phone features.

Remote Authentication Dial In User Service (RADUIS) was an older protocol used in implementing AAA standards. The protocol was also named as radius gateway for a clearer and easy to remember term. Despite its popularity and availability, radius gateway had some complications and limitations that need to be addressed. Applications relying on radius gateway were immensely limited to performing a more secured and reliable process. Thus, it gave birth to a new form of protocol called DIAMETER widely used in modern applications. The name is a pun on the RADIUS protocol, which is the predecessor (a diameter is twice the radius).

Diameter protocol came as a result of developments to eliminate limitations with the radius gateway. It serves similar purpose in AAA applications however, advanced processes and operations were added to the protocol to make it reliable. This included the addition of attribute value pairs (AVPs) and error notification which was not present on older protocols. Diameter is not directly backwards compatible, but provides an upgrade path for RADIUS. As a result, older applications designed to run on older protocols including those that were designed in conformity to radius gateway had to adapt the changes brought by the newer diameter protocol. Necessary steps were done on most application to have it run with diameter protocol, without changing the entire structure of these applications.

The design of the diameter protocol was initiated by the 3rd Generation Partnership Project (3GPP) to be used for their IP Multimedia Subsystem (IMS). By using the diameter protocol, applications are able to support interfaces such as Cx, Dh, Dx, Rf, Ro, and Sh. The Diameter protocol uses a binary header format and is capable of transporting a range of data units called AVPs. The Diameter base protocol specifies the delivery mechanisms, capability negotiation, error handling, accounting and extensibility of the protocol, whereas individual Diameter applications specify service-specific functions and AVPs.