asciidoctor-rfc 0.2.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +116 -6
- data/asciidoctor-rfc.gemspec +15 -1
- data/lib/asciidoctor/rfc/common/base.rb +74 -7
- data/lib/asciidoctor/rfc/common/front.rb +1 -1
- data/lib/asciidoctor/rfc/v2/base.rb +87 -38
- data/lib/asciidoctor/rfc/v2/blocks.rb +29 -2
- data/lib/asciidoctor/rfc/v2/converter.rb +0 -1
- data/lib/asciidoctor/rfc/v2/inline_anchor.rb +2 -8
- data/lib/asciidoctor/rfc/v2/lists.rb +7 -4
- data/lib/asciidoctor/rfc/v2/table.rb +1 -1
- data/lib/asciidoctor/rfc/v3/base.rb +41 -43
- data/lib/asciidoctor/rfc/v3/blocks.rb +29 -2
- data/lib/asciidoctor/rfc/v3/converter.rb +0 -2
- data/lib/asciidoctor/rfc/v3/inline_anchor.rb +2 -6
- data/lib/asciidoctor/rfc/version.rb +1 -1
- data/spec/asciidoctor/rfc/v2/comments_spec.rb +7 -3
- data/spec/asciidoctor/rfc/v2/date_spec.rb +23 -0
- data/spec/asciidoctor/rfc/v2/dlist_spec.rb +107 -9
- data/spec/asciidoctor/rfc/v2/image_spec.rb +17 -0
- data/spec/asciidoctor/rfc/v2/inline_formatting_spec.rb +12 -0
- data/spec/asciidoctor/rfc/v2/listing_spec.rb +22 -0
- data/spec/asciidoctor/rfc/v2/literal_spec.rb +22 -2
- data/spec/asciidoctor/rfc/v2/preamble_spec.rb +72 -0
- data/spec/asciidoctor/rfc/v2/references_spec.rb +3 -1
- data/spec/asciidoctor/rfc/v2/table_spec.rb +104 -4
- data/spec/asciidoctor/rfc/v2/text_spec.rb +89 -0
- data/spec/asciidoctor/rfc/v2/ulist_spec.rb +40 -0
- data/spec/asciidoctor/rfc/v3/dlist_spec.rb +103 -1
- data/spec/asciidoctor/rfc/v3/image_spec.rb +18 -0
- data/spec/asciidoctor/rfc/v3/listing_spec.rb +26 -0
- data/spec/asciidoctor/rfc/v3/literal_spec.rb +20 -1
- data/spec/asciidoctor/rfc/v3/preamble_spec.rb +150 -0
- data/spec/asciidoctor/rfc/v3/references_spec.rb +35 -34
- data/spec/asciidoctor/rfc/v3/series_info_spec.rb +39 -0
- data/spec/examples/README.adoc +162 -0
- data/spec/examples/davies-template-bare-06.adoc +3 -0
- data/spec/examples/draft-ietf-core-block-xx.mkd +935 -0
- data/spec/examples/draft-ietf-core-block-xx.mkd.adoc +1013 -0
- data/spec/examples/draft-ietf-core-block-xx.xml.orig +1251 -0
- data/spec/examples/example-v2.adoc +6 -2
- data/spec/examples/example-v3.adoc +5 -1
- data/spec/examples/hoffmanv2.xml.adoc +247 -0
- data/spec/examples/hoffmanv2.xml.orig +339 -0
- data/spec/examples/hoffmanv3.xml.orig +346 -0
- data/spec/examples/mib-doc-template-xml-06.adoc +5 -1
- data/spec/examples/rfc2100.md.adoc +2 -3
- data/spec/examples/rfc3514.md.adoc +3 -2
- data/spec/examples/rfc5841.md.adoc +1 -1
- data/spec/examples/rfc748.md.adoc +7 -6
- data/spec/examples/rfc7511.md.adoc +15 -15
- data/spec/examples/skel.mkd +32 -0
- data/spec/examples/skel.mkd.adoc +50 -0
- data/spec/examples/skel.xml.orig +105 -0
- data/spec/examples/stupid-s.mkd +569 -0
- data/spec/examples/stupid-s.mkd.adoc +771 -0
- data/spec/examples/stupid-s.xml.orig +880 -0
- data/spec/spec_helper.rb +1 -1
- metadata +32 -4
@@ -0,0 +1,771 @@
|
|
1
|
+
= STUN/TURN using PHP in Despair
|
2
|
+
Klaus Hartke <hartke@tzi.org>; Carsten Bormann <cabo@tzi.org>
|
3
|
+
:doctype: internet-draft
|
4
|
+
:abbrev: STuPiD
|
5
|
+
:name: draft-hartke-xmpp-stupid-00
|
6
|
+
:date: 2009-07-05
|
7
|
+
:status: informational
|
8
|
+
:ipr: trust200902
|
9
|
+
:area: General
|
10
|
+
:workgroup: XMPP Working Group
|
11
|
+
:keyword: Internet-Draft
|
12
|
+
:toc-include: yes
|
13
|
+
:sort-refs: yes
|
14
|
+
:sym-refs: yes
|
15
|
+
:forename_initials: K.
|
16
|
+
:organization: Universität Bremen TZI
|
17
|
+
:forename_initials_2: C.
|
18
|
+
:organization_2: Universität Bremen TZI
|
19
|
+
:street_2: Postfach 330440
|
20
|
+
:city_2: Bremen
|
21
|
+
:code_2: D-28359
|
22
|
+
:country_2: Germany
|
23
|
+
:phone_2: +49-421-218-63921
|
24
|
+
:fax_2: +49-421-218-7000
|
25
|
+
|
26
|
+
|
27
|
+
[abstract]
|
28
|
+
NAT (Network Address Translator) Traversal may require TURN
|
29
|
+
(Traversal Using Relays around NAT) functionality in certain
|
30
|
+
cases that are not unlikely to occur. There is little
|
31
|
+
incentive to deploy TURN servers, except by those who need
|
32
|
+
them — who may not be in a position to deploy a new protocol
|
33
|
+
on an Internet-connected node, in particular not one with
|
34
|
+
deployment requirements as high as those of TURN.
|
35
|
+
|
36
|
+
"STUN/TURN using PHP in Despair" is a highly deployable
|
37
|
+
protocol for obtaining TURN-like functionality, while also
|
38
|
+
providing the most important function of STUN.
|
39
|
+
|
40
|
+
[#problems]
|
41
|
+
== Introduction
|
42
|
+
|
43
|
+
NAT (Network Address Translator) Traversal may require TURN
|
44
|
+
(Traversal Using Relays around NAT)
|
45
|
+
<<I-D.ietf-behave-turn>>
|
46
|
+
functionality in certain
|
47
|
+
cases that are not unlikely to occur. There is little
|
48
|
+
incentive to deploy TURN servers, except by those who need
|
49
|
+
them — who may not be in a position to deploy a new protocol
|
50
|
+
on an Internet-connected node, in particular not one with
|
51
|
+
deployment requirements as high as those of TURN.
|
52
|
+
|
53
|
+
"STUN/TURN using PHP in Despair" is a highly deployable
|
54
|
+
protocol for obtaining TURN-like functionality, while also
|
55
|
+
providing the most important function of STUN
|
56
|
+
<<RFC5389>>.
|
57
|
+
|
58
|
+
The high degree of deployability is achieved by making STuPiD
|
59
|
+
a Web service, implementable in any Web application deployment
|
60
|
+
scheme. As PHP appears to be the solution of choice for
|
61
|
+
avoiding deployment problems in the Web world, a PHP-based
|
62
|
+
sample implementation of STuPiD is presented in <<figimpl>> in <<impl>>.
|
63
|
+
(This single-page script has been tested with a free-of-charge
|
64
|
+
web hoster, so it should be deployable by literally everyone.)
|
65
|
+
|
66
|
+
[#need]
|
67
|
+
=== The Need for Standardization
|
68
|
+
|
69
|
+
If STuPiD is so easy to deploy, why standardize on it?
|
70
|
+
First of all, STuPiD server implementations will be done by
|
71
|
+
other people than the clients making use of the service.
|
72
|
+
Clearly communicating between these communities is a good
|
73
|
+
idea, in particular if there are security considerations.
|
74
|
+
|
75
|
+
Having one standard form of STuPiD service instead of one
|
76
|
+
specific to each kind of client also creates an incentive
|
77
|
+
for optimized implementations.
|
78
|
+
|
79
|
+
Finally, where STuPiD becomes part of a client standard
|
80
|
+
(such as a potential extension to XMPP's in-band byte-stream
|
81
|
+
protocol as hinted in <<xmpp>>), it is a good
|
82
|
+
thing if STuPiD is already defined.
|
83
|
+
|
84
|
+
Hence, this document focuses on the definition of the STuPiD
|
85
|
+
service itself, tries to make this as general as possible
|
86
|
+
without increasing complexity or cost and leaves the details
|
87
|
+
of any client standards to future documents.
|
88
|
+
|
89
|
+
[#ops]
|
90
|
+
== Basic Protocol Operation
|
91
|
+
|
92
|
+
The STuPiD protocol will typically be used with application
|
93
|
+
instances that first attempt to obtain connectivity using
|
94
|
+
mechanisms similar to those described in the STUN
|
95
|
+
specification <<RFC5389>>. However, with STuPiD,
|
96
|
+
STUN is not really needed for TCP, as was demonstrated in
|
97
|
+
previous STUN-like implementations <<STUNT>>.
|
98
|
+
Instead, STuPiD (like <<STUNT>>) provides a
|
99
|
+
simple Web service that
|
100
|
+
echoes the remote address and port of an incoming HTTP
|
101
|
+
request; in most cases, this is enough to get the job done.
|
102
|
+
|
103
|
+
In case no connection can be established with this simple
|
104
|
+
STUN(T)-like mechanism, a TURN-like relay is needed as a final
|
105
|
+
fall-back.
|
106
|
+
The STuPiD protocol supports this, but solely provides a way
|
107
|
+
for the data to be
|
108
|
+
relayed. STuPiD relies on an out-of-band channel to notify
|
109
|
+
the peer whenever new data is available (synchronization signal).
|
110
|
+
See <<xmpp>> for one likely example of such an
|
111
|
+
out-of-band channel.
|
112
|
+
(Note that the out-of-band channel may have a much lower
|
113
|
+
throughput than the STuPiD relay channel — this is exactly
|
114
|
+
the case in the example provided in <<xmpp>>,
|
115
|
+
where the out-of-band channel is typically throughput-limited
|
116
|
+
to on the order of a few kilobits per second.)
|
117
|
+
|
118
|
+
By designing the STuPiD web service in such a way that it can
|
119
|
+
be implemented by a simple PHP script such as that presented
|
120
|
+
in <<impl>>, it is easy to deploy by those who
|
121
|
+
need the STuPiD services.
|
122
|
+
The combination of the low-throughput out-of-band channel for
|
123
|
+
synchronization and the STuPiD web service for bulk data
|
124
|
+
relaying is somewhat silly but gets the job done.
|
125
|
+
|
126
|
+
The STuPiD data relay is implemented as follows (see <<figops>>):
|
127
|
+
|
128
|
+
. Peer A, the source of the data to be relayed, stores a chunk of
|
129
|
+
data at the STuPiD server using an opaque identifier, the "chunk
|
130
|
+
identifier". How that chunk identifier is chosen is local to Peer
|
131
|
+
A; it could be composed of a random session id and a sequence number.
|
132
|
+
. Peer A notifies the receiver of the data, Peer
|
133
|
+
B, that a new data chunk is available, specifying the URI needed
|
134
|
+
for retrieval.
|
135
|
+
This notification is provided through an out-out-band channel.
|
136
|
+
(As an optimization for multiple consecutive transfers, A might
|
137
|
+
inform B once of a constant prefix of that URI and only send a
|
138
|
+
varying part such as a sequence number in each notification —
|
139
|
+
this is something to be decided in the client-client notification
|
140
|
+
protocol.)
|
141
|
+
. Peer B retrieves the data from the STuPiD server using the URI
|
142
|
+
provided by Peer A.
|
143
|
+
|
144
|
+
Note that the data transfer mechanism is one-way, i.e. to send
|
145
|
+
data in the other direction as well, Peer B needs to perform
|
146
|
+
the same steps using a STuPiD server at the same or a
|
147
|
+
different location.
|
148
|
+
|
149
|
+
[#figops]
|
150
|
+
.STuPiD Protocol Operation
|
151
|
+
====
|
152
|
+
....
|
153
|
+
|
154
|
+
|
155
|
+
STuPiD ```````````````````````````````,
|
156
|
+
Script <----------------------------. ,
|
157
|
+
| ,
|
158
|
+
^ , | ,
|
159
|
+
| , | ,
|
160
|
+
(1) | , | , (3)
|
161
|
+
POST | , | , GET
|
162
|
+
| , | ,
|
163
|
+
| v | v
|
164
|
+
|
165
|
+
Peer A -----------------------> Peer B
|
166
|
+
(2)
|
167
|
+
out-of-band
|
168
|
+
Notification
|
169
|
+
....
|
170
|
+
====
|
171
|
+
|
172
|
+
|
173
|
+
== Protocol Definition
|
174
|
+
|
175
|
+
[#Terminology]
|
176
|
+
=== Terminology
|
177
|
+
|
178
|
+
In this document, the key words "**MUST**", "**MUST NOT**", "**REQUIRED**",
|
179
|
+
"**SHALL**", "**SHALL NOT**", "**SHOULD**", "**SHOULD NOT**", "**RECOMMENDED**", "**MAY**",
|
180
|
+
and "**OPTIONAL**" are to be interpreted as described in BCP 14, RFC 2119
|
181
|
+
<<RFC2119>> and indicate requirement levels for compliant STuPiD
|
182
|
+
implementations.
|
183
|
+
|
184
|
+
|
185
|
+
=== Discovering External IP Address and Port
|
186
|
+
|
187
|
+
A client may discover its external IP address and the port
|
188
|
+
required for port prediction by performing a HTTP GET
|
189
|
+
request to a STuPiD server. The STuPiD server **MUST** reply
|
190
|
+
with the remote address and remote port in the following
|
191
|
+
format:
|
192
|
+
|
193
|
+
host ":" port
|
194
|
+
|
195
|
+
where 'host' and 'port' are defined as in <<RFC3986>>.
|
196
|
+
|
197
|
+
|
198
|
+
=== Storing Data
|
199
|
+
|
200
|
+
Data chunks are stored using the POST request of HTTP. The
|
201
|
+
STuPiD server **MUST** support one URI parameter which is passed
|
202
|
+
as query-string:
|
203
|
+
|
204
|
+
'chid': A unique ID identifying the data chunk to be stored.
|
205
|
+
The ID **SHOULD** be chosen from the characters of the base64url
|
206
|
+
set <<RFC4648>>.
|
207
|
+
|
208
|
+
The payload of the POST request **MUST** be the data to be
|
209
|
+
stored. The 'Content-Type' **SHOULD** be
|
210
|
+
'application/octet-stream', although a STuPiD server
|
211
|
+
implementation **SHOULD** simply ignore the 'Content-Type' as a
|
212
|
+
client implementation may be restricted and may not able to
|
213
|
+
specify a specific 'Content-Type'. (E.g., in certain cases,
|
214
|
+
the peer may be limited to sending the data as
|
215
|
+
multipart-form-encoded — still, the data is stored as a
|
216
|
+
byte stream.)
|
217
|
+
|
218
|
+
STuPiD servers may reject data chunks that are larger than
|
219
|
+
some predefined limit.
|
220
|
+
This maximum size in bytes of each data chunk is **RECOMMENDED**
|
221
|
+
to be 65536 or more.
|
222
|
+
|
223
|
+
As HTTP already provides data transparency,
|
224
|
+
the data chunk **SHOULD NOT** be encoded using Base64 or any
|
225
|
+
other data transparency mechanism; in any case, the STuPiD
|
226
|
+
server will not attempt to decode the chunk.
|
227
|
+
|
228
|
+
The sender **MUST** wait for the HTTP response before
|
229
|
+
going on to notify the receiver.
|
230
|
+
|
231
|
+
|
232
|
+
=== Notification
|
233
|
+
|
234
|
+
The sender notifies the receiver of the data chunk by passing
|
235
|
+
via an out-of-band channel (which is not part of the STuPiD
|
236
|
+
protocol):
|
237
|
+
|
238
|
+
The full URL from which the data chunk can be retrieved,
|
239
|
+
i.e. the same URL that was used to store the data chunk,
|
240
|
+
including the chunk ID parameter.
|
241
|
+
|
242
|
+
The exact notification mechanism over the out-of-band channel
|
243
|
+
and the definition of a session is dependent on the
|
244
|
+
out-of-band channel. See <<xmpp>> for one
|
245
|
+
example of such an out-of-band channel.
|
246
|
+
|
247
|
+
|
248
|
+
=== Retrieving Data
|
249
|
+
|
250
|
+
The notified peer retrieves the data chunk using a GET request
|
251
|
+
with the URL supplied by the sender. The STuPiD server **MUST**
|
252
|
+
set the 'Content-Type' of the returned body to
|
253
|
+
'application/octet-stream'.
|
254
|
+
|
255
|
+
|
256
|
+
== Implementation Notes
|
257
|
+
|
258
|
+
A STuPiD server implementation **SHOULD** delete stored data some
|
259
|
+
time after it was stored. It is **RECOMMENDED** not to delete the
|
260
|
+
data before five minutes have elapsed after it was stored.
|
261
|
+
Different client protocols will have different reactions to
|
262
|
+
data that have been deleted prematurely and cannot be
|
263
|
+
retrieved by the notified peer; this may be as trivial as
|
264
|
+
packet loss or it may cause a reliable byte-stream to fail
|
265
|
+
(<<impl>>).
|
266
|
+
(TODO: It may be useful to provide some hints in the storing
|
267
|
+
POST request.)
|
268
|
+
|
269
|
+
STuPiD clients should aggregate data in order to minimize the
|
270
|
+
number of requests to the STuPiD server per second.
|
271
|
+
The specific aggregation method chosen depends on the data
|
272
|
+
rate required (and the maximum chunk size), the latency
|
273
|
+
requirements, and the application semantics.
|
274
|
+
|
275
|
+
Clearly, it is up to the implementation to decide how the data
|
276
|
+
chunks are actually stored. A sufficiently silly STuPiD server
|
277
|
+
implementation might for instance use a MySQL database.
|
278
|
+
|
279
|
+
|
280
|
+
== Security Considerations
|
281
|
+
|
282
|
+
The security objectives of STuPiD are to be as secure as if
|
283
|
+
NAT traversal had succeeded, i.e., an on-path attacker can
|
284
|
+
overhear and fake messages, but an off-path attacker cannot.
|
285
|
+
If a higher level of security is desired, it should be
|
286
|
+
provided on top of the data relayed by STuPiD, e.g. by using
|
287
|
+
XTLS <<I-D.meyer-xmpp-e2e-encryption>>.
|
288
|
+
|
289
|
+
Much of the security of STuPiD is based on the assumption that
|
290
|
+
an off-path attacker cannot guess the chunk identifiers. A
|
291
|
+
suitable source of randomness <<RFC4086>> should
|
292
|
+
be used to generate at least a sufficiently large part of the
|
293
|
+
chunk identifiers (e.g., the chunk identifier could be a hard
|
294
|
+
to guess prefix followed by a serial number).
|
295
|
+
|
296
|
+
To protect the STuPiD server against denial of service and
|
297
|
+
possibly some forms of theft of service, it is **RECOMMENDED**
|
298
|
+
that the POST side of the STuPiD server be protected by some
|
299
|
+
form of authentication such as HTTP authentication. There is
|
300
|
+
little need to protect the GET side.
|
301
|
+
|
302
|
+
[bibliography]
|
303
|
+
== Normative References
|
304
|
+
++++
|
305
|
+
|
306
|
+
<reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
|
307
|
+
<front>
|
308
|
+
<title>
|
309
|
+
Key words for use in RFCs to Indicate Requirement Levels
|
310
|
+
</title>
|
311
|
+
<author initials="S." surname="Bradner" fullname="S. Bradner">
|
312
|
+
<organization/>
|
313
|
+
</author>
|
314
|
+
<date year="1997" month="March"/>
|
315
|
+
<abstract>
|
316
|
+
<t>
|
317
|
+
In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.
|
318
|
+
</t>
|
319
|
+
</abstract>
|
320
|
+
</front>
|
321
|
+
<seriesInfo name="BCP" value="14"/>
|
322
|
+
<seriesInfo name="RFC" value="2119"/>
|
323
|
+
<seriesInfo name="DOI" value="10.17487/RFC2119"/>
|
324
|
+
</reference>
|
325
|
+
|
326
|
+
<reference anchor="RFC3986" target="https://www.rfc-editor.org/info/rfc3986">
|
327
|
+
<front>
|
328
|
+
<title>Uniform Resource Identifier (URI): Generic Syntax</title>
|
329
|
+
<author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee">
|
330
|
+
<organization/>
|
331
|
+
</author>
|
332
|
+
<author initials="R." surname="Fielding" fullname="R. Fielding">
|
333
|
+
<organization/>
|
334
|
+
</author>
|
335
|
+
<author initials="L." surname="Masinter" fullname="L. Masinter">
|
336
|
+
<organization/>
|
337
|
+
</author>
|
338
|
+
<date year="2005" month="January"/>
|
339
|
+
<abstract>
|
340
|
+
<t>
|
341
|
+
A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource. This specification defines the generic URI syntax and a process for resolving URI references that might be in relative form, along with guidelines and security considerations for the use of URIs on the Internet. The URI syntax defines a grammar that is a superset of all valid URIs, allowing an implementation to parse the common components of a URI reference without knowing the scheme-specific requirements of every possible identifier. This specification does not define a generative grammar for URIs; that task is performed by the individual specifications of each URI scheme. [STANDARDS-TRACK]
|
342
|
+
</t>
|
343
|
+
</abstract>
|
344
|
+
</front>
|
345
|
+
<seriesInfo name="STD" value="66"/>
|
346
|
+
<seriesInfo name="RFC" value="3986"/>
|
347
|
+
<seriesInfo name="DOI" value="10.17487/RFC3986"/>
|
348
|
+
</reference>
|
349
|
+
|
350
|
+
<reference anchor="RFC4086" target="https://www.rfc-editor.org/info/rfc4086">
|
351
|
+
<front>
|
352
|
+
<title>Randomness Requirements for Security</title>
|
353
|
+
<author initials="D." surname="Eastlake 3rd" fullname="D. Eastlake 3rd">
|
354
|
+
<organization/>
|
355
|
+
</author>
|
356
|
+
<author initials="J." surname="Schiller" fullname="J. Schiller">
|
357
|
+
<organization/>
|
358
|
+
</author>
|
359
|
+
<author initials="S." surname="Crocker" fullname="S. Crocker">
|
360
|
+
<organization/>
|
361
|
+
</author>
|
362
|
+
<date year="2005" month="June"/>
|
363
|
+
<abstract>
|
364
|
+
<t>
|
365
|
+
Security systems are built on strong cryptographic algorithms that foil pattern analysis attempts. However, the security of these systems is dependent on generating secret quantities for passwords, cryptographic keys, and similar quantities. The use of pseudo-random processes to generate secret quantities can result in pseudo-security. A sophisticated attacker may find it easier to reproduce the environment that produced the secret quantities and to search the resulting small set of possibilities than to locate the quantities in the whole of the potential number space.
|
366
|
+
</t>
|
367
|
+
<t>
|
368
|
+
Choosing random quantities to foil a resourceful and motivated adversary is surprisingly difficult. This document points out many pitfalls in using poor entropy sources or traditional pseudo-random number generation techniques for generating such quantities. It recommends the use of truly random hardware techniques and shows that the existing hardware on many systems can be used for this purpose. It provides suggestions to ameliorate the problem when a hardware solution is not available, and it gives examples of how large such quantities need to be for some applications. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.
|
369
|
+
</t>
|
370
|
+
</abstract>
|
371
|
+
</front>
|
372
|
+
<seriesInfo name="BCP" value="106"/>
|
373
|
+
<seriesInfo name="RFC" value="4086"/>
|
374
|
+
<seriesInfo name="DOI" value="10.17487/RFC4086"/>
|
375
|
+
</reference>
|
376
|
+
|
377
|
+
<reference anchor="RFC4648" target="https://www.rfc-editor.org/info/rfc4648">
|
378
|
+
<front>
|
379
|
+
<title>The Base16, Base32, and Base64 Data Encodings</title>
|
380
|
+
<author initials="S." surname="Josefsson" fullname="S. Josefsson">
|
381
|
+
<organization/>
|
382
|
+
</author>
|
383
|
+
<date year="2006" month="October"/>
|
384
|
+
<abstract>
|
385
|
+
<t>
|
386
|
+
This document describes the commonly used base 64, base 32, and base 16 encoding schemes. It also discusses the use of line-feeds in encoded data, use of padding in encoded data, use of non-alphabet characters in encoded data, use of different encoding alphabets, and canonical encodings. [STANDARDS-TRACK]
|
387
|
+
</t>
|
388
|
+
</abstract>
|
389
|
+
</front>
|
390
|
+
<seriesInfo name="RFC" value="4648"/>
|
391
|
+
<seriesInfo name="DOI" value="10.17487/RFC4648"/>
|
392
|
+
</reference>
|
393
|
+
++++
|
394
|
+
|
395
|
+
[bibliography]
|
396
|
+
== Informative References
|
397
|
+
++++
|
398
|
+
<reference anchor="RFC5389" target="https://www.rfc-editor.org/info/rfc5389">
|
399
|
+
<front>
|
400
|
+
<title>Session Traversal Utilities for NAT (STUN)</title>
|
401
|
+
<author initials="J." surname="Rosenberg" fullname="J. Rosenberg">
|
402
|
+
<organization/>
|
403
|
+
</author>
|
404
|
+
<author initials="R." surname="Mahy" fullname="R. Mahy">
|
405
|
+
<organization/>
|
406
|
+
</author>
|
407
|
+
<author initials="P." surname="Matthews" fullname="P. Matthews">
|
408
|
+
<organization/>
|
409
|
+
</author>
|
410
|
+
<author initials="D." surname="Wing" fullname="D. Wing">
|
411
|
+
<organization/>
|
412
|
+
</author>
|
413
|
+
<date year="2008" month="October"/>
|
414
|
+
<abstract>
|
415
|
+
<t>
|
416
|
+
Session Traversal Utilities for NAT (STUN) is a protocol that serves as a tool for other protocols in dealing with Network Address Translator (NAT) traversal. It can be used by an endpoint to determine the IP address and port allocated to it by a NAT. It can also be used to check connectivity between two endpoints, and as a keep-alive protocol to maintain NAT bindings. STUN works with many existing NATs, and does not require any special behavior from them.
|
417
|
+
</t>
|
418
|
+
<t>
|
419
|
+
STUN is not a NAT traversal solution by itself. Rather, it is a tool to be used in the context of a NAT traversal solution. This is an important change from the previous version of this specification (RFC 3489), which presented STUN as a complete solution.
|
420
|
+
</t>
|
421
|
+
<t>
|
422
|
+
This document obsoletes RFC 3489. [STANDARDS-TRACK]
|
423
|
+
</t>
|
424
|
+
</abstract>
|
425
|
+
</front>
|
426
|
+
<seriesInfo name="RFC" value="5389"/>
|
427
|
+
<seriesInfo name="DOI" value="10.17487/RFC5389"/>
|
428
|
+
</reference>
|
429
|
+
|
430
|
+
<reference anchor="I-D.ietf-behave-turn">
|
431
|
+
<front>
|
432
|
+
<title>Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)</title>
|
433
|
+
|
434
|
+
<author initials='J' surname='Rosenberg' fullname='Jonathan Rosenberg'>
|
435
|
+
<organization />
|
436
|
+
</author>
|
437
|
+
|
438
|
+
<author initials='R' surname='Mahy' fullname='Rohan Mahy'>
|
439
|
+
<organization />
|
440
|
+
</author>
|
441
|
+
|
442
|
+
<author initials='P' surname='Matthews' fullname='Philip Matthews'>
|
443
|
+
<organization />
|
444
|
+
</author>
|
445
|
+
|
446
|
+
<date month='July' day='3' year='2009' />
|
447
|
+
|
448
|
+
<abstract><t>If a host is located behind a NAT, then in certain situations it can be impossible for that host to communicate directly with other hosts (peers). In these situations, it is necessary for the host to use the services of an intermediate node that acts as a communication relay. This specification defines a protocol, called TURN (Traversal Using Relays around NAT), that allows the host to control the operation of the relay and to exchange packets with its peers using the relay. TURN differs from some other relay control protocols in that it allows a client to communicate with multiple peers using a single relay address. The TURN protocol was designed to be used as part of the ICE (Interactive Connectivity Establishment) approach to NAT traversal, though it can be also used without ICE.</t></abstract>
|
449
|
+
|
450
|
+
</front>
|
451
|
+
|
452
|
+
<seriesInfo name='Internet-Draft' value='draft-ietf-behave-turn-16' />
|
453
|
+
<format type='TXT'
|
454
|
+
target='http://www.ietf.org/internet-drafts/draft-ietf-behave-turn-16.txt' />
|
455
|
+
</reference>
|
456
|
+
|
457
|
+
<reference anchor="STUNT" target="http://deusty.blogspot.com/2007/09/stunt-out-of-band-channels.html">
|
458
|
+
<front>
|
459
|
+
<title>STUNT & out-of-band channels</title>
|
460
|
+
<author initials="R." surname="Hanson" fullname="Robbie Hanson">
|
461
|
+
<organization></organization>
|
462
|
+
</author>
|
463
|
+
<date year="2007" month="September" day="17"/>
|
464
|
+
</front>
|
465
|
+
</reference>
|
466
|
+
<reference anchor="I-D.meyer-xmpp-e2e-encryption">
|
467
|
+
<front>
|
468
|
+
<title>XTLS: End-to-End Encryption for the Extensible Messaging and Presence Protocol (XMPP) Using Transport Layer Security (TLS)</title>
|
469
|
+
|
470
|
+
<author initials='D' surname='Meyer' fullname='Dirk Meyer'>
|
471
|
+
<organization />
|
472
|
+
</author>
|
473
|
+
|
474
|
+
<author initials='P' surname='Saint-Andre' fullname='Peter Saint-Andre'>
|
475
|
+
<organization />
|
476
|
+
</author>
|
477
|
+
|
478
|
+
<date month='June' day='29' year='2009' />
|
479
|
+
|
480
|
+
<abstract><t>This document specifies "XTLS", a protocol for end-to-end encryption of Extensible Messaging and Presence Protocol (XMPP) traffic. XTLS is an application-level usage of Transport Layer Security (TLS) that is set up using the XMPP Jingle extension for session negotiation and transported using any streaming transport as the data delivery mechanism. Thus XTLS treats the end-to-end exchange of XML stanzas as a virtual transport and uses TLS to secure that transport, enabling XMPP entities to communicate in a way that is designed to ensure the confidentiality and integrity XML stanzas. The protocol can be used for secure end-to-end messaging as well as other XMPP applications, such as file transfer.</t></abstract>
|
481
|
+
|
482
|
+
</front>
|
483
|
+
|
484
|
+
<seriesInfo name='Internet-Draft' value='draft-meyer-xmpp-e2e-encryption-02' />
|
485
|
+
<format type='TXT'
|
486
|
+
target='http://www.ietf.org/internet-drafts/draft-meyer-xmpp-e2e-encryption-02.txt' />
|
487
|
+
</reference>
|
488
|
+
|
489
|
+
|
490
|
+
<reference anchor="I-D.ietf-xmpp-3920bis">
|
491
|
+
<front>
|
492
|
+
<title>Extensible Messaging and Presence Protocol (XMPP): Core</title>
|
493
|
+
|
494
|
+
<author initials='P' surname='Saint-Andre' fullname='Peter Saint-Andre'>
|
495
|
+
<organization />
|
496
|
+
</author>
|
497
|
+
|
498
|
+
<date month='December' day='20' year='2010' />
|
499
|
+
|
500
|
+
<abstract><t>The Extensible Messaging and Presence Protocol (XMPP) is an application profile of the Extensible Markup Language (XML) that enables the near-real-time exchange of structured yet extensible data between any two or more network entities. This document defines XMPP's core protocol methods: setup and teardown of XML streams, channel encryption, authentication, error handling, and communication primitives for messaging, network availability ("presence"), and request-response interactions. This document obsoletes RFC 3920.</t></abstract>
|
501
|
+
|
502
|
+
</front>
|
503
|
+
|
504
|
+
<seriesInfo name='Internet-Draft' value='draft-ietf-xmpp-3920bis-22' />
|
505
|
+
<format type='TXT'
|
506
|
+
target='http://www.ietf.org/internet-drafts/draft-ietf-xmpp-3920bis-22.txt' />
|
507
|
+
</reference>
|
508
|
+
|
509
|
+
++++
|
510
|
+
|
511
|
+
[#xmp]
|
512
|
+
== Examples
|
513
|
+
|
514
|
+
This appendix provides some examples of the STuPiD protocol operation.
|
515
|
+
|
516
|
+
[#figxmpdisco]
|
517
|
+
.Discovering External IP Address and Port
|
518
|
+
====
|
519
|
+
....
|
520
|
+
Request:
|
521
|
+
|
522
|
+
GET /stupid.php HTTP/1.0
|
523
|
+
User-Agent: Example/1.11.4
|
524
|
+
Accept: */*
|
525
|
+
Host: example.org
|
526
|
+
Connection: Keep-Alive
|
527
|
+
|
528
|
+
Response:
|
529
|
+
|
530
|
+
HTTP/1.1 200 OK
|
531
|
+
Date: Sun, 05 Jul 2009 00:30:37 GMT
|
532
|
+
Server: Apache/2.2
|
533
|
+
Cache-Control: no-cache, must-revalidate
|
534
|
+
Expires: Sat, 26 Jul 1997 05:00:00 GMT
|
535
|
+
Vary: Accept-Encoding
|
536
|
+
Content-Length: 17
|
537
|
+
Keep-Alive: timeout=1, max=400
|
538
|
+
Connection: Keep-Alive
|
539
|
+
Content-Type: application/octet-stream
|
540
|
+
|
541
|
+
192.0.2.239:36654
|
542
|
+
....
|
543
|
+
====
|
544
|
+
|
545
|
+
[#figxmpstore]
|
546
|
+
.Storing Data
|
547
|
+
====
|
548
|
+
....
|
549
|
+
Request:
|
550
|
+
|
551
|
+
POST /stupid.php?chid=i781hf64-0 HTTP/1.0
|
552
|
+
User-Agent: Example/1.11.4
|
553
|
+
Accept: */*
|
554
|
+
Host: example.org
|
555
|
+
Connection: Keep-Alive
|
556
|
+
Content-Type: application/octet-stream
|
557
|
+
Content-Length: 11
|
558
|
+
|
559
|
+
Hello World
|
560
|
+
|
561
|
+
Response:
|
562
|
+
|
563
|
+
HTTP/1.1 200 OK
|
564
|
+
Date: Sun, 05 Jul 2009 00:20:34 GMT
|
565
|
+
Server: Apache/2.2
|
566
|
+
Cache-Control: no-cache, must-revalidate
|
567
|
+
Expires: Sat, 26 Jul 1997 05:00:00 GMT
|
568
|
+
Vary: Accept-Encoding
|
569
|
+
Content-Length: 0
|
570
|
+
Keep-Alive: timeout=1, max=400
|
571
|
+
Connection: Keep-Alive
|
572
|
+
Content-Type: application/octet-stream
|
573
|
+
....
|
574
|
+
====
|
575
|
+
|
576
|
+
[#figxmpretr]
|
577
|
+
.Retrieving Data
|
578
|
+
====
|
579
|
+
....
|
580
|
+
Request:
|
581
|
+
|
582
|
+
GET /stupid.php?chid=i781hf64-0 HTTP/1.0
|
583
|
+
User-Agent: Example/1.11.4
|
584
|
+
Accept: */*
|
585
|
+
Host: example.org
|
586
|
+
Connection: Keep-Alive
|
587
|
+
|
588
|
+
Response:
|
589
|
+
|
590
|
+
HTTP/1.1 200 OK
|
591
|
+
Date: Sun, 05 Jul 2009 00:21:29 GMT
|
592
|
+
Server: Apache/2.2
|
593
|
+
Cache-Control: no-cache, must-revalidate
|
594
|
+
Expires: Sat, 26 Jul 1997 05:00:00 GMT
|
595
|
+
Vary: Accept-Encoding
|
596
|
+
Content-Length: 11
|
597
|
+
Keep-Alive: timeout=1, max=400
|
598
|
+
Connection: Keep-Alive
|
599
|
+
Content-Type: application/octet-stream
|
600
|
+
|
601
|
+
Hello World
|
602
|
+
....
|
603
|
+
====
|
604
|
+
|
605
|
+
[#impl]
|
606
|
+
== Sample Implementation
|
607
|
+
|
608
|
+
[#figimpl]
|
609
|
+
.STuPiD Sample Implementation
|
610
|
+
====
|
611
|
+
[source,php]
|
612
|
+
----
|
613
|
+
<?php
|
614
|
+
header("Cache-Control: no-cache, must-revalidate");
|
615
|
+
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
616
|
+
header("Content-Type: application/octet-stream");
|
617
|
+
|
618
|
+
mysql_connect(localhost, "username", "password");
|
619
|
+
mysql_select_db("stupid");
|
620
|
+
|
621
|
+
$chid = mysql_real_escape_string($_GET["chid"]);
|
622
|
+
|
623
|
+
if ($_SERVER["REQUEST_METHOD"] == "GET") {
|
624
|
+
if (empty($chid)) {
|
625
|
+
echo $_SERVER["REMOTE_ADDR"] . ":" . $_SERVER["REMOTE_PORT"];
|
626
|
+
} elseif ($result = mysql_query("SELECT `data` FROM `Data` " .
|
627
|
+
"WHERE `chid` = '$chid'")) {
|
628
|
+
if ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
629
|
+
echo base64_decode($row["data"]);
|
630
|
+
} else {
|
631
|
+
header("HTTP/1.0 404 Not Found");
|
632
|
+
}
|
633
|
+
mysql_free_result($result);
|
634
|
+
} else {
|
635
|
+
header("HTTP/1.0 404 Not Found");
|
636
|
+
}
|
637
|
+
} elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
|
638
|
+
if (empty($chid)) {
|
639
|
+
header("HTTP/1.0 404 Not Found");
|
640
|
+
} else {
|
641
|
+
mysql_query("DELETE FROM `Data` " .
|
642
|
+
"WHERE `timestamp` < DATE_SUB(NOW(), INTERVAL 5 MINUTE)");
|
643
|
+
$data = base64_encode(file_get_contents("php://input"));
|
644
|
+
if (!mysql_query("INSERT INTO `Data` (`chid`, `data`) " .
|
645
|
+
"VALUES ('$chid', '$data')")) {
|
646
|
+
header("HTTP/1.0 403 Bad Request");
|
647
|
+
}
|
648
|
+
}
|
649
|
+
} else {
|
650
|
+
header("HTTP/1.0 405 Method Not Allowed");
|
651
|
+
header("Allow: GET, HEAD, POST");
|
652
|
+
}
|
653
|
+
mysql_close();
|
654
|
+
?>
|
655
|
+
----
|
656
|
+
====
|
657
|
+
|
658
|
+
[#xmpp]
|
659
|
+
== Using XMPP as Out-Of-Band Channel
|
660
|
+
|
661
|
+
XMPP <<I-D.ietf-xmpp-3920bis>> is a good choice for
|
662
|
+
an out-of-band channel.
|
663
|
+
|
664
|
+
The notification protocol is closely modeled after XMPP's
|
665
|
+
In-Band Bytestreams (IBB, see
|
666
|
+
http://xmpp.org/extensions/xep-0047.html). Just replace the
|
667
|
+
namespace and insert the STuPiD Retrieval URI instead of the
|
668
|
+
actual Base64 encoded data, see <<figxmpnots>>.
|
669
|
+
(Note that the current proposal redundantly sends a sid and a
|
670
|
+
seq as well as the chid composed of these two; it may be
|
671
|
+
possible to optimize this, possibly sending the constant prefix
|
672
|
+
of the URI once at bytestream creation time.)
|
673
|
+
|
674
|
+
Notifications **MUST** be processed in the order they are
|
675
|
+
received. If an out-of-sequence notification is received for a
|
676
|
+
particular session (determined by checking the 'seq' attribute),
|
677
|
+
then this indicates that a notification has been lost. The
|
678
|
+
recipient **MUST NOT** process such an out-of-sequence notification,
|
679
|
+
nor any that follow it within the same session; instead, the
|
680
|
+
recipient **MUST** consider the session invalid. (Adapted from
|
681
|
+
http://xmpp.org/extensions/xep-0047.html#send)
|
682
|
+
|
683
|
+
Of course, other methods can be used for setup and teardown, such as Jingle
|
684
|
+
(see http://xmpp.org/extensions/xep-0261.html).
|
685
|
+
|
686
|
+
[#figxmpcri]
|
687
|
+
.Creating a Bytestream: Initiator requests session
|
688
|
+
====
|
689
|
+
[source,xml]
|
690
|
+
----
|
691
|
+
<iq from='romeo@montague.net/orchard'
|
692
|
+
id='jn3h8g65'
|
693
|
+
to='juliet@capulet.com/balcony'
|
694
|
+
type='set'>
|
695
|
+
<open xmlns='urn:xmpp:tmp:stupid'
|
696
|
+
block-size='65536'
|
697
|
+
sid='i781hf64'
|
698
|
+
stanza='iq'/>
|
699
|
+
</iq>
|
700
|
+
----
|
701
|
+
====
|
702
|
+
|
703
|
+
[#figxmpcrr]
|
704
|
+
.Creating a Bytestream: Responder accepts session
|
705
|
+
====
|
706
|
+
[source,xml]
|
707
|
+
----
|
708
|
+
<iq from='juliet@capulet.com/balcony'
|
709
|
+
id='jn3h8g65'
|
710
|
+
to='romeo@montague.net/orchard'
|
711
|
+
type='result'/>
|
712
|
+
----
|
713
|
+
====
|
714
|
+
|
715
|
+
[#figxmpnots]
|
716
|
+
.Sending Notifications: Notification in an IQ stanza
|
717
|
+
====
|
718
|
+
[source,xml]
|
719
|
+
----
|
720
|
+
<iq from='romeo@montague.net/orchard'
|
721
|
+
id='kr91n475'
|
722
|
+
to='juliet@capulet.com/balcony'
|
723
|
+
type='set'>
|
724
|
+
<data xmlns='urn:xmpp:tmp:stupid'
|
725
|
+
seq='0'
|
726
|
+
sid='i781hf64'
|
727
|
+
url='http://example.org/stupid.php?chid=i781hf64-0'/>
|
728
|
+
</iq>
|
729
|
+
----
|
730
|
+
====
|
731
|
+
|
732
|
+
[#figxmpnota]
|
733
|
+
.Sending Notifications: Acknowledging notification using IQ
|
734
|
+
====
|
735
|
+
[source,xml]
|
736
|
+
----
|
737
|
+
<iq from='juliet@capulet.com/balcony'
|
738
|
+
id='kr91n475'
|
739
|
+
to='romeo@montague.net/orchard'
|
740
|
+
type='result'/>
|
741
|
+
----
|
742
|
+
====
|
743
|
+
|
744
|
+
[#figxmpclor]
|
745
|
+
.Closing the Bytestream: Request
|
746
|
+
====
|
747
|
+
[source,xml]
|
748
|
+
----
|
749
|
+
<iq from='romeo@montague.net/orchard'
|
750
|
+
id='us71g45j'
|
751
|
+
to='juliet@capulet.com/balcony'
|
752
|
+
type='set'>
|
753
|
+
<close xmlns='urn:xmpp:tmp:stupid'
|
754
|
+
sid='i781hf64'/>
|
755
|
+
</iq>
|
756
|
+
----
|
757
|
+
====
|
758
|
+
|
759
|
+
[#figxmpclos]
|
760
|
+
.Closing the Bytestream: Success response
|
761
|
+
====
|
762
|
+
[source,xml]
|
763
|
+
----
|
764
|
+
<iq from='juliet@capulet.com/balcony'
|
765
|
+
id='us71g45j'
|
766
|
+
to='romeo@montague.net/orchard'
|
767
|
+
type='result'/>
|
768
|
+
----
|
769
|
+
====
|
770
|
+
|
771
|
+
|