RFC 4101
Writing Protocol Models
Writing Protocol Models ๐
okay bestie, this is RFC 4101, called Writing Protocol Models ๐ It's from the Network Working Group and was written by E. Rescorla of RTFM, Inc. and the IAB โจ It's Informational, dated June 2005 ๐ฆ The header doesn't list any RFCs it obsoletes or updates, so it stands on its own ๐ง This is part 1 of 4, so more is coming ๐
Status of This Memo ๐ธ
this memo just provides info for the Internet community ๐ It does not specify an Internet standard of any kind, so no vibes of being a rule, lol. Distribution of this memo is unlimited ๐
Copyright Notice ๐
Copyright (C) The Internet Society (2005).
Abstract ๐
the IETF process runs on peer review, and that's iconic ๐ But IETF docs are usually written to be useful for implementors, not reviewers ๐ Like, the people writing them are super careful about state machines and bits on the wire, but all that detail tends to get in the way of first understanding ๐ญ This document describes an approach for making protocol "models" so reviewers can quickly grasp the essence of a system ๐ฅ
1. Introduction ๐
the IETF process depends on peer review, fr fr โจ But honestly, a lot of submitted docs are extremely hard to review ๐ Reviewers only have so much time, so the reviews end up taking forever, being inadequate, or both ๐ฉ In the author's view, a big part of the problem is that most docs skip presenting an architectural model for how the protocol operates ๐ง They just describe the protocol and let the reviewer figure it out, which is giving "good luck" ๐
That's fine when you're documenting for implementors, because they have to understand the protocol anyway ๐ซถ But it seriously increases the strain on reviewers ๐ญ Reviewers need the big picture first and then can zoom into particular points ๐ They simply do not have time to give the whole doc the attention an implementor would ๐
One way to lighten this load is to hand the reviewer a MODEL, which is a short description of the system in overview form ๐ฆ That gives them the context to spot the important or tricky pieces and focus there ๐ฏ As a bonus, if you write the model first, it can serve as an aid to the detailed protocol design and a focus for early review, before the protocol is finished ๐ท The idea is that the model would either be the first section of the protocol document or a separate doc shipped along with the protocol ๐
2. The Purpose of a Protocol Model ๐
a protocol model needs to answer three basic questions, and they're non-negotiable ๐ค
- What problem is the protocol trying to achieve?
- What messages are being transmitted and what do they mean?
- What are the important, but unobvious, features of the protocol?
the basic idea is to give enough info that the reader could design a protocol that's roughly isomorphic to the one being described ๐งฉ Obviously that doesn't mean the protocol would be identical, just that it would share most of the important features โจ For example, going with a KDC-based authentication model is an essential feature of Kerberos [KERBEROS] ๐ By contrast, using ASN.1 is a simple implementation decision ๐ S-expressions -- or XML, had it existed at the time -- would have served equally well ๐
the purpose of a protocol model is explicitly NOT to give a complete or alternate description of the protocol ๐ซ It's to give a big picture overview so readers can quickly understand the essential elements of how it works ๐
3. Basic Principles ๐
in this section we talk about basic principles that should guide your presentation ๐ง
3.1. Less is more ๐ซง
humans can only keep a very small number of pieces of info in their head at once ๐ง ๐ Because we want people to get the big picture, we have to dispense with a lot of detail ๐๏ธ And that's good, not bad ๐ฅฐ The simpler you can make things, the better ๐
3.2. Abstraction is good ๐ฆ
a key technique for representing complex systems is to abstract away pieces ๐บ๏ธ Like, maps are better than photographs for finding out where you want to go, because they give you an abstract, stylized view of the info you care about ๐ Don't be afraid to squish multiple protocol elements into a single abstract piece for teaching purposes ๐
3.3. A few well-chosen details sometimes help โจ
the converse of the previous principle is that sometimes details help bring a description into focus ๐ Lots of people work better with examples, so it's often a good move to talk about the material in the abstract and then give a concrete description of one specific piece to bring it into focus ๐ก Authors should focus on the normal path ๐ค๏ธ Error cases and corner cases should only be discussed where they help illustrate an important point ๐ โโ๏ธ
4. Writing Protocol Models ๐ท
in our experience, models are easiest to grasp when they're presented visually ๐จ The recommended format is centered around a few key diagrams, each with explanatory text ๐ These diagrams should be simple and typically be "boxes and arrows" ๐ฆโก๏ธ boxes for the major components, arrows for how they relate, and labels for the important features ๐ท๏ธ
we recommend a presentation structured in three parts to match the three questions from earlier sections ๐ง Each part should contain 1-3 diagrams that illustrate the relevant points ๐ผ๏ธ
4.1. Describe the problem you're trying to solve ๐ฏ
the most critical job of a protocol model is to explain what the protocol is trying to achieve ๐ This gives crucial context for understanding how the protocol works and whether it meets its goals ๐ค Given the goals, an experienced reviewer will usually have an idea of how they'd approach the problem, so they can compare that approach with the one the protocol under review takes ๐ง
the "Problem" section of the model should start with a short statement of the environments where the protocol is expected to be used ๐ก It should describe the relevant entities and the likely scenarios in which they'd take part in the protocol ๐ญ The Problem section should feature a diagram of the major communicating parties and how they relate to each other ๐ผ๏ธ It's especially important to lay out the trust relationships between the various parties, because those are often unobvious ๐จ
4.1.1. Example: STUN (RFC 3489) ๐ซ
STUN [STUN] is a UNilateral Self-Address Fixing (UNSAF) [UNSAF] protocol that lets a machine behind a NAT figure out what its external apparent IP address is ๐ Although STUN gives a complete and thorough description of how it works, it doesn't give a brief, up-front overview for a quick understanding ๐ So the rest of this section shows what a suitable overview might look like ๐
Network Address Translation (NAT) makes it hard to run a bunch of classes of service from behind the NAT gateway ๐ง This is a real problem when protocols need to advertise address/port pairs as part of the application layer protocol ๐ฎ The NAT can be set up to accept data headed for that port, but address translation means the address the application knows about isn't the same one it's reachable on ๐
check out the scenario in the figure below ๐ A SIP client is starting a session with a SIP server and wants the server to send it some media ๐ถ In its Session Description Protocol (SDP) [SDP] request, it gives the IP address and port it's listening on ๐ง But unbeknownst to the client, a NAT is in the way ๐ฑ The NAT translates the IP address in the header, but unless it's SIP aware, it doesn't change the address in the request ๐ Result? The media goes into a black hole ๐ณ๏ธ๐
+-----------+
| SIP |
| Server |
| |
+-----------+
^
| [FROM: 198.203.2.1:8954]
| [MSG: SEND MEDIA TO 10.0.10.5:6791]
|
|
+-----------+
| |
| NAT |
--------------+ Gateway +----------------
| |
+-----------+
^
| [FROM: 10.0.10.5:6791]
| [MSG: SEND MEDIA TO 10.0.10.5:6791]
|
10.0.10.5
+-----------+
| SIP |
| Client |
| |
+-----------+
the purpose of STUN is to let clients detect this situation and determine the address mapping ๐ต๏ธโโ๏ธ Then they can put the right address in their application-level messages ๐ This is done by using an external STUN server ๐ฐ๏ธ That server can work out the translated address and tell the STUN client, as shown below ๐ซถ
+-----------+
| STUN |
| Server |
| |
+-----------+
^ |
[IP HDR FROM: 198.203.2.1:8954] | | [IP HDR TO: 198.203.2.1:8954]
[MSG: WHAT IS MY ADDRESS?] | | [MSG: YOU ARE 198.203.2.1:8954]
| v
+-----------+
| |
| NAT |
--------------+ Gateway +----------------
| |
+-----------+
^ |
[IP HDR FROM: 10.0.10.5:6791] | | [IP HDR TO: 10.0.10.5:6791]
[MSG: WHAT IS MY ADDRESS?] | | [MSG: YOU ARE 198.203.2.1:8954]
| v
10.0.10.5
+-----------+
| SIP |
| Client |
| |
+-----------+
4.2. Describe the protocol in broad overview ๐บ๏ธ
once the problem is described, the next job is to give a broad overview of the protocol ๐ธ This means showing, either in "ladder diagram" or "boxes and arrows" form, the protocol messages that flow between the various networking agents ๐ช The diagram should come with explanatory text describing the purpose of each message and the MAJOR data elements ๐
this section SHOULD NOT contain detailed descriptions of the protocol messages or of each data element ๐ โโ๏ธ In particular, bit diagrams, ASN.1 modules, and XML schema SHOULD NOT be shown ๐ซ The point of this section isn't to fully describe the protocol, it's to give enough of a map that a person reading the full protocol doc can see where each specific piece fits ๐งญ
in certain cases it may be helpful to describe the behavior of network elements with a state machine ๐ But state machines should be kept as minimal as possible ๐ค Remember that the purpose is to promote high-level comprehension, not complete understanding ๐ง ๐
more parts are coming, so stay tuned ๐ง๐
4.2.1. Example: DCCP
Okay bestie, let's talk DCCP ๐ The Datagram Congestion Control Protocol [DCCP] is a protocol for datagram transport with network-friendly congestion avoidance behavior ๐ฆ The DCCP base protocol document is over 100 pages long ๐ญ and the congestion control mechanisms are their own separate docs. So an architectural overview that skips the nitty-gritty is literally so helpful, and that's what this section is trying to be โจ
NOTE: The author of this document was on the DCCP review team, and his experience with that document was one of the motivating factors for this one ๐ Since the review, the DCCP authors have added some overview material, and some of it comes from earlier versions of this document ๐ซถ
Although DCCP is datagram-oriented like UDP, it's stateful like TCP ๐ Connections go through these phases:
- Initiation
- Feature negotiation
- Data transfer
- Termination
4.2.1.1. Initiation
Just like TCP, the initiation phase of DCCP is a three-way handshake ๐ค Here's how it goes:
Client Server
------ ------
DCCP-Request ->
[Ports, Service,
Features]
<- DCCP-Response
[Features,
Cookie]
DCCP-Ack ->
[Features,
Cookie]
DCCP 3-way handshake
So in the DCCP-Request, the client tells the server the name of the service it wants to talk to, plus the ports it wants to use ๐ฎ Ports aren't tightly bound to services here, unlike what you get with TCP or UDP common practice, so that's a fun difference ๐ This message also kicks off feature negotiation. For pedagogical reasons, we'll cover feature negotiation separately in the next section, but the early bits of it actually happen at the same time as initiation, so keep that in mind ๐ง
In the DCCP-Response, the server basically says "yep, I'm down to accept this connection" and keeps feature negotiation going ๐ธ To stop SYN flood-style DOS attacks ๐ค, DCCP uses an IKE-style cookie exchange. The server can hand the client a cookie that holds all of the negotiation state, and the client must echo that cookie back in the DCCP-Ack. Because the cookie carries everything, the server doesn't have to keep state on its end, which is so iconic ๐
In the DCCP-Ack, the client acknowledges the DCCP-Response and returns the cookie so the server can finish its side of the connection ๐ Like we said above, this message may also carry feature negotiation messages.
4.2.1.2. Feature Negotiation
In DCCP, feature negotiation happens by attaching options to other DCCP packets ๐ฆ So it can be piggybacked on any other DCCP message! That means feature negotiation can happen during connection initiation and also during data flow. Main character energy ๐
Somewhat unusually (but honestly iconic), DCCP features are one-sided ๐ That means it's totally possible to have one congestion control regime for data going from client to server and a different one for data going from server to client.
Feature negotiation is done with the Change and Confirm options. There are four feature negotiation options in all: Change L, Confirm L, Change R, and Confirm R ๐ The "L" options are sent by the feature location, which is where the feature is maintained. The "R" options are sent by the feature remote.
A Change R message says to the peer "change this option setting on your side" ๐ซถ The peer can answer with a Confirm L, which means "I've changed it." Some features let a Change R option contain multiple values, sorted in preference order. For example:
Client Server
------ ------
Change R(CCID, 2) -->
<-- Confirm L(CCID, 2)
* agreement that CCID/Server = 2 *
Change R(CCID, 3 4) -->
<-- Confirm L(CCID, 4, 4 2)
* agreement that CCID/Server = 4 *
In the second exchange, the client asks the server to use either CCID 3 or CCID 4, with 3 preferred ๐ค The server picks 4 and sends back its own preference list, "4 2". Easy peasy ๐
The Change L and Confirm R options are for feature negotiations that the feature location starts. In the next example, the server asks that CCID/Server be set to 3 or 2 (with 3 preferred), and the client agrees โจ
Client Server
------ ------
<-- Change L(CCID, 3 2)
Confirm R(CCID, 3, 3 2) -->
* agreement that CCID/Server = 3 *
4.2.1.3. Data Transfer
Instead of having one single congestion control regime like TCP does, DCCP offers a bunch of negotiable congestion control regimes ๐ The DCCP documents describe two of them: additive increase, multiplicative decrease (CCID-2 [CCID2]), and TCP-friendly rate control (CCID-3 [CCID3]). CCID-2 is meant for apps that want maximum throughput ๐ CCID-3 is meant for real-time apps that want a smooth response to congestion ๐ง
4.2.1.3.1. CCID-2
CCID-2's congestion control is extremely similar to TCP's, so if you know TCP, you're already halfway there ๐ The sender keeps a congestion window and sends packets until that window is full. The receiver Acks the packets. Dropped packets and ECN [ECN] are used to signal congestion. The response to congestion is to halve the congestion window ๐
One subtle difference from TCP: the Acks in DCCP must contain the sequence numbers of all received packets (within a given window), not just the highest sequence number like in TCP ๐
4.2.1.3.2. CCID-3
CCID-3 is an equation-based form of rate control, and it's meant to respond to congestion more smoothly than CCID-2 does ๐ฆ The sender keeps a "transmit rate." The receiver sends Ack packets that carry its estimate of packet loss, and the sender uses that info to update its transmit rate. CCID-3 acts a bit differently from TCP in its short-term congestion response, but it's designed to play fair with TCP over the long term ๐ซถ
4.2.1.4. Termination
Connection termination in DCCP starts with sending a Close message ๐ Either side can send one. The peer then responds with a Reset message, and that's when the connection closes. The side that sent the Close message must quietly keep the socket in TIMEWAIT state for 2MSL ๐
Client Server
------ ------
Close ->
<- Reset
[Remains in TIMEWAIT]
Also, the server might want to close the connection without sticking around in TIMEWAIT (for example, because it wants to keep server-side state to a minimum) ๐ง To pull that off, the server can make the client send a Close by sending a CloseReq message. That way, the TIMEWAIT state ends up on the client instead ๐
4.3. Describe any important protocol features
The final section (if there is one) should explain any important protocol features that aren't obvious from the previous sections ๐ In the best case, all the important features are obvious from the message flow, but that's not always how it goes ๐ This section is the author's chance to explain those features. Authors should think carefully before writing it. If there aren't any important points to make, they shouldn't fill this section up ๐ โโ๏ธ
Examples of the kind of feature that belongs here include high-level security considerations, congestion control information, and overviews of the algorithms that network elements are meant to follow โญ For instance, if you've got a routing protocol, you might use this section to sketch out the algorithm the router uses to work out the right routes from protocol messages ๐บ๏ธ
4.3.1. Example: WebDAV COPY and MOVE
WebDAV [WEBDAV] is pretty terse ๐ It likes to define the required behaviors and let the reader work out the implications. Sometimes explanatory material that spells out those implications really helps the reader get the overall model, so this section covers one such case ๐
WebDAV [WEBDAV] includes both a COPY method and a MOVE method. A MOVE can be thought of as a COPY followed by a DELETE, but COPY+DELETE and MOVE aren't totally equivalent ๐
Using COPY+DELETE as a stand-in for MOVE is a problem because of the intermediate file it creates ๐ฌ Picture a user who's getting close to a quota boundary. A COPY+DELETE should be forbidden because it would temporarily exceed the quota. A simple rename, though, should work just fine in that situation โจ
The second issue is permissions ๐ The WebDAV permissions model lets the server grant users permission to rename files but not to create new ones. That's unusual for ordinary filesystems, but WebDAV doesn't prevent it. This is clearly not possible if a client uses COPY+DELETE to do a MOVE.
Finally, a COPY+DELETE doesn't produce the same logical result you'd expect from a MOVE ๐ซ Since COPY creates a new resource, it's permitted (but not required) to use the time of new file creation as the creation date property. On the flip side, the expectation for MOVE is that the renamed file keeps the same properties as the original ๐ธ
5. Formatting Issues ๐
The requirement that Internet-Drafts and RFCs be renderable in ASCII is a real obstacle when you're writing the graphics-heavy kind of document we're describing ๐ฅฒ Authors might find it easier to make a separate protocol model document in Postscript or PDF and just make it available at review time, though an archival version would definitely be handy ๐
6. A Complete Example: Internet Key Exchange (IKE) ๐
Internet Key Exchange (IKE) [IKE] is one of the most complicated security protocols the IETF has ever designed ๐ตโ๐ซ Even though the basic IKE core is a fairly straightforward Diffie-Hellman-based handshake, it can be hard for new readers to get abstractly, apart from the protocol details. The rest of this section gives an overview of IKE that's built for those new readers ๐ซถ
6.1. Operating Environment โจ
okay so IKE (Internet Key Exchange) [IKE] is the key establishment and parameter negotiation protocol for Internet protocols ๐. Its main job is setting up security associations (SAs) [IPSEC] for IPsec AH [AH] and ESP [ESP] ๐.
+--------------------+ +--------------------+
| | | |
| +------------+ | | +------------+ |
| | Key | | IKE | | Key | |
| | Management | <-+-----------------------+-> | Management | |
| | Process | | | | Process | |
| +------------+ | | +------------+ |
| ^ | | ^ |
| | | | | |
| v | | v |
| +------------+ | | +------------+ |
| | IPsec | | AH/ESP | | IPsec | |
| | Stack | <-+-----------------------+-> | Stack | |
| | | | | | | |
| +------------+ | | +------------+ |
| | | |
| | | |
| Initiator | | Responder |
+--------------------+ +--------------------+
so the general deployment model looks like the diagram above ๐. The IPsec engines and IKE engines are typically separate modules. When there's no security association for a packet that needs processing (either sent or received), the IPsec engine contacts the IKE engine and asks it to set up an appropriate SA. The IKE engine contacts the right peer and uses IKE to establish the SA. Once the IKE handshake is finished, it registers the SA with the IPsec engine ๐ .
Also, IKE traffic between the peers can be used to refresh keying material or adjust operating parameters, like algorithms โจ.
6.1.1. Initiator and Responder ๐
IPsec is basically symmetrical, but IKE is not. The party who sends the first message is called the INITIATOR. The other party is called the RESPONDER. With TCP connections, the INITIATOR will typically be the peer doing the active open (aka the client) ๐.
6.1.2. Perfect Forward Secrecy ๐
One of the big goals in IKE design was that traffic stays protected even if the nodes' keying material gets compromised later, as long as the session had already terminated and the session-specific keying material was gone. This is often called Perfect Forward Secrecy (PFS) or back traffic protection ๐.
6.1.3. Denial of Service Resistance ๐ญ
Because IKE lets arbitrary peers start computationally-expensive cryptographic operations, it potentially allows resource consumption denial of service (DoS) attacks to be mounted against the IKE engine. IKE includes countermeasures designed to minimize this risk ๐ก๏ธ.
6.1.4. Keying Assumptions ๐ค
Because Security Associations are essentially symmetric, both sides must, in general, be authenticated. IKE needs to be able to set up SAs between a broad range of peers with all kinds of prior relationships, so it supports a very flexible keying model ๐ง. Peers can authenticate via shared keys, digital signatures (typically from keys vouched for by certificates), or encryption keys.
6.1.5. Identity Protection ๐ซถ
Even though IKE requires the peers to authenticate to each other, the working group thought it was desirable to give the communicating peers some identity protection. In particular, the peers should be able to hide their identity from passive observers, and one peer should be able to require the author to authenticate before they self-identity. In this case, the designers chose to make the party who speaks first (the INITIATOR) identify first ๐.
6.2. Protocol Overview ๐ฆ
At a very high level, there are two kinds of IKE handshake:
- Those that establish an IKE security association.
- Those that establish an AH or ESP security association.
When two peers that have never communicated before need to establish an AH/ESH SA, they must first establish an IKE SA. This lets them exchange an arbitrary amount of protected IKE traffic. They can then use that SA to do a second handshake to establish SAs for AH and ESP. Here's the schematic form ๐. The notation E(SA,XXXX) is used to indicate that traffic is encrypted under a given SA.
Initiator Responder
--------- ---------
Handshake MSG -> \ Stage 1:
<- Handshake MSG \ Establish IKE
/ SA (IKEsa)
[...] /
\ Stage 2:
E(IKEsa, Handshake MSG) -> \ Establish AH/ESP
<- E(IKEsa, Handshake MSG) / SA
The two kinds of IKE handshake
IKE terminology is kinda confusing, referring under different circumstances to "phases" and "modes" ๐. For maximal clarity, we'll refer to establishing the IKE SA as "Stage 1" and establishing the AH/ESP SAs as "Stage 2". Note that it's quite possible for there to be more than one Stage 2 handshake once Stage 1 has been finished. This might be useful for establishing multiple AH/ESP SAs with different cryptographic properties ๐.
The Stage 1 and Stage 2 handshakes are actually pretty different, because the Stage 2 handshake can, of course, assume that its traffic is being protected with an IKE SA. So we'll discuss Stage 1 first and then Stage 2 ๐ธ.
6.2.1. Stage 1 ๐
There are a large number of variants of the IKE Stage 1 handshake, necessitated by the use of different authentication mechanisms. However, broadly speaking, Stage 1 handshakes fall into one of two basic categories: MAIN MODE, which provides identity protection and DoS resistance, and AGGRESSIVE MODE, which does not. We'll cover MAIN MODE first ๐ .
6.2.1.1. Main Mode ๐
Main Mode is a six message (3 round trip) handshake, which offers identity protection and DoS resistance. Here's an overview ๐.
Initiator Responder
--------- ---------
CookieI, Algorithms -> \ Parameter
<- CookieR, Algorithms / Establishment
CookieR,
Nonce, Key Exchange ->
<- Nonce, Key Exchange\ Establish
/ Shared key
E(IKEsa, Auth Data) ->
<- E(IKEsa, Auth data)\ Authenticate
/ Peers
IKE Main Mode handshake (Stage 1)
In the first round trip, the Initiator offers a set of algorithms and parameters. The Responder picks out the single set that it likes and responds with that set. It also provides CookieR, which will be used to prevent DoS attacks. At this point, there is no secure association, but the peers have tentatively agreed upon parameters. These parameters include a Diffie-Hellman (DH) group, which will be used in the second round trip ๐ท.
In the second round trip, the Initiator sends the key exchange information. This generally consists of the Initiator's Diffie-Hellman public share (Yi). He also supplies CookieR, which was provided by the responder. The Responder replies with his own DH share (Yr). At this point, both Initiator and Responder can compute the shared DH key (ZZ). However, there has been no authentication, and therefore they don't know with any certainty that the connection hasn't been attacked ๐ฌ. Note that as long as the peers generate fresh DH shares for each handshake, PFS will be provided โจ.
Before we move on, let's take a look at the cookie exchange ๐ช. The basic anti-DoS measure used by IKE is to force the peer to demonstrate that it can receive traffic from you. This foils blind attacks like SYN floods [SYNFLOOD] and also makes it somewhat easier to track down attackers. The cookie exchange serves this role in IKE. The Responder can verify that the Initiator supplied a valid CookieR before doing the expensive DH key agreement. This does not totally eliminate DoS attacks, because an attacker who was willing to reveal his location could still consume server resources; but it does protect against a certain class of blind attack ๐ซง.
In the final round trip, the peers establish their identities ๐ชช. Because they share an (unauthenticated) key, they can send their identities encrypted, thus providing identity protection from eavesdroppers. The exact method of proving identity depends on what form of credential is being used (signing key, encryption key, shared secret, etc.), but in general you can think of it as a signature over some subset of the handshake messages. So, each side would supply its certificate and then sign using the key associated with that certificate. If shared keys are used, the authentication data would be a key ID and a MAC. Authentication using public key encryption follows similar principles, but is more complicated. Refer to the IKE document for more details ๐.
At the end of the Main Mode handshake, the peers share:
- A set of algorithms for encryption of further IKE traffic.
- Traffic encryption and authentication keys.
- Mutual knowledge of the peer's identity.
6.2.1.2. Aggressive Mode ๐
Although IKE Main Mode provides the required services, there was concern that the large number of round trips required added excessive latency. Accordingly, an Aggressive Mode was defined. Aggressive Mode packs more data into fewer messages, and thus reduces latency. However, it does not provide identity protection or protection against DoS ๐.
Initiator Responder
--------- ---------
Algorithms, Nonce,
Key Exchange, ->
<- Algorithms, Nonce,
Key Exchange, Auth Data
Auth Data ->
IKE Aggressive Mode Handshake (Stage 1)
After the first round trip, the peers have all the required properties, but the Initiator has not authenticated to the Responder. The third message closes the loop by authenticating the Initiator. Note that since the authentication data is sent in the clear, no identity protection is provided; and because the Responder does the DH key agreement without a round trip to the Initiator, there is no DoS protection. ๐
6.2.2. Stage 2 โจ
okay so Stage 1 on its own isn't that useful, bestie ๐ The whole point of IKE is to set up the associations that protect your other traffic, not just the IKE SAs themselves. That's where Stage 2 comes in (IKE calls it "Quick Mode") ๐ The basic Stage 2 handshake looks like this:
Initiator Responder
--------- ---------
AH/ESP parameters,
Algorithms, Nonce,
Handshake Hash ->
<- AH/ESP parameters,
Algorithms, Nonce,
Handshake Hash
Handshake Hash ->
The Basic IKE Quick Mode (Stage 2)
As with quick mode, the first two messages set up the algorithms and parameters, and the last message is a check over the earlier ones. This time the parameters also include the transforms to apply to the traffic (AH or ESP) and which kinds of traffic get protected. And notice there's no key exchange info in these messages ๐
In this version, the peers use the Stage 1 keying material that's already around to derive fresh keys for traffic protection, with the nonces making sure everything stays fresh ๐ฆ Quick mode also lets you do a brand new Diffie-Hellman handshake for per-traffic key PFS ๐ In that case, the first two messages get Key Exchange payloads too, like this:
Initiator Responder
--------- ---------
AH/ESP parameters,
Algorithms, Nonce,
Key Exchange, ->
Handshake Hash
<- AH/ESP parameters,
Algorithms, Nonce,
Key Exchange,
Handshake Hash
Handshake Hash ->
A Variant of Quick Mode with PFS (Stage 2)
6.3. Other Considerations ๐ง
There are a bunch of IKE features that deserve special attention, so we're covering them here ๐
6.3.1. Cookie Generation ๐ช
Remember how IKE uses cookies as a partial defense against DoS attacks? When the responder gets Main Mode message 3 with the Key Exchange data and the cookie, it checks that the cookie is correct. But this verification must not involve keeping a list of valid cookies. Otherwise an attacker could eat up memory by repeatedly asking the responder for cookies ๐ The recommended way to generate one, as suggested by Phil Karn, is to have a single master key and compute a hash of the secret and the initiator's address information. The responder can verify the cookie by recomputing it from the information in the third message and checking whether it matches ๐ซถ
6.3.2. Endpoint Identities ๐ชช
So far we've been kinda vague about what kinds of endpoint identities get used, so let's fix that ๐ญ In principle there are three ways a peer might be identified: by a shared key, a pre-configured public key, or a certificate.
6.3.2.1. Shared Key ๐
In a shared key scheme, the peers share a symmetric key. The key is tied to a key identifier that both parties know. The party verifying the identity is also assumed to have a table showing which traffic (aka which addresses) that identity is allowed to negotiate SAs for.
6.3.2.2. Pre-Configured Public Key ๐ธ
It's basically the same vibe as shared key, except the verifying party has the authenticating party's public key instead of a shared key.
6.3.2.3. Certificate ๐
In a certificate scheme, the authenticating party presents a certificate containing their public key. Checking that this certificate matches the authentication data from the peer is straightforward. What's less straightforward is figuring out whether a given peer is entitled to negotiate for a given class of traffic. In theory you might be able to tell from the name in the certificate (like if the subject name contains an IP address that matches the ostensible IP address). In practice, IKE doesn't clearly specify this, so it's not really interoperable ๐ For now, it's likely that a configuration table maps certificates to policies, same as the other two authentication schemes.
7. Security Considerations ๐
This document doesn't define any protocols, so it has no security issues.
A. Appendix: IAB Members at the Time of This Writing ๐
Bernard Aboba
Harald Alvestrand
Rob Austein
Leslie Daigle
Patrik Falstrom
Sally Floyd
Jun-ichiro Itojun Hagino
Mark Handley
Bob Hinden
Geoff Huston
Eric Rescorla
Pete Resnick
Jonathan Rosenberg
Normative References
There are no normative references for this document.
Informative References
[AH] Kent, S., and R. Atkinson, "IP Authentication Header", RFC
2402, November 1998.
[CCID2] Floyd, S. and E. Kohler, "Profile for DCCP Congestion
Control ID 2: TCP-like Congestion Control", Work in
Progress, October 2003.
[CCID3] Floyd, S., Kohler, E., and J. Padhye, "Profile for DCCP
Congestion Control ID 3: TFRC Congestion Control", Work in
Progress, February 2004.
[DCCP] Kohler, E., Handley, M., and S. Floyd, "Datagram
Congestion Control Protocol (DCCP)", Work in Progress,
November 2004.
[ECN] Ramakrishnan, K. Floyd, S., and D. Black, "The Addition of
Explicit Congestion Notification (ECN) to IP", RFC 3168,
September 2001.
[ESP] Kent, S. and R. Atkinson, "IP Encapsulating Security
Payload (ESP)", RFC 2406, November 1998.
[IKE] Harkins, D. and D. Carrel, "The Internet Key Exchange
(IKE)", RFC 2409, November 1998.
[IPSEC] Kent, S. and R. Atkinson, "Security Architecture for the
Internet Protocol", RFC 2401, November 1998.
[KERBEROS] Kohl, J. and C. Neuman, "The Kerberos Network
Authentication Service (V5)", RFC 1510, September 1993.
[SDP] Handley, M. and V. Jacobson, "SDP: Session Description
Protocol" RFC 2327, April 1998.
[STUN] Rosenberg, J., Weinberger, J., Huitema, C., and R. Mahy,
"STUN - Simple Traversal of User Datagram Protocol (UDP)",
RFC 3489, March 2003.
[SYNFLOOD] CERT Advisory CA-1996-21 TCP SYN Flooding and IP Spoofing
Attacks <http://www.cert.org/advisories/CA-1996-21.html>,
September 19, 1996.
[UNSAF] Daigle, L. and IAB, "IAB Considerations for UNilateral
Self-Address Fixing (UNSAF) Across Network Address
Translation", RFC 3424, November 2002.
[WEBDAV] Goland, Y., Whitehead, E., Faizi, A., Carter, S., and D.
Jensen, "HTTP Extensions for Distributed Authoring --
WEBDAV", RFC 2518, February 1999.
Authors' Addresses ๐
Eric Rescorla
RTFM, Inc.
2064 Edgewood Drive
Palo Alto, CA 94303
Phone: (650)-320-8549
EMail: ekr@rtfm.com
Internet Architecture Board
IAB
EMail: iab@iab.org
Full Copyright Statement ยฉ๏ธ
Copyright (C) The Internet Society (2005).
This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights.
This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property ๐งพ
The IETF takes no position regarding the validity or scope of any Intellectual Property Rights 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. It also doesn't represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat, 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 implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf-ipr@ietf.org.
Acknowledgement ๐
Funding for the RFC Editor function is currently provided by the Internet Society.
๐ฆ where this page comes from
- ietf: rfc4101 2005-06
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms