RFC 6520

Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS) Heartbeat Extension

๐Ÿ“… published February 2012, from ietf

RFC 6520 ๐Ÿ’– Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS) Heartbeat Extension

Okay bestie, the title block first ๐ŸŽ€ This one is Request for Comments 6520, and it's on the Standards Track (so it's a real, official spec, not a vibe). It came out in February 2012, and the ISSN is 2070-1721. The authors are R. Seggelmann and M. Tuexen from Muenster Univ. of Appl. Sciences, plus M. Williams from GWhiz Arts & Sciences ๐Ÿฆ‹. The block doesn't list anything it obsoletes or updates, so there's nothing to chase down there โœจ

Abstract

okay so this doc describes the Heartbeat Extension for TLS and DTLS ๐Ÿงš The main idea is that it gives you a brand-new protocol so you can keep a connection alive without doing a renegotiation, and it also gives DTLS a base for path MTU (PMTU) discovery ๐Ÿ’œ

Status of This Memo

This is an Internet Standards Track document ๐Ÿ‘‘

It's a product of the Internet Engineering Task Force (IETF), which means it reflects the consensus of the IETF community. It got public review and was approved for publication by the Internet Engineering Steering Group (IESG) ๐Ÿซถ If you want more on Internet Standards, check Section 2 of RFC 5741.

For the current status, any errata, and how to give feedback, go to http://www.rfc-editor.org/info/rfc6520 ๐Ÿ’…

Copyright (c) 2012 IETF Trust and the persons identified as the document authors. All rights reserved ๐ŸŒˆ

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) as they stand on the date of publication. Please actually read these, because they're about your rights and restrictions for this document. Code Components pulled out of this document have to include Simplified BSD License text, as described in Section 4.e of the Trust Legal Provisions, and they come without warranty, as described in the Simplified BSD License โญ

Table of Contents

1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.  Heartbeat Hello Extension . . . . . . . . . . . . . . . . . . . 3
3.  Heartbeat Protocol  . . . . . . . . . . . . . . . . . . . . . . 4
4.  Heartbeat Request and Response Messages . . . . . . . . . . . . 5
5.  Use Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
6.  IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 7
7.  Security Considerations . . . . . . . . . . . . . . . . . . . . 7
8.  Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . 7
9.  References  . . . . . . . . . . . . . . . . . . . . . . . . . . 7

1. Introduction โœจ

1.1. Overview

So this doc is all about the Heartbeat Extension for TLS and DTLS ๐Ÿฆ‹ It's defined in [RFC5246] and [RFC6347], and it also works with their adaptations to specific transport protocols, which are described in [RFC3436], [RFC5238], and [RFC6083].

DTLS is built to secure traffic running over unreliable transport protocols ๐Ÿ™ˆ Those usually have no session management. The only way DTLS can figure out whether a peer is still alive is a costly renegotiation, and that's especially painful when the application only sends traffic in one direction. On top of that, DTLS needs to do path MTU (PMTU) discovery, but it has no specific message type for that which won't mess with the transfer of user messages ๐Ÿ˜ญ

TLS sits on reliable protocols, but there isn't necessarily a feature that keeps the connection alive when there's no continuous data transfer ๐Ÿ’€

The Heartbeat Extension in this document fixes all of those limitations ๐Ÿ”ฅ The user can send the new HeartbeatRequest message, and the peer has to answer right away with a HeartbeatResponse. For PMTU discovery, HeartbeatRequest messages with padding can be used as probe packets, as described in [RFC4821] ๐Ÿ“

1.2. Conventions

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119] ๐Ÿ’œ

2. Heartbeat Hello Extension ๐ŸŽ€

Heartbeat support gets signalled with Hello Extensions โœจ But it's not just a yes or no. A peer can say it supports Heartbeats, and it can also pick whether it's willing to receive HeartbeatRequest messages and reply with HeartbeatResponse messages, or whether it's only willing to send HeartbeatRequest messages ๐Ÿ’… The first one is shown by using peer_allowed_to_send as the HeartbeatMode. The second one is shown by using peer_not_allowed_to_send as the Heartbeat mode. And this choice can change with every renegotiation ๐ŸŒธ

HeartbeatRequest messages MUST NOT be sent to a peer that's indicating peer_not_allowed_to_send. If an endpoint that indicated peer_not_allowed_to_send gets a HeartbeatRequest message, it SHOULD drop the message silently, and it MAY send an unexpected_message Alert message ๐Ÿ™ˆ

The format of the Heartbeat Hello Extension is defined like this:

enum {
   peer_allowed_to_send(1),
   peer_not_allowed_to_send(2),
   (255)
} HeartbeatMode;

struct {
   HeartbeatMode mode;
} HeartbeatExtension;

If an unknown mode comes in, an error Alert message using illegal_parameter as its AlertDescription MUST be sent back in response ๐Ÿšจ

3. Heartbeat Protocol ๐Ÿงš

The Heartbeat protocol is a brand-new protocol that runs on top of the Record Layer โœจ It has two message types: HeartbeatRequest and HeartbeatResponse ๐Ÿฆ‹

enum {
   heartbeat_request(1),
   heartbeat_response(2),
   (255)
} HeartbeatMessageType;

A HeartbeatRequest message can show up almost any time during the life of a connection ๐Ÿ‘‘ Whenever one is received, it SHOULD be answered with a matching HeartbeatResponse message ๐Ÿ’–

BUT a HeartbeatRequest message SHOULD NOT be sent during handshakes ๐Ÿ˜ญ If a handshake starts while a HeartbeatRequest is still in flight, the sending peer MUST stop the DTLS retransmission timer for it. The receiving peer SHOULD discard the message silently if it shows up during the handshake. For DTLS, HeartbeatRequest messages from older epochs SHOULD be discarded ๐ŸŒˆ

There MUST NOT be more than one HeartbeatRequest message in flight at a time ๐Ÿšซ A HeartbeatRequest message counts as in flight until the matching HeartbeatResponse message is received, or until the retransmit timer expires ๐Ÿซถ

When you're using an unreliable transport protocol like the Datagram Congestion Control Protocol (DCCP) or UDP, HeartbeatRequest messages MUST be retransmitted using the simple timeout and retransmission scheme that DTLS uses for flights, as described in Section 4.2.4 of [RFC6347] ๐Ÿ”ฅ Especially, after a number of retransmissions without getting a matching HeartbeatResponse message that has the expected payload, the DTLS connection SHOULD be terminated. The threshold used for this SHOULD be the same as for DTLS handshake messages ๐Ÿ’€ Also note that once the timer supervising a HeartbeatRequest message expires, that message is no longer considered in flight. So the HeartbeatRequest message is eligible for retransmission ๐Ÿ“ The retransmission scheme, together with the rule that only one HeartbeatRequest is allowed in flight, makes sure congestion control is handled properly when the transport protocol doesn't provide it, like DTLS over UDP โœจ

When you're using a reliable transport protocol like the Stream Control Transmission Protocol (SCTP) or TCP, HeartbeatRequest messages only need to be sent once ๐Ÿ’… The transport layer takes care of retransmissions. If no matching HeartbeatResponse message has been received after some amount of time, the DTLS/TLS connection MAY be terminated by the application that started sending the HeartbeatRequest message ๐ŸŽ€

4. Heartbeat Request and Response Messages ๐Ÿฆ‹

The Heartbeat protocol messages are made of their type plus an arbitrary payload and padding โœจ

struct {
   HeartbeatMessageType type;
   uint16 payload_length;
   opaque payload[HeartbeatMessage.payload_length];
   opaque padding[padding_length];
} HeartbeatMessage;

The total length of a HeartbeatMessage MUST NOT exceed 2^14, or max_fragment_length when it's negotiated as defined in [RFC6066] ๐Ÿšซ

Here's what each field is about:

  • type: The message type, either heartbeat_request or heartbeat_response.
  • payload_length: The length of the payload.
  • payload: The payload is arbitrary content.
  • padding: The padding is random content that MUST be ignored by the receiver. The length of a HeartbeatMessage is TLSPlaintext.length for TLS and DTLSPlaintext.length for DTLS. Also, the length of the type field is 1 byte, and the length of the payload_length is 2. So the padding_length is TLSPlaintext.length - payload_length - 3 for TLS and DTLSPlaintext.length - payload_length - 3 for DTLS. The padding_length MUST be at least 16 ๐Ÿงฎ

The sender of a HeartbeatMessage MUST use random padding of at least 16 bytes ๐ŸŽ€ The padding of a received HeartbeatMessage message MUST be ignored ๐Ÿ™ˆ

If the payload_length of a received HeartbeatMessage is too large, the received HeartbeatMessage MUST be discarded silently ๐Ÿ’€

When a HeartbeatRequest message is received and sending a HeartbeatResponse isn't prohibited anywhere else in this document, the receiver MUST send a matching HeartbeatResponse message that carries an exact copy of the payload from the HeartbeatRequest ๐Ÿซถ

If a received HeartbeatResponse message doesn't have the expected payload, the message MUST be discarded silently. If it does have the expected payload, the retransmission timer MUST be stopped ๐ŸŒธ

5. Use Cases ๐Ÿ’œ

Each endpoint sends HeartbeatRequest messages at a rate, with the padding, that the particular use case needs โœจ The endpoint should not expect its peer to send HeartbeatRequests. The directions are independent ๐Ÿฆ‹

5.1. Path MTU Discovery

DTLS does path MTU discovery as described in Section 4.1.1.1 of [RFC6347] ๐Ÿ”ฅ A detailed description of how to do path MTU discovery is in [RFC4821]. The probe packets that are needed are the HeartbeatRequest messages ๐Ÿ‘‘

This way of using HeartbeatRequest messages for DTLS is similar to the one for the Stream Control Transmission Protocol (SCTP), which uses the padding chunk (PAD-chunk) defined in [RFC4820] ๐Ÿงš

5.2. Liveliness Check

Sending HeartbeatRequest messages lets the sender make sure it can reach the peer and that the peer is alive ๐Ÿ’– Even with TLS/TCP, this allows checks at a much higher rate than the TCP keep-alive feature would allow ๐Ÿ˜ญ

On top of confirming the peer is still reachable, sending HeartbeatRequest messages refreshes the NAT state of all the NATs involved ๐ŸŒˆ

HeartbeatRequest messages SHOULD only be sent after an idle period that's at least multiple round-trip times long ๐Ÿซถ This idle period SHOULD be configurable, up to a period of multiple minutes and down to a period of one second โญ A default value for the idle period SHOULD be configurable, but it SHOULD also be tunable on a per-peer basis ๐Ÿ’…

6. IANA Considerations โœจ

Okay so IANA is the org that keeps all the official number lists, and they did some very important bestie work here ๐Ÿ“‹๐Ÿ’…

IANA assigned the heartbeat content type (24) from the "TLS ContentType Registry" as specified in [RFC5246]. The reference is to RFC 6520 ๐ŸŽ€

IANA created and now maintains a brand-new registry for Heartbeat Message Types ๐Ÿฆ‹ The message types are numbers in the range from 0 to 255 (decimal). IANA assigned the heartbeat_request (1) and the heartbeat_response (2) message types. The values 0 and 255 should be reserved ๐ŸŒธ This registry uses the Expert Review policy as described in [RFC5226]. The reference is to RFC 6520.

IANA assigned the heartbeat extension type (15) from the TLS "ExtensionType Values" registry as specified in [RFC5246]. The reference is to RFC 6520 โœจ

IANA created and now maintains another new registry, this one for Heartbeat Modes ๐Ÿงš The modes are numbers in the range from 0 to 255 (decimal). IANA assigned the peer_allowed_to_send (1) and the peer_not_allowed_to_send (2) modes. The values 0 and 255 should be reserved. This registry uses the Expert Review policy as described in [RFC5226]. The reference is to RFC 6520 ๐Ÿ’œ


7. Security Considerations ๐Ÿ”ฅ

Okay, this section is serious, bestie ๐Ÿ˜ญ The security considerations of [RFC5246] and [RFC6347] apply to this document. Those rules are still in full effect, no exceptions.

This document does not introduce any new security considerations. So no new drama from this one, but the old drama from those two RFCs still applies ๐Ÿ’€๐Ÿ™ˆ


8. Acknowledgments ๐Ÿซถ

The authors wish to thank Pasi Eronen, Adrian Farrel, Stephen Farrell, Adam Langley, Nikos Mavrogiannopoulos, Tom Petch, Eric Rescorla, Peter Saint-Andre, and Juho Vaehae-Herttua for their invaluable comments. They absolutely deserve all the flowers ๐Ÿ’๐Ÿ‘‘


9. References ๐Ÿ“š

9.1. Normative References

[RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
           Requirement Levels", BCP 14, RFC 2119, March 1997.

[RFC5226]  Narten, T. and H. Alvestrand, "Guidelines for Writing an
           IANA Considerations Section in RFCs", BCP 26, RFC 5226,
           May 2008.

[RFC5246]  Dierks, T. and E. Rescorla, "The Transport Layer Security
           (TLS) Protocol Version 1.2", RFC 5246, August 2008.

[RFC6066]  Eastlake, D., "Transport Layer Security (TLS) Extensions:
           Extension Definitions", RFC 6066, January 2011.

[RFC6347]  Rescorla, E. and N. Modadugu, "Datagram Transport Layer
           Security Version 1.2", RFC 6347, January 2012.

9.2. Informative References

[RFC3436]  Jungmaier, A., Rescorla, E., and M. Tuexen, "Transport
           Layer Security over Stream Control Transmission Protocol",
           RFC 3436, December 2002.

[RFC4820]  Tuexen, M., Stewart, R., and P. Lei, "Padding Chunk and
           Parameter for the Stream Control Transmission Protocol
           (SCTP)", RFC 4820, March 2007.

[RFC4821]  Mathis, M. and J. Heffner, "Packetization Layer Path MTU
           Discovery", RFC 4821, March 2007.

[RFC5238]  Phelan, T., "Datagram Transport Layer Security (DTLS) over
           the Datagram Congestion Control Protocol (DCCP)",
           RFC 5238, May 2008.

[RFC6083]  Tuexen, M., Seggelmann, R., and E. Rescorla, "Datagram
           Transport Layer Security (DTLS) for Stream Control
           Transmission Protocol (SCTP)", RFC 6083, January 2011.

Authors' Addresses ๐Ÿฆ‹

Robin Seggelmann
Muenster University of Applied Sciences
Stegerwaldstr. 39
48565 Steinfurt
DE

EMail: seggelmann@fh-muenster.de
Michael Tuexen
Muenster University of Applied Sciences
Stegerwaldstr. 39
48565 Steinfurt
DE

EMail: tuexen@fh-muenster.de
Michael Glenn Williams
GWhiz Arts & Sciences
2885 Denise Court
Newbury Park, CA, 91320
USA

EMail: michael.glenn.williams@gmail.com

That's the whole RFC, bestie! ๐ŸŒˆโœจ You made it through every single section ๐ŸŽ€๐Ÿ’–

๐Ÿ“ฆ where this page comes from