home *** CD-ROM | disk | FTP | other *** search
/ Internet Core Protocols / Oreilly-InternetCoreProtocols.iso / RFCs / rfc2401.txt < prev    next >
Encoding:
Text File  |  1999-10-14  |  167.8 KB  |  3,700 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                            S. Kent
  8. Request for Comments: 2401                                      BBN Corp
  9. Obsoletes: 1825                                              R. Atkinson
  10. Category: Standards Track                                  @Home Network
  11.                                                            November 1998
  12.  
  13.  
  14.             Security Architecture for the Internet Protocol
  15.  
  16. Status of this Memo
  17.  
  18.    This document specifies an Internet standards track protocol for the
  19.    Internet community, and requests discussion and suggestions for
  20.    improvements.  Please refer to the current edition of the "Internet
  21.    Official Protocol Standards" (STD 1) for the standardization state
  22.    and status of this protocol.  Distribution of this memo is unlimited.
  23.  
  24. Copyright Notice
  25.  
  26.    Copyright (C) The Internet Society (1998).  All Rights Reserved.
  27.  
  28. Table of Contents
  29.  
  30. 1. Introduction........................................................3
  31.   1.1 Summary of Contents of Document..................................3
  32.   1.2 Audience.........................................................3
  33.   1.3 Related Documents................................................4
  34. 2. Design Objectives...................................................4
  35.   2.1 Goals/Objectives/Requirements/Problem Description................4
  36.   2.2 Caveats and Assumptions..........................................5
  37. 3. System Overview.....................................................5
  38.   3.1 What IPsec Does..................................................6
  39.   3.2 How IPsec Works..................................................6
  40.   3.3 Where IPsec May Be Implemented...................................7
  41. 4. Security Associations...............................................8
  42.   4.1 Definition and Scope.............................................8
  43.   4.2 Security Association Functionality..............................10
  44.   4.3 Combining Security Associations.................................11
  45.   4.4 Security Association Databases..................................13
  46.      4.4.1 The Security Policy Database (SPD).........................14
  47.      4.4.2 Selectors..................................................17
  48.      4.4.3 Security Association Database (SAD)........................21
  49.   4.5 Basic Combinations of Security Associations.....................24
  50.   4.6 SA and Key Management...........................................26
  51.      4.6.1 Manual Techniques..........................................27
  52.      4.6.2 Automated SA and Key Management............................27
  53.      4.6.3 Locating a Security Gateway................................28
  54.   4.7 Security Associations and Multicast.............................29
  55.  
  56.  
  57.  
  58. Kent & Atkinson             Standards Track                     [Page 1]
  59.  
  60. RFC 2401              Security Architecture for IP         November 1998
  61.  
  62.  
  63. 5. IP Traffic Processing..............................................30
  64.   5.1 Outbound IP Traffic Processing..................................30
  65.      5.1.1 Selecting and Using an SA or SA Bundle.....................30
  66.      5.1.2 Header Construction for Tunnel Mode........................31
  67.         5.1.2.1 IPv4 -- Header Construction for Tunnel Mode...........31
  68.         5.1.2.2 IPv6 -- Header Construction for Tunnel Mode...........32
  69.   5.2 Processing Inbound IP Traffic...................................33
  70.      5.2.1 Selecting and Using an SA or SA Bundle.....................33
  71.      5.2.2 Handling of AH and ESP tunnels.............................34
  72. 6. ICMP Processing (relevant to IPsec)................................35
  73.   6.1 PMTU/DF Processing..............................................36
  74.      6.1.1 DF Bit.....................................................36
  75.      6.1.2 Path MTU Discovery (PMTU)..................................36
  76.         6.1.2.1 Propagation of PMTU...................................36
  77.         6.1.2.2 Calculation of PMTU...................................37
  78.         6.1.2.3 Granularity of PMTU Processing........................37
  79.         6.1.2.4 PMTU Aging............................................38
  80. 7. Auditing...........................................................39
  81. 8. Use in Systems Supporting Information Flow Security................39
  82.   8.1 Relationship Between Security Associations and Data Sensitivity.40
  83.   8.2 Sensitivity Consistency Checking................................40
  84.   8.3 Additional MLS Attributes for Security Association Databases....41
  85.   8.4 Additional Inbound Processing Steps for MLS Networking..........41
  86.   8.5 Additional Outbound Processing Steps for MLS Networking.........41
  87.   8.6 Additional MLS Processing for Security Gateways.................42
  88. 9. Performance Issues.................................................42
  89. 10. Conformance Requirements..........................................43
  90. 11. Security Considerations...........................................43
  91. 12. Differences from RFC 1825.........................................43
  92. Acknowledgements......................................................44
  93. Appendix A -- Glossary................................................45
  94. Appendix B -- Analysis/Discussion of PMTU/DF/Fragmentation Issues.....48
  95.   B.1 DF bit..........................................................48
  96.   B.2 Fragmentation...................................................48
  97.   B.3 Path MTU Discovery..............................................52
  98.      B.3.1 Identifying the Originating Host(s)........................53
  99.      B.3.2 Calculation of PMTU........................................55
  100.      B.3.3 Granularity of Maintaining PMTU Data.......................56
  101.      B.3.4 Per Socket Maintenance of PMTU Data........................57
  102.      B.3.5 Delivery of PMTU Data to the Transport Layer...............57
  103.      B.3.6 Aging of PMTU Data.........................................57
  104. Appendix C -- Sequence Space Window Code Example......................58
  105. Appendix D -- Categorization of ICMP messages.........................60
  106. References............................................................63
  107. Disclaimer............................................................64
  108. Author Information....................................................65
  109. Full Copyright Statement..............................................66
  110.  
  111.  
  112.  
  113.  
  114. Kent & Atkinson             Standards Track                     [Page 2]
  115.  
  116. RFC 2401              Security Architecture for IP         November 1998
  117.  
  118.  
  119. 1. Introduction
  120.  
  121. 1.1 Summary of Contents of Document
  122.  
  123.    This memo specifies the base architecture for IPsec compliant
  124.    systems.  The goal of the architecture is to provide various security
  125.    services for traffic at the IP layer, in both the IPv4 and IPv6
  126.    environments.  This document describes the goals of such systems,
  127.    their components and how they fit together with each other and into
  128.    the IP environment.  It also describes the security services offered
  129.    by the IPsec protocols, and how these services can be employed in the
  130.    IP environment.  This document does not address all aspects of IPsec
  131.    architecture.  Subsequent documents will address additional
  132.    architectural details of a more advanced nature, e.g., use of IPsec
  133.    in NAT environments and more complete support for IP multicast.  The
  134.    following fundamental components of the IPsec security architecture
  135.    are discussed in terms of their underlying, required functionality.
  136.    Additional RFCs (see Section 1.3 for pointers to other documents)
  137.    define the protocols in (a), (c), and (d).
  138.  
  139.         a. Security Protocols -- Authentication Header (AH) and
  140.            Encapsulating Security Payload (ESP)
  141.         b. Security Associations -- what they are and how they work,
  142.            how they are managed, associated processing
  143.         c. Key Management -- manual and automatic (The Internet Key
  144.            Exchange (IKE))
  145.         d. Algorithms for authentication and encryption
  146.  
  147.    This document is not an overall Security Architecture for the
  148.    Internet; it addresses security only at the IP layer, provided
  149.    through the use of a combination of cryptographic and protocol
  150.    security mechanisms.
  151.  
  152.    The keywords MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD,
  153.    SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL, when they appear in this
  154.    document, are to be interpreted as described in RFC 2119 [Bra97].
  155.  
  156. 1.2 Audience
  157.  
  158.    The target audience for this document includes implementers of this
  159.    IP security technology and others interested in gaining a general
  160.    background understanding of this system.  In particular, prospective
  161.    users of this technology (end users or system administrators) are
  162.    part of the target audience.  A glossary is provided as an appendix
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170. Kent & Atkinson             Standards Track                     [Page 3]
  171.  
  172. RFC 2401              Security Architecture for IP         November 1998
  173.  
  174.  
  175.    to help fill in gaps in background/vocabulary.  This document assumes
  176.    that the reader is familiar with the Internet Protocol, related
  177.    networking technology, and general security terms and concepts.
  178.  
  179. 1.3 Related Documents
  180.  
  181.    As mentioned above, other documents provide detailed definitions of
  182.    some of the components of IPsec and of their inter-relationship.
  183.    They include RFCs on the following topics:
  184.  
  185.         a. "IP Security Document Roadmap" [TDG97] -- a document
  186.            providing guidelines for specifications describing encryption
  187.            and authentication algorithms used in this system.
  188.         b. security protocols -- RFCs describing the Authentication
  189.            Header (AH) [KA98a] and Encapsulating Security Payload (ESP)
  190.            [KA98b] protocols.
  191.         c. algorithms for authentication and encryption -- a separate
  192.            RFC for each algorithm.
  193.         d. automatic key management -- RFCs on "The Internet Key
  194.            Exchange (IKE)" [HC98], "Internet Security Association and
  195.            Key Management Protocol (ISAKMP)" [MSST97],"The OAKLEY Key
  196.            Determination Protocol" [Orm97], and "The Internet IP
  197.            Security Domain of Interpretation for ISAKMP" [Pip98].
  198.  
  199. 2. Design Objectives
  200.  
  201. 2.1 Goals/Objectives/Requirements/Problem Description
  202.  
  203.    IPsec is designed to provide interoperable, high quality,
  204.    cryptographically-based security for IPv4 and IPv6.  The set of
  205.    security services offered includes access control, connectionless
  206.    integrity, data origin authentication, protection against replays (a
  207.    form of partial sequence integrity), confidentiality (encryption),
  208.    and limited traffic flow confidentiality.  These services are
  209.    provided at the IP layer, offering protection for IP and/or upper
  210.    layer protocols.
  211.  
  212.    These objectives are met through the use of two traffic security
  213.    protocols, the Authentication Header (AH) and the Encapsulating
  214.    Security Payload (ESP), and through the use of cryptographic key
  215.    management procedures and protocols.  The set of IPsec protocols
  216.    employed in any context, and the ways in which they are employed,
  217.    will be determined by the security and system requirements of users,
  218.    applications, and/or sites/organizations.
  219.  
  220.    When these mechanisms are correctly implemented and deployed, they
  221.    ought not to adversely affect users, hosts, and other Internet
  222.    components that do not employ these security mechanisms for
  223.  
  224.  
  225.  
  226. Kent & Atkinson             Standards Track                     [Page 4]
  227.  
  228. RFC 2401              Security Architecture for IP         November 1998
  229.  
  230.  
  231.    protection of their traffic.  These mechanisms also are designed to
  232.    be algorithm-independent.  This modularity permits selection of
  233.    different sets of algorithms without affecting the other parts of the
  234.    implementation.  For example, different user communities may select
  235.    different sets of algorithms (creating cliques) if required.
  236.  
  237.    A standard set of default algorithms is specified to facilitate
  238.    interoperability in the global Internet.  The use of these
  239.    algorithms, in conjunction with IPsec traffic protection and key
  240.    management protocols, is intended to permit system and application
  241.    developers to deploy high quality, Internet layer, cryptographic
  242.    security technology.
  243.  
  244. 2.2 Caveats and Assumptions
  245.  
  246.    The suite of IPsec protocols and associated default algorithms are
  247.    designed to provide high quality security for Internet traffic.
  248.    However, the security offered by use of these protocols ultimately
  249.    depends on the quality of the their implementation, which is outside
  250.    the scope of this set of standards.  Moreover, the security of a
  251.    computer system or network is a function of many factors, including
  252.    personnel, physical, procedural, compromising emanations, and
  253.    computer security practices.  Thus IPsec is only one part of an
  254.    overall system security architecture.
  255.  
  256.    Finally, the security afforded by the use of IPsec is critically
  257.    dependent on many aspects of the operating environment in which the
  258.    IPsec implementation executes.  For example, defects in OS security,
  259.    poor quality of random number sources, sloppy system management
  260.    protocols and practices, etc. can all degrade the security provided
  261.    by IPsec.  As above, none of these environmental attributes are
  262.    within the scope of this or other IPsec standards.
  263.  
  264. 3. System Overview
  265.  
  266.    This section provides a high level description of how IPsec works,
  267.    the components of the system, and how they fit together to provide
  268.    the security services noted above.  The goal of this description is
  269.    to enable the reader to "picture" the overall process/system, see how
  270.    it fits into the IP environment, and to provide context for later
  271.    sections of this document, which describe each of the components in
  272.    more detail.
  273.  
  274.    An IPsec implementation operates in a host or a security gateway
  275.    environment, affording protection to IP traffic.  The protection
  276.    offered is based on requirements defined by a Security Policy
  277.    Database (SPD) established and maintained by a user or system
  278.    administrator, or by an application operating within constraints
  279.  
  280.  
  281.  
  282. Kent & Atkinson             Standards Track                     [Page 5]
  283.  
  284. RFC 2401              Security Architecture for IP         November 1998
  285.  
  286.  
  287.    established by either of the above.  In general, packets are selected
  288.    for one of three processing modes based on IP and transport layer
  289.    header information (Selectors, Section 4.4.2) matched against entries
  290.    in the database (SPD).  Each packet is either afforded IPsec security
  291.    services, discarded, or allowed to bypass IPsec, based on the
  292.    applicable database policies identified by the Selectors.
  293.  
  294. 3.1 What IPsec Does
  295.  
  296.    IPsec provides security services at the IP layer by enabling a system
  297.    to select required security protocols, determine the algorithm(s) to
  298.    use for the service(s), and put in place any cryptographic keys
  299.    required to provide the requested services.  IPsec can be used to
  300.    protect one or more "paths" between a pair of hosts, between a pair
  301.    of security gateways, or between a security gateway and a host.  (The
  302.    term "security gateway" is used throughout the IPsec documents to
  303.    refer to an intermediate system that implements IPsec protocols.  For
  304.    example, a router or a firewall implementing IPsec is a security
  305.    gateway.)
  306.  
  307.    The set of security services that IPsec can provide includes access
  308.    control, connectionless integrity, data origin authentication,
  309.    rejection of replayed packets (a form of partial sequence integrity),
  310.    confidentiality (encryption), and limited traffic flow
  311.    confidentiality.  Because these services are provided at the IP
  312.    layer, they can be used by any higher layer protocol, e.g., TCP, UDP,
  313.    ICMP, BGP, etc.
  314.  
  315.    The IPsec DOI also supports negotiation of IP compression [SMPT98],
  316.    motivated in part by the observation that when encryption is employed
  317.    within IPsec, it prevents effective compression by lower protocol
  318.    layers.
  319.  
  320. 3.2 How IPsec Works
  321.  
  322.    IPsec uses two protocols to provide traffic security --
  323.    Authentication Header (AH) and Encapsulating Security Payload (ESP).
  324.    Both protocols are described in more detail in their respective RFCs
  325.    [KA98a, KA98b].
  326.  
  327.         o The IP Authentication Header (AH) [KA98a] provides
  328.           connectionless integrity, data origin authentication, and an
  329.           optional anti-replay service.
  330.         o The Encapsulating Security Payload (ESP) protocol [KA98b] may
  331.           provide confidentiality (encryption), and limited traffic flow
  332.           confidentiality.  It also may provide connectionless
  333.  
  334.  
  335.  
  336.  
  337.  
  338. Kent & Atkinson             Standards Track                     [Page 6]
  339.  
  340. RFC 2401              Security Architecture for IP         November 1998
  341.  
  342.  
  343.           integrity, data origin authentication, and an anti-replay
  344.           service.  (One or the other set of these security services
  345.           must be applied whenever ESP is invoked.)
  346.         o Both AH and ESP are vehicles for access control, based on the
  347.           distribution of cryptographic keys and the management of
  348.           traffic flows relative to these security protocols.
  349.  
  350.    These protocols may be applied alone or in combination with each
  351.    other to provide a desired set of security services in IPv4 and IPv6.
  352.    Each protocol supports two modes of use: transport mode and tunnel
  353.    mode.  In transport mode the protocols provide protection primarily
  354.    for upper layer protocols; in tunnel mode, the protocols are applied
  355.    to tunneled IP packets.  The differences between the two modes are
  356.    discussed in Section 4.
  357.  
  358.    IPsec allows the user (or system administrator) to control the
  359.    granularity at which a security service is offered.  For example, one
  360.    can create a single encrypted tunnel to carry all the traffic between
  361.    two security gateways or a separate encrypted tunnel can be created
  362.    for each TCP connection between each pair of hosts communicating
  363.    across these gateways.  IPsec management must incorporate facilities
  364.    for specifying:
  365.  
  366.         o which security services to use and in what combinations
  367.         o the granularity at which a given security protection should be
  368.           applied
  369.         o the algorithms used to effect cryptographic-based security
  370.  
  371.    Because these security services use shared secret values
  372.    (cryptographic keys), IPsec relies on a separate set of mechanisms
  373.    for putting these keys in place. (The keys are used for
  374.    authentication/integrity and encryption services.)  This document
  375.    requires support for both manual and automatic distribution of keys.
  376.    It specifies a specific public-key based approach (IKE -- [MSST97,
  377.    Orm97, HC98]) for automatic key management, but other automated key
  378.    distribution techniques MAY be used.  For example, KDC-based systems
  379.    such as Kerberos and other public-key systems such as SKIP could be
  380.    employed.
  381.  
  382. 3.3 Where IPsec May Be Implemented
  383.  
  384.    There are several ways in which IPsec may be implemented in a host or
  385.    in conjunction with a router or firewall (to create a security
  386.    gateway).  Several common examples are provided below:
  387.  
  388.         a. Integration of IPsec into the native IP implementation.  This
  389.            requires access to the IP source code and is applicable to
  390.            both hosts and security gateways.
  391.  
  392.  
  393.  
  394. Kent & Atkinson             Standards Track                     [Page 7]
  395.  
  396. RFC 2401              Security Architecture for IP         November 1998
  397.  
  398.  
  399.         b. "Bump-in-the-stack" (BITS) implementations, where IPsec is
  400.            implemented "underneath" an existing implementation of an IP
  401.            protocol stack, between the native IP and the local network
  402.            drivers.  Source code access for the IP stack is not required
  403.            in this context, making this implementation approach
  404.            appropriate for use with legacy systems.  This approach, when
  405.            it is adopted, is usually employed in hosts.
  406.  
  407.         c. The use of an outboard crypto processor is a common design
  408.            feature of network security systems used by the military, and
  409.            of some commercial systems as well.  It is sometimes referred
  410.            to as a "Bump-in-the-wire" (BITW) implementation.  Such
  411.            implementations may be designed to serve either a host or a
  412.            gateway (or both).  Usually the BITW device is IP
  413.            addressable.  When supporting a single host, it may be quite
  414.            analogous to a BITS implementation, but in supporting a
  415.            router or firewall, it must operate like a security gateway.
  416.  
  417. 4. Security Associations
  418.  
  419.    This section defines Security Association management requirements for
  420.    all IPv6 implementations and for those IPv4 implementations that
  421.    implement AH, ESP, or both.  The concept of a "Security Association"
  422.    (SA) is fundamental to IPsec.  Both AH and ESP make use of SAs and a
  423.    major function of IKE is the establishment and maintenance of
  424.    Security Associations.  All implementations of AH or ESP MUST support
  425.    the concept of a Security Association as described below.  The
  426.    remainder of this section describes various aspects of Security
  427.    Association management, defining required characteristics for SA
  428.    policy management, traffic processing, and SA management techniques.
  429.  
  430. 4.1 Definition and Scope
  431.  
  432.    A Security Association (SA) is a simplex "connection" that affords
  433.    security services to the traffic carried by it.  Security services
  434.    are afforded to an SA by the use of AH, or ESP, but not both.  If
  435.    both AH and ESP protection is applied to a traffic stream, then two
  436.    (or more) SAs are created to afford protection to the traffic stream.
  437.    To secure typical, bi-directional communication between two hosts, or
  438.    between two security gateways, two Security Associations (one in each
  439.    direction) are required.
  440.  
  441.    A security association is uniquely identified by a triple consisting
  442.    of a Security Parameter Index (SPI), an IP Destination Address, and a
  443.    security protocol (AH or ESP) identifier.  In principle, the
  444.    Destination Address may be a unicast address, an IP broadcast
  445.    address, or a multicast group address.  However, IPsec SA management
  446.    mechanisms currently are defined only for unicast SAs.  Hence, in the
  447.  
  448.  
  449.  
  450. Kent & Atkinson             Standards Track                     [Page 8]
  451.  
  452. RFC 2401              Security Architecture for IP         November 1998
  453.  
  454.  
  455.    discussions that follow, SAs will be described in the context of
  456.    point-to-point communication, even though the concept is applicable
  457.    in the point-to-multipoint case as well.
  458.  
  459.    As noted above, two types of SAs are defined: transport mode and
  460.    tunnel mode.  A transport mode SA is a security association between
  461.    two hosts.  In IPv4, a transport mode security protocol header
  462.    appears immediately after the IP header and any options, and before
  463.    any higher layer protocols (e.g., TCP or UDP).  In IPv6, the security
  464.    protocol header appears after the base IP header and extensions, but
  465.    may appear before or after destination options, and before higher
  466.    layer protocols.  In the case of ESP, a transport mode SA provides
  467.    security services only for these higher layer protocols, not for the
  468.    IP header or any extension headers preceding the ESP header.  In the
  469.    case of AH, the protection is also extended to selected portions of
  470.    the IP header, selected portions of extension headers, and selected
  471.    options (contained in the IPv4 header, IPv6 Hop-by-Hop extension
  472.    header, or IPv6 Destination extension headers).  For more details on
  473.    the coverage afforded by AH, see the AH specification [KA98a].
  474.  
  475.    A tunnel mode SA is essentially an SA applied to an IP tunnel.
  476.    Whenever either end of a security association is a security gateway,
  477.    the SA MUST be tunnel mode.  Thus an SA between two security gateways
  478.    is always a tunnel mode SA, as is an SA between a host and a security
  479.    gateway.  Note that for the case where traffic is destined for a
  480.    security gateway, e.g., SNMP commands, the security gateway is acting
  481.    as a host and transport mode is allowed.  But in that case, the
  482.    security gateway is not acting as a gateway, i.e., not transiting
  483.    traffic.  Two hosts MAY establish a tunnel mode SA between
  484.    themselves.  The requirement for any (transit traffic) SA involving a
  485.    security gateway to be a tunnel SA arises due to the need to avoid
  486.    potential problems with regard to fragmentation and reassembly of
  487.    IPsec packets, and in circumstances where multiple paths (e.g., via
  488.    different security gateways) exist to the same destination behind the
  489.    security gateways.
  490.  
  491.    For a tunnel mode SA, there is an "outer" IP header that specifies
  492.    the IPsec processing destination, plus an "inner" IP header that
  493.    specifies the (apparently) ultimate destination for the packet.  The
  494.    security protocol header appears after the outer IP header, and
  495.    before the inner IP header.  If AH is employed in tunnel mode,
  496.    portions of the outer IP header are afforded protection (as above),
  497.    as well as all of the tunneled IP packet (i.e., all of the inner IP
  498.    header is protected, as well as higher layer protocols).  If ESP is
  499.    employed, the protection is afforded only to the tunneled packet, not
  500.    to the outer header.
  501.  
  502.  
  503.  
  504.  
  505.  
  506. Kent & Atkinson             Standards Track                     [Page 9]
  507.  
  508. RFC 2401              Security Architecture for IP         November 1998
  509.  
  510.  
  511.    In summary,
  512.            a) A host MUST support both transport and tunnel mode.
  513.            b) A security gateway is required to support only tunnel
  514.               mode.  If it supports transport mode, that should be used
  515.               only when the security gateway is acting as a host, e.g.,
  516.               for network management.
  517.  
  518. 4.2 Security Association Functionality
  519.  
  520.    The set of security services offered by an SA depends on the security
  521.    protocol selected, the SA mode, the endpoints of the SA, and on the
  522.    election of optional services within the protocol.  For example, AH
  523.    provides data origin authentication and connectionless integrity for
  524.    IP datagrams (hereafter referred to as just "authentication").  The
  525.    "precision" of the authentication service is a function of the
  526.    granularity of the security association with which AH is employed, as
  527.    discussed in Section 4.4.2, "Selectors".
  528.  
  529.    AH also offers an anti-replay (partial sequence integrity) service at
  530.    the discretion of the receiver, to help counter denial of service
  531.    attacks.  AH is an appropriate protocol to employ when
  532.    confidentiality is not required (or is not permitted, e.g , due to
  533.    government restrictions on use of encryption).  AH also provides
  534.    authentication for selected portions of the IP header, which may be
  535.    necessary in some contexts.  For example, if the integrity of an IPv4
  536.    option or IPv6 extension header must be protected en route between
  537.    sender and receiver, AH can provide this service (except for the
  538.    non-predictable but mutable parts of the IP header.)
  539.  
  540.    ESP optionally provides confidentiality for traffic.  (The strength
  541.    of the confidentiality service depends in part, on the encryption
  542.    algorithm employed.)  ESP also may optionally provide authentication
  543.    (as defined above).  If authentication is negotiated for an ESP SA,
  544.    the receiver also may elect to enforce an anti-replay service with
  545.    the same features as the AH anti-replay service.  The scope of the
  546.    authentication offered by ESP is narrower than for AH, i.e., the IP
  547.    header(s) "outside" the ESP header is(are) not protected.  If only
  548.    the upper layer protocols need to be authenticated, then ESP
  549.    authentication is an appropriate choice and is more space efficient
  550.    than use of AH encapsulating ESP.  Note that although both
  551.    confidentiality and authentication are optional, they cannot both be
  552.    omitted. At least one of them MUST be selected.
  553.  
  554.    If confidentiality service is selected, then an ESP (tunnel mode) SA
  555.    between two security gateways can offer partial traffic flow
  556.    confidentiality.  The use of tunnel mode allows the inner IP headers
  557.    to be encrypted, concealing the identities of the (ultimate) traffic
  558.    source and destination.  Moreover, ESP payload padding also can be
  559.  
  560.  
  561.  
  562. Kent & Atkinson             Standards Track                    [Page 10]
  563.  
  564. RFC 2401              Security Architecture for IP         November 1998
  565.  
  566.  
  567.    invoked to hide the size of the packets, further concealing the
  568.    external characteristics of the traffic.  Similar traffic flow
  569.    confidentiality services may be offered when a mobile user is
  570.    assigned a dynamic IP address in a dialup context, and establishes a
  571.    (tunnel mode) ESP SA to a corporate firewall (acting as a security
  572.    gateway).  Note that fine granularity SAs generally are more
  573.    vulnerable to traffic analysis than coarse granularity ones which are
  574.    carrying traffic from many subscribers.
  575.  
  576. 4.3 Combining Security Associations
  577.  
  578.    The IP datagrams transmitted over an individual SA are afforded
  579.    protection by exactly one security protocol, either AH or ESP, but
  580.    not both.  Sometimes a security policy may call for a combination of
  581.    services for a particular traffic flow that is not achievable with a
  582.    single SA.  In such instances it will be necessary to employ multiple
  583.    SAs to implement the required security policy.  The term "security
  584.    association bundle" or "SA bundle" is applied to a sequence of SAs
  585.    through which traffic must be processed to satisfy a security policy.
  586.    The order of the sequence is defined by the policy.  (Note that the
  587.    SAs that comprise a bundle may terminate at different endpoints. For
  588.    example, one SA may extend between a mobile host and a security
  589.    gateway and a second, nested SA may extend to a host behind the
  590.    gateway.)
  591.  
  592.    Security associations may be combined into bundles in two ways:
  593.    transport adjacency and iterated tunneling.
  594.  
  595.            o Transport adjacency refers to applying more than one
  596.              security protocol to the same IP datagram, without invoking
  597.              tunneling.  This approach to combining AH and ESP allows
  598.              for only one level of combination; further nesting yields
  599.              no added benefit (assuming use of adequately strong
  600.              algorithms in each protocol) since the processing is
  601.              performed at one IPsec instance at the (ultimate)
  602.              destination.
  603.  
  604.              Host 1 --- Security ---- Internet -- Security --- Host 2
  605.               | |        Gwy 1                      Gwy 2        | |
  606.               | |                                                | |
  607.               | -----Security Association 1 (ESP transport)------- |
  608.               |                                                    |
  609.               -------Security Association 2 (AH transport)----------
  610.  
  611.            o Iterated tunneling refers to the application of multiple
  612.              layers of security protocols effected through IP tunneling.
  613.              This approach allows for multiple levels of nesting, since
  614.              each tunnel can originate or terminate at a different IPsec
  615.  
  616.  
  617.  
  618. Kent & Atkinson             Standards Track                    [Page 11]
  619.  
  620. RFC 2401              Security Architecture for IP         November 1998
  621.  
  622.  
  623.              site along the path.  No special treatment is expected for
  624.              ISAKMP traffic at intermediate security gateways other than
  625.              what can be specified through appropriate SPD entries (See
  626.              Case 3 in Section 4.5)
  627.  
  628.              There are 3 basic cases of iterated tunneling -- support is
  629.              required only for cases 2 and 3.:
  630.  
  631.              1. both endpoints for the SAs are the same -- The inner and
  632.                 outer tunnels could each be either AH or ESP, though it
  633.                 is unlikely that Host 1 would specify both to be the
  634.                 same, i.e., AH inside of AH or ESP inside of ESP.
  635.  
  636.                 Host 1 --- Security ---- Internet -- Security --- Host 2
  637.                  | |        Gwy 1                      Gwy 2        | |
  638.                  | |                                                | |
  639.                  | -------Security Association 1 (tunnel)---------- | |
  640.                  |                                                    |
  641.                  ---------Security Association 2 (tunnel)--------------
  642.  
  643.              2. one endpoint of the SAs is the same -- The inner and
  644.                 uter tunnels could each be either AH or ESP.
  645.  
  646.                 Host 1 --- Security ---- Internet -- Security --- Host 2
  647.                  | |        Gwy 1                      Gwy 2         |
  648.                  | |                                     |           |
  649.                  | ----Security Association 1 (tunnel)----           |
  650.                  |                                                   |
  651.                  ---------Security Association 2 (tunnel)-------------
  652.  
  653.              3. neither endpoint is the same -- The inner and outer
  654.                 tunnels could each be either AH or ESP.
  655.  
  656.                 Host 1 --- Security ---- Internet -- Security --- Host 2
  657.                  |          Gwy 1                      Gwy 2         |
  658.                  |            |                          |           |
  659.                  |            --Security Assoc 1 (tunnel)-           |
  660.                  |                                                   |
  661.                  -----------Security Association 2 (tunnel)-----------
  662.  
  663.    These two approaches also can be combined, e.g., an SA bundle could
  664.    be constructed from one tunnel mode SA and one or two transport mode
  665.    SAs, applied in sequence.  (See Section 4.5 "Basic Combinations of
  666.    Security Associations.") Note that nested tunnels can also occur
  667.    where neither the source nor the destination endpoints of any of the
  668.    tunnels are the same.  In that case, there would be no host or
  669.    security gateway with a bundle corresponding to the nested tunnels.
  670.  
  671.  
  672.  
  673.  
  674. Kent & Atkinson             Standards Track                    [Page 12]
  675.  
  676. RFC 2401              Security Architecture for IP         November 1998
  677.  
  678.  
  679.    For transport mode SAs, only one ordering of security protocols seems
  680.    appropriate.  AH is applied to both the upper layer protocols and
  681.    (parts of) the IP header.  Thus if AH is used in a transport mode, in
  682.    conjunction with ESP, AH SHOULD appear as the first header after IP,
  683.    prior to the appearance of ESP.  In that context, AH is applied to
  684.    the ciphertext output of ESP.  In contrast, for tunnel mode SAs, one
  685.    can imagine uses for various orderings of AH and ESP.  The required
  686.    set of SA bundle types that MUST be supported by a compliant IPsec
  687.    implementation is described in Section 4.5.
  688.  
  689. 4.4 Security Association Databases
  690.  
  691.    Many of the details associated with processing IP traffic in an IPsec
  692.    implementation are largely a local matter, not subject to
  693.    standardization.  However, some external aspects of the processing
  694.    must be standardized, to ensure interoperability and to provide a
  695.    minimum management capability that is essential for productive use of
  696.    IPsec.  This section describes a general model for processing IP
  697.    traffic relative to security associations, in support of these
  698.    interoperability and functionality goals.  The model described below
  699.    is nominal; compliant implementations need not match details of this
  700.    model as presented, but the external behavior of such implementations
  701.    must be mappable to the externally observable characteristics of this
  702.    model.
  703.  
  704.    There are two nominal databases in this model: the Security Policy
  705.    Database and the Security Association Database.  The former specifies
  706.    the policies that determine the disposition of all IP traffic inbound
  707.    or outbound from a host, security gateway, or BITS or BITW IPsec
  708.    implementation.  The latter database contains parameters that are
  709.    associated with each (active) security association.  This section
  710.    also defines the concept of a Selector, a set of IP and upper layer
  711.    protocol field values that is used by the Security Policy Database to
  712.    map traffic to a policy, i.e., an SA (or SA bundle).
  713.  
  714.    Each interface for which IPsec is enabled requires nominally separate
  715.    inbound vs. outbound databases (SAD and SPD), because of the
  716.    directionality of many of the fields that are used as selectors.
  717.    Typically there is just one such interface, for a host or security
  718.    gateway (SG).  Note that an SG would always have at least 2
  719.    interfaces, but the "internal" one to the corporate net, usually
  720.    would not have IPsec enabled and so only one pair of SADs and one
  721.    pair of SPDs would be needed.  On the other hand, if a host had
  722.    multiple interfaces or an SG had multiple external interfaces, it
  723.    might be necessary to have separate SAD and SPD pairs for each
  724.    interface.
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Kent & Atkinson             Standards Track                    [Page 13]
  731.  
  732. RFC 2401              Security Architecture for IP         November 1998
  733.  
  734.  
  735. 4.4.1 The Security Policy Database (SPD)
  736.  
  737.    Ultimately, a security association is a management construct used to
  738.    enforce a security policy in the IPsec environment.  Thus an
  739.    essential element of SA processing is an underlying Security Policy
  740.    Database (SPD) that specifies what services are to be offered to IP
  741.    datagrams and in what fashion.  The form of the database and its
  742.    interface are outside the scope of this specification.  However, this
  743.    section does specify certain minimum management functionality that
  744.    must be provided, to allow a user or system administrator to control
  745.    how IPsec is applied to traffic transmitted or received by a host or
  746.    transiting a security gateway.
  747.  
  748.    The SPD must be consulted during the processing of all traffic
  749.    (INBOUND and OUTBOUND), including non-IPsec traffic.  In order to
  750.    support this, the SPD requires distinct entries for inbound and
  751.    outbound traffic.  One can think of this as separate SPDs (inbound
  752.    vs.  outbound).  In addition, a nominally separate SPD must be
  753.    provided for each IPsec-enabled interface.
  754.  
  755.    An SPD must discriminate among traffic that is afforded IPsec
  756.    protection and traffic that is allowed to bypass IPsec.  This applies
  757.    to the IPsec protection to be applied by a sender and to the IPsec
  758.    protection that must be present at the receiver.  For any outbound or
  759.    inbound datagram, three processing choices are possible: discard,
  760.    bypass IPsec, or apply IPsec.  The first choice refers to traffic
  761.    that is not allowed to exit the host, traverse the security gateway,
  762.    or be delivered to an application at all.  The second choice refers
  763.    to traffic that is allowed to pass without additional IPsec
  764.    protection.  The third choice refers to traffic that is afforded
  765.    IPsec protection, and for such traffic the SPD must specify the
  766.    security services to be provided, protocols to be employed,
  767.    algorithms to be used, etc.
  768.  
  769.    For every IPsec implementation, there MUST be an administrative
  770.    interface that allows a user or system administrator to manage the
  771.    SPD.  Specifically, every inbound or outbound packet is subject to
  772.    processing by IPsec and the SPD must specify what action will be
  773.    taken in each case.  Thus the administrative interface must allow the
  774.    user (or system administrator) to specify the security processing to
  775.    be applied to any packet entering or exiting the system, on a packet
  776.    by packet basis.  (In a host IPsec implementation making use of a
  777.    socket interface, the SPD may not need to be consulted on a per
  778.    packet basis, but the effect is still the same.)  The management
  779.    interface for the SPD MUST allow creation of entries consistent with
  780.    the selectors defined in Section 4.4.2, and MUST support (total)
  781.    ordering of these entries.  It is expected that through the use of
  782.    wildcards in various selector fields, and because all packets on a
  783.  
  784.  
  785.  
  786. Kent & Atkinson             Standards Track                    [Page 14]
  787.  
  788. RFC 2401              Security Architecture for IP         November 1998
  789.  
  790.  
  791.    single UDP or TCP connection will tend to match a single SPD entry,
  792.    this requirement will not impose an unreasonably detailed level of
  793.    SPD specification.  The selectors are analogous to what are found in
  794.    a stateless firewall or filtering router and which are currently
  795.    manageable this way.
  796.  
  797.    In host systems, applications MAY be allowed to select what security
  798.    processing is to be applied to the traffic they generate and consume.
  799.    (Means of signalling such requests to the IPsec implementation are
  800.    outside the scope of this standard.)  However, the system
  801.    administrator MUST be able to specify whether or not a user or
  802.    application can override (default) system policies.  Note that
  803.    application specified policies may satisfy system requirements, so
  804.    that the system may not need to do additional IPsec processing beyond
  805.    that needed to meet an application's requirements.  The form of the
  806.    management interface is not specified by this document and may differ
  807.    for hosts vs. security gateways, and within hosts the interface may
  808.    differ for socket-based vs.  BITS implementations.  However, this
  809.    document does specify a standard set of SPD elements that all IPsec
  810.    implementations MUST support.
  811.  
  812.    The SPD contains an ordered list of policy entries.  Each policy
  813.    entry is keyed by one or more selectors that define the set of IP
  814.    traffic encompassed by this policy entry.  (The required selector
  815.    types are defined in Section 4.4.2.)  These define the granularity of
  816.    policies or SAs.  Each entry includes an indication of whether
  817.    traffic matching this policy will be bypassed, discarded, or subject
  818.    to IPsec processing.  If IPsec processing is to be applied, the entry
  819.    includes an SA (or SA bundle) specification, listing the IPsec
  820.    protocols, modes, and algorithms to be employed, including any
  821.    nesting requirements.  For example, an entry may call for all
  822.    matching traffic to be protected by ESP in transport mode using
  823.    3DES-CBC with an explicit IV, nested inside of AH in tunnel mode
  824.    using HMAC/SHA-1.  For each selector, the policy entry specifies how
  825.    to derive the corresponding values for a new Security Association
  826.    Database (SAD, see Section 4.4.3) entry from those in the SPD and the
  827.    packet (Note that at present, ranges are only supported for IP
  828.    addresses; but wildcarding can be expressed for all selectors):
  829.  
  830.            a. use the value in the packet itself -- This will limit use
  831.               of the SA to those packets which have this packet's value
  832.               for the selector even if the selector for the policy entry
  833.               has a range of allowed values or a wildcard for this
  834.               selector.
  835.            b. use the value associated with the policy entry -- If this
  836.               were to be just a single value, then there would be no
  837.               difference between (b) and (a).  However, if the allowed
  838.               values for the selector are a range (for IP addresses) or
  839.  
  840.  
  841.  
  842. Kent & Atkinson             Standards Track                    [Page 15]
  843.  
  844. RFC 2401              Security Architecture for IP         November 1998
  845.  
  846.  
  847.               wildcard, then in the case of a range,(b) would enable use
  848.               of the SA by any packet with a selector value within the
  849.               range not just by packets with the selector value of the
  850.               packet that triggered the creation of the SA.  In the case
  851.               of a wildcard, (b) would allow use of the SA by packets
  852.               with any value for this selector.
  853.  
  854.    For example, suppose there is an SPD entry where the allowed value
  855.    for source address is any of a range of hosts (192.168.2.1 to
  856.    192.168.2.10).  And suppose that a packet is to be sent that has a
  857.    source address of 192.168.2.3.  The value to be used for the SA could
  858.    be any of the sample values below depending on what the policy entry
  859.    for this selector says is the source of the selector value:
  860.  
  861.            source for the  example of
  862.            value to be     new SAD
  863.            used in the SA  selector value
  864.            --------------- ------------
  865.            a. packet       192.168.2.3 (one host)
  866.            b. SPD entry    192.168.2.1 to 192.168.2.10 (range of hosts)
  867.  
  868.    Note that if the SPD entry had an allowed value of wildcard for the
  869.    source address, then the SAD selector value could be wildcard (any
  870.    host).  Case (a) can be used to prohibit sharing, even among packets
  871.    that match the same SPD entry.
  872.  
  873.    As described below in Section 4.4.3, selectors may include "wildcard"
  874.    entries and hence the selectors for two entries may overlap.  (This
  875.    is analogous to the overlap that arises with ACLs or filter entries
  876.    in routers or packet filtering firewalls.)  Thus, to ensure
  877.    consistent, predictable processing, SPD entries MUST be ordered and
  878.    the SPD MUST always be searched in the same order, so that the first
  879.    matching entry is consistently selected.  (This requirement is
  880.    necessary as the effect of processing traffic against SPD entries
  881.    must be deterministic, but there is no way to canonicalize SPD
  882.    entries given the use of wildcards for some selectors.)  More detail
  883.    on matching of packets against SPD entries is provided in Section 5.
  884.  
  885.    Note that if ESP is specified, either (but not both) authentication
  886.    or encryption can be omitted.  So it MUST be possible to configure
  887.    the SPD value for the authentication or encryption algorithms to be
  888.    "NULL".  However, at least one of these services MUST be selected,
  889.    i.e., it MUST NOT be possible to configure both of them as "NULL".
  890.  
  891.    The SPD can be used to map traffic to specific SAs or SA bundles.
  892.    Thus it can function both as the reference database for security
  893.    policy and as the map to existing SAs (or SA bundles).  (To
  894.    accommodate the bypass and discard policies cited above, the SPD also
  895.  
  896.  
  897.  
  898. Kent & Atkinson             Standards Track                    [Page 16]
  899.  
  900. RFC 2401              Security Architecture for IP         November 1998
  901.  
  902.  
  903.    MUST provide a means of mapping traffic to these functions, even
  904.    though they are not, per se, IPsec processing.)  The way in which the
  905.    SPD operates is different for inbound vs. outbound traffic and it
  906.    also may differ for host vs.  security gateway, BITS, and BITW
  907.    implementations.  Sections 5.1 and 5.2 describe the use of the SPD
  908.    for outbound and inbound processing, respectively.
  909.  
  910.    Because a security policy may require that more than one SA be
  911.    applied to a specified set of traffic, in a specific order, the
  912.    policy entry in the SPD must preserve these ordering requirements,
  913.    when present.  Thus, it must be possible for an IPsec implementation
  914.    to determine that an outbound or inbound packet must be processed
  915.    thorough a sequence of SAs.  Conceptually, for outbound processing,
  916.    one might imagine links (to the SAD) from an SPD entry for which
  917.    there are active SAs, and each entry would consist of either a single
  918.    SA or an ordered list of SAs that comprise an SA bundle.  When a
  919.    packet is matched against an SPD entry and there is an existing SA or
  920.    SA bundle that can be used to carry the traffic, the processing of
  921.    the packet is controlled by the SA or SA bundle entry on the list.
  922.    For an inbound IPsec packet for which multiple IPsec SAs are to be
  923.    applied, the lookup based on destination address, IPsec protocol, and
  924.    SPI should identify a single SA.
  925.  
  926.    The SPD is used to control the flow of ALL traffic through an IPsec
  927.    system, including security and key management traffic (e.g., ISAKMP)
  928.    from/to entities behind a security gateway.  This means that ISAKMP
  929.    traffic must be explicitly accounted for in the SPD, else it will be
  930.    discarded.  Note that a security gateway could prohibit traversal of
  931.    encrypted packets in various ways, e.g., having a DISCARD entry in
  932.    the SPD for ESP packets or providing proxy key exchange.  In the
  933.    latter case, the traffic would be internally routed to the key
  934.    management module in the security gateway.
  935.  
  936. 4.4.2  Selectors
  937.  
  938.    An SA (or SA bundle) may be fine-grained or coarse-grained, depending
  939.    on the selectors used to define the set of traffic for the SA.  For
  940.    example, all traffic between two hosts may be carried via a single
  941.    SA, and afforded a uniform set of security services.  Alternatively,
  942.    traffic between a pair of hosts might be spread over multiple SAs,
  943.    depending on the applications being used (as defined by the Next
  944.    Protocol and Port fields), with different security services offered
  945.    by different SAs.  Similarly, all traffic between a pair of security
  946.    gateways could be carried on a single SA, or one SA could be assigned
  947.    for each communicating host pair.  The following selector parameters
  948.    MUST be supported for SA management to facilitate control of SA
  949.    granularity.  Note that in the case of receipt of a packet with an
  950.    ESP header, e.g., at an encapsulating security gateway or BITW
  951.  
  952.  
  953.  
  954. Kent & Atkinson             Standards Track                    [Page 17]
  955.  
  956. RFC 2401              Security Architecture for IP         November 1998
  957.  
  958.  
  959.    implementation, the transport layer protocol, source/destination
  960.    ports, and Name (if present) may be "OPAQUE", i.e., inaccessible
  961.    because of encryption or fragmentation.  Note also that both Source
  962.    and Destination addresses should either be IPv4 or IPv6.
  963.  
  964.       - Destination IP Address (IPv4 or IPv6): this may be a single IP
  965.         address (unicast, anycast, broadcast (IPv4 only), or multicast
  966.         group), a range of addresses (high and low values (inclusive),
  967.         address + mask, or a wildcard address.  The last three are used
  968.         to support more than one destination system sharing the same SA
  969.         (e.g., behind a security gateway). Note that this selector is
  970.         conceptually different from the "Destination IP Address" field
  971.         in the <Destination IP Address, IPsec Protocol, SPI> tuple used
  972.         to uniquely identify an SA.  When a tunneled packet arrives at
  973.         the tunnel endpoint, its SPI/Destination address/Protocol are
  974.         used to look up the SA for this packet in the SAD.  This
  975.         destination address comes from the encapsulating IP header.
  976.         Once the packet has been processed according to the tunnel SA
  977.         and has come out of the tunnel, its selectors are "looked up" in
  978.         the Inbound SPD.  The Inbound SPD has a selector called
  979.         destination address.  This IP destination address is the one in
  980.         the inner (encapsulated) IP header.  In the case of a
  981.         transport'd packet, there will be only one IP header and this
  982.         ambiguity does not exist.  [REQUIRED for all implementations]
  983.  
  984.       - Source IP Address(es) (IPv4 or IPv6): this may be a single IP
  985.         address (unicast, anycast, broadcast (IPv4 only), or multicast
  986.         group), range of addresses (high and low values inclusive),
  987.         address + mask, or a wildcard address.  The last three are used
  988.         to support more than one source system sharing the same SA
  989.         (e.g., behind a security gateway or in a multihomed host).
  990.         [REQUIRED for all implementations]
  991.  
  992.       - Name: There are 2 cases (Note that these name forms are
  993.         supported in the IPsec DOI.)
  994.                 1. User ID
  995.                     a. a fully qualified user name string (DNS), e.g.,
  996.                        mozart@foo.bar.com
  997.                     b. X.500 distinguished name, e.g., C = US, SP = MA,
  998.                        O = GTE Internetworking, CN = Stephen T. Kent.
  999.                 2. System name (host, security gateway, etc.)
  1000.                     a. a fully qualified DNS name, e.g., foo.bar.com
  1001.                     b. X.500 distinguished name
  1002.                     c. X.500 general name
  1003.  
  1004.         NOTE: One of the possible values of this selector is "OPAQUE".
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010. Kent & Atkinson             Standards Track                    [Page 18]
  1011.  
  1012. RFC 2401              Security Architecture for IP         November 1998
  1013.  
  1014.  
  1015.         [REQUIRED for the following cases.  Note that support for name
  1016.         forms other than addresses is not required for manually keyed
  1017.         SAs.
  1018.                 o User ID
  1019.                     - native host implementations
  1020.                     - BITW and BITS implementations acting as HOSTS
  1021.                       with only one user
  1022.                     - security gateway implementations for INBOUND
  1023.                       processing.
  1024.                 o System names -- all implementations]
  1025.  
  1026.       - Data sensitivity level: (IPSO/CIPSO labels)
  1027.         [REQUIRED for all systems providing information flow security as
  1028.         per Section 8, OPTIONAL for all other systems.]
  1029.  
  1030.       - Transport Layer Protocol: Obtained from the IPv4 "Protocol" or
  1031.         the IPv6 "Next Header" fields.  This may be an individual
  1032.         protocol number.  These packet fields may not contain the
  1033.         Transport Protocol due to the presence of IP extension headers,
  1034.         e.g., a Routing Header, AH, ESP, Fragmentation Header,
  1035.         Destination Options, Hop-by-hop options, etc.  Note that the
  1036.         Transport Protocol may not be available in the case of receipt
  1037.         of a packet with an ESP header, thus a value of "OPAQUE" SHOULD
  1038.         be supported.
  1039.         [REQUIRED for all implementations]
  1040.  
  1041.         NOTE: To locate the transport protocol, a system has to chain
  1042.         through the packet headers checking the "Protocol" or "Next
  1043.         Header" field until it encounters either one it recognizes as a
  1044.         transport protocol, or until it reaches one that isn't on its
  1045.         list of extension headers, or until it encounters an ESP header
  1046.         that renders the transport protocol opaque.
  1047.  
  1048.       - Source and Destination (e.g., TCP/UDP) Ports: These may be
  1049.         individual UDP or TCP port values or a wildcard port.  (The use
  1050.         of the Next Protocol field and the Source and/or Destination
  1051.         Port fields (in conjunction with the Source and/or Destination
  1052.         Address fields), as an SA selector is sometimes referred to as
  1053.         "session-oriented keying.").  Note that the source and
  1054.         destination ports may not be available in the case of receipt of
  1055.         a packet with an ESP header, thus a value of "OPAQUE" SHOULD be
  1056.         supported.
  1057.  
  1058.         The following table summarizes the relationship between the
  1059.         "Next Header" value in the packet and SPD and the derived Port
  1060.         Selector value for the SPD and SAD.
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066. Kent & Atkinson             Standards Track                    [Page 19]
  1067.  
  1068. RFC 2401              Security Architecture for IP         November 1998
  1069.  
  1070.  
  1071.           Next Hdr        Transport Layer   Derived Port Selector Field
  1072.           in Packet       Protocol in SPD   Value in SPD and SAD
  1073.           --------        ---------------   ---------------------------
  1074.           ESP             ESP or ANY        ANY (i.e., don't look at it)
  1075.           -don't care-    ANY               ANY (i.e., don't look at it)
  1076.           specific value  specific value    NOT ANY (i.e., drop packet)
  1077.              fragment
  1078.           specific value  specific value    actual port selector field
  1079.              not fragment
  1080.  
  1081.         If the packet has been fragmented, then the port information may
  1082.         not be available in the current fragment.  If so, discard the
  1083.         fragment.  An ICMP PMTU should be sent for the first fragment,
  1084.         which will have the port information.  [MAY be supported]
  1085.  
  1086.    The IPsec implementation context determines how selectors are used.
  1087.    For example, a host implementation integrated into the stack may make
  1088.    use of a socket interface.  When a new connection is established the
  1089.    SPD can be consulted and an SA (or SA bundle) bound to the socket.
  1090.    Thus traffic sent via that socket need not result in additional
  1091.    lookups to the SPD/SAD.  In contrast, a BITS, BITW, or security
  1092.    gateway implementation needs to look at each packet and perform an
  1093.    SPD/SAD lookup based on the selectors. The allowable values for the
  1094.    selector fields differ between the traffic flow, the security
  1095.    association, and the security policy.
  1096.  
  1097.    The following table summarizes the kinds of entries that one needs to
  1098.    be able to express in the SPD and SAD.  It shows how they relate to
  1099.    the fields in data traffic being subjected to IPsec screening.
  1100.    (Note: the "wild" or "wildcard" entry for src and dst addresses
  1101.    includes a mask, range, etc.)
  1102.  
  1103.  Field         Traffic Value       SAD Entry            SPD Entry
  1104.  --------      -------------   ----------------   --------------------
  1105.  src addr      single IP addr  single,range,wild  single,range,wildcard
  1106.  dst addr      single IP addr  single,range,wild  single,range,wildcard
  1107.  xpt protocol* xpt protocol    single,wildcard    single,wildcard
  1108.  src port*     single src port single,wildcard    single,wildcard
  1109.  dst port*     single dst port single,wildcard    single,wildcard
  1110.  user id*      single user id  single,wildcard    single,wildcard
  1111.  sec. labels   single value    single,wildcard    single,wildcard
  1112.  
  1113.        * The SAD and SPD entries for these fields could be "OPAQUE"
  1114.          because the traffic value is encrypted.
  1115.  
  1116.    NOTE: In principle, one could have selectors and/or selector values
  1117.    in the SPD which cannot be negotiated for an SA or SA bundle.
  1118.    Examples might include selector values used to select traffic for
  1119.  
  1120.  
  1121.  
  1122. Kent & Atkinson             Standards Track                    [Page 20]
  1123.  
  1124. RFC 2401              Security Architecture for IP         November 1998
  1125.  
  1126.  
  1127.    discarding or enumerated lists which cause a separate SA to be
  1128.    created for each item on the list.  For now, this is left for future
  1129.    versions of this document and the list of required selectors and
  1130.    selector values is the same for the SPD and the SAD.  However, it is
  1131.    acceptable to have an administrative interface that supports use of
  1132.    selector values which cannot be negotiated provided that it does not
  1133.    mislead the user into believing it is creating an SA with these
  1134.    selector values.  For example, the interface may allow the user to
  1135.    specify an enumerated list of values but would result in the creation
  1136.    of a separate policy and SA for each item on the list.  A vendor
  1137.    might support such an interface to make it easier for its customers
  1138.    to specify clear and concise policy specifications.
  1139.  
  1140. 4.4.3 Security Association Database (SAD)
  1141.  
  1142.    In each IPsec implementation there is a nominal Security Association
  1143.    Database, in which each entry defines the parameters associated with
  1144.    one SA.  Each SA has an entry in the SAD.  For outbound processing,
  1145.    entries are pointed to by entries in the SPD.  Note that if an SPD
  1146.    entry does not currently point to an SA that is appropriate for the
  1147.    packet, the implementation creates an appropriate SA (or SA Bundle)
  1148.    and links the SPD entry to the SAD entry (see Section 5.1.1).  For
  1149.    inbound processing, each entry in the SAD is indexed by a destination
  1150.    IP address, IPsec protocol type, and SPI.  The following parameters
  1151.    are associated with each entry in the SAD.  This description does not
  1152.    purport to be a MIB, but only a specification of the minimal data
  1153.    items required to support an SA in an IPsec implementation.
  1154.  
  1155.    For inbound processing: The following packet fields are used to look
  1156.    up the SA in the SAD:
  1157.  
  1158.          o Outer Header's Destination IP address: the IPv4 or IPv6
  1159.            Destination address.
  1160.            [REQUIRED for all implementations]
  1161.          o IPsec Protocol: AH or ESP, used as an index for SA lookup
  1162.            in this database.  Specifies the IPsec protocol to be
  1163.            applied to the traffic on this SA.
  1164.            [REQUIRED for all implementations]
  1165.          o SPI: the 32-bit value used to distinguish among different
  1166.            SAs terminating at the same destination and using the same
  1167.            IPsec protocol.
  1168.            [REQUIRED for all implementations]
  1169.  
  1170.    For each of the selectors defined in Section 4.4.2, the SA entry in
  1171.    the SAD MUST contain the value or values which were negotiated at the
  1172.    time the SA was created.  For the sender, these values are used to
  1173.    decide whether a given SA is appropriate for use with an outbound
  1174.    packet.  This is part of checking to see if there is an existing SA
  1175.  
  1176.  
  1177.  
  1178. Kent & Atkinson             Standards Track                    [Page 21]
  1179.  
  1180. RFC 2401              Security Architecture for IP         November 1998
  1181.  
  1182.  
  1183.    that can be used.  For the receiver, these values are used to check
  1184.    that the selector values in an inbound packet match those for the SA
  1185.    (and thus indirectly those for the matching policy).  For the
  1186.    receiver, this is part of verifying that the SA was appropriate for
  1187.    this packet.  (See Section 6 for rules for ICMP messages.)  These
  1188.    fields can have the form of specific values, ranges, wildcards, or
  1189.    "OPAQUE" as described in section 4.4.2, "Selectors".  Note that for
  1190.    an ESP SA, the encryption algorithm or the authentication algorithm
  1191.    could be "NULL".  However they MUST not both be "NULL".
  1192.  
  1193.    The following SAD fields are used in doing IPsec processing:
  1194.  
  1195.          o Sequence Number Counter: a 32-bit value used to generate the
  1196.            Sequence Number field in AH or ESP headers.
  1197.            [REQUIRED for all implementations, but used only for outbound
  1198.            traffic.]
  1199.          o Sequence Counter Overflow: a flag indicating whether overflow
  1200.            of the Sequence Number Counter should generate an auditable
  1201.            event and prevent transmission of additional packets on the
  1202.            SA.
  1203.            [REQUIRED for all implementations, but used only for outbound
  1204.            traffic.]
  1205.          o Anti-Replay Window: a 32-bit counter and a bit-map (or
  1206.            equivalent) used to determine whether an inbound AH or ESP
  1207.            packet is a replay.
  1208.            [REQUIRED for all implementations but used only for inbound
  1209.            traffic. NOTE: If anti-replay has been disabled by the
  1210.            receiver, e.g., in the case of a manually keyed SA, then the
  1211.            Anti-Replay Window is not used.]
  1212.          o AH Authentication algorithm, keys, etc.
  1213.            [REQUIRED for AH implementations]
  1214.          o ESP Encryption algorithm, keys, IV mode, IV, etc.
  1215.            [REQUIRED for ESP implementations]
  1216.          o ESP authentication algorithm, keys, etc. If the
  1217.            authentication service is not selected, this field will be
  1218.            null.
  1219.            [REQUIRED for ESP implementations]
  1220.          o Lifetime of this Security Association: a time interval after
  1221.            which an SA must be replaced with a new SA (and new SPI) or
  1222.            terminated, plus an indication of which of these actions
  1223.            should occur.  This may be expressed as a time or byte count,
  1224.            or a simultaneous use of both, the first lifetime to expire
  1225.            taking precedence. A compliant implementation MUST support
  1226.            both types of lifetimes, and must support a simultaneous use
  1227.            of both.  If time is employed, and if IKE employs X.509
  1228.            certificates for SA establishment, the SA lifetime must be
  1229.            constrained by the validity intervals of the certificates,
  1230.            and the NextIssueDate of the CRLs used in the IKE exchange
  1231.  
  1232.  
  1233.  
  1234. Kent & Atkinson             Standards Track                    [Page 22]
  1235.  
  1236. RFC 2401              Security Architecture for IP         November 1998
  1237.  
  1238.  
  1239.            for the SA.  Both initiator and responder are responsible for
  1240.            constraining SA lifetime in this fashion.
  1241.            [REQUIRED for all implementations]
  1242.  
  1243.            NOTE: The details of how to handle the refreshing of keys
  1244.            when SAs expire is a local matter.  However, one reasonable
  1245.            approach is:
  1246.              (a) If byte count is used, then the implementation
  1247.                  SHOULD count the number of bytes to which the IPsec
  1248.                  algorithm is applied.  For ESP, this is the encryption
  1249.                  algorithm (including Null encryption) and for AH,
  1250.                  this is the authentication algorithm.  This includes
  1251.                  pad bytes, etc.  Note that implementations SHOULD be
  1252.                  able to handle having the counters at the ends of an
  1253.                  SA get out of synch, e.g., because of packet loss or
  1254.                  because the implementations at each end of the SA
  1255.                  aren't doing things the same way.
  1256.              (b) There SHOULD be two kinds of lifetime -- a soft
  1257.                  lifetime which warns the implementation to initiate
  1258.                  action such as setting up a replacement SA and a
  1259.                  hard lifetime when the current SA ends.
  1260.              (c) If the entire packet does not get delivered during
  1261.                  the SAs lifetime, the packet SHOULD be discarded.
  1262.  
  1263.          o IPsec protocol mode: tunnel, transport or wildcard.
  1264.            Indicates which mode of AH or ESP is applied to traffic on
  1265.            this SA.  Note that if this field is "wildcard" at the
  1266.            sending end of the SA, then the application has to specify
  1267.            the mode to the IPsec implementation.  This use of wildcard
  1268.            allows the same SA to be used for either tunnel or transport
  1269.            mode traffic on a per packet basis, e.g., by different
  1270.            sockets.  The receiver does not need to know the mode in
  1271.            order to properly process the packet's IPsec headers.
  1272.  
  1273.            [REQUIRED as follows, unless implicitly defined by context:
  1274.                    - host implementations must support all modes
  1275.                    - gateway implementations must support tunnel mode]
  1276.  
  1277.            NOTE: The use of wildcard for the protocol mode of an inbound
  1278.            SA may add complexity to the situation in the receiver (host
  1279.            only).  Since the packets on such an SA could be delivered in
  1280.            either tunnel or transport mode, the security of an incoming
  1281.            packet could depend in part on which mode had been used to
  1282.            deliver it.  If, as a result, an application cared about the
  1283.            SA mode of a given packet, then the application would need a
  1284.            mechanism to obtain this mode information.
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290. Kent & Atkinson             Standards Track                    [Page 23]
  1291.  
  1292. RFC 2401              Security Architecture for IP         November 1998
  1293.  
  1294.  
  1295.          o Path MTU: any observed path MTU and aging variables.  See
  1296.            Section 6.1.2.4
  1297.            [REQUIRED for all implementations but used only for outbound
  1298.            traffic]
  1299.  
  1300. 4.5 Basic Combinations of Security Associations
  1301.  
  1302.    This section describes four examples of combinations of security
  1303.    associations that MUST be supported by compliant IPsec hosts or
  1304.    security gateways.  Additional combinations of AH and/or ESP in
  1305.    tunnel and/or transport modes MAY be supported at the discretion of
  1306.    the implementor.  Compliant implementations MUST be capable of
  1307.    generating these four combinations and on receipt, of processing
  1308.    them, but SHOULD be able to receive and process any combination.  The
  1309.    diagrams and text below describe the basic cases.  The legend for the
  1310.    diagrams is:
  1311.  
  1312.         ==== = one or more security associations (AH or ESP, transport
  1313.                or tunnel)
  1314.         ---- = connectivity (or if so labelled, administrative boundary)
  1315.         Hx   = host x
  1316.         SGx  = security gateway x
  1317.         X*   = X supports IPsec
  1318.  
  1319.    NOTE: The security associations below can be either AH or ESP.  The
  1320.    mode (tunnel vs transport) is determined by the nature of the
  1321.    endpoints.  For host-to-host SAs, the mode can be either transport or
  1322.    tunnel.
  1323.  
  1324.    Case 1.  The case of providing end-to-end security between 2 hosts
  1325.         across the Internet (or an Intranet).
  1326.  
  1327.                  ====================================
  1328.                  |                                  |
  1329.                 H1* ------ (Inter/Intranet) ------ H2*
  1330.  
  1331.         Note that either transport or tunnel mode can be selected by the
  1332.         hosts.  So the headers in a packet between H1 and H2 could look
  1333.         like any of the following:
  1334.  
  1335.                   Transport                  Tunnel
  1336.              -----------------          ---------------------
  1337.              1. [IP1][AH][upper]        4. [IP2][AH][IP1][upper]
  1338.              2. [IP1][ESP][upper]       5. [IP2][ESP][IP1][upper]
  1339.              3. [IP1][AH][ESP][upper]
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346. Kent & Atkinson             Standards Track                    [Page 24]
  1347.  
  1348. RFC 2401              Security Architecture for IP         November 1998
  1349.  
  1350.  
  1351.         Note that there is no requirement to support general nesting,
  1352.         but in transport mode, both AH and ESP can be applied to the
  1353.         packet.  In this event, the SA establishment procedure MUST
  1354.         ensure that first ESP, then AH are applied to the packet.
  1355.  
  1356.    Case 2.  This case illustrates simple virtual private networks
  1357.         support.
  1358.  
  1359.                        ===========================
  1360.                        |                         |
  1361.   ---------------------|----                  ---|-----------------------
  1362.   |                    |   |                  |  |                      |
  1363.   |  H1 -- (Local --- SG1* |--- (Internet) ---| SG2* --- (Local --- H2  |
  1364.   |        Intranet)       |                  |          Intranet)      |
  1365.   --------------------------                  ---------------------------
  1366.       admin. boundary                               admin. boundary
  1367.  
  1368.         Only tunnel mode is required here.  So the headers in a packet
  1369.         between SG1 and SG2 could look like either of the following:
  1370.  
  1371.                         Tunnel
  1372.                 ---------------------
  1373.                 4. [IP2][AH][IP1][upper]
  1374.                 5. [IP2][ESP][IP1][upper]
  1375.  
  1376.    Case 3.  This case combines cases 1 and 2, adding end-to-end security
  1377.         between the sending and receiving hosts.  It imposes no new
  1378.         requirements on the hosts or security gateways, other than a
  1379.         requirement for a security gateway to be configurable to pass
  1380.         IPsec traffic (including ISAKMP traffic) for hosts behind it.
  1381.  
  1382.      ===============================================================
  1383.      |                                                             |
  1384.      |                 =========================                   |
  1385.      |                 |                       |                   |
  1386.   ---|-----------------|----                ---|-------------------|---
  1387.   |  |                 |   |                |  |                   |  |
  1388.   | H1* -- (Local --- SG1* |-- (Internet) --| SG2* --- (Local --- H2* |
  1389.   |        Intranet)       |                |          Intranet)      |
  1390.   --------------------------                ---------------------------
  1391.        admin. boundary                            admin. boundary
  1392.  
  1393.    Case 4.  This covers the situation where a remote host (H1) uses the
  1394.         Internet to reach an organization's firewall (SG2) and to then
  1395.         gain access to some server or other machine (H2).  The remote
  1396.         host could be a mobile host (H1) dialing up to a local PPP/ARA
  1397.         server (not shown) on the Internet and then crossing the
  1398.         Internet to the home organization's firewall (SG2), etc.  The
  1399.  
  1400.  
  1401.  
  1402. Kent & Atkinson             Standards Track                    [Page 25]
  1403.  
  1404. RFC 2401              Security Architecture for IP         November 1998
  1405.  
  1406.  
  1407.         details of support for this case, (how H1 locates SG2,
  1408.         authenticates it, and verifies its authorization to represent
  1409.         H2) are discussed in Section 4.6.3, "Locating a Security
  1410.         Gateway".
  1411.  
  1412.         ======================================================
  1413.         |                                                    |
  1414.         |==============================                      |
  1415.         ||                            |                      |
  1416.         ||                         ---|----------------------|---
  1417.         ||                         |  |                      |  |
  1418.         H1* ----- (Internet) ------| SG2* ---- (Local ----- H2* |
  1419.               ^                    |           Intranet)        |
  1420.               |                    ------------------------------
  1421.         could be dialup              admin. boundary (optional)
  1422.         to PPP/ARA server
  1423.  
  1424.         Only tunnel mode is required between H1 and SG2.  So the choices
  1425.         for the SA between H1 and SG2 would be one of the ones in case
  1426.         2.  The choices for the SA between H1 and H2 would be one of the
  1427.         ones in case 1.
  1428.  
  1429.         Note that in this case, the sender MUST apply the transport
  1430.         header before the tunnel header.  Therefore the management
  1431.         interface to the IPsec implementation MUST support configuration
  1432.         of the SPD and SAD to ensure this ordering of IPsec header
  1433.         application.
  1434.  
  1435.    As noted above, support for additional combinations of AH and ESP is
  1436.    optional.  Use of other, optional combinations may adversely affect
  1437.    interoperability.
  1438.  
  1439. 4.6 SA and Key Management
  1440.  
  1441.    IPsec mandates support for both manual and automated SA and
  1442.    cryptographic key management.  The IPsec protocols, AH and ESP, are
  1443.    largely independent of the associated SA management techniques,
  1444.    although the techniques involved do affect some of the security
  1445.    services offered by the protocols.  For example, the optional anti-
  1446.    replay services available for AH and ESP require automated SA
  1447.    management.  Moreover, the granularity of key distribution employed
  1448.    with IPsec determines the granularity of authentication provided.
  1449.    (See also a discussion of this issue in Section 4.7.)  In general,
  1450.    data origin authentication in AH and ESP is limited by the extent to
  1451.    which secrets used with the authentication algorithm (or with a key
  1452.    management protocol that creates such secrets) are shared among
  1453.    multiple possible sources.
  1454.  
  1455.  
  1456.  
  1457.  
  1458. Kent & Atkinson             Standards Track                    [Page 26]
  1459.  
  1460. RFC 2401              Security Architecture for IP         November 1998
  1461.  
  1462.  
  1463.    The following text describes the minimum requirements for both types
  1464.    of SA management.
  1465.  
  1466. 4.6.1 Manual Techniques
  1467.  
  1468.    The simplest form of management is manual management, in which a
  1469.    person manually configures each system with keying material and
  1470.    security association management data relevant to secure communication
  1471.    with other systems.  Manual techniques are practical in small, static
  1472.    environments but they do not scale well.  For example, a company
  1473.    could create a Virtual Private Network (VPN) using IPsec in security
  1474.    gateways at several sites.  If the number of sites is small, and
  1475.    since all the sites come under the purview of a single administrative
  1476.    domain, this is likely to be a feasible context for manual management
  1477.    techniques.  In this case, the security gateway might selectively
  1478.    protect traffic to and from other sites within the organization using
  1479.    a manually configured key, while not protecting traffic for other
  1480.    destinations.  It also might be appropriate when only selected
  1481.    communications need to be secured.  A similar argument might apply to
  1482.    use of IPsec entirely within an organization for a small number of
  1483.    hosts and/or gateways.  Manual management techniques often employ
  1484.    statically configured, symmetric keys, though other options also
  1485.    exist.
  1486.  
  1487. 4.6.2 Automated SA and Key Management
  1488.  
  1489.    Widespread deployment and use of IPsec requires an Internet-standard,
  1490.    scalable, automated, SA management protocol.  Such support is
  1491.    required to facilitate use of the anti-replay features of AH and ESP,
  1492.    and to accommodate on-demand creation of SAs, e.g., for user- and
  1493.    session-oriented keying.  (Note that the notion of "rekeying" an SA
  1494.    actually implies creation of a new SA with a new SPI, a process that
  1495.    generally implies use of an automated SA/key management protocol.)
  1496.  
  1497.    The default automated key management protocol selected for use with
  1498.    IPsec is IKE [MSST97, Orm97, HC98] under the IPsec domain of
  1499.    interpretation [Pip98].  Other automated SA management protocols MAY
  1500.    be employed.
  1501.  
  1502.    When an automated SA/key management protocol is employed, the output
  1503.    from this protocol may be used to generate multiple keys, e.g., for a
  1504.    single ESP SA.  This may arise because:
  1505.  
  1506.        o the encryption algorithm uses multiple keys (e.g., triple DES)
  1507.        o the authentication algorithm uses multiple keys
  1508.        o both encryption and authentication algorithms are employed
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514. Kent & Atkinson             Standards Track                    [Page 27]
  1515.  
  1516. RFC 2401              Security Architecture for IP         November 1998
  1517.  
  1518.  
  1519.    The Key Management System may provide a separate string of bits for
  1520.    each key or it may generate one string of bits from which all of them
  1521.    are extracted.  If a single string of bits is provided, care needs to
  1522.    be taken to ensure that the parts of the system that map the string
  1523.    of bits to the required keys do so in the same fashion at both ends
  1524.    of the SA.  To ensure that the IPsec implementations at each end of
  1525.    the SA use the same bits for the same keys, and irrespective of which
  1526.    part of the system divides the string of bits into individual keys,
  1527.    the encryption key(s) MUST be taken from the first (left-most, high-
  1528.    order) bits and the authentication key(s) MUST be taken from the
  1529.    remaining bits.  The number of bits for each key is defined in the
  1530.    relevant algorithm specification RFC.  In the case of multiple
  1531.    encryption keys or multiple authentication keys, the specification
  1532.    for the algorithm must specify the order in which they are to be
  1533.    selected from a single string of bits provided to the algorithm.
  1534.  
  1535. 4.6.3 Locating a Security Gateway
  1536.  
  1537.    This section discusses issues relating to how a host learns about the
  1538.    existence of relevant security gateways and once a host has contacted
  1539.    these security gateways, how it knows that these are the correct
  1540.    security gateways.  The details of where the required information is
  1541.    stored is a local matter.
  1542.  
  1543.    Consider a situation in which a remote host (H1) is using the
  1544.    Internet to gain access to a server or other machine (H2) and there
  1545.    is a security gateway (SG2), e.g., a firewall, through which H1's
  1546.    traffic must pass.  An example of this situation would be a mobile
  1547.    host (Road Warrior) crossing the Internet to the home organization's
  1548.    firewall (SG2).  (See Case 4 in the section 4.5 Basic Combinations of
  1549.    Security Associations.) This situation raises several issues:
  1550.  
  1551.         1. How does H1 know/learn about the existence of the security
  1552.            gateway SG2?
  1553.         2. How does it authenticate SG2, and once it has authenticated
  1554.            SG2, how does it confirm that SG2 has been authorized to
  1555.            represent H2?
  1556.         3. How does SG2 authenticate H1 and verify that H1 is authorized
  1557.            to contact H2?
  1558.         4. How does H1 know/learn about backup gateways which provide
  1559.            alternate paths to H2?
  1560.  
  1561.    To address these problems, a host or security gateway MUST have an
  1562.    administrative interface that allows the user/administrator to
  1563.    configure the address of a security gateway for any sets of
  1564.    destination addresses that require its use. This includes the ability
  1565.    to configure:
  1566.  
  1567.  
  1568.  
  1569.  
  1570. Kent & Atkinson             Standards Track                    [Page 28]
  1571.  
  1572. RFC 2401              Security Architecture for IP         November 1998
  1573.  
  1574.  
  1575.         o the requisite information for locating and authenticating the
  1576.           security gateway and verifying its authorization to represent
  1577.           the destination host.
  1578.         o the requisite information for locating and authenticating any
  1579.           backup gateways and verifying their authorization to represent
  1580.           the destination host.
  1581.  
  1582.    It is assumed that the SPD is also configured with policy information
  1583.    that covers any other IPsec requirements for the path to the security
  1584.    gateway and the destination host.
  1585.  
  1586.    This document does not address the issue of how to automate the
  1587.    discovery/verification of security gateways.
  1588.  
  1589. 4.7 Security Associations and Multicast
  1590.  
  1591.    The receiver-orientation of the Security Association implies that, in
  1592.    the case of unicast traffic, the destination system will normally
  1593.    select the SPI value.  By having the destination select the SPI
  1594.    value, there is no potential for manually configured Security
  1595.    Associations to conflict with automatically configured (e.g., via a
  1596.    key management protocol) Security Associations or for Security
  1597.    Associations from multiple sources to conflict with each other.  For
  1598.    multicast traffic, there are multiple destination systems per
  1599.    multicast group.  So some system or person will need to coordinate
  1600.    among all multicast groups to select an SPI or SPIs on behalf of each
  1601.    multicast group and then communicate the group's IPsec information to
  1602.    all of the legitimate members of that multicast group via mechanisms
  1603.    not defined here.
  1604.  
  1605.    Multiple senders to a multicast group SHOULD use a single Security
  1606.    Association (and hence Security Parameter Index) for all traffic to
  1607.    that group when a symmetric key encryption or authentication
  1608.    algorithm is employed. In such circumstances, the receiver knows only
  1609.    that the message came from a system possessing the key for that
  1610.    multicast group.  In such circumstances, a receiver generally will
  1611.    not be able to authenticate which system sent the multicast traffic.
  1612.    Specifications for other, more general multicast cases are deferred
  1613.    to later IPsec documents.
  1614.  
  1615.    At the time this specification was published, automated protocols for
  1616.    multicast key distribution were not considered adequately mature for
  1617.    standardization.  For multicast groups having relatively few members,
  1618.    manual key distribution or multiple use of existing unicast key
  1619.    distribution algorithms such as modified Diffie-Hellman appears
  1620.    feasible.  For very large groups, new scalable techniques will be
  1621.    needed.  An example of current work in this area is the Group Key
  1622.    Management Protocol (GKMP) [HM97].
  1623.  
  1624.  
  1625.  
  1626. Kent & Atkinson             Standards Track                    [Page 29]
  1627.  
  1628. RFC 2401              Security Architecture for IP         November 1998
  1629.  
  1630.  
  1631. 5. IP Traffic Processing
  1632.  
  1633.    As mentioned in Section 4.4.1 "The Security Policy Database (SPD)",
  1634.    the SPD must be consulted during the processing of all traffic
  1635.    (INBOUND and OUTBOUND), including non-IPsec traffic.  If no policy is
  1636.    found in the SPD that matches the packet (for either inbound or
  1637.    outbound traffic), the packet MUST be discarded.
  1638.  
  1639.    NOTE: All of the cryptographic algorithms used in IPsec expect their
  1640.    input in canonical network byte order (see Appendix in RFC 791) and
  1641.    generate their output in canonical network byte order.  IP packets
  1642.    are also transmitted in network byte order.
  1643.  
  1644. 5.1 Outbound IP Traffic Processing
  1645.  
  1646. 5.1.1 Selecting and Using an SA or SA Bundle
  1647.  
  1648.    In a security gateway or BITW implementation (and in many BITS
  1649.    implementations), each outbound packet is compared against the SPD to
  1650.    determine what processing is required for the packet.  If the packet
  1651.    is to be discarded, this is an auditable event.  If the traffic is
  1652.    allowed to bypass IPsec processing, the packet continues through
  1653.    "normal" processing for the environment in which the IPsec processing
  1654.    is taking place.  If IPsec processing is required, the packet is
  1655.    either mapped to an existing SA (or SA bundle), or a new SA (or SA
  1656.    bundle) is created for the packet.  Since a packet's selectors might
  1657.    match multiple policies or multiple extant SAs and since the SPD is
  1658.    ordered, but the SAD is not, IPsec MUST:
  1659.  
  1660.            1. Match the packet's selector fields against the outbound
  1661.               policies in the SPD to locate the first appropriate
  1662.               policy, which will point to zero or more SA bundles in the
  1663.               SAD.
  1664.  
  1665.            2. Match the packet's selector fields against those in the SA
  1666.               bundles found in (1) to locate the first SA bundle that
  1667.               matches.  If no SAs were found or none match, create an
  1668.               appropriate SA bundle and link the SPD entry to the SAD
  1669.               entry.  If no key management entity is found, drop the
  1670.               packet.
  1671.  
  1672.            3. Use the SA bundle found/created in (2) to do the required
  1673.               IPsec processing, e.g., authenticate and encrypt.
  1674.  
  1675.    In a host IPsec implementation based on sockets, the SPD will be
  1676.    consulted whenever a new socket is created, to determine what, if
  1677.    any, IPsec processing will be applied to the traffic that will flow
  1678.    on that socket.
  1679.  
  1680.  
  1681.  
  1682. Kent & Atkinson             Standards Track                    [Page 30]
  1683.  
  1684. RFC 2401              Security Architecture for IP         November 1998
  1685.  
  1686.  
  1687.    NOTE: A compliant implementation MUST not allow instantiation of an
  1688.    ESP SA that employs both a NULL encryption and a NULL authentication
  1689.    algorithm.  An attempt to negotiate such an SA is an auditable event.
  1690.  
  1691. 5.1.2 Header Construction for Tunnel Mode
  1692.  
  1693.    This section describes the handling of the inner and outer IP
  1694.    headers, extension headers, and options for AH and ESP tunnels.  This
  1695.    includes how to construct the encapsulating (outer) IP header, how to
  1696.    handle fields in the inner IP header, and what other actions should
  1697.    be taken.  The general idea is modeled after the one used in RFC
  1698.    2003, "IP Encapsulation with IP":
  1699.  
  1700.         o The outer IP header Source Address and Destination Address
  1701.           identify the "endpoints" of the tunnel (the encapsulator and
  1702.           decapsulator).  The inner IP header Source Address and
  1703.           Destination Addresses identify the original sender and
  1704.           recipient of the datagram, (from the perspective of this
  1705.           tunnel), respectively.  (see footnote 3 after the table in
  1706.           5.1.2.1 for more details on the encapsulating source IP
  1707.           address.)
  1708.         o The inner IP header is not changed except to decrement the TTL
  1709.           as noted below, and remains unchanged during its delivery to
  1710.           the tunnel exit point.
  1711.         o No change to IP options or extension headers in the inner
  1712.           header occurs during delivery of the encapsulated datagram
  1713.           through the tunnel.
  1714.         o If need be, other protocol headers such as the IP
  1715.           Authentication header may be inserted between the outer IP
  1716.           header and the inner IP header.
  1717.  
  1718.    The tables in the following sub-sections show the handling for the
  1719.    different header/option fields (constructed = the value in the outer
  1720.    field is constructed independently of the value in the inner).
  1721.  
  1722. 5.1.2.1 IPv4 -- Header Construction for Tunnel Mode
  1723.  
  1724.                         <-- How Outer Hdr Relates to Inner Hdr -->
  1725.                         Outer Hdr at                 Inner Hdr at
  1726.    IPv4                 Encapsulator                 Decapsulator
  1727.      Header fields:     --------------------         ------------
  1728.        version          4 (1)                        no change
  1729.        header length    constructed                  no change
  1730.        TOS              copied from inner hdr (5)    no change
  1731.        total length     constructed                  no change
  1732.        ID               constructed                  no change
  1733.        flags (DF,MF)    constructed, DF (4)          no change
  1734.        fragmt offset    constructed                  no change
  1735.  
  1736.  
  1737.  
  1738. Kent & Atkinson             Standards Track                    [Page 31]
  1739.  
  1740. RFC 2401              Security Architecture for IP         November 1998
  1741.  
  1742.  
  1743.        TTL              constructed (2)              decrement (2)
  1744.        protocol         AH, ESP, routing hdr         no change
  1745.        checksum         constructed                  constructed (2)
  1746.        src address      constructed (3)              no change
  1747.        dest address     constructed (3)              no change
  1748.    Options            never copied                 no change
  1749.  
  1750.         1. The IP version in the encapsulating header can be different
  1751.            from the value in the inner header.
  1752.  
  1753.         2. The TTL in the inner header is decremented by the
  1754.            encapsulator prior to forwarding and by the decapsulator if
  1755.            it forwards the packet.  (The checksum changes when the TTL
  1756.            changes.)
  1757.  
  1758.            Note: The decrementing of the TTL is one of the usual actions
  1759.            that takes place when forwarding a packet.  Packets
  1760.            originating from the same node as the encapsulator do not
  1761.            have their TTL's decremented, as the sending node is
  1762.            originating the packet rather than forwarding it.
  1763.  
  1764.         3. src and dest addresses depend on the SA, which is used to
  1765.            determine the dest address which in turn determines which src
  1766.            address (net interface) is used to forward the packet.
  1767.  
  1768.            NOTE: In principle, the encapsulating IP source address can
  1769.            be any of the encapsulator's interface addresses or even an
  1770.            address different from any of the encapsulator's IP
  1771.            addresses, (e.g., if it's acting as a NAT box) so long as the
  1772.            address is reachable through the encapsulator from the
  1773.            environment into which the packet is sent.  This does not
  1774.            cause a problem because IPsec does not currently have any
  1775.            INBOUND processing requirement that involves the Source
  1776.            Address of the encapsulating IP header.  So while the
  1777.            receiving tunnel endpoint looks at the Destination Address in
  1778.            the encapsulating IP header, it only looks at the Source
  1779.            Address in the inner (encapsulated) IP header.
  1780.  
  1781.         4. configuration determines whether to copy from the inner
  1782.            header (IPv4 only), clear or set the DF.
  1783.  
  1784.         5. If Inner Hdr is IPv4 (Protocol = 4), copy the TOS.  If Inner
  1785.            Hdr is IPv6 (Protocol = 41), map the Class to TOS.
  1786.  
  1787. 5.1.2.2 IPv6 -- Header Construction for Tunnel Mode
  1788.  
  1789.    See previous section 5.1.2 for notes 1-5 indicated by (footnote
  1790.    number).
  1791.  
  1792.  
  1793.  
  1794. Kent & Atkinson             Standards Track                    [Page 32]
  1795.  
  1796. RFC 2401              Security Architecture for IP         November 1998
  1797.  
  1798.  
  1799.                         <-- How Outer Hdr  Relates Inner Hdr --->
  1800.                         Outer Hdr at                 Inner Hdr at
  1801.    IPv6                 Encapsulator                 Decapsulator
  1802.      Header fields:     --------------------         ------------
  1803.        version          6 (1)                        no change
  1804.        class            copied or configured (6)     no change
  1805.        flow id          copied or configured         no change
  1806.        len              constructed                  no change
  1807.        next header      AH,ESP,routing hdr           no change
  1808.        hop limit        constructed (2)              decrement (2)
  1809.        src address      constructed (3)              no change
  1810.        dest address     constructed (3)              no change
  1811.      Extension headers  never copied                 no change
  1812.  
  1813.         6. If Inner Hdr is IPv6 (Next Header = 41), copy the Class.  If
  1814.            Inner Hdr is IPv4 (Next Header = 4), map the TOS to Class.
  1815.  
  1816. 5.2 Processing Inbound IP Traffic
  1817.  
  1818.    Prior to performing AH or ESP processing, any IP fragments are
  1819.    reassembled.  Each inbound IP datagram to which IPsec processing will
  1820.    be applied is identified by the appearance of the AH or ESP values in
  1821.    the IP Next Protocol field (or of AH or ESP as an extension header in
  1822.    the IPv6 context).
  1823.  
  1824.    Note: Appendix C contains sample code for a bitmask check for a 32
  1825.    packet window that can be used for implementing anti-replay service.
  1826.  
  1827. 5.2.1 Selecting and Using an SA or SA Bundle
  1828.  
  1829.    Mapping the IP datagram to the appropriate SA is simplified because
  1830.    of the presence of the SPI in the AH or ESP header.  Note that the
  1831.    selector checks are made on the inner headers not the outer (tunnel)
  1832.    headers.  The steps followed are:
  1833.  
  1834.            1. Use the packet's destination address (outer IP header),
  1835.               IPsec protocol, and SPI to look up the SA in the SAD.  If
  1836.               the SA lookup fails, drop the packet and log/report the
  1837.               error.
  1838.  
  1839.            2. Use the SA found in (1) to do the IPsec processing, e.g.,
  1840.               authenticate and decrypt.  This step includes matching the
  1841.               packet's (Inner Header if tunneled) selectors to the
  1842.               selectors in the SA.  Local policy determines the
  1843.               specificity of the SA selectors (single value, list,
  1844.               range, wildcard).  In general, a packet's source address
  1845.               MUST match the SA selector value.  However, an ICMP packet
  1846.               received on a tunnel mode SA may have a source address
  1847.  
  1848.  
  1849.  
  1850. Kent & Atkinson             Standards Track                    [Page 33]
  1851.  
  1852. RFC 2401              Security Architecture for IP         November 1998
  1853.  
  1854.  
  1855.               other than that bound to the SA and thus such packets
  1856.               should be permitted as exceptions to this check.  For an
  1857.               ICMP packet, the selectors from the enclosed problem
  1858.               packet (the source and destination addresses and ports
  1859.               should be swapped) should be checked against the selectors
  1860.               for the SA.  Note that some or all of these selectors may
  1861.               be inaccessible because of limitations on how many bits of
  1862.               the problem packet the ICMP packet is allowed to carry or
  1863.               due to encryption.  See Section 6.
  1864.  
  1865.               Do (1) and (2) for every IPsec header until a Transport
  1866.               Protocol Header or an IP header that is NOT for this
  1867.               system is encountered.  Keep track of what SAs have been
  1868.               used and their order of application.
  1869.  
  1870.            3. Find an incoming policy in the SPD that matches the
  1871.               packet.  This could be done, for example, by use of
  1872.               backpointers from the SAs to the SPD or by matching the
  1873.               packet's selectors (Inner Header if tunneled) against
  1874.               those of the policy entries in the SPD.
  1875.  
  1876.            4. Check whether the required IPsec processing has been
  1877.               applied, i.e., verify that the SA's found in (1) and (2)
  1878.               match the kind and order of SAs required by the policy
  1879.               found in (3).
  1880.  
  1881.               NOTE: The correct "matching" policy will not necessarily
  1882.               be the first inbound policy found.  If the check in (4)
  1883.               fails, steps (3) and (4) are repeated until all policy
  1884.               entries have been checked or until the check succeeds.
  1885.  
  1886.    At the end of these steps, pass the resulting packet to the Transport
  1887.    Layer or forward the packet.  Note that any IPsec headers processed
  1888.    in these steps may have been removed, but that this information,
  1889.    i.e., what SAs were used and the order of their application, may be
  1890.    needed for subsequent IPsec or firewall processing.
  1891.  
  1892.    Note that in the case of a security gateway, if forwarding causes a
  1893.    packet to exit via an IPsec-enabled interface, then additional IPsec
  1894.    processing may be applied.
  1895.  
  1896. 5.2.2 Handling of AH and ESP tunnels
  1897.  
  1898.    The handling of the inner and outer IP headers, extension headers,
  1899.    and options for AH and ESP tunnels should be performed as described
  1900.    in the tables in Section 5.1.
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906. Kent & Atkinson             Standards Track                    [Page 34]
  1907.  
  1908. RFC 2401              Security Architecture for IP         November 1998
  1909.  
  1910.  
  1911. 6. ICMP Processing (relevant to IPsec)
  1912.  
  1913.    The focus of this section is on the handling of ICMP error messages.
  1914.    Other ICMP traffic, e.g., Echo/Reply, should be treated like other
  1915.    traffic and can be protected on an end-to-end basis using SAs in the
  1916.    usual fashion.
  1917.  
  1918.    An ICMP error message protected by AH or ESP and generated by a
  1919.    router SHOULD be processed and forwarded in a tunnel mode SA.  Local
  1920.    policy determines whether or not it is subjected to source address
  1921.    checks by the router at the destination end of the tunnel.  Note that
  1922.    if the router at the originating end of the tunnel is forwarding an
  1923.    ICMP error message from another router, the source address check
  1924.    would fail.  An ICMP message protected by AH or ESP and generated by
  1925.    a router MUST NOT be forwarded on a transport mode SA (unless the SA
  1926.    has been established to the router acting as a host, e.g., a Telnet
  1927.    connection used to manage a router).  An ICMP message generated by a
  1928.    host SHOULD be checked against the source IP address selectors bound
  1929.    to the SA in which the message arrives.  Note that even if the source
  1930.    of an ICMP error message is authenticated, the returned IP header
  1931.    could be invalid. Accordingly, the selector values in the IP header
  1932.    SHOULD also be checked to be sure that they are consistent with the
  1933.    selectors for the SA over which the ICMP message was received.
  1934.  
  1935.    The table in Appendix D characterize ICMP messages as being either
  1936.    host generated, router generated, both, unknown/unassigned.  ICMP
  1937.    messages falling into the last two categories should be handled as
  1938.    determined by the receiver's policy.
  1939.  
  1940.    An ICMP message not protected by AH or ESP is unauthenticated and its
  1941.    processing and/or forwarding may result in denial of service.  This
  1942.    suggests that, in general, it would be desirable to ignore such
  1943.    messages.  However, it is expected that many routers (vs. security
  1944.    gateways) will not implement IPsec for transit traffic and thus
  1945.    strict adherence to this rule would cause many ICMP messages to be
  1946.    discarded.  The result is that some critical IP functions would be
  1947.    lost, e.g., redirection and PMTU processing.  Thus it MUST be
  1948.    possible to configure an IPsec implementation to accept or reject
  1949.    (router) ICMP traffic as per local security policy.
  1950.  
  1951.    The remainder of this section addresses how PMTU processing MUST be
  1952.    performed at hosts and security gateways.  It addresses processing of
  1953.    both authenticated and unauthenticated ICMP PMTU messages.  However,
  1954.    as noted above, unauthenticated ICMP messages MAY be discarded based
  1955.    on local policy.
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962. Kent & Atkinson             Standards Track                    [Page 35]
  1963.  
  1964. RFC 2401              Security Architecture for IP         November 1998
  1965.  
  1966.  
  1967. 6.1 PMTU/DF Processing
  1968.  
  1969. 6.1.1 DF Bit
  1970.  
  1971.    In cases where a system (host or gateway) adds an encapsulating
  1972.    header (ESP tunnel or AH tunnel), it MUST support the option of
  1973.    copying the DF bit from the original packet to the encapsulating
  1974.    header (and processing ICMP PMTU messages).  This means that it MUST
  1975.    be possible to configure the system's treatment of the DF bit (set,
  1976.    clear, copy from encapsulated header) for each interface.  (See
  1977.    Appendix B for rationale.)
  1978.  
  1979. 6.1.2 Path MTU Discovery (PMTU)
  1980.  
  1981.    This section discusses IPsec handling for Path MTU Discovery
  1982.    messages.  ICMP PMTU is used here to refer to an ICMP message for:
  1983.  
  1984.            IPv4 (RFC 792):
  1985.                    - Type = 3 (Destination Unreachable)
  1986.                    - Code = 4 (Fragmentation needed and DF set)
  1987.                    - Next-Hop MTU in the low-order 16 bits of the second
  1988.                      word of the ICMP header (labelled "unused" in RFC
  1989.                      792), with high-order 16 bits set to zero
  1990.  
  1991.            IPv6 (RFC 1885):
  1992.                    - Type = 2 (Packet Too Big)
  1993.                    - Code = 0 (Fragmentation needed)
  1994.                    - Next-Hop MTU in the 32 bit MTU field of the ICMP6
  1995.                      message
  1996.  
  1997. 6.1.2.1 Propagation of PMTU
  1998.  
  1999.    The amount of information returned with the ICMP PMTU message (IPv4
  2000.    or IPv6) is limited and this affects what selectors are available for
  2001.    use in further propagating the PMTU information.  (See Appendix B for
  2002.    more detailed discussion of this topic.)
  2003.  
  2004.    o PMTU message with 64 bits of IPsec header -- If the ICMP PMTU
  2005.      message contains only 64 bits of the IPsec header (minimum for
  2006.      IPv4), then a security gateway MUST support the following options
  2007.      on a per SPI/SA basis:
  2008.  
  2009.         a. if the originating host can be determined (or the possible
  2010.            sources narrowed down to a manageable number), send the PM
  2011.            information to all the possible originating hosts.
  2012.         b. if the originating host cannot be determined, store the PMTU
  2013.            with the SA and wait until the next packet(s) arrive from the
  2014.            originating host for the relevant security association.  If
  2015.  
  2016.  
  2017.  
  2018. Kent & Atkinson             Standards Track                    [Page 36]
  2019.  
  2020. RFC 2401              Security Architecture for IP         November 1998
  2021.  
  2022.  
  2023.            the packet(s) are bigger than the PMTU, drop the packet(s),
  2024.            and compose ICMP PMTU message(s) with the new packet(s) and
  2025.            the updated PMTU, and send the ICMP message(s) about the
  2026.            problem to the originating host. Retain the PMTU information
  2027.            for any message that might arrive subsequently (see Section
  2028.            6.1.2.4, "PMTU Aging").
  2029.  
  2030.    o PMTU message with >64 bits of IPsec header -- If the ICMP message
  2031.      contains more information from the original packet then there may
  2032.      be enough non-opaque information to immediately determine to which
  2033.      host to propagate the ICMP/PMTU message and to provide that system
  2034.      with the 5 fields (source address, destination address, source
  2035.      port, destination port, transport protocol) needed to determine
  2036.      where to store/update the PMTU.  Under such circumstances, a
  2037.      security gateway MUST generate an ICMP PMTU message immediately
  2038.      upon receipt of an ICMP PMTU from further down the path.
  2039.  
  2040.    o Distributing the PMTU to the Transport Layer -- The host mechanism
  2041.      for getting the updated PMTU to the transport layer is unchanged,
  2042.      as specified in RFC 1191 (Path MTU Discovery).
  2043.  
  2044. 6.1.2.2 Calculation of PMTU
  2045.  
  2046.    The calculation of PMTU from an ICMP PMTU MUST take into account the
  2047.    addition of any IPsec header -- AH transport, ESP transport, AH/ESP
  2048.    transport, ESP tunnel, AH tunnel.  (See Appendix B for discussion of
  2049.    implementation issues.)
  2050.  
  2051.    Note: In some situations the addition of IPsec headers could result
  2052.    in an effective PMTU (as seen by the host or application) that is
  2053.    unacceptably small.  To avoid this problem, the implementation may
  2054.    establish a threshold below which it will not report a reduced PMTU.
  2055.    In such cases, the implementation would apply IPsec and then fragment
  2056.    the resulting packet according to the PMTU.  This would result in a
  2057.    more efficient use of the available bandwidth.
  2058.  
  2059. 6.1.2.3 Granularity of PMTU Processing
  2060.  
  2061.    In hosts, the granularity with which ICMP PMTU processing can be done
  2062.    differs depending on the implementation situation.  Looking at a
  2063.    host, there are 3 situations that are of interest with respect to
  2064.    PMTU issues (See Appendix B for additional details on this topic.):
  2065.  
  2066.         a. Integration of IPsec into the native IP implementation
  2067.         b. Bump-in-the-stack implementations, where IPsec is implemented
  2068.            "underneath" an existing implementation of a TCP/IP protocol
  2069.            stack, between the native IP and the local network drivers
  2070.  
  2071.  
  2072.  
  2073.  
  2074. Kent & Atkinson             Standards Track                    [Page 37]
  2075.  
  2076. RFC 2401              Security Architecture for IP         November 1998
  2077.  
  2078.  
  2079.         c. No IPsec implementation -- This case is included because it
  2080.            is relevant in cases where a security gateway is sending PMTU
  2081.            information back to a host.
  2082.  
  2083.    Only in case (a) can the PMTU data be maintained at the same
  2084.    granularity as communication associations.  In (b) and (c), the IP
  2085.    layer will only be able to maintain PMTU data at the granularity of
  2086.    source and destination IP addresses (and optionally TOS), as
  2087.    described in RFC 1191.  This is an important difference, because more
  2088.    than one communication association may map to the same source and
  2089.    destination IP addresses, and each communication association may have
  2090.    a different amount of IPsec header overhead (e.g., due to use of
  2091.    different transforms or different algorithms).
  2092.  
  2093.    Implementation of the calculation of PMTU and support for PMTUs at
  2094.    the granularity of individual communication associations is a local
  2095.    matter.  However, a socket-based implementation of IPsec in a host
  2096.    SHOULD maintain the information on a per socket basis.  Bump in the
  2097.    stack systems MUST pass an ICMP PMTU to the host IP implementation,
  2098.    after adjusting it for any IPsec header overhead added by these
  2099.    systems.  The calculation of the overhead SHOULD be determined by
  2100.    analysis of the SPI and any other selector information present in a
  2101.    returned ICMP PMTU message.
  2102.  
  2103. 6.1.2.4 PMTU Aging
  2104.  
  2105.    In all systems (host or gateway) implementing IPsec and maintaining
  2106.    PMTU information, the PMTU associated with a security association
  2107.    (transport or tunnel) MUST be "aged" and some mechanism put in place
  2108.    for updating the PMTU in a timely manner, especially for discovering
  2109.    if the PMTU is smaller than it needs to be.  A given PMTU has to
  2110.    remain in place long enough for a packet to get from the source end
  2111.    of the security association to the system at the other end of the
  2112.    security association and propagate back an ICMP error message if the
  2113.    current PMTU is too big.  Note that if there are nested tunnels,
  2114.    multiple packets and round trip times might be required to get an
  2115.    ICMP message back to an encapsulator or originating host.
  2116.  
  2117.    Systems SHOULD use the approach described in the Path MTU Discovery
  2118.    document (RFC 1191, Section 6.3), which suggests periodically
  2119.    resetting the PMTU to the first-hop data-link MTU and then letting
  2120.    the normal PMTU Discovery processes update the PMTU as necessary.
  2121.    The period SHOULD be configurable.
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130. Kent & Atkinson             Standards Track                    [Page 38]
  2131.  
  2132. RFC 2401              Security Architecture for IP         November 1998
  2133.  
  2134.  
  2135. 7. Auditing
  2136.  
  2137.    Not all systems that implement IPsec will implement auditing.  For
  2138.    the most part, the granularity of auditing is a local matter.
  2139.    However, several auditable events are identified in the AH and ESP
  2140.    specifications and for each of these events a minimum set of
  2141.    information that SHOULD be included in an audit log is defined.
  2142.    Additional information also MAY be included in the audit log for each
  2143.    of these events, and additional events, not explicitly called out in
  2144.    this specification, also MAY result in audit log entries.  There is
  2145.    no requirement for the receiver to transmit any message to the
  2146.    purported transmitter in response to the detection of an auditable
  2147.    event, because of the potential to induce denial of service via such
  2148.    action.
  2149.  
  2150. 8. Use in Systems Supporting Information Flow Security
  2151.  
  2152.    Information of various sensitivity levels may be carried over a
  2153.    single network.  Information labels (e.g., Unclassified, Company
  2154.    Proprietary, Secret) [DoD85, DoD87] are often employed to distinguish
  2155.    such information.  The use of labels facilitates segregation of
  2156.    information, in support of information flow security models, e.g.,
  2157.    the Bell-LaPadula model [BL73].  Such models, and corresponding
  2158.    supporting technology, are designed to prevent the unauthorized flow
  2159.    of sensitive information, even in the face of Trojan Horse attacks.
  2160.    Conventional, discretionary access control (DAC) mechanisms, e.g.,
  2161.    based on access control lists, generally are not sufficient to
  2162.    support such policies, and thus facilities such as the SPD do not
  2163.    suffice in such environments.
  2164.  
  2165.    In the military context, technology that supports such models is
  2166.    often referred to as multi-level security (MLS).  Computers and
  2167.    networks often are designated "multi-level secure" if they support
  2168.    the separation of labelled data in conjunction with information flow
  2169.    security policies.  Although such technology is more broadly
  2170.    applicable than just military applications, this document uses the
  2171.    acronym "MLS" to designate the technology, consistent with much
  2172.    extant literature.
  2173.  
  2174.    IPsec mechanisms can easily support MLS networking.  MLS networking
  2175.    requires the use of strong Mandatory Access Controls (MAC), which
  2176.    unprivileged users or unprivileged processes are incapable of
  2177.    controlling or violating.  This section pertains only to the use of
  2178.    these IP security mechanisms in MLS (information flow security
  2179.    policy) environments.  Nothing in this section applies to systems not
  2180.    claiming to provide MLS.
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186. Kent & Atkinson             Standards Track                    [Page 39]
  2187.  
  2188. RFC 2401              Security Architecture for IP         November 1998
  2189.  
  2190.  
  2191.    As used in this section, "sensitivity information" might include
  2192.    implementation-defined hierarchic levels, categories, and/or
  2193.    releasability information.
  2194.  
  2195.    AH can be used to provide strong authentication in support of
  2196.    mandatory access control decisions in MLS environments.  If explicit
  2197.    IP sensitivity information (e.g., IPSO [Ken91]) is used and
  2198.    confidentiality is not considered necessary within the particular
  2199.    operational environment, AH can be used to authenticate the binding
  2200.    between sensitivity labels in the IP header and the IP payload
  2201.    (including user data).  This is a significant improvement over
  2202.    labeled IPv4 networks where the sensitivity information is trusted
  2203.    even though there is no authentication or cryptographic binding of
  2204.    the information to the IP header and user data.  IPv4 networks might
  2205.    or might not use explicit labelling.  IPv6 will normally use implicit
  2206.    sensitivity information that is part of the IPsec Security
  2207.    Association but not transmitted with each packet instead of using
  2208.    explicit sensitivity information.  All explicit IP sensitivity
  2209.    information MUST be authenticated using either ESP, AH, or both.
  2210.  
  2211.    Encryption is useful and can be desirable even when all of the hosts
  2212.    are within a protected environment, for example, behind a firewall or
  2213.    disjoint from any external connectivity.  ESP can be used, in
  2214.    conjunction with appropriate key management and encryption
  2215.    algorithms, in support of both DAC and MAC.  (The choice of
  2216.    encryption and authentication algorithms, and the assurance level of
  2217.    an IPsec implementation will determine the environments in which an
  2218.    implementation may be deemed sufficient to satisfy MLS requirements.)
  2219.    Key management can make use of sensitivity information to provide
  2220.    MAC.  IPsec implementations on systems claiming to provide MLS SHOULD
  2221.    be capable of using IPsec to provide MAC for IP-based communications.
  2222.  
  2223. 8.1 Relationship Between Security Associations and Data Sensitivity
  2224.  
  2225.    Both the Encapsulating Security Payload and the Authentication Header
  2226.    can be combined with appropriate Security Association policies to
  2227.    provide multi-level secure networking.  In this case each SA (or SA
  2228.    bundle) is normally used for only a single instance of sensitivity
  2229.    information.  For example, "PROPRIETARY - Internet Engineering" must
  2230.    be associated with a different SA (or SA bundle) from "PROPRIETARY -
  2231.    Finance".
  2232.  
  2233. 8.2 Sensitivity Consistency Checking
  2234.  
  2235.    An MLS implementation (both host and router) MAY associate
  2236.    sensitivity information, or a range of sensitivity information with
  2237.    an interface, or a configured IP address with its associated prefix
  2238.    (the latter is sometimes referred to as a logical interface, or an
  2239.  
  2240.  
  2241.  
  2242. Kent & Atkinson             Standards Track                    [Page 40]
  2243.  
  2244. RFC 2401              Security Architecture for IP         November 1998
  2245.  
  2246.  
  2247.    interface alias).  If such properties exist, an implementation SHOULD
  2248.    compare the sensitivity information associated with the packet
  2249.    against the sensitivity information associated with the interface or
  2250.    address/prefix from which the packet arrived, or through which the
  2251.    packet will depart.  This check will either verify that the
  2252.    sensitivities match, or that the packet's sensitivity falls within
  2253.    the range of the interface or address/prefix.
  2254.  
  2255.    The checking SHOULD be done on both inbound and outbound processing.
  2256.  
  2257. 8.3 Additional MLS Attributes for Security Association Databases
  2258.  
  2259.    Section 4.4 discussed two Security Association databases (the
  2260.    Security Policy Database (SPD) and the Security Association Database
  2261.    (SAD)) and the associated policy selectors and SA attributes.  MLS
  2262.    networking introduces an additional selector/attribute:
  2263.  
  2264.            - Sensitivity information.
  2265.  
  2266.    The Sensitivity information aids in selecting the appropriate
  2267.    algorithms and key strength, so that the traffic gets a level of
  2268.    protection appropriate to its importance or sensitivity as described
  2269.    in section 8.1.  The exact syntax of the sensitivity information is
  2270.    implementation defined.
  2271.  
  2272. 8.4 Additional Inbound Processing Steps for MLS Networking
  2273.  
  2274.    After an inbound packet has passed through IPsec processing, an MLS
  2275.    implementation SHOULD first check the packet's sensitivity (as
  2276.    defined by the SA (or SA bundle) used for the packet) with the
  2277.    interface or address/prefix as described in section 8.2 before
  2278.    delivering the datagram to an upper-layer protocol or forwarding it.
  2279.  
  2280.    The MLS system MUST retain the binding between the data received in
  2281.    an IPsec protected packet and the sensitivity information in the SA
  2282.    or SAs used for processing, so appropriate policy decisions can be
  2283.    made when delivering the datagram to an application or forwarding
  2284.    engine.  The means for maintaining this binding are implementation
  2285.    specific.
  2286.  
  2287. 8.5 Additional Outbound Processing Steps for MLS Networking
  2288.  
  2289.    An MLS implementation of IPsec MUST perform two additional checks
  2290.    besides the normal steps detailed in section 5.1.1.  When consulting
  2291.    the SPD or the SAD to find an outbound security association, the MLS
  2292.    implementation MUST use the sensitivity of the data to select an
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298. Kent & Atkinson             Standards Track                    [Page 41]
  2299.  
  2300. RFC 2401              Security Architecture for IP         November 1998
  2301.  
  2302.  
  2303.    appropriate outbound SA or SA bundle.  The second check comes before
  2304.    forwarding the packet out to its destination, and is the sensitivity
  2305.    consistency checking described in section 8.2.
  2306.  
  2307. 8.6 Additional MLS Processing for Security Gateways
  2308.  
  2309.    An MLS security gateway MUST follow the previously mentioned inbound
  2310.    and outbound processing rules as well as perform some additional
  2311.    processing specific to the intermediate protection of packets in an
  2312.    MLS environment.
  2313.  
  2314.    A security gateway MAY act as an outbound proxy, creating SAs for MLS
  2315.    systems that originate packets forwarded by the gateway.  These MLS
  2316.    systems may explicitly label the packets to be forwarded, or the
  2317.    whole originating network may have sensitivity characteristics
  2318.    associated with it.  The security gateway MUST create and use
  2319.    appropriate SAs for AH, ESP, or both, to protect such traffic it
  2320.    forwards.
  2321.  
  2322.    Similarly such a gateway SHOULD accept and process inbound AH and/or
  2323.    ESP packets and forward appropriately, using explicit packet
  2324.    labeling, or relying on the sensitivity characteristics of the
  2325.    destination network.
  2326.  
  2327. 9. Performance Issues
  2328.  
  2329.    The use of IPsec imposes computational performance costs on the hosts
  2330.    or security gateways that implement these protocols.  These costs are
  2331.    associated with the memory needed for IPsec code and data structures,
  2332.    and the computation of integrity check values, encryption and
  2333.    decryption, and added per-packet handling.  The per-packet
  2334.    computational costs will be manifested by increased latency and,
  2335.    possibly, reduced throughout.  Use of SA/key management protocols,
  2336.    especially ones that employ public key cryptography, also adds
  2337.    computational performance costs to use of IPsec.  These per-
  2338.    association computational costs will be manifested in terms of
  2339.    increased latency in association establishment.  For many hosts, it
  2340.    is anticipated that software-based cryptography will not appreciably
  2341.    reduce throughput, but hardware may be required for security gateways
  2342.    (since they represent aggregation points), and for some hosts.
  2343.  
  2344.    The use of IPsec also imposes bandwidth utilization costs on
  2345.    transmission, switching, and routing components of the Internet
  2346.    infrastructure, components not implementing IPsec.  This is due to
  2347.    the increase in the packet size resulting from the addition of AH
  2348.    and/or ESP headers, AH and ESP tunneling (which adds a second IP
  2349.    header), and the increased packet traffic associated with key
  2350.    management protocols.  It is anticipated that, in most instances,
  2351.  
  2352.  
  2353.  
  2354. Kent & Atkinson             Standards Track                    [Page 42]
  2355.  
  2356. RFC 2401              Security Architecture for IP         November 1998
  2357.  
  2358.  
  2359.    this increased bandwidth demand will not noticeably affect the
  2360.    Internet infrastructure.  However, in some instances, the effects may
  2361.    be significant, e.g., transmission of ESP encrypted traffic over a
  2362.    dialup link that otherwise would have compressed the traffic.
  2363.  
  2364.    Note: The initial SA establishment overhead will be felt in the first
  2365.    packet.  This delay could impact the transport layer and application.
  2366.    For example, it could cause TCP to retransmit the SYN before the
  2367.    ISAKMP exchange is done.  The effect of the delay would be different
  2368.    on UDP than TCP because TCP shouldn't transmit anything other than
  2369.    the SYN until the connection is set up whereas UDP will go ahead and
  2370.    transmit data beyond the first packet.
  2371.  
  2372.    Note: As discussed earlier, compression can still be employed at
  2373.    layers above IP.  There is an IETF working group (IP Payload
  2374.    Compression Protocol (ippcp)) working on "protocol specifications
  2375.    that make it possible to perform lossless compression on individual
  2376.    payloads before the payload is processed by a protocol that encrypts
  2377.    it. These specifications will allow for compression operations to be
  2378.    performed prior to the encryption of a payload by IPsec protocols."
  2379.  
  2380. 10. Conformance Requirements
  2381.  
  2382.    All IPv4 systems that claim to implement IPsec MUST comply with all
  2383.    requirements of the Security Architecture document.  All IPv6 systems
  2384.    MUST comply with all requirements of the Security Architecture
  2385.    document.
  2386.  
  2387. 11. Security Considerations
  2388.  
  2389.    The focus of this document is security; hence security considerations
  2390.    permeate this specification.
  2391.  
  2392. 12. Differences from RFC 1825
  2393.  
  2394.    This architecture document differs substantially from RFC 1825 in
  2395.    detail and in organization, but the fundamental notions are
  2396.    unchanged.  This document provides considerable additional detail in
  2397.    terms of compliance specifications.  It introduces the SPD and SAD,
  2398.    and the notion of SA selectors.  It is aligned with the new versions
  2399.    of AH and ESP, which also differ from their predecessors.  Specific
  2400.    requirements for supported combinations of AH and ESP are newly
  2401.    added, as are details of PMTU management.
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410. Kent & Atkinson             Standards Track                    [Page 43]
  2411.  
  2412. RFC 2401              Security Architecture for IP         November 1998
  2413.  
  2414.  
  2415. Acknowledgements
  2416.  
  2417.    Many of the concepts embodied in this specification were derived from
  2418.    or influenced by the US Government's SP3 security protocol, ISO/IEC's
  2419.    NLSP, the proposed swIPe security protocol [SDNS, ISO, IB93, IBK93],
  2420.    and the work done for SNMP Security and SNMPv2 Security.
  2421.  
  2422.    For over 3 years (although it sometimes seems *much* longer), this
  2423.    document has evolved through multiple versions and iterations.
  2424.    During this time, many people have contributed significant ideas and
  2425.    energy to the process and the documents themselves.  The authors
  2426.    would like to thank Karen Seo for providing extensive help in the
  2427.    review, editing, background research, and coordination for this
  2428.    version of the specification.  The authors would also like to thank
  2429.    the members of the IPsec and IPng working groups, with special
  2430.    mention of the efforts of (in alphabetic order): Steve Bellovin,
  2431.    Steve Deering, James Hughes, Phil Karn, Frank Kastenholz, Perry
  2432.    Metzger, David Mihelcic, Hilarie Orman, Norman Shulman, William
  2433.    Simpson, Harry Varnis, and Nina Yuan.
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466. Kent & Atkinson             Standards Track                    [Page 44]
  2467.  
  2468. RFC 2401              Security Architecture for IP         November 1998
  2469.  
  2470.  
  2471. Appendix A -- Glossary
  2472.  
  2473.    This section provides definitions for several key terms that are
  2474.    employed in this document.  Other documents provide additional
  2475.    definitions and background information relevant to this technology,
  2476.    e.g., [VK83, HA94].  Included in this glossary are generic security
  2477.    service and security mechanism terms, plus IPsec-specific terms.
  2478.  
  2479.      Access Control
  2480.         Access control is a security service that prevents unauthorized
  2481.         use of a resource, including the prevention of use of a resource
  2482.         in an unauthorized manner.  In the IPsec context, the resource
  2483.         to which access is being controlled is often:
  2484.                 o for a host, computing cycles or data
  2485.                 o for a security gateway, a network behind the gateway
  2486.         or
  2487.                   bandwidth on that network.
  2488.  
  2489.      Anti-replay
  2490.         [See "Integrity" below]
  2491.  
  2492.      Authentication
  2493.         This term is used informally to refer to the combination of two
  2494.         nominally distinct security services, data origin authentication
  2495.         and connectionless integrity.  See the definitions below for
  2496.         each of these services.
  2497.  
  2498.      Availability
  2499.         Availability, when viewed as a security service, addresses the
  2500.         security concerns engendered by attacks against networks that
  2501.         deny or degrade service.  For example, in the IPsec context, the
  2502.         use of anti-replay mechanisms in AH and ESP support
  2503.         availability.
  2504.  
  2505.      Confidentiality
  2506.         Confidentiality is the security service that protects data from
  2507.         unauthorized disclosure.  The primary confidentiality concern in
  2508.         most instances is unauthorized disclosure of application level
  2509.         data, but disclosure of the external characteristics of
  2510.         communication also can be a concern in some circumstances.
  2511.         Traffic flow confidentiality is the service that addresses this
  2512.         latter concern by concealing source and destination addresses,
  2513.         message length, or frequency of communication.  In the IPsec
  2514.         context, using ESP in tunnel mode, especially at a security
  2515.         gateway, can provide some level of traffic flow confidentiality.
  2516.         (See also traffic analysis, below.)
  2517.  
  2518.  
  2519.  
  2520.  
  2521.  
  2522. Kent & Atkinson             Standards Track                    [Page 45]
  2523.  
  2524. RFC 2401              Security Architecture for IP         November 1998
  2525.  
  2526.  
  2527.      Encryption
  2528.         Encryption is a security mechanism used to transform data from
  2529.         an intelligible form (plaintext) into an unintelligible form
  2530.         (ciphertext), to provide confidentiality.  The inverse
  2531.         transformation process is designated "decryption".  Oftimes the
  2532.         term "encryption" is used to generically refer to both
  2533.         processes.
  2534.  
  2535.      Data Origin Authentication
  2536.         Data origin authentication is a security service that verifies
  2537.         the identity of the claimed source of data.  This service is
  2538.         usually bundled with connectionless integrity service.
  2539.  
  2540.      Integrity
  2541.         Integrity is a security service that ensures that modifications
  2542.         to data are detectable.  Integrity comes in various flavors to
  2543.         match application requirements.  IPsec supports two forms of
  2544.         integrity: connectionless and a form of partial sequence
  2545.         integrity.  Connectionless integrity is a service that detects
  2546.         modification of an individual IP datagram, without regard to the
  2547.         ordering of the datagram in a stream of traffic.  The form of
  2548.         partial sequence integrity offered in IPsec is referred to as
  2549.         anti-replay integrity, and it detects arrival of duplicate IP
  2550.         datagrams (within a constrained window).  This is in contrast to
  2551.         connection-oriented integrity, which imposes more stringent
  2552.         sequencing requirements on traffic, e.g., to be able to detect
  2553.         lost or re-ordered messages.  Although authentication and
  2554.         integrity services often are cited separately, in practice they
  2555.         are intimately connected and almost always offered in tandem.
  2556.  
  2557.      Security Association (SA)
  2558.         A simplex (uni-directional) logical connection, created for
  2559.         security purposes.  All traffic traversing an SA is provided the
  2560.         same security processing.  In IPsec, an SA is an internet layer
  2561.         abstraction implemented through the use of AH or ESP.
  2562.  
  2563.      Security Gateway
  2564.         A security gateway is an intermediate system that acts as the
  2565.         communications interface between two networks.  The set of hosts
  2566.         (and networks) on the external side of the security gateway is
  2567.         viewed as untrusted (or less trusted), while the networks and
  2568.         hosts and on the internal side are viewed as trusted (or more
  2569.         trusted).  The internal subnets and hosts served by a security
  2570.         gateway are presumed to be trusted by virtue of sharing a
  2571.         common, local, security administration.  (See "Trusted
  2572.         Subnetwork" below.) In the IPsec context, a security gateway is
  2573.         a point at which AH and/or ESP is implemented in order to serve
  2574.  
  2575.  
  2576.  
  2577.  
  2578. Kent & Atkinson             Standards Track                    [Page 46]
  2579.  
  2580. RFC 2401              Security Architecture for IP         November 1998
  2581.  
  2582.  
  2583.         a set of internal hosts, providing security services for these
  2584.         hosts when they communicate with external hosts also employing
  2585.         IPsec (either directly or via another security gateway).
  2586.  
  2587.      SPI
  2588.         Acronym for "Security Parameters Index".  The combination of a
  2589.         destination address, a security protocol, and an SPI uniquely
  2590.         identifies a security association (SA, see above).  The SPI is
  2591.         carried in AH and ESP protocols to enable the receiving system
  2592.         to select the SA under which a received packet will be
  2593.         processed.  An SPI has only local significance, as defined by
  2594.         the creator of the SA (usually the receiver of the packet
  2595.         carrying the SPI); thus an SPI is generally viewed as an opaque
  2596.         bit string.  However, the creator of an SA may choose to
  2597.         interpret the bits in an SPI to facilitate local processing.
  2598.  
  2599.      Traffic Analysis
  2600.         The analysis of network traffic flow for the purpose of deducing
  2601.         information that is useful to an adversary.  Examples of such
  2602.         information are frequency of transmission, the identities of the
  2603.         conversing parties, sizes of packets, flow identifiers, etc.
  2604.         [Sch94]
  2605.  
  2606.      Trusted Subnetwork
  2607.         A subnetwork containing hosts and routers that trust each other
  2608.         not to engage in active or passive attacks.  There also is an
  2609.         assumption that the underlying communications channel (e.g., a
  2610.         LAN or CAN) isn't being attacked by other means.
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634. Kent & Atkinson             Standards Track                    [Page 47]
  2635.  
  2636. RFC 2401              Security Architecture for IP         November 1998
  2637.  
  2638.  
  2639. Appendix B -- Analysis/Discussion of PMTU/DF/Fragmentation Issues
  2640.  
  2641. B.1 DF bit
  2642.  
  2643.    In cases where a system (host or gateway) adds an encapsulating
  2644.    header (e.g., ESP tunnel), should/must the DF bit in the original
  2645.    packet be copied to the encapsulating header?
  2646.  
  2647.    Fragmenting seems correct for some situations, e.g., it might be
  2648.    appropriate to fragment packets over a network with a very small MTU,
  2649.    e.g., a packet radio network, or a cellular phone hop to mobile node,
  2650.    rather than propagate back a very small PMTU for use over the rest of
  2651.    the path.  In other situations, it might be appropriate to set the DF
  2652.    bit in order to get feedback from later routers about PMTU
  2653.    constraints which require fragmentation.  The existence of both of
  2654.    these situations argues for enabling a system to decide whether or
  2655.    not to fragment over a particular network "link", i.e., for requiring
  2656.    an implementation to be able to copy the DF bit (and to process ICMP
  2657.    PMTU messages), but making it an option to be selected on a per
  2658.    interface basis.  In other words, an administrator should be able to
  2659.    configure the router's treatment of the DF bit (set, clear, copy from
  2660.    encapsulated header) for each interface.
  2661.  
  2662.    Note: If a bump-in-the-stack implementation of IPsec attempts to
  2663.    apply different IPsec algorithms based on source/destination ports,
  2664.    it will be difficult to apply Path MTU adjustments.
  2665.  
  2666. B.2 Fragmentation
  2667.  
  2668.    If required, IP fragmentation occurs after IPsec processing within an
  2669.    IPsec implementation.  Thus, transport mode AH or ESP is applied only
  2670.    to whole IP datagrams (not to IP fragments).  An IP packet to which
  2671.    AH or ESP has been applied may itself be fragmented by routers en
  2672.    route, and such fragments MUST be reassembled prior to IPsec
  2673.    processing at a receiver.  In tunnel mode, AH or ESP is applied to an
  2674.    IP packet, the payload of which may be a fragmented IP packet.  For
  2675.    example, a security gateway, "bump-in-the-stack" (BITS), or "bump-
  2676.    in-the-wire" (BITW) IPsec implementation may apply tunnel mode AH to
  2677.    such fragments.  Note that BITS or BITW implementations are examples
  2678.    of where a host IPsec implementation might receive fragments to which
  2679.    tunnel mode is to be applied.  However, if transport mode is to be
  2680.    applied, then these implementations MUST reassemble the fragments
  2681.    prior to applying IPsec.
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690. Kent & Atkinson             Standards Track                    [Page 48]
  2691.  
  2692. RFC 2401              Security Architecture for IP         November 1998
  2693.  
  2694.  
  2695.    NOTE: IPsec always has to figure out what the encapsulating IP header
  2696.    fields are.  This is independent of where you insert IPsec and is
  2697.    intrinsic to the definition of IPsec.  Therefore any IPsec
  2698.    implementation that is not integrated into an IP implementation must
  2699.    include code to construct the necessary IP headers (e.g., IP2):
  2700.  
  2701.         o AH-tunnel --> IP2-AH-IP1-Transport-Data
  2702.         o ESP-tunnel -->  IP2-ESP_hdr-IP1-Transport-Data-ESP_trailer
  2703.  
  2704.    *********************************************************************
  2705.  
  2706.    Overall, the fragmentation/reassembly approach described above works
  2707.    for all cases examined.
  2708.  
  2709.                               AH Xport   AH Tunnel  ESP Xport  ESP Tunnel
  2710.  Implementation approach      IPv4 IPv6  IPv4 IPv6  IPv4 IPv6  IPv4 IPv6
  2711.  -----------------------      ---- ----  ---- ----  ---- ----  ---- ----
  2712.  Hosts (integr w/ IP stack)     Y    Y     Y    Y     Y    Y     Y    Y
  2713.  Hosts (betw/ IP and drivers)   Y    Y     Y    Y     Y    Y     Y    Y
  2714.  S. Gwy (integr w/ IP stack)               Y    Y                Y    Y
  2715.  Outboard crypto processor *
  2716.  
  2717.         * If the crypto processor system has its own IP address, then it
  2718.           is covered by the security gateway case.  This box receives
  2719.           the packet from the host and performs IPsec processing.  It
  2720.           has to be able to handle the same AH, ESP, and related
  2721.           IPv4/IPv6 tunnel processing that a security gateway would have
  2722.           to handle.  If it doesn't have it's own address, then it is
  2723.           similar to the bump-in-the stack implementation between IP and
  2724.           the network drivers.
  2725.  
  2726.    The following analysis assumes that:
  2727.  
  2728.         1. There is only one IPsec module in a given system's stack.
  2729.            There isn't an IPsec module A (adding ESP/encryption and
  2730.            thus) hiding the transport protocol, SRC port, and DEST port
  2731.            from IPsec module B.
  2732.         2. There are several places where IPsec could be implemented (as
  2733.            shown in the table above).
  2734.                 a. Hosts with integration of IPsec into the native IP
  2735.                    implementation.  Implementer has access to the source
  2736.                    for the stack.
  2737.                 b. Hosts with bump-in-the-stack implementations, where
  2738.                    IPsec is implemented between IP and the local network
  2739.                    drivers.  Source access for stack is not available;
  2740.                    but there are well-defined interfaces that allows the
  2741.                    IPsec code to be incorporated into the system.
  2742.  
  2743.  
  2744.  
  2745.  
  2746. Kent & Atkinson             Standards Track                    [Page 49]
  2747.  
  2748. RFC 2401              Security Architecture for IP         November 1998
  2749.  
  2750.  
  2751.                 c. Security gateways and outboard crypto processors with
  2752.                    integration of IPsec into the stack.
  2753.         3. Not all of the above approaches are feasible in all hosts.
  2754.            But it was assumed that for each approach, there are some
  2755.            hosts for whom the approach is feasible.
  2756.  
  2757.    For each of the above 3 categories, there are IPv4 and IPv6, AH
  2758.    transport and tunnel modes, and ESP transport and tunnel modes -- for
  2759.    a total of 24 cases (3 x 2 x 4).
  2760.  
  2761.    Some header fields and interface fields are listed here for ease of
  2762.    reference -- they're not in the header order, but instead listed to
  2763.    allow comparison between the columns.  (* = not covered by AH
  2764.    authentication.  ESP authentication doesn't cover any headers that
  2765.    precede it.)
  2766.  
  2767.                                              IP/Transport Interface
  2768.              IPv4            IPv6            (RFC 1122 -- Sec 3.4)
  2769.              ----            ----            ----------------------
  2770.              Version = 4     Version = 6
  2771.              Header Len
  2772.              *TOS            Class,Flow Lbl  TOS
  2773.              Packet Len      Payload Len     Len
  2774.              ID                              ID (optional)
  2775.              *Flags                          DF
  2776.              *Offset
  2777.              *TTL            *Hop Limit      TTL
  2778.              Protocol        Next Header
  2779.              *Checksum
  2780.              Src Address     Src Address     Src Address
  2781.              Dst Address     Dst Address     Dst Address
  2782.              Options?        Options?        Opt
  2783.  
  2784.              ? = AH covers Option-Type and Option-Length, but
  2785.                  might not cover Option-Data.
  2786.  
  2787.    The results for each of the 20 cases is shown below ("works" = will
  2788.    work if system fragments after outbound IPsec processing, reassembles
  2789.    before inbound IPsec processing).  Notes indicate implementation
  2790.    issues.
  2791.  
  2792.     a. Hosts (integrated into IP stack)
  2793.           o AH-transport  --> (IP1-AH-Transport-Data)
  2794.                     - IPv4 -- works
  2795.                     - IPv6 -- works
  2796.           o AH-tunnel --> (IP2-AH-IP1-Transport-Data)
  2797.                     - IPv4 -- works
  2798.                     - IPv6 -- works
  2799.  
  2800.  
  2801.  
  2802. Kent & Atkinson             Standards Track                    [Page 50]
  2803.  
  2804. RFC 2401              Security Architecture for IP         November 1998
  2805.  
  2806.  
  2807.           o ESP-transport --> (IP1-ESP_hdr-Transport-Data-ESP_trailer)
  2808.                     - IPv4 -- works
  2809.                     - IPv6 -- works
  2810.           o ESP-tunnel -->  (IP2-ESP_hdr-IP1-Transport-Data-ESP_trailer)
  2811.                     - IPv4 -- works
  2812.                     - IPv6 -- works
  2813.  
  2814.     b. Hosts (Bump-in-the-stack) -- put IPsec between IP layer and
  2815.        network drivers.  In this case, the IPsec module would have to do
  2816.        something like one of the following for fragmentation and
  2817.        reassembly.
  2818.             - do the fragmentation/reassembly work itself and
  2819.               send/receive the packet directly to/from the network
  2820.               layer.  In AH or ESP transport mode, this is fine.  In AH
  2821.               or ESP tunnel mode where the tunnel end is at the ultimate
  2822.               destination, this is fine.  But in AH or ESP tunnel modes
  2823.               where the tunnel end is different from the ultimate
  2824.               destination and where the source host is multi-homed, this
  2825.               approach could result in sub-optimal routing because the
  2826.               IPsec module may be unable to obtain the information
  2827.               needed (LAN interface and next-hop gateway) to direct the
  2828.               packet to the appropriate network interface.  This is not
  2829.               a problem if the interface and next-hop gateway are the
  2830.               same for the ultimate destination and for the tunnel end.
  2831.               But if they are different, then IPsec would need to know
  2832.               the LAN interface and the next-hop gateway for the tunnel
  2833.               end.  (Note: The tunnel end (security gateway) is highly
  2834.               likely to be on the regular path to the ultimate
  2835.               destination.  But there could also be more than one path
  2836.               to the destination, e.g., the host could be at an
  2837.               organization with 2 firewalls.  And the path being used
  2838.               could involve the less commonly chosen firewall.)  OR
  2839.             - pass the IPsec'd packet back to the IP layer where an
  2840.               extra IP header would end up being pre-pended and the
  2841.               IPsec module would have to check and let IPsec'd fragments
  2842.               go by.
  2843.                                     OR
  2844.             - pass the packet contents to the IP layer in a form such
  2845.               that the IP layer recreates an appropriate IP header
  2846.  
  2847.        At the network layer, the IPsec module will have access to the
  2848.        following selectors from the packet -- SRC address, DST address,
  2849.        Next Protocol, and if there's a transport layer header --> SRC
  2850.        port and DST port.  One cannot assume IPsec has access to the
  2851.        Name.  It is assumed that the available selector information is
  2852.        sufficient to figure out the relevant Security Policy entry and
  2853.        Security Association(s).
  2854.  
  2855.  
  2856.  
  2857.  
  2858. Kent & Atkinson             Standards Track                    [Page 51]
  2859.  
  2860. RFC 2401              Security Architecture for IP         November 1998
  2861.  
  2862.  
  2863.           o AH-transport  --> (IP1-AH-Transport-Data)
  2864.                     - IPv4 -- works
  2865.                     - IPv6 -- works
  2866.           o AH-tunnel --> (IP2-AH-IP1-Transport-Data)
  2867.                     - IPv4 -- works
  2868.                     - IPv6 -- works
  2869.           o ESP-transport --> (IP1-ESP_hdr-Transport-Data-ESP_trailer)
  2870.                     - IPv4 -- works
  2871.                     - IPv6 -- works
  2872.           o ESP-tunnel -->  (IP2-ESP_hdr-IP1-Transport-Data-ESP_trailer)
  2873.                     - IPv4 -- works
  2874.                     - IPv6 -- works
  2875.  
  2876.     c. Security gateways -- integrate IPsec into the IP stack
  2877.  
  2878.        NOTE: The IPsec module will have access to the following
  2879.        selectors from the packet -- SRC address, DST address, Next
  2880.        Protocol, and if there's a transport layer header --> SRC port
  2881.        and DST port.  It won't have access to the User ID (only Hosts
  2882.        have access to User ID information.)  Unlike some Bump-in-the-
  2883.        stack implementations, security gateways may be able to look up
  2884.        the Source Address in the DNS to provide a System Name, e.g., in
  2885.        situations involving use of dynamically assigned IP addresses in
  2886.        conjunction with dynamically updated DNS entries.  It also won't
  2887.        have access to the transport layer information if there is an ESP
  2888.        header, or if it's not the first fragment of a fragmented
  2889.        message.  It is assumed that the available selector information
  2890.        is sufficient to figure out the relevant Security Policy entry
  2891.        and Security Association(s).
  2892.  
  2893.           o AH-tunnel --> (IP2-AH-IP1-Transport-Data)
  2894.                     - IPv4 -- works
  2895.                     - IPv6 -- works
  2896.           o ESP-tunnel -->  (IP2-ESP_hdr-IP1-Transport-Data-ESP_trailer)
  2897.                     - IPv4 -- works
  2898.                     - IPv6 -- works
  2899.  
  2900.    **********************************************************************
  2901.  
  2902. B.3 Path MTU Discovery
  2903.  
  2904.    As mentioned earlier, "ICMP PMTU" refers to an ICMP message used for
  2905.    Path MTU Discovery.
  2906.  
  2907.    The legend for the diagrams below in B.3.1 and B.3.3 (but not B.3.2)
  2908.    is:
  2909.  
  2910.         ==== = security association (AH or ESP, transport or tunnel)
  2911.  
  2912.  
  2913.  
  2914. Kent & Atkinson             Standards Track                    [Page 52]
  2915.  
  2916. RFC 2401              Security Architecture for IP         November 1998
  2917.  
  2918.  
  2919.         ---- = connectivity (or if so labelled, administrative boundary)
  2920.         .... = ICMP message (hereafter referred to as ICMP PMTU) for
  2921.  
  2922.                 IPv4:
  2923.                 - Type = 3 (Destination Unreachable)
  2924.                 - Code = 4 (Fragmentation needed and DF set)
  2925.                 - Next-Hop MTU in the low-order 16 bits of the second
  2926.                   word of the ICMP header (labelled unused in RFC 792),
  2927.                   with high-order 16 bits set to zero
  2928.  
  2929.                 IPv6 (RFC 1885):
  2930.                 - Type = 2 (Packet Too Big)
  2931.                 - Code = 0 (Fragmentation needed and DF set)
  2932.                 - Next-Hop MTU in the 32 bit MTU field of the ICMP6
  2933.  
  2934.         Hx   = host x
  2935.         Rx   = router x
  2936.         SGx  = security gateway x
  2937.         X*   = X supports IPsec
  2938.  
  2939. B.3.1 Identifying the Originating Host(s)
  2940.  
  2941. The amount of information returned with the ICMP message is limited
  2942. and this affects what selectors are available to identify security
  2943. associations, originating hosts, etc. for use in further propagating
  2944. the PMTU information.
  2945.  
  2946. In brief...  An ICMP message must contain the following information
  2947. from the "offending" packet:
  2948.         - IPv4 (RFC 792) --  IP header plus a minimum of 64 bits
  2949.  
  2950. Accordingly, in the IPv4 context, an ICMP PMTU may identify only the
  2951. first (outermost) security association.  This is because the ICMP
  2952. PMTU may contain only 64 bits of the "offending" packet beyond the IP
  2953. header, which would capture only the first SPI from AH or ESP.  In
  2954. the IPv6 context, an ICMP PMTU will probably provide all the SPIs and
  2955. the selectors in the IP header, but maybe not the SRC/DST ports (in
  2956. the transport header) or the encapsulated (TCP, UDP, etc.) protocol.
  2957. Moreover, if ESP is used, the transport ports and protocol selectors
  2958. may be encrypted.
  2959.  
  2960. Looking at the diagram below of a security gateway tunnel (as
  2961. mentioned elsewhere, security gateways do not use transport mode)...
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970. Kent & Atkinson             Standards Track                    [Page 53]
  2971.  
  2972. RFC 2401              Security Architecture for IP         November 1998
  2973.  
  2974.  
  2975.      H1   ===================           H3
  2976.        \  |                 |          /
  2977.    H0 -- SG1* ---- R1 ---- SG2* ---- R2 -- H5
  2978.        /  ^        |                   \
  2979.      H2   |........|                    H4
  2980.  
  2981.    Suppose that the security policy for SG1 is to use a single SA to SG2
  2982.    for all the traffic between hosts H0, H1, and H2 and hosts H3, H4,
  2983.    and H5.  And suppose H0 sends a data packet to H5 which causes R1 to
  2984.    send an ICMP PMTU message to SG1.  If the PMTU message has only the
  2985.    SPI, SG1 will be able to look up the SA and find the list of possible
  2986.    hosts (H0, H1, H2, wildcard); but SG1 will have no way to figure out
  2987.    that H0 sent the traffic that triggered the ICMP PMTU message.
  2988.  
  2989.       original        after IPsec     ICMP
  2990.       packet          processing      packet
  2991.       --------        -----------     ------
  2992.                                       IP-3 header (S = R1, D = SG1)
  2993.                                       ICMP header (includes PMTU)
  2994.                       IP-2 header     IP-2 header (S = SG1, D = SG2)
  2995.                       ESP header      minimum of 64 bits of ESP hdr (*)
  2996.       IP-1 header     IP-1 header
  2997.       TCP header      TCP header
  2998.       TCP data        TCP data
  2999.                       ESP trailer
  3000.  
  3001.       (*) The 64 bits will include enough of the ESP (or AH) header to
  3002.           include the SPI.
  3003.               - ESP -- SPI (32 bits), Seq number (32 bits)
  3004.               - AH -- Next header (8 bits), Payload Len (8 bits),
  3005.                 Reserved (16 bits), SPI (32 bits)
  3006.  
  3007.    This limitation on the amount of information returned with an ICMP
  3008.    message creates a problem in identifying the originating hosts for
  3009.    the packet (so as to know where to further propagate the ICMP PMTU
  3010.    information).  If the ICMP message contains only 64 bits of the IPsec
  3011.    header (minimum for IPv4), then the IPsec selectors (e.g., Source and
  3012.    Destination addresses, Next Protocol, Source and Destination ports,
  3013.    etc.) will have been lost.  But the ICMP error message will still
  3014.    provide SG1 with the SPI, the PMTU information and the source and
  3015.    destination gateways for the relevant security association.
  3016.  
  3017.    The destination security gateway and SPI uniquely define a security
  3018.    association which in turn defines a set of possible originating
  3019.    hosts.  At this point, SG1 could:
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026. Kent & Atkinson             Standards Track                    [Page 54]
  3027.  
  3028. RFC 2401              Security Architecture for IP         November 1998
  3029.  
  3030.  
  3031.    a. send the PMTU information to all the possible originating hosts.
  3032.       This would not work well if the host list is a wild card or if
  3033.       many/most of the hosts weren't sending to SG1; but it might work
  3034.       if the SPI/destination/etc mapped to just one or a small number of
  3035.       hosts.
  3036.    b. store the PMTU with the SPI/etc and wait until the next packet(s)
  3037.       arrive from the originating host(s) for the relevant security
  3038.       association.  If it/they are bigger than the PMTU, drop the
  3039.       packet(s), and compose ICMP PMTU message(s) with the new packet(s)
  3040.       and the updated PMTU, and send the originating host(s) the ICMP
  3041.       message(s) about the problem.  This involves a delay in notifying
  3042.       the originating host(s), but avoids the problems of (a).
  3043.  
  3044.    Since only the latter approach is feasible in all instances, a
  3045.    security gateway MUST provide such support, as an option.  However,
  3046.    if the ICMP message contains more information from the original
  3047.    packet, then there may be enough information to immediately determine
  3048.    to which host to propagate the ICMP/PMTU message and to provide that
  3049.    system with the 5 fields (source address, destination address, source
  3050.    port, destination port, and transport protocol) needed to determine
  3051.    where to store/update the PMTU.  Under such circumstances, a security
  3052.    gateway MUST generate an ICMP PMTU message immediately upon receipt
  3053.    of an ICMP PMTU from further down the path.  NOTE: The Next Protocol
  3054.    field may not be contained in the ICMP message and the use of ESP
  3055.    encryption may hide the selector fields that have been encrypted.
  3056.  
  3057. B.3.2 Calculation of PMTU
  3058.  
  3059.    The calculation of PMTU from an ICMP PMTU has to take into account
  3060.    the addition of any IPsec header by H1 -- AH and/or ESP transport, or
  3061.    ESP or AH tunnel.  Within a single host, multiple applications may
  3062.    share an SPI and nesting of security associations may occur.  (See
  3063.    Section 4.5 Basic Combinations of Security Associations for
  3064.    description of the combinations that MUST be supported).  The diagram
  3065.    below illustrates an example of security associations between a pair
  3066.    of hosts (as viewed from the perspective of one of the hosts.)  (ESPx
  3067.    or AHx = transport mode)
  3068.  
  3069.            Socket 1 -------------------------|
  3070.                                              |
  3071.            Socket 2 (ESPx/SPI-A) ---------- AHx (SPI-B) -- Internet
  3072.  
  3073.    In order to figure out the PMTU for each socket that maps to SPI-B,
  3074.    it will be necessary to have backpointers from SPI-B to each of the 2
  3075.    paths that lead to it -- Socket 1 and Socket 2/SPI-A.
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082. Kent & Atkinson             Standards Track                    [Page 55]
  3083.  
  3084. RFC 2401              Security Architecture for IP         November 1998
  3085.  
  3086.  
  3087. B.3.3 Granularity of Maintaining PMTU Data
  3088.  
  3089.    In hosts, the granularity with which PMTU ICMP processing can be done
  3090.    differs depending on the implementation situation.  Looking at a
  3091.    host, there are three situations that are of interest with respect to
  3092.    PMTU issues:
  3093.  
  3094.    a. Integration of IPsec into the native IP implementation
  3095.    b. Bump-in-the-stack implementations, where IPsec is implemented
  3096.       "underneath" an existing implementation of a TCP/IP protocol
  3097.       stack, between the native IP and the local network drivers
  3098.    c. No IPsec implementation -- This case is included because it is
  3099.       relevant in cases where a security gateway is sending PMTU
  3100.       information back to a host.
  3101.  
  3102.    Only in case (a) can the PMTU data be maintained at the same
  3103.    granularity as communication associations.  In the other cases, the
  3104.    IP layer will maintain PMTU data at the granularity of Source and
  3105.    Destination IP addresses (and optionally TOS/Class), as described in
  3106.    RFC 1191.  This is an important difference, because more than one
  3107.    communication association may map to the same source and destination
  3108.    IP addresses, and each communication association may have a different
  3109.    amount of IPsec header overhead (e.g., due to use of different
  3110.    transforms or different algorithms).  The examples below illustrate
  3111.    this.
  3112.  
  3113.    In cases (a) and (b)...  Suppose you have the following situation.
  3114.    H1 is sending to H2 and the packet to be sent from R1 to R2 exceeds
  3115.    the PMTU of the network hop between them.
  3116.  
  3117.                  ==================================
  3118.                  |                                |
  3119.                 H1* --- R1 ----- R2 ---- R3 ---- H2*
  3120.                  ^       |
  3121.                  |.......|
  3122.  
  3123.    If R1 is configured to not fragment subscriber traffic, then R1 sends
  3124.    an ICMP PMTU message with the appropriate PMTU to H1.  H1's
  3125.    processing would vary with the nature of the implementation.  In case
  3126.    (a) (native IP), the security services are bound to sockets or the
  3127.    equivalent.  Here the IP/IPsec implementation in H1 can store/update
  3128.    the PMTU for the associated socket.  In case (b), the IP layer in H1
  3129.    can store/update the PMTU but only at the granularity of Source and
  3130.    Destination addresses and possibly TOS/Class, as noted above.  So the
  3131.    result may be sub-optimal, since the PMTU for a given
  3132.    SRC/DST/TOS/Class will be the subtraction of the largest amount of
  3133.    IPsec header used for any communication association between a given
  3134.    source and destination.
  3135.  
  3136.  
  3137.  
  3138. Kent & Atkinson             Standards Track                    [Page 56]
  3139.  
  3140. RFC 2401              Security Architecture for IP         November 1998
  3141.  
  3142.  
  3143.    In case (c), there has to be a security gateway to have any IPsec
  3144.    processing.  So suppose you have the following situation.  H1 is
  3145.    sending to H2 and the packet to be sent from SG1 to R exceeds the
  3146.    PMTU of the network hop between them.
  3147.  
  3148.                          ================
  3149.                          |              |
  3150.                 H1 ---- SG1* --- R --- SG2* ---- H2
  3151.                  ^       |
  3152.                  |.......|
  3153.  
  3154.    As described above for case (b), the IP layer in H1 can store/update
  3155.    the PMTU but only at the granularity of Source and Destination
  3156.    addresses, and possibly TOS/Class.  So the result may be sub-optimal,
  3157.    since the PMTU for a given SRC/DST/TOS/Class will be the subtraction
  3158.    of the largest amount of IPsec header used for any communication
  3159.    association between a given source and destination.
  3160.  
  3161. B.3.4 Per Socket Maintenance of PMTU Data
  3162.  
  3163.    Implementation of the calculation of PMTU (Section B.3.2) and support
  3164.    for PMTUs at the granularity of individual "communication
  3165.    associations" (Section B.3.3) is a local matter.  However, a socket-
  3166.    based implementation of IPsec in a host SHOULD maintain the
  3167.    information on a per socket basis.  Bump in the stack systems MUST
  3168.    pass an ICMP PMTU to the host IP implementation, after adjusting it
  3169.    for any IPsec header overhead added by these systems.  The
  3170.    determination of the overhead SHOULD be determined by analysis of the
  3171.    SPI and any other selector information present in a returned ICMP
  3172.    PMTU message.
  3173.  
  3174. B.3.5 Delivery of PMTU Data to the Transport Layer
  3175.  
  3176.    The host mechanism for getting the updated PMTU to the transport
  3177.    layer is unchanged, as specified in RFC 1191 (Path MTU Discovery).
  3178.  
  3179. B.3.6 Aging of PMTU Data
  3180.  
  3181.    This topic is covered in Section 6.1.2.4.
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194. Kent & Atkinson             Standards Track                    [Page 57]
  3195.  
  3196. RFC 2401              Security Architecture for IP         November 1998
  3197.  
  3198.  
  3199. Appendix C -- Sequence Space Window Code Example
  3200.  
  3201.    This appendix contains a routine that implements a bitmask check for
  3202.    a 32 packet window.  It was provided by James Hughes
  3203.    (jim_hughes@stortek.com) and Harry Varnis (hgv@anubis.network.com)
  3204.    and is intended as an implementation example.  Note that this code
  3205.    both checks for a replay and updates the window.  Thus the algorithm,
  3206.    as shown, should only be called AFTER the packet has been
  3207.    authenticated.  Implementers might wish to consider splitting the
  3208.    code to do the check for replays before computing the ICV.  If the
  3209.    packet is not a replay, the code would then compute the ICV, (discard
  3210.    any bad packets), and if the packet is OK, update the window.
  3211.  
  3212. #include <stdio.h>
  3213. #include <stdlib.h>
  3214. typedef unsigned long u_long;
  3215.  
  3216. enum {
  3217.     ReplayWindowSize = 32
  3218. };
  3219.  
  3220. u_long bitmap = 0;                 /* session state - must be 32 bits */
  3221. u_long lastSeq = 0;                     /* session state */
  3222.  
  3223. /* Returns 0 if packet disallowed, 1 if packet permitted */
  3224. int ChkReplayWindow(u_long seq);
  3225.  
  3226. int ChkReplayWindow(u_long seq) {
  3227.     u_long diff;
  3228.  
  3229.     if (seq == 0) return 0;             /* first == 0 or wrapped */
  3230.     if (seq > lastSeq) {                /* new larger sequence number */
  3231.         diff = seq - lastSeq;
  3232.         if (diff < ReplayWindowSize) {  /* In window */
  3233.             bitmap <<= diff;
  3234.             bitmap |= 1;                /* set bit for this packet */
  3235.         } else bitmap = 1;          /* This packet has a "way larger" */
  3236.         lastSeq = seq;
  3237.         return 1;                       /* larger is good */
  3238.     }
  3239.     diff = lastSeq - seq;
  3240.     if (diff >= ReplayWindowSize) return 0; /* too old or wrapped */
  3241.     if (bitmap & ((u_long)1 << diff)) return 0; /* already seen */
  3242.     bitmap |= ((u_long)1 << diff);              /* mark as seen */
  3243.     return 1;                           /* out of order but good */
  3244. }
  3245.  
  3246. char string_buffer[512];
  3247.  
  3248.  
  3249.  
  3250. Kent & Atkinson             Standards Track                    [Page 58]
  3251.  
  3252. RFC 2401              Security Architecture for IP         November 1998
  3253.  
  3254.  
  3255. #define STRING_BUFFER_SIZE sizeof(string_buffer)
  3256.  
  3257. int main() {
  3258.     int result;
  3259.     u_long last, current, bits;
  3260.  
  3261.     printf("Input initial state (bits in hex, last msgnum):\n");
  3262.     if (!fgets(string_buffer, STRING_BUFFER_SIZE, stdin)) exit(0);
  3263.     sscanf(string_buffer, "%lx %lu", &bits, &last);
  3264.     if (last != 0)
  3265.     bits |= 1;
  3266.     bitmap = bits;
  3267.     lastSeq = last;
  3268.     printf("bits:%08lx last:%lu\n", bitmap, lastSeq);
  3269.     printf("Input value to test (current):\n");
  3270.  
  3271.     while (1) {
  3272.         if (!fgets(string_buffer, STRING_BUFFER_SIZE, stdin)) break;
  3273.         sscanf(string_buffer, "%lu", ¤t);
  3274.         result = ChkReplayWindow(current);
  3275.         printf("%-3s", result ? "OK" : "BAD");
  3276.         printf(" bits:%08lx last:%lu\n", bitmap, lastSeq);
  3277.     }
  3278.     return 0;
  3279. }
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306. Kent & Atkinson             Standards Track                    [Page 59]
  3307.  
  3308. RFC 2401              Security Architecture for IP         November 1998
  3309.  
  3310.  
  3311. Appendix D -- Categorization of ICMP messages
  3312.  
  3313. The tables below characterize ICMP messages as being either host
  3314. generated, router generated, both, unassigned/unknown.  The first set
  3315. are IPv4.  The second set are IPv6.
  3316.  
  3317.                                 IPv4
  3318.  
  3319. Type    Name/Codes                                             Reference
  3320. ========================================================================
  3321. HOST GENERATED:
  3322.   3     Destination Unreachable
  3323.          2  Protocol Unreachable                               [RFC792]
  3324.          3  Port Unreachable                                   [RFC792]
  3325.          8  Source Host Isolated                               [RFC792]
  3326.         14  Host Precedence Violation                          [RFC1812]
  3327.  10     Router Selection                                       [RFC1256]
  3328.  
  3329.  
  3330.  
  3331.  
  3332. Type    Name/Codes                                             Reference
  3333. ========================================================================
  3334. ROUTER GENERATED:
  3335.   3     Destination Unreachable
  3336.          0  Net Unreachable                                    [RFC792]
  3337.          4  Fragmentation Needed, Don't Fragment was Set       [RFC792]
  3338.          5  Source Route Failed                                [RFC792]
  3339.          6  Destination Network Unknown                        [RFC792]
  3340.          7  Destination Host Unknown                           [RFC792]
  3341.          9  Comm. w/Dest. Net. is Administratively Prohibited  [RFC792]
  3342.         11  Destination Network Unreachable for Type of Service[RFC792]
  3343.   5     Redirect
  3344.          0  Redirect Datagram for the Network (or subnet)      [RFC792]
  3345.          2  Redirect Datagram for the Type of Service & Network[RFC792]
  3346.   9     Router Advertisement                                   [RFC1256]
  3347.  18     Address Mask Reply                                     [RFC950]
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362. Kent & Atkinson             Standards Track                    [Page 60]
  3363.  
  3364. RFC 2401              Security Architecture for IP         November 1998
  3365.  
  3366.  
  3367.                                 IPv4
  3368. Type    Name/Codes                                             Reference
  3369. ========================================================================
  3370. BOTH ROUTER AND HOST GENERATED:
  3371.   0     Echo Reply                                             [RFC792]
  3372.   3     Destination Unreachable
  3373.          1  Host Unreachable                                   [RFC792]
  3374.         10  Comm. w/Dest. Host is Administratively Prohibited  [RFC792]
  3375.         12  Destination Host Unreachable for Type of Service   [RFC792]
  3376.         13  Communication Administratively Prohibited          [RFC1812]
  3377.         15  Precedence cutoff in effect                        [RFC1812]
  3378.   4     Source Quench                                          [RFC792]
  3379.   5     Redirect
  3380.          1  Redirect Datagram for the Host                     [RFC792]
  3381.          3  Redirect Datagram for the Type of Service and Host [RFC792]
  3382.   6     Alternate Host Address                                 [JBP]
  3383.   8     Echo                                                   [RFC792]
  3384.  11     Time Exceeded                                          [RFC792]
  3385.  12     Parameter Problem                              [RFC792,RFC1108]
  3386.  13     Timestamp                                              [RFC792]
  3387.  14     Timestamp Reply                                        [RFC792]
  3388.  15     Information Request                                    [RFC792]
  3389.  16     Information Reply                                      [RFC792]
  3390.  17     Address Mask Request                                   [RFC950]
  3391.  30     Traceroute                                             [RFC1393]
  3392.  31     Datagram Conversion Error                              [RFC1475]
  3393.  32     Mobile Host Redirect                                   [Johnson]
  3394.  39     SKIP                                                   [Markson]
  3395.  40     Photuris                                               [Simpson]
  3396.  
  3397.  
  3398. Type    Name/Codes                                             Reference
  3399. ========================================================================
  3400. UNASSIGNED TYPE OR UNKNOWN GENERATOR:
  3401.   1     Unassigned                                             [JBP]
  3402.   2     Unassigned                                             [JBP]
  3403.   7     Unassigned                                             [JBP]
  3404.  19     Reserved (for Security)                                [Solo]
  3405.  20-29  Reserved (for Robustness Experiment)                   [ZSu]
  3406.  33     IPv6 Where-Are-You                                     [Simpson]
  3407.  34     IPv6 I-Am-Here                                         [Simpson]
  3408.  35     Mobile Registration Request                            [Simpson]
  3409.  36     Mobile Registration Reply                              [Simpson]
  3410.  37     Domain Name Request                                    [Simpson]
  3411.  38     Domain Name Reply                                      [Simpson]
  3412.  41-255 Reserved                                               [JBP]
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418. Kent & Atkinson             Standards Track                    [Page 61]
  3419.  
  3420. RFC 2401              Security Architecture for IP         November 1998
  3421.  
  3422.  
  3423.                                 IPv6
  3424.  
  3425. Type    Name/Codes                                             Reference
  3426. ========================================================================
  3427. HOST GENERATED:
  3428.   1     Destination Unreachable                                [RFC 1885]
  3429.          4  Port Unreachable
  3430.  
  3431. Type    Name/Codes                                             Reference
  3432. ========================================================================
  3433. ROUTER GENERATED:
  3434.   1     Destination Unreachable                                [RFC1885]
  3435.          0  No Route to Destination
  3436.          1  Comm. w/Destination is Administratively Prohibited
  3437.          2  Not a Neighbor
  3438.          3  Address Unreachable
  3439.   2     Packet Too Big                                         [RFC1885]
  3440.          0
  3441.   3     Time Exceeded                                          [RFC1885]
  3442.          0  Hop Limit Exceeded in Transit
  3443.          1  Fragment reassembly time exceeded
  3444.  
  3445.  
  3446. Type    Name/Codes                                             Reference
  3447. ========================================================================
  3448. BOTH ROUTER AND HOST GENERATED:
  3449.   4     Parameter Problem                                      [RFC1885]
  3450.          0  Erroneous Header Field Encountered
  3451.          1  Unrecognized Next Header Type Encountered
  3452.          2  Unrecognized IPv6 Option Encountered
  3453.  
  3454.  
  3455.  
  3456.  
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474. Kent & Atkinson             Standards Track                    [Page 62]
  3475.  
  3476. RFC 2401              Security Architecture for IP         November 1998
  3477.  
  3478.  
  3479. References
  3480.  
  3481.    [BL73]    Bell, D.E. & LaPadula, L.J., "Secure Computer Systems:
  3482.              Mathematical Foundations and Model", Technical Report M74-
  3483.              244, The MITRE Corporation, Bedford, MA, May 1973.
  3484.  
  3485.    [Bra97]   Bradner, S., "Key words for use in RFCs to Indicate
  3486.              Requirement Level", BCP 14, RFC 2119, March 1997.
  3487.  
  3488.    [DoD85]   US National Computer Security Center, "Department of
  3489.              Defense Trusted Computer System Evaluation Criteria", DoD
  3490.              5200.28-STD, US Department of Defense, Ft. Meade, MD.,
  3491.              December 1985.
  3492.  
  3493.    [DoD87]   US National Computer Security Center, "Trusted Network
  3494.              Interpretation of the Trusted Computer System Evaluation
  3495.              Criteria", NCSC-TG-005, Version 1, US Department of
  3496.              Defense, Ft. Meade, MD., 31 July 1987.
  3497.  
  3498.    [HA94]    Haller, N., and R. Atkinson, "On Internet Authentication",
  3499.              RFC 1704, October 1994.
  3500.  
  3501.    [HC98]    Harkins, D., and D. Carrel, "The Internet Key Exchange
  3502.              (IKE)", RFC 2409, November 1998.
  3503.  
  3504.    [HM97]    Harney, H., and C.  Muckenhirn, "Group Key Management
  3505.              Protocol (GKMP) Architecture", RFC 2094, July 1997.
  3506.  
  3507.    [ISO]     ISO/IEC JTC1/SC6, Network Layer Security Protocol, ISO-IEC
  3508.              DIS 11577, International Standards Organisation, Geneva,
  3509.              Switzerland, 29 November 1992.
  3510.  
  3511.    [IB93]    John Ioannidis and Matt Blaze, "Architecture and
  3512.              Implementation of Network-layer Security Under Unix",
  3513.              Proceedings of USENIX Security Symposium, Santa Clara, CA,
  3514.              October 1993.
  3515.  
  3516.    [IBK93]   John Ioannidis, Matt Blaze, & Phil Karn, "swIPe: Network-
  3517.              Layer Security for IP", presentation at the Spring 1993
  3518.              IETF Meeting, Columbus, Ohio
  3519.  
  3520.    [KA98a]   Kent, S., and R. Atkinson, "IP Authentication Header", RFC
  3521.              2402, November 1998.
  3522.  
  3523.    [KA98b]   Kent, S., and R. Atkinson, "IP Encapsulating Security
  3524.              Payload (ESP)", RFC 2406, November 1998.
  3525.  
  3526.  
  3527.  
  3528.  
  3529.  
  3530. Kent & Atkinson             Standards Track                    [Page 63]
  3531.  
  3532. RFC 2401              Security Architecture for IP         November 1998
  3533.  
  3534.  
  3535.    [Ken91]   Kent, S., "US DoD Security Options for the Internet
  3536.              Protocol", RFC 1108, November 1991.
  3537.  
  3538.    [MSST97]  Maughan, D., Schertler, M., Schneider, M., and J. Turner,
  3539.              "Internet Security Association and Key Management Protocol
  3540.              (ISAKMP)", RFC 2408, November 1998.
  3541.  
  3542.    [Orm97]   Orman, H., "The OAKLEY Key Determination Protocol", RFC
  3543.              2412, November 1998.
  3544.  
  3545.    [Pip98]   Piper, D., "The Internet IP Security Domain of
  3546.              Interpretation for ISAKMP", RFC 2407, November 1998.
  3547.  
  3548.    [Sch94]   Bruce Schneier, Applied Cryptography, Section 8.6, John
  3549.              Wiley & Sons, New York, NY, 1994.
  3550.  
  3551.    [SDNS]    SDNS Secure Data Network System, Security Protocol 3, SP3,
  3552.              Document SDN.301, Revision 1.5, 15 May 1989, published in
  3553.              NIST Publication NIST-IR-90-4250, February 1990.
  3554.  
  3555.    [SMPT98]  Shacham, A., Monsour, R., Pereira, R., and M. Thomas, "IP
  3556.              Payload Compression Protocol (IPComp)", RFC 2393, August
  3557.              1998.
  3558.  
  3559.    [TDG97]   Thayer, R., Doraswamy, N., and R. Glenn, "IP Security
  3560.              Document Roadmap", RFC 2411, November 1998.
  3561.  
  3562.    [VK83]    V.L. Voydock & S.T. Kent, "Security Mechanisms in High-
  3563.              level Networks", ACM Computing Surveys, Vol. 15, No. 2,
  3564.              June 1983.
  3565.  
  3566. Disclaimer
  3567.  
  3568.    The views and specification expressed in this document are those of
  3569.    the authors and are not necessarily those of their employers.  The
  3570.    authors and their employers specifically disclaim responsibility for
  3571.    any problems arising from correct or incorrect implementation or use
  3572.    of this design.
  3573.  
  3574.  
  3575.  
  3576.  
  3577.  
  3578.  
  3579.  
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586. Kent & Atkinson             Standards Track                    [Page 64]
  3587.  
  3588. RFC 2401              Security Architecture for IP         November 1998
  3589.  
  3590.  
  3591. Author Information
  3592.  
  3593.    Stephen Kent
  3594.    BBN Corporation
  3595.    70 Fawcett Street
  3596.    Cambridge, MA  02140
  3597.    USA
  3598.  
  3599.    Phone: +1 (617) 873-3988
  3600.    EMail: kent@bbn.com
  3601.  
  3602.  
  3603.    Randall Atkinson
  3604.    @Home Network
  3605.    425 Broadway
  3606.    Redwood City, CA 94063
  3607.    USA
  3608.  
  3609.    Phone: +1 (415) 569-5000
  3610.    EMail: rja@corp.home.net
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642. Kent & Atkinson             Standards Track                    [Page 65]
  3643.  
  3644. RFC 2401              Security Architecture for IP         November 1998
  3645.  
  3646.  
  3647. Copyright (C) The Internet Society (1998).  All Rights Reserved.
  3648.  
  3649.    This document and translations of it may be copied and furnished to
  3650.    others, and derivative works that comment on or otherwise explain it
  3651.    or assist in its implementation may be prepared, copied, published
  3652.    and distributed, in whole or in part, without restriction of any
  3653.    kind, provided that the above copyright notice and this paragraph are
  3654.    included on all such copies and derivative works.  However, this
  3655.    document itself may not be modified in any way, such as by removing
  3656.    the copyright notice or references to the Internet Society or other
  3657.    Internet organizations, except as needed for the purpose of
  3658.    developing Internet standards in which case the procedures for
  3659.    copyrights defined in the Internet Standards process must be
  3660.    followed, or as required to translate it into languages other than
  3661.    English.
  3662.  
  3663.    The limited permissions granted above are perpetual and will not be
  3664.    revoked by the Internet Society or its successors or assigns.
  3665.  
  3666.    This document and the information contained herein is provided on an
  3667.    "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
  3668.    TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  3669.    BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
  3670.    HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
  3671.    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698. Kent & Atkinson             Standards Track                    [Page 66]
  3699.  
  3700.