Debian Codegraph @

README.turnutils

raw
1 GENERAL INFORMATION
2
3 A set of turnutils_* programs provides some utility functionality to be used
4 for testing and for setting up the TURN server.
5
6 1. turnutils_uclient: emulates multiple UDP,TCP,TLS or DTLS clients.
7 (this program is provided for the testing purposes only !)
8 The compiled binary image of this program is located in bin/
9 sub-directory.
10
11 2. turnutils_peer: a simple stateless UDP-only "echo" server,
12 to be used as the final server in relay pattern ("peer"). For every incoming
13 UDP packet, it simply echoes it back.
14 (this program is provided for the testing purposes only !)
15 When the test clients are communicating in the client-to-client manner
16 (when the "turnutils_uclient" program is used with "-y" option) then the
17 turnutils_peer is not needed.
18
19 The compiled binary image of this program is located in bin/ subdirectory.
20
21 3. turnutils_stunclient: a simple STUN client example.
22 The compiled binary image of this program is located in bin/ subdirectory.
23
24 4. turnutils_rfc5769check: a utility that checks the correctness of the
25 STUN/TURN protocol implementation. This utility is used only for the compilation
26 check procedure, it is not copied to the installation destination.
27
28 In the "examples/scripts" subdirectory, you will find the examples of command lines to be used
29 to run the programs. The scripts are meant to be run from examples/ subdirectory, for example:
30
31 $ cd examples
32
33 $ ./scripts/secure_relay.sh
34
35 5. turnutils_natdiscovery: a utility that provides NAT behavior discovery
36 according RFC5780. This utility discovers the actual NAT Mapping and Filtering
37 behavior, etc. Be aware that on TURN server side two different listening IP
38 addresses should be configured to be able to work properly!
39
40 6. turnutils_oauth: a utility that provides OAuth access_token
41 generation(AEAD encryption), validation and decryption. This utility inputs
42 all the keys and lifetimes and any related information that needed for
43 creation and validationi of an access_token. It outputs a JSON with all OAuth
44 PoP parameters that need to pass to the client. Output is generated accoriding
45 RFC7635 Appendix B, Figure 8.
46
47 For more details, and for the access_token structure, read rfc7635, and see
48 script in examples/scripts/oauth.sh.
49
50
51 =====================================
52
53 NAME
54
55 turnutils_uclient - this client emulation application is supplied for the test purposes only.
56
57 SYNOPSIS
58
59 $ turnutils_uclient [-tTSvsyhcxg] [options] <TURN-Server-IP-address>
60
61 DESCRIPTION
62
63 It was designed to simulate multiple clients. It uses asynch IO API in
64 libevent to handle multiple clients. A client connects to the relay,
65 negotiates the session, and sends multiple (configured number) messages to the server (relay),
66 expecting the same number of replies. The length of the messages is configurable.
67 The message is an arbitrary octet stream.
68 The number of the messages to send is configurable.
69
70 Flags:
71
72 -t Use TCP for communications between client and TURN server (default is UDP).
73
74 -b Use SCTP for communications between client and TURN server (default is UDP).
75
76 -T Use TCP for the relay transport (default - UDP). Implies options -t, -y, -c,
77 and ignores flags and options -s, -e, -r and -g. Can be used together
78 with -b.
79
80 -P Passive TCP (RFC6062 with active peer). Implies -T.
81
82 -S Secure SSL connection: SSL/TLS for TCP, DTLS for UDP, TLS/SCTP for SCTP.
83
84 -U Secure unencrypted connection (suite eNULL): SSL/TLS for TCP, DTLS for UDP.
85
86 -v Verbose.
87
88 -s Use "Send" method in TURN; by default, it uses TURN Channels.
89
90 -y Use client-to-client connections:
91 RTP/RTCP pair of channels to another RTP/RTCP pair of channels.
92 with this option the turnutils_peer application is not used,
93 as the allocated relay endpoints are talking to each other.
94
95 -h Hang on indefinitely after the last sent packet.
96
97 -c Do not create rtcp connections.
98
99 -x Request IPv6 relay address (RFC6156).
100
101 -X IPv4 relay address explicitly requested.
102
103 -g Set DONT_FRAGMENT parameter in TURN requests.
104
105 -D Do mandatory channel padding even for UDP (like pjnath).
106
107 -N do negative tests (some limited cases only).
108
109 -R do negative protocol tests.
110
111 -O DOS attack mode.
112
113 -M Use TURN ICE Mobility.
114
115 -I Do not set permissions on TURN relay endpoints
116 (for testing the non-standard server relay functionality).
117
118 -G Generate extra requests (create permissions, channel bind).
119
120 -B Random disconnect after a few initial packets.
121
122 -Z Dual allocation (SSODA). Implies -c option.
123
124 -J Use oAuth with default test key kid='north'.
125
126 -Y Load-generator mode:
127 packet floods data through a single TURN allocation as fast as possible,
128 alloc creates allocations as fast as possible,
129 and invalid sends small invalid packets to the TURN listener as fast as possible.
130 Load-generator modes imply -c and do not support -y.
131
132 --no-even-port Never attach an EVEN-PORT attribute to ALLOCATE requests. The
133 default clnet_allocate path picks 0 or -1 randomly even under -c,
134 which the turnserver --multiplex-peer mode strictly rejects with
135 error 400. Use --no-even-port for clean alloc-flood runs and any
136 other testing against --multiplex-peer.
137
138 --listener-threads <N> Number of receive (listener) threads on the loadgen
139 (also available as -K N). Default auto: 0 for -m < 4, bumped to 1
140 when -m >= 4. 0 keeps the legacy single-event-base behaviour. Each
141 listener owns its own libevent base; sessions are sharded
142 round-robin. Max 4.
143
144 --sender-threads <N> Number of send (timer-driven) threads on the loadgen.
145 Default auto: 0 for -m < 4, bumped to 2 when -m >= 4. 0 keeps the
146 legacy single-threaded send (main thread's timer_handler iterates
147 all sessions). Each sender owns its own libevent base and a session
148 shard; per-tick sends coalesce into one UDP-GSO sendmsg (or one
149 sendmmsg when GSO is unavailable). Max 4.
150
151 Options with required values:
152
153 -l Message length (Default: 100 Bytes).
154
155 -i Certificate file (for secure connections only, optional).
156
157 -k Private key file (for secure connections only).
158
159 -E CA file for server certificate verification,
160 if the server certificate to be verified.
161
162 -p TURN Server port (Defaults: 3478 unsecure, 5349 secure).
163
164 -n Number of messages to send (Default: 5).
165 In load-generator mode, -n is the number of operations per client.
166 If omitted there, the client runs until interrupted.
167
168 -d Local interface device (optional, Linux only).
169
170 -L Local IP address (optional).
171
172 -m Number of clients (Default: 1, 2 or 4, depending on options).
173
174 -e Peer address.
175
176 -r Peer port (Default: 3480).
177
178 -z Per-session packet interval in milliseconds (Default: 20).
179 In packet and invalid load-generator modes the default is 0 ms.
180
181 -u STUN/TURN user name.
182
183 -w STUN/TURN user password.
184
185 -W TURN REST API secret. The "plain text" secret e.g. "north"
186 that is stored in the value column of the turn_secret
187 table in the database if dynamic, or the static-auth-secret
188 value set in the configuration file if using static.
189
190 -C This is the timestamp/username separator symbol (character) in
191 TURN REST API. The default value is :.
192
193 -F Cipher suite for TLS/DTLS. Default value is DEFAULT.
194
195 -o the ORIGIN STUN attribute value.
196
197 -a Bandwidth for the bandwidth request in ALLOCATE. The default value is zero.
198
199 Notes for load-generator mode:
200
201 - packet mode still performs the normal TURN allocation/setup and then starts sending immediately with no pacing.
202
203 - alloc mode does not require -e; it repeatedly establishes new allocations and closes them again.
204 - alloc mode does not require -e; it repeatedly establishes new allocations, uses a unique client local port for each one, attaches each one to a unique synthetic peer ip:port, and closes them again.
205
206 - invalid mode does not require -e; by default it uses 16-byte payloads unless -l is specified.
207
208 See the examples in the "examples/scripts" directory.
209
210 ======================================
211
212 NAME
213
214 turnutils_peer - a simple UDP-only echo backend server.
215
216 SYNOPSIS
217
218 $ turnutils_peer [-v] [options]
219
220 DESCRIPTION
221
222 This application is used for the test purposes only, as a peer for the turnutils_uclient application.
223
224 Options with required values:
225
226 -p Listening UDP port (Default: 3480).
227
228 -d Listening interface device (optional)
229
230 -L Listening address of turnutils_peer server. Multiple listening addresses can be used, IPv4 and IPv6.
231 If no listener address(es) defined, then it listens on all IPv4 and IPv6 addresses.
232
233 -v Verbose
234
235 ========================================
236
237 NAME
238
239 turnutils_stunclient - a basic STUN client.
240
241 SYNOPSIS
242
243 $ turnutils_stunclient [options] <STUN-Server-IP-address>
244
245 DESCRIPTION
246
247 It sends a "new" STUN RFC 5389 request (over UDP) and shows the reply information.
248
249 Options with required values:
250
251 -p STUN server port (Default: 3478).
252
253 -L Local address to use (optional).
254
255 -f Force RFC 5780 processing.
256
257 -c Continuously send STUN binding requests and report round-trip latency until interrupted.
258
259 -i Interval between continuous requests in milliseconds (Default: 1000).
260
261 -t Response timeout in milliseconds (Default: 3000).
262
263 The turnutils_stunclient program checks the results of the first request,
264 and if it finds that the STUN server supports RFC 5780
265 (the binding response reveals that) then the turnutils_stunclient makes a couple more
266 requests with different parameters, to demonstrate the NAT discovery capabilities.
267
268 Continuous mode reports every response or timeout and prints packet loss and
269 minimum/average/maximum round-trip latency when interrupted with Ctrl-C.
270
271 This utility does not support the "old" "classic" STUN protocol (RFC 3489).
272
273 =====================================
274
275 NAME
276
277 turnutils_rfc5769check - a utility that tests the correctness of STUN protocol implementation.
278
279 SYNOPSIS
280
281 $ turnutils_rfc5769check
282
283 DESCRIPTION
284
285 turnutils_rfc5769check tests the correctness of STUN protocol implementation
286 against the test vectors predefined in RFC 5769 and prints the results of the
287 tests on the screen. This utility is used only for the compilation
288 check procedure, it is not copied to the installation destination.
289
290 Usage:
291
292 $ turnutils_rfc5769check
293
294 =====================================
295
296 NAME
297
298 turnutils_natdiscovery - a utility that discovers NAT mapping and filtering
299 behavior according RFC5780.
300
301 SYNOPSIS
302
303 $ turnutils_natdiscovery [options] <STUN-Server-FQDN-or-IP-address>
304
305 DESCRIPTION
306
307 turnutils_natdiscovery discovers the NAT Mapping and Filtering behavior, to
308 determine if that NAT is currently using Endpoint-Independent,
309 Address-Dependent, or Address and Port-Dependent Mapping and/or to determine if
310 that NAT is currently using Endpoint-Independent, Address-Dependent, or Address
311 and Port-Dependent Filtering.
312
313 Use either -m, -f, -c, -H flag to discover NAT behavior.
314
315 Flags:
316
317 -m NAT mapping behavior discovery
318
319 -f NAT filtering behavior discovery
320
321 -t NAT mapping lifetime behavior discovery
322 Requires a timer (-T)
323
324 -c NAT collision behavior discovery
325
326 -H NAT hairpinning behavior discovery
327
328 -P Add 1500 byte Padding to the behavior discovery
329 Applicable with all except NAT mapping Lifetime discovery
330
331 Options with required values:
332
333 -p STUN server port (Default: 3478)
334
335 -L Local address to use (optional)
336
337 -l Local port to use (use with -L)
338
339 -A Secondary Local address (optional)
340 Required for collision discovery
341
342 -T Mapping lifetime timer (sec)
343 Used by mapping lifetime behavior discovery
344
345 Usage:
346
347 $ turnutils_natdiscovery -m -f stun.example.com
348
349 =====================================
350
351 NAME
352
353 turnutils_oauth - a utility that helps OAuth access_token generation/encryption and validation/decyption
354
355 SYNOPSIS
356
357 $ turnutils_oauth [options]
358
359 DESCRIPTION
360
361 turnutils_oauth utility provides help in OAuth access_token encryption and/or
362 decryption with AEAD (Atuthenticated Encryption with Associated Data). It helps
363 for an Auth Server in access_token creation, and also for debugging purposes it
364 helps the access_token validation and decryption. This utility inputs all the
365 keys and lifetimes and any related information that are needed for encryption
366 or decryption of an access_token. It outputs a JSON with all OAuth PoP
367 parameters that need to pass to the client. Output is generated accoriding
368 RFC7635 Appendix B, Figure 8. This utility could help to build an Auth Server
369 service, but be awere that this utility does not generate "session key" /
370 "mac_key" and not verifies lifetime of "session key" / "mac_key" or "Auth key".
371 For more details, and for the access_token structure, read rfc7635, and see
372 the example in examples/scripts/oauth.sh.
373
374 Use either -e and/or -d flag to encrypt or decrypt access_token.
375
376 Flags:
377
378 -h, --help usage
379
380 -v, --verbose verbose mode
381
382 -e, --encrypt encrypt token
383
384 -d, --decrypt decrypt validate token
385
386 Options with required values:
387
388 -i, --server-name server name (max. 255 char)
389
390 -j, --auth-key-id Auth key id (max. 32 char)
391
392 -k, --auth-key base64 encoded Auth key
393
394 -l --auth-key-timestamp Auth key timestamp (sec since epoch)
395
396 -m, --auth-key-lifetime Auth key lifetime in sec
397
398 -n, --auth-key-as-rs-alg Authorization Server(AS) - Resource Server(RS) encryption algorithm
399
400 -o, --token-nonce base64 encoded nonce base64(12 octet) = 16 char
401
402 -p, --token-mac-key base64 encoded MAC key base64(32 octet) = 44 char
403
404 -q, --token-timestamp timestamp in format 64 bit unsigned (Native format - Unix),
405 so 48 bit for secs since epoch UTC + 16 bit for 1/64000 fractions of a second.
406 e.g.: the actual unixtimestamp 16 bit left shifted. (Default: actual gmtime)
407 -r, --token-lifetime lifetime in sec (Default: 3600)
408
409 -t, --token base64 encoded encrypted token for validation and decryption
410
411 -u, --hmac-alg stun client hmac algorithm
412
413 Usage:
414
415 $ turnutils_natdiscovery
416
417 ===================================
418
419 DOCS
420
421 After installation, run the command:
422
423 $ man turnutils
424
425 or in the project root directory:
426
427 $ man -M man turnutils
428
429 to see the man page.
430
431 =====================================
432
433 FILES
434
435 /etc/turnserver.conf
436
437 /var/db/turndb
438
439 /usr/local/var/db/turndb
440
441 /var/lib/turn/turndb
442
443 /usr/local/etc/turnserver.conf
444
445 =================================
446
447 DIRECTORIES
448
449 /usr/local/share/turnserver
450
451 /usr/local/share/doc/turnserver
452
453 /usr/local/share/examples/turnserver
454
455 ===================================
456
457 STANDARDS
458
459 new STUN RFC 5389
460
461 TURN RFC 5766
462
463 TURN-TCP extension RFC 6062
464
465 TURN IPv6 extension RFC 6156
466
467 STUN/TURN test vectors RFC 5769
468
469 STUN NAT behavior discovery RFC 5780
470
471 ====================================
472
473 SEE ALSO
474
475 turnserver, turnadmin
476
477 ======================================
478
479 WEB RESOURCES
480
481 project page:
482
483 https://github.com/coturn/coturn/
484
485 Wiki page:
486
487 https://github.com/coturn/coturn/wiki
488
489 forum:
490
491 https://groups.google.com/forum/?fromgroups=#!forum/turn-server-project-rfc5766-turn-server/
492
493 ======================================
494
495 AUTHORS
496
497 See the AUTHORS.md file in the coturn source distribution.