<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">

<?rfc compact="yes"?>
<?rfc toc="yes"?>

<rfc category="info" ipr="full3978"
     docName="draft-josefsson-dns-url-14">

<front>

<title abbrev="DNS URI">
Domain Name System Uniform Resource Identifiers
</title>

<author initials="S." surname="Josefsson" fullname="Simon Josefsson">
  <organization>SJD</organization>
  <address>
    <email>simon@josefsson.org</email>
  </address>
</author>
	
<date month="August" year="2005"/>

<abstract>

  <t>This document defines Uniform Resource Identifiers for Domain Name
    System resources.</t>

  <t>See &lt;http://josefsson.org/dns-url/&gt; for more
    information.</t>

</abstract>

</front>
	
<middle>

<section title="Introduction and Background">

  <t>The Domain Name System (DNS) <xref target="RFC1034" />
    <xref target="RFC1035" /> is a widely deployed system used, among
    other things, to translate host names into IP addresses.  Several
    protocols use Uniform Resource Identifiers (URIs) to refer to
    data.  By defining a URI scheme for DNS data, the gap between
    these two worlds is bridged.  The DNS URI scheme defined here can
    be used to reference any data stored in the DNS.</t>

  <t>Data browsers may support DNS URIs by forming DNS queries and
    rendering DNS responses using HTML <xref target="RFC2854" />,
    which is similar to what is commonly done for FTP
    <xref target="RFC0959" /> resources.  Applications that are
    Multipurpose Internet Mail Extensions (MIME)
    <xref target="RFC2048" /> aware may tag DNS data retrieved using
    this scheme with the text/dns or application/dns types as
    specified in <xref target="RFC4027" />.</t>

  <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
    NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL"
    in this document are to be interpreted as described
    in <xref target="RFC2119">RFC 2119</xref>.</t>

  <t><vspace blankLines="10000" /></t>

</section>

<section title="Usage Model">

  <t>Refer to section 1 of <xref target="RFC3986" /> for an in-depth
    discussion of URI classifications.  In particular, the reader is
    assumed to be familiar with the distinction between "name" and
    "locator".  This section describes how the DNS URI scheme is
    intended to be used and outlines future work that may be required
    to use URIs with the DNS for some applications.</t>

  <t>The URI scheme described in this document focuses on the data
    stored in the DNS.  As such, there is no provision to specify any
    of the fields in the actual DNS protocol.  This is intended so
    that the URI may be used even in situations where the DNS protocol
    is not used directly.  Two examples for this are zone file editors
    and DNS-related configuration files, which may use this URI scheme
    to identify data.  The application would not use the DNS protocol
    to resolve the URIs.</t>

  <t>A limitation of this design is that it does not accommodate all
    protocol parameters within the DNS protocol.  It is expected that,
    for certain applications, a more detailed URI syntax that maps more
    closely to the DNS protocol may be required.  However, such a URI
    definition is not included in this document.  This document
    specifies a URI that is primarily intended to name DNS resources,
    but it can also be used to locate said resources for simple, yet
    common, applications.</t>

  <t><vspace blankLines="10000" /></t>

</section>

<section title="DNS URI Registration">

  <t>This section contains the registration template for the DNS URI
    scheme in accordance with <xref target="RFC2717" />.</t>

  <t>URL scheme name: "dns".</t>

  <t>URL scheme syntax: A DNS URI designates a DNS resource record
    set, referenced by domain name, class, type, and, optionally, the
    authority.  The DNS URI follows the generic syntax from RFC 3986
    <xref target="RFC3986" /> and is described using ABNF
    <xref target="RFC4234" />.  Strings are not case sensitive, and
    free insertion of linear-white-space is not permitted.</t>

  <figure>
    <artwork>
dnsurl          = "dns:" [ "//" dnsauthority "/" ]
                  dnsname ["?" dnsquery]

dnsauthority    = host [ ":" port ]
                             ; See RFC 3986 for the
                             ; definition of "host" and "port".

dnsname         = *pchar
                             ; See RFC 3986 for the
                             ; definition of "pchar".

                             ; The "dnsname" field may be a
                             ; "relative" or "absolute" name,
                             ; as per RFC 1034, section 3.1.

                             ; Note further that an empty
                             ; "dnsname" value is to be
                             ; interpreted as the root itself.
                             ; See below on relative dnsnames.

dnsquery        = dnsqueryelement [";" dnsquery]

dnsqueryelement = ( "CLASS=" dnsclassval ) / ( "TYPE=" dnstypeval )
                             ; Each clause MUST NOT be used more
                             ; than once.

dnsclassval     = 1*digit / "IN" / "CH" / 
                  &lt;Any IANA registered DNS class mnemonic&gt;

dnstypeval      = 1*digit / "A" / "NS" / "MD" /
                  &lt;Any IANA registered DNS type mnemonic&gt;
    </artwork>
  </figure>

  <t>Unless specified in the URI, the authority ("dnsauthority") is
    assumed to be locally known, the class ("dnsclassval") to be the
    Internet class ("IN"), and the type ("dnstypeval") to be the
    Address type ("A").  These default values match the typical use of
    DNS: to look up addresses for host names.</t>

  <t>A dnsquery element MUST NOT contain more than one occurrence of
    the "CLASS" and "TYPE" fields.  For example, both
    "dns:example?TYPE=A;TYPE=TXT" and "dns:example?TYPE=A;TYPE=A" are
    invalid.  However, the fields may occur in any order, so that both
    "dns:example?TYPE=A;CLASS=IN" and "dns:example?CLASS=IN;TYPE=A"
    are valid.</t>

  <t>The digit representation of types and classes MAY be used when a
    mnemonic for the corresponding value is not well known (e.g., for
    newly introduced types or classes), but it SHOULD NOT be used for
    the types or classes defined in the DNS specification
    <xref target="RFC1035" />.  All implementations MUST recognize the
    mnemonics defined in <xref target="RFC1035" />.</t>

  <t>To avoid ambiguity, relative "dnsname" values (i.e., those not
    ending with ".") are assumed to be relative to the root.  For
    example, "dns:host.example" and "dns:host.example." both refer to
    the same owner name; namely, "host.example.".  Further, an empty
    "dnsname" value is considered a degenerative form of a relative
    name, which refers to the root (".").</t>

  <t>To resolve a DNS URI using the DNS protocol
    <xref target="RFC1035" />, a query is created, using as input the
    dnsname, dnsclassval, and dnstypeval from the URI string (or the
    appropriate default values).  If an authority ("dnsauthority") is
    given in the URI string, this indicates the server that should
    receive the DNS query. Otherwise, the default DNS server should
    receive it.</t>

  <t>Note that DNS URIs could be resolved by other protocols than the
    DNS protocol, or by using the DNS protocol in some other way than
    as described above (e.g., multicast DNS).  DNS URIs do not require
    the use of the DNS protocol, although it is expected to be the
    typical usage.  The previous paragraph only illustrates how DNS
    URIs are resolved using the DNS protocol.</t>

  <t>A client MAY want to check that it understands the dnsclassval
    and dnstypeval before sending a query, so that it will be able to
    understand the response.  However, a typical example of a client
    that would not need to check dnsclassval and dnstypeval would be a
    proxy that would just treat the received answer as opaque
    data.</t>

  <t>Character encoding considerations: Characters are encoded as per
    RFC 3986 <xref target="RFC3986" />.  The DNS protocol does not
    consider character sets; it simply transports opaque data.  In
    particular, the "dnsname" field of the DNS URI is to be considered
    an internationalized domain name (IDN) unaware domain name slot,
    in the terminology of RFC3940 <xref target="RFC3490" />.  The
    considerations for "host" and "port" are discussed in
    <xref target="RFC3986" />.</t>

  <t>Because "." is used as the DNS label separator, an escaping
    mechanism is required to encode a "." that is part of a DNS label.
    The escaping mechanism is described in section 5.1 of RFC 1035
    <xref target="RFC1035" />. For example, a DNS label of "exa.mple"
    can be escaped as "exa\.mple" or "exa\046mple".  However, the URI
    specification disallows the "\" character from occurring directly
    in URIs, so it must be escaped as "%5c".  The single DNS label
    "exa.mple" is thus encoded as "exa%5c.mple".  The same mechanism
    can be used to encode other characters, for example, "?" and ";".
    Note that "." and "%2e" are equivalent within dnsname and are
    interchangeable.</t>

  <t>This URI specification allows all possible domain names to be
    encoded, provided the encoding rules are observed per
    <xref target="RFC3986" />).  However, certain applications may
    restrict the set of valid characters.  Care should be taken so
    that invalid characters in these contexts do not cause harm.  In
    particular, host names in the DNS have certain restrictions.  It
    is up to these applications to limit this subset; this URI scheme
    places no restrictions.</t>

  <t>Intended usage: Whenever it is useful for DNS resources to be
    referenced by protocol-independent identifiers.  Often, this
    occurs when the data is more important than the access
    method. Since software in general has coped without this so far,
    it is not anticipated to be implemented widely, nor migrated to by
    existing systems, but specific solutions (especially
    security-related) may find this appropriate.</t>

  <t>Applications and/or protocols that use this scheme include
    Security-related software, DNS administration tools, and network
    programming packages.</t>

  <t>Interoperability considerations: The data referenced by this URI
    scheme might be transferred by protocols that are not URI aware
    (such as the DNS protocol). This is not anticipated to have any
    serious interoperability impact.</t>

  <t>Interoperability problems may occur if one entity understands a
    new DNS class/type mnemonic that another entity does not.  This is
    an interoperability problem for DNS software in general, although
    it is not a major practical problem for current DNS deployments,
    as the DNS types and classes are fairly static.  To guarantee
    interoperability, implementations can use integers for all
    mnemonics not defined in <xref target="RFC1035" />.</t>

  <t>Interaction with Binary Labels <xref target="RFC2673" /> or other
    extended label types has not been analyzed.  However, binary
    labels appear to be infrequently used in practice.</t>

  <t>Contact: simon@josefsson.org</t>

  <t>Author/Change Controller: simon@josefsson.org</t>

</section>

<section title="Examples">
  
  <t>A DNS URI is of the following general form.  This is intended to
    illustrate, not define, the scheme:</t>

  <t>    dns:[//authority/]domain[?CLASS=class;TYPE=type]</t>

  <t>The following illustrates a URI for a resource with the absolute
    name "www.example.org.", the Internet (IN) class, and the Address
    (A) type:</t>

  <t>dns:www.example.org.?clAsS=IN;tYpE=A</t>

  <t>Since the default class is IN and the default type is A, the same
    resource can be identified by a shorter URI using a relative
    name:</t>

  <t>dns:www.example.org</t>

  <t>The following illustrates a URI for a resource with the name
    "simon.example.org" for the CERT type in the Internet (IN)
    class:</t>

  <t>dns:simon.example.org?type=CERT</t>

  <t>The following illustrates a URI for a resource with the name
    "ftp.example.org", in the Internet (IN) class and the address (A)
    type, but from the DNS authority 192.168.1.1 instead of the
    default authority:</t>

  <t>dns://192.168.1.1/ftp.example.org?type=A</t>

  <t>The following illustrates various escaping techniques.  The owner
    name would be "world wide web.example\.domain.org", where "\."
    denotes the character "." as part of a label, and "."  denotes the
    label separator:</t>

  <t>dns:world%20wide%20web.example%5c.domain.org?TYPE=TXT</t>

  <t>The following illustrates a strange but valid DNS resource:</t>

  <t>dns://fw.example.org/*.%20%00.example?type=TXT</t>

  <t><vspace blankLines="10000" /></t>

</section>

<section title="Acknowledgements">
  
  <t>Thanks to Stuart Cheshire, Donald Eastlake, Pasi Eronen, Bill
    Fenner, Ted Hardie, Russ Housley, Peter Koch, Andrew Main, Larry
    Masinter, Michael Mealling, Steve Mattson, Marcos Sanz, Jason
    Sloderbeck, Paul Vixie, Sam Weiler, and Bert Wijnen for comments
    and suggestions.  The author acknowledges RSA Laboratories for
    supporting the work that led to this document.</t>

</section>

<section title="Security Considerations">

  <t>If a DNS URI references domains in the Internet DNS environment,
    both the URI itself and the information referenced by the URI is
    public information.  If a DNS URI is used within an "internal" DNS
    environment, both the DNS URI and the data referenced should be
    handled using the same considerations that apply to DNS data in
    the "internal" environment.</t>

  <t>If information referenced by DNS URIs are used to make security
    decisions (such data includes, but is not limited to, certificates
    stored in the DNS <xref target="RFC2538" />), implementations may
    need to employ security techniques such as Secure DNS
    <xref target="RFC4033" />, CMS <xref target="RFC3852" />, or
    OpenPGP <xref target="RFC2440" />, to protect the data during
    transport.  How to implement this will depend on the usage
    scenario, and it is not up to this URI scheme to define how the
    data referenced by DNS URIs should be protected.</t>

  <t>If applications accept unknown dnsqueryelement values in a URI 
    (e.g., URI "dns:www.example.org?secret=value") without knowing
    what the "secret=value" dnsqueryelement means, a covert channel
    used to "leak" information may be enabled.  The implications of
    covert channels should be understood by applications that accept
    unknown dnsqueryelement values.</t>
    
  <t>Slight variations, such as the difference between upper and lower
    case in the dnsname field, can be used as a covert channel to leak
    information.</t>

</section>

<section anchor="iana-considerations" title="IANA Considerations">

  <t>The IANA has registered the DNS URI scheme, using the template in
    section 3, in accordance with
    <xref target="RFC2717">RFC 2717</xref>.</t>

  <t><vspace blankLines="10000" /></t>

</section>

<section title="Copying Conditions">

  <t>Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Simon Josefsson</t>

  <t>Regarding this entire document or any portion of it, the author
    makes no guarantees and is not responsible for any damage
    resulting from its use.  The author grants irrevocable permission
    to anyone to use, modify, and distribute it in any way that does
    not diminish the rights of anyone else to use, modify, and
    distribute it, provided that redistributed derivative works do not
    contain misleading author or version information.  Derivative
    works need not be licensed under similar terms.</t>
  
</section>

</middle>

<back>

<references title="Normative References">

  <?rfc include="reference.RFC.1034.xml"?>
  <?rfc include="reference.RFC.1035.xml"?>
  <?rfc include="reference.RFC.2119.xml"?>
  <?rfc include="reference.RFC.4234.xml"?>
  <?rfc include="reference.RFC.3986.xml"?>

</references>

<references title="Informative References">

  <?rfc include="reference.RFC.0959.xml"?>
  <?rfc include="reference.RFC.2048.xml"?>
  <?rfc include="reference.RFC.2440.xml"?>
  <?rfc include="reference.RFC.2538.xml"?>
  <?rfc include="reference.RFC.2673.xml"?>
  <?rfc include="reference.RFC.2717.xml"?>
  <?rfc include="reference.RFC.2854.xml"?>
  <?rfc include="reference.RFC.3852.xml"?>
  <?rfc include="reference.RFC.3490.xml"?>
  <?rfc include="reference.RFC.4027.xml"?>
  <?rfc include="reference.RFC.4033.xml"?>

</references>

<section title="Revision Changes">

  <t>Note to RFC editor: Remove this appendix before publication.</t>

<section title="Changes since -06">

  <t>The MIME registration templates for text/dns and application/dns
    was removed, and will be defined in separate documents.</t>

  <t>Improved discussion related to which mnemonics that must be
    supported.  The interoperability problem that provoked the
    clarification is also mentioned.</t>

  <t>Security consideration improvements.</t>

</section>

<section title="Changes since -07">

  <t>Author/Change Controller changed to author of this document, not
    IESG.  Terminology section collapsed into introduction.  The
    second paragraph of the introduction rewritten and gives explicit
    examples. Intended usage and applications fields fixed.  Moved
    this revision tracking information to an appendix.  Mention IDN in
    charset section.  All previous thanks to suggestions by Larry
    Masinter.</t>

</section>

<section title="Changes since -08">

  <t>Modifications derived from Last-Call comments: Made more clear
  that DNS URIs does not imply use of the DNS protocol, but the issue
  is not stressed because of the apparent inflamatory state of
  affairs.  Added informative references to HTML and FTP.  Clarified
  that dnsname can be empty.  Clarified that first dnsqueryelement
  "win" in case of ambiguity.  Clarified security consideration with
  respect to unknown dnsqueryelements.  Use "authority" instead of
  "server".  Say "IANA registered" instead of "standard".
  Interoperability note about binary DNS labels.  Typos.</t>

</section>

<section title="Changes since -09">

  <t>Use legal texts from RFC 3667.  Update UTF-8 reference to RFC
  3629.  Simplified introduction.  Discuss relative and absolute
  dnsname's.  Clarify that empty dnsname correspond to the root.
  Change so that dns:foo?TYPE=A;TYPE=TXT is invalid, instead of
  meaning TYPE=A.  The underspecified extension mechanism was dropped;
  now only TYPE= and CLASS= are permitted.  Remove background
  discussion of why the dnsname field is made a IDN unaware domain
  name slot.  Use standard DNS escaping (i.e, "\." for ".") instead of
  broken approach that violated the URI specification.  Improve
  examples.  Add security considerations.</t>

</section>

<section title="Changes since -10">

  <t>Add section "Usage Model".  Move acknowledgements, as per
    rfc2223bis.  Add permissive copying condition.  Updates to align
    with RFC 3986.</t>

</section>

<section title="Changes since -11">

  <t>Fix typos.  IESG feedback: Move RFC2119 reference to normative
  section. Replace OCSP example with X.509 CRL Distribution Point
  extension. Fix ABNF not to use "...".</t>

</section>

<section title="Changes since -12">

  <t>Reference MIME and RFC 4027.  IESG feedback: Do not mention
    OpenPGP/X.509 as illustrative examples in the introduction
    section.</t>

</section>

<section title="Changes since -13">

  <t>Fix typos.  Incorporate RFC Editor fixes.</t>

</section>

</section>

</back>

</rfc>
