<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
 <!ENTITY rfc2119 PUBLIC ""
          "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY rfc7830 PUBLIC ""
          "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7830.xml">
]>

<rfc category="std" docName="draft-mayrhofer-dprive-padding-profile-00"
  ipr="trust200902">
  <?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
  <?rfc toc="yes" ?>
  <?rfc symrefs="yes" ?>
  <?rfc sortrefs="yes"?>
  <?rfc iprnotified="no" ?>
  <?rfc strict="yes" ?>
  <front>
    <title abbrev="draft-mayrhofer-dprive-padding-profile">Padding Profiles for EDNS(0)</title>

    <author initials="A.M." surname="Mayrhofer"
      fullname="Alexander Mayrhofer">
      <organization>nic.at GmbH</organization>
      <address>
    <postal>
     <street>Karlsplatz 1/2/9</street>
     <city>Vienna</city>
     <code>1010</code>
     <country>Austria</country>
    </postal>
    <email>alex.mayrhofer.ietf@gmail.com</email>
   </address>
   </author>
   <!-- TODO / Q to the group 
      useful document?
	  more strategies?
	  do we want recommend strategies?
	  standards track or informational?
	  consider implications of actual padding length? (max/ min)
	  security considerations - open!

   -->
   <date year="2016"/>
   <area>Operations and Management Area</area>
    <!-- <workgroup></workgroup> -->
    <abstract>
      <t>   
	  RFC 7830 specifies the EDNS0 'Padding' option, but does not specify the amount of 
      padding to be used in specific applications. This memo lists the possible options
      ("Padding Profiles"), discusses the implications of each of these options, and 
	  provides implementation guidance.
      </t>
    </abstract>
  </front>
  <middle>
    <section title="Introduction">
	  <t><xref target="RFC7830">RFC 7830</xref> specifies the Extensions Mechanisms for DNS (EDNS(0))
      "Padding" option, which allows DNS clients and servers to 
	  artificially increase the size of a DNS message by a variable number
      of bytes, hampering size-based correlation of encrypted DNS messages.
      </t>
	  <t>However, RFC 7803 deliberately does not specify the actual amount of padding to be used. 
	  This memo discusses options regarding the actual size of padding, and lists advantages and 
	  disadvantages of each of these "Padding Strategies".
	  </t>
	</section>
    <section anchor="terminology" title="Terminology">
      <t> The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
        "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", 
		"NOT RECOMMENDED", "MAY", and
        "OPTIONAL" in this document are to be interpreted as described
        in <xref target="RFC2119"/>. </t>
	 </section>
	 <section title="General Guidance">
	   <t>Padding messages does not have any semantic impact on the DNS protocol. However, the amount of (possible) padding does 
	   depend on the circumstances under which a DNS message is created, specifically the maximum message length as 
	   dictated by protocol negotiations. Therefore, in order to not impact the possibility to add other EDNS options, 
	   "Padding" MUST be the last ENDS option applied before a DNS message is sent.</t>
	   <t>Especially in situations with scarce computing and networking resources such as long-life battery powered devices,
	   the tradeoff between significantly increasing the size of DNS messages by generous padding and the corresponding gain in confidentiality 
	   must be carefully considered. </t>
	 </section>
	 <section title="Padding Strategies">
	   <t>This section is a non-exhaustive list of strategies with regards to choosing the appropriate padding length.</t>
	   <section title="No Padding">
	     <t>In the "No Padding" strategy, the EDNS0 Padding option is not used, and the size of the final (actually, "non-padded")
		 message obviously corresponds exactly to the size of the unpadded messages. Even though this "non-strategy" could seem out of choice 
		 in this list, it needs to be considered for cases when either of the parties (client or server) does not apply padding, while the other
		 party does.</t>
		 <t>Note that following this "strategy" is required if the message size of the unpadded message does not allow for the Padding option
		 to be included (less than 4 octets message space left). Therefore, this "non-strategy" is listed here for the sake of completeness.
		 </t>
		 <t>Advantages: The only advantage of this approach is that this "strategy" requires no additional resources on client, server and network side.</t>
		 <t>Disadvantages: The original size of the message remains unchanged, hence this approach adds no additional entropy</t>
		 <t>TODO: Recommend that this strategy MUST NOT be used unless message size disallows the use of Padding.</t>
	   </section>
	   <section title="Fixed Length Padding">
	     <t>In fixed length padding, a sender chooses to pad each message with a padding of constant length.</t>
		 <t>Options: Actual length of padding</t>
		 <t>Advantages: Since the padding is constant in length, this strategy is very easy to implement, and at least ensures that the message length diverges 
		 from the length of the original packet (even only by a fixed value)</t>
		 <t>Disadvantage: Obviously, the amount of padding easily discoverable from a single decrypted message. When a public DNS server applies this strategy,
		 the length of the padding hence must be assumed to be public knowledge. Therefore, this strategy is almost as bad as the
		 "No Padding" strategy described above.</t>
		</section> 
		<section title="Block Length Padding">
		  <t>In Block Length Padding, a sender pads each message so that its padded length is a multiple of a chosen block length. This creates a greatly reduced variety 
		  of message lengths. An implementor needs to consider that even the zero-length EDNS0 Padding Option increases the length of the packet by 4 octets.
		  </t>
		  <t>Options: Block Length - values between 16 and 128 (Discuss!) octets seem reasonable</t>
		  <t>Advantages: This strategy is reasonably easy to implement, reduces the variety of message ("fingerprint") sizes significantly, and does not require a source of 
		  (pseudo) random numbers, since the amount of padding can be derived from the actual (unpadded) message.</t>
		  <t>Disadvantage: Given an unpadded message and the block size of the padding (which is assumed to be public knowledge once a server is reachable), 
		  the size of a message can be predicted. Therefore, the minimum and maximum length of the unpadded message is known.</t>
		  <t>TODO: Recommended strategy?</t>
		</section>
		<section title="Random Length Padding">
		  <t>When using Random Length Padding, a sender pads each message with a random amount of padding. Due to the size of the EDNS0 Padding Option itself, 
		  each message size is hence increased by at least 4 octets. The upper limit for pading is the maximum message size. However, a client or server 
		  may choose to impose a lower maximum padding length.</t>
		  <t>Alternatively, pad a certain percentage of "remaining space"?</t>
		  <t>Options: Maximum (and eventually minimum) padding length.</t>
		  <t>Advantages: This strategy should create the best "distribution" of message sizes</t>
		  <t>Disadvantage: This strategy requires a good source of (pseudo) random numbers which keeps up with the required message rates. Especially on 
		  busy servers, this could be a significant hindrance.</t>
		  <t>TODO: Recommendation - this is (at first glance) the best strategy, but requires significant effort</t>
		</section>
		<section title="Random Block Length Padding">
		  <t>This strategy combines Block Length Padding with a random component. Specifically, a sender randomly chooses between a few block lenght'es 
		  and then applies Block Length Padding based on the chosen block length. The random selection of block lenght might even be reasonably 
		  based on a "weak" source of randomness, such as the transction ID of the message.</t>
		  <t>Options: Number of size of the set of Block Lengths, source of "randomness"</t>
		  <t>Advantages: Compared to Block Length Padding, this creates more variety in the resulting message sizes 
		  for a certain individual original message length. Also, compared to "Random Length Padding", 
		  it might not require a "full blown" random number source.</t>
		  <t>Disadvantage: Requires more implementation effort compared to simple Block Length Padding</t>
		  <t>TODO: Recommend over simple Block Length Padding?</t>
		</section>
	</section>
	<section title='IANA Considerations'>
	   <t>This document has no considerations for IANA.</t>
	</section>
	<section title="Security Considerations">
	   <t>The choice of the right padding strategy (and the right parameters for the chose strategy) has a significant impact on 
	   the resilience of encrypted DNS against size-based correlation attacks. Therefore, any implementor of EDNS0 Padding must 
	   carefully consider the chosen strategy and its parameters.</t>
	   <t>A clients carefully chosen Padding strategy may be without effect if the corresponding server does apply an inffective (or no) Padding 
	   strategy on the response packets. Therefore, a client applying Padding may want to chose a DNS server which does apply at least an 
	   equally effective Padding strategy on responses.</t>
	</section>
  </middle>
  <back>
    <references title="Normative References">
                &rfc2119;
				&rfc7830;
	</references>
  </back>
</rfc>