| 1 |
<pre>Network Working Group R. Rosenbaum |
| 2 |
Request for Comments: 1464 Digital Equipment Corporation |
| 3 |
May 1993 |
| 4 |
|
| 5 |
|
| 6 |
<span class="h1">Using the Domain Name System</span> |
| 7 |
<span class="h1">To Store Arbitrary String Attributes</span> |
| 8 |
|
| 9 |
Status of this Memo |
| 10 |
|
| 11 |
This memo defines an Experimental Protocol for the Internet |
| 12 |
community. Discussion and suggestions for improvement are requested. |
| 13 |
Please refer to the current edition of the "IAB Official Protocol |
| 14 |
Standards" for the standardization state and status of this protocol. |
| 15 |
Distribution of this memo is unlimited. |
| 16 |
|
| 17 |
Abstract |
| 18 |
|
| 19 |
While the Domain Name System (DNS) [<a href="#ref-2" title=""Domain Names - Concepts and Facilities"">2</a>,<a href="#ref-3" title=""Domain Names - Implementation and Specification"">3</a>] is generally used to store |
| 20 |
predefined types of information (e.g., addresses of hosts), it is |
| 21 |
possible to use it to store information that has not been previously |
| 22 |
classified. |
| 23 |
|
| 24 |
This paper describes a simple means to associate arbitrary string |
| 25 |
information (ASCII text) with attributes that have not been defined |
| 26 |
by the DNS. It uses DNS TXT resource records to store the |
| 27 |
information. It requires no change to current DNS implementations. |
| 28 |
|
| 29 |
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span> |
| 30 |
|
| 31 |
The Domain Name System is designed to store information that has both |
| 32 |
a predefined type and structure. Examples include IP addresses of |
| 33 |
hosts and names of mail exchangers. It would be useful to take |
| 34 |
advantage of the widespread use and scaleability of the DNS to store |
| 35 |
information that has not been previously defined. |
| 36 |
|
| 37 |
This paper proposes the use of the DNS TXT resource record (defined |
| 38 |
in STD 13, <a href="./rfc1035">RFC 1035</a>) to contain new types of information. The |
| 39 |
principal advantage of such an approach is that it requires no change |
| 40 |
to most existing DNS servers. It is not intended to replace the |
| 41 |
process by which new resource records are defined and implemented. |
| 42 |
|
| 43 |
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Format of TXT record</span> |
| 44 |
|
| 45 |
To store new types of information, the TXT record uses a structured |
| 46 |
format in its TXT-DATA field. The format consists of the attribute |
| 47 |
name followed by the value of the attribute. The name and value are |
| 48 |
separated by an equals sign (=). |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
<span class="grey">Rosenbaum [Page 1]</span></pre> |
| 53 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span> |
| 54 |
<span class="grey"><a href="./rfc1464">RFC 1464</a> Storing Arbitrary Attributes in DNS May 1993</span> |
| 55 |
|
| 56 |
|
| 57 |
For example, the following TXT records contain attributes specified |
| 58 |
in this fashion: |
| 59 |
|
| 60 |
host.widgets.com IN TXT "printer=lpr5" |
| 61 |
sam.widgets.com IN TXT "favorite drink=orange juice" |
| 62 |
|
| 63 |
The general syntax is: |
| 64 |
|
| 65 |
<owner> <class> <ttl> TXT "<attribute name>=<attribute value>" |
| 66 |
|
| 67 |
Attribute Names |
| 68 |
|
| 69 |
Any printable ASCII character is permitted for the attribute name. |
| 70 |
If an equals sign is embedded in the attribute name, it must be |
| 71 |
quoted with a preceding grave accent (or backquote: "`"). A |
| 72 |
backquote must also be quoted with an additional "`". |
| 73 |
|
| 74 |
Attribute Name Matching Rules |
| 75 |
|
| 76 |
The attribute name is considered case-insensitive. For example, a |
| 77 |
lookup of the attribute "Favorite Drink" would match a TXT record |
| 78 |
containing "favorite drink=Earl Grey tea". |
| 79 |
|
| 80 |
During lookups, TXT records that do not contain an unquoted "=" are |
| 81 |
ignored. TXT records that seem to contain a null attribute name, |
| 82 |
that is, the TXT-DATA starts with the character "=", are also |
| 83 |
ignored. |
| 84 |
|
| 85 |
Leading and trailing whitespace (spaces and tabs) in the attribute |
| 86 |
name are ignored unless they are quoted (with a "`"). For example, |
| 87 |
"abc" matches " abc<tab>" but does not match "` abc". |
| 88 |
|
| 89 |
Note that most DNS server implementations require a backslash (\) or |
| 90 |
double quote (") in a text string to be quoted with a preceding |
| 91 |
backslash. Accent grave ("`") was chosen as a quoting character in |
| 92 |
this syntax to avoid confusion with "\" (and remove the need for |
| 93 |
confusing strings that include sequences like "\\\\"). |
| 94 |
|
| 95 |
Attribute Values |
| 96 |
|
| 97 |
All printable ASCII characters are permitted in the attribute value. |
| 98 |
No characters need to be quoted with a "`". In other words, the |
| 99 |
first unquoted equals sign in the TXT record is the name/value |
| 100 |
delimiter. All subsequent characters are part of the value. |
| 101 |
|
| 102 |
Once again, note that in most implementations the backslash character |
| 103 |
is an active quoting character (and must, itself, be quoted). |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
<span class="grey">Rosenbaum [Page 2]</span></pre> |
| 109 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span> |
| 110 |
<span class="grey"><a href="./rfc1464">RFC 1464</a> Storing Arbitrary Attributes in DNS May 1993</span> |
| 111 |
|
| 112 |
|
| 113 |
All whitespace in the attribute value is returned to the requestor |
| 114 |
(it is up to the application to decide if it is significant.) |
| 115 |
|
| 116 |
Examples |
| 117 |
|
| 118 |
<sp> indicates a space character. |
| 119 |
|
| 120 |
Attribute Attribute Internal Form External Form |
| 121 |
Name Value (server to resolver) (TXT record) |
| 122 |
|
| 123 |
color blue color=blue "color=blue" |
| 124 |
equation a=4 equation=a=4 "equation=a=4" |
| 125 |
a=a true a`=a=true "a`=a=true" |
| 126 |
a\=a false a\`=a=false "a\\`=a=false" |
| 127 |
= \= `==\= "`==\\=" |
| 128 |
|
| 129 |
string "Cat" string="Cat" "string=\"Cat\"" |
| 130 |
string2 `abc` string2=``abc`` "string2=``abc``" |
| 131 |
novalue novalue= "novalue=" |
| 132 |
a b c d a b=c d "a b=c d" |
| 133 |
abc<sp> 123<sp> abc` =123<sp> "abc` =123 " |
| 134 |
|
| 135 |
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Application Usage</span> |
| 136 |
|
| 137 |
The attributes can be accessed by the standard resolver library, but |
| 138 |
it is recommended that a library routine designed specially for this |
| 139 |
attribute format be used. Such a routine might provide an analogue |
| 140 |
to gethostbyname: |
| 141 |
|
| 142 |
getattributebyname(objectname, name of object |
| 143 |
attributename, name of attribute |
| 144 |
attributevalue, pointer to buffer |
| 145 |
attributevaluelen) length of buffer |
| 146 |
|
| 147 |
This routine would remove all quoting characters before returning the |
| 148 |
information to the caller. A more complex routine could return |
| 149 |
attributes with multiple values, or several different attributes. |
| 150 |
|
| 151 |
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Attribute Name Registration</span> |
| 152 |
|
| 153 |
To permit ease of interoperability and to reduce the chance of naming |
| 154 |
conflicts, a registration process for well known attribute names |
| 155 |
might be established. This could be a periodically updated list of |
| 156 |
names and/or adherence to other name registration mechanisms such as |
| 157 |
published object identifiers. |
| 158 |
|
| 159 |
This paper does not address attribute name registration. |
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
<span class="grey">Rosenbaum [Page 3]</span></pre> |
| 165 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span> |
| 166 |
<span class="grey"><a href="./rfc1464">RFC 1464</a> Storing Arbitrary Attributes in DNS May 1993</span> |
| 167 |
|
| 168 |
|
| 169 |
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Restrictions</span> |
| 170 |
|
| 171 |
Some DNS server implementations place limits on the size or number of |
| 172 |
TXT records associated with a particular owner. Certain |
| 173 |
implementations may not support TXT records at all. |
| 174 |
|
| 175 |
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. REFERENCES and BIBLIOGRAPHY</span> |
| 176 |
|
| 177 |
[<a id="ref-1">1</a>] Stahl, M., "Domain Administrators Guide", <a href="./rfc1032">RFC 1032</a>, Network |
| 178 |
Information Center, SRI International, November 1987. |
| 179 |
|
| 180 |
[<a id="ref-2">2</a>] Mockapetris, P., "Domain Names - Concepts and Facilities", STD |
| 181 |
13, <a href="./rfc1034">RFC 1034</a>, USC/Information Sciences Institute, November 1987. |
| 182 |
|
| 183 |
[<a id="ref-3">3</a>] Mockapetris, P., "Domain Names - Implementation and |
| 184 |
Specification", STD 13, <a href="./rfc1035">RFC 1035</a>, USC/Information Sciences |
| 185 |
Institute, November 1987. |
| 186 |
|
| 187 |
[<a id="ref-4">4</a>] Mockapetris, P., "DNS Encoding of Network Names and Other Types", |
| 188 |
<a href="./rfc1101">RFC 1101</a>, USC/Information Sciences Institute, April 1989. |
| 189 |
|
| 190 |
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Security Considerations</span> |
| 191 |
|
| 192 |
Security issues are not discussed in this memo. |
| 193 |
|
| 194 |
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Author's Address</span> |
| 195 |
|
| 196 |
Rich Rosenbaum |
| 197 |
Digital Equipment Corporation |
| 198 |
550 King Street, LKG2-2/Z7 |
| 199 |
Littleton, MA 01460-1289 |
| 200 |
|
| 201 |
Phone: 508-486-5922 |
| 202 |
Email: [email protected] |
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
Rosenbaum [Page 4] |
| 221 |
</pre> |