turnutils.1 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. .\" Text automatically generated by txt2man
  2. .TH TURN 1 "29 September 2017" "" ""
  3. .SH GENERAL INFORMATION
  4. A set of turnutils_* programs provides some utility functionality to be used
  5. for testing and for setting up the TURN server.
  6. .TP
  7. .B
  8. 1.
  9. \fIturnutils_uclient\fP: emulates multiple UDP,TCP,TLS or DTLS clients.
  10. (this program is provided for the testing purposes only !)
  11. The compiled binary image of this program is located in bin/
  12. sub\-directory.
  13. .TP
  14. .B
  15. 2.
  16. \fIturnutils_peer\fP: a simple stateless UDP\-only "echo" server,
  17. to be used as the final server in relay pattern ("peer"). For every incoming
  18. UDP packet, it simply echoes it back.
  19. (this program is provided for the testing purposes only !)
  20. When the test clients are communicating in the client\-to\-client manner
  21. (when the "\fIturnutils_uclient\fP" program is used with "\fB\-y\fP" option) then the
  22. \fIturnutils_peer\fP is not needed.
  23. .PP
  24. The compiled binary image of this program is located in bin/ subdirectory.
  25. .TP
  26. .B
  27. 3.
  28. \fIturnutils_stunclient\fP: a simple STUN client example.
  29. The compiled binary image of this program is located in bin/ subdirectory.
  30. .TP
  31. .B
  32. 4.
  33. \fIturnutils_rfc5769check\fP: a utility that checks the correctness of the
  34. STUN/TURN protocol implementation. This utility is used only for the compilation
  35. check procedure, it is not copied to the installation destination.
  36. .PP
  37. In the "examples/scripts" subdirectory, you will find the examples of command lines to be used
  38. to run the programs. The scripts are meant to be run from examples/ subdirectory, for example:
  39. .PP
  40. $ cd examples
  41. .PP
  42. $ ./scripts/secure_relay.sh
  43. .TP
  44. .B
  45. 5.
  46. \fIturnutils_natdiscovery\fP: a utility that provides NAT behavior discovery
  47. according RFC5780. This utility discovers the actual NAT Mapping and Filtering
  48. behavior. Be aweare that at least two different listening IP addresses should
  49. be configured to be able to work properly!
  50. .TP
  51. .B
  52. 6.
  53. \fIturnutils_oauth\fP: a utility that provides OAuth access_token
  54. \fBgeneration\fP(AEAD encryption), validation and decryption. This utility inputs
  55. all the keys and lifetimes and any related information that needed for
  56. creation and validationi of an access_token. It outputs a JSON with all OAuth
  57. PoP parameters that need to pass to the client. Output is generated accoriding
  58. RFC7635 Appendix B, Figure 8.
  59. .PP
  60. For more details, and for the access_token structure, read rfc7635, and see
  61. script in examples/scripts/oauth.sh.
  62. .RE
  63. .PP
  64. .RS
  65. =====================================
  66. .SS NAME
  67. \fB
  68. \fBturnutils_uclient \fP\- this client emulation application is supplied for the test purposes only.
  69. \fB
  70. .SS SYNOPSIS
  71. $ \fIturnutils_uclient\fP [\fB\-tTSvsyhcxg\fP] [options] <TURN\-Server\-IP\-address>
  72. .SS DESCRIPTION
  73. It was designed to simulate multiple clients. It uses asynch IO API in
  74. libevent to handle multiple clients. A client connects to the relay,
  75. negotiates the session, and sends multiple (configured number) messages to the server (relay),
  76. expecting the same number of replies. The length of the messages is configurable.
  77. The message is an arbitrary octet stream.
  78. The number of the messages to send is configurable.
  79. .TP
  80. .B
  81. Flags:
  82. .TP
  83. .B
  84. \fB\-t\fP
  85. Use TCP for communications between client and TURN server (default is UDP).
  86. .TP
  87. .B
  88. \fB\-b\fP
  89. Use SCTP for communications between client and TURN server (default is UDP).
  90. .TP
  91. .B
  92. \fB\-T\fP
  93. Use TCP for the relay transport (default \- UDP). Implies options \fB\-t\fP, \fB\-y\fP, \fB\-c\fP,
  94. and ignores flags and options \fB\-s\fP, \fB\-e\fP, \fB\-r\fP and \fB\-g\fP. Can be used together
  95. with \fB\-b\fP.
  96. .TP
  97. .B
  98. \fB\-P\fP
  99. Passive TCP (RFC6062 with active peer). Implies \fB\-T\fP.
  100. .TP
  101. .B
  102. \fB\-S\fP
  103. Secure SSL connection: SSL/TLS for TCP, DTLS for UDP, TLS/SCTP for SCTP.
  104. .TP
  105. .B
  106. \fB\-U\fP
  107. Secure unencrypted connection (suite eNULL): SSL/TLS for TCP, DTLS for UDP.
  108. .TP
  109. .B
  110. \fB\-v\fP
  111. Verbose.
  112. .TP
  113. .B
  114. \fB\-s\fP
  115. Use "Send" method in TURN; by default, it uses TURN Channels.
  116. .TP
  117. .B
  118. \fB\-y\fP
  119. Use client\-to\-client connections:
  120. RTP/RTCP pair of channels to another RTP/RTCP pair of channels.
  121. with this option the \fIturnutils_peer\fP application is not used,
  122. as the allocated relay endpoints are talking to each other.
  123. .TP
  124. .B
  125. \fB\-h\fP
  126. Hang on indefinitely after the last sent packet.
  127. .TP
  128. .B
  129. \fB\-c\fP
  130. Do not create rtcp connections.
  131. .TP
  132. .B
  133. \fB\-x\fP
  134. Request IPv6 relay address (RFC6156).
  135. .TP
  136. .B
  137. \fB\-X\fP
  138. IPv4 relay address explicitly requested.
  139. .TP
  140. .B
  141. \fB\-g\fP
  142. Set DONT_FRAGMENT parameter in TURN requests.
  143. .TP
  144. .B
  145. \fB\-D\fP
  146. Do mandatory channel padding even for UDP (like pjnath).
  147. .TP
  148. .B
  149. \fB\-N\fP
  150. do negative tests (some limited cases only).
  151. .TP
  152. .B
  153. \fB\-R\fP
  154. do negative protocol tests.
  155. .TP
  156. .B
  157. \fB\-O\fP
  158. DOS attack mode.
  159. .TP
  160. .B
  161. \fB\-M\fP
  162. Use TURN ICE Mobility.
  163. .TP
  164. .B
  165. \fB\-I\fP
  166. Do not set permissions on TURN relay endpoints
  167. (for testing the non\-standard server relay functionality).
  168. .TP
  169. .B
  170. \fB\-G\fP
  171. Generate extra requests (create permissions, channel bind).
  172. .TP
  173. .B
  174. \fB\-B\fP
  175. Random disconnect after a few initial packets.
  176. .TP
  177. .B
  178. \fB\-Z\fP
  179. Dual allocation (SSODA). Implies \fB\-c\fP option.
  180. .TP
  181. .B
  182. \fB\-J\fP
  183. Use oAuth with default test key kid='north'.
  184. .TP
  185. .B
  186. Options with required values:
  187. .TP
  188. .B
  189. \fB\-l\fP
  190. Message length (Default: 100 Bytes).
  191. .TP
  192. .B
  193. \fB\-i\fP
  194. Certificate file (for secure connections only, optional).
  195. .TP
  196. .B
  197. \fB\-k\fP
  198. Private key file (for secure connections only).
  199. .TP
  200. .B
  201. \fB\-E\fP
  202. CA file for server certificate verification,
  203. if the server certificate to be verified.
  204. .TP
  205. .B
  206. \fB\-p\fP
  207. \fBTURN Server\fP port (Defaults: 3478 unsecure, 5349 secure).
  208. .TP
  209. .B
  210. \fB\-n\fP
  211. Number of messages to send (Default: 5).
  212. .TP
  213. .B
  214. \fB\-d\fP
  215. Local interface device (optional, Linux only).
  216. .TP
  217. .B
  218. \fB\-L\fP
  219. Local IP address (optional).
  220. .TP
  221. .B
  222. \fB\-m\fP
  223. Number of clients (Default: 1, 2 or 4, depending on options).
  224. .TP
  225. .B
  226. \fB\-e\fP
  227. Peer address.
  228. .TP
  229. .B
  230. \fB\-r\fP
  231. Peer port (Default: 3480).
  232. .TP
  233. .B
  234. \fB\-z\fP
  235. Per\-session packet interval in milliseconds (Default: 20).
  236. .TP
  237. .B
  238. \fB\-u\fP
  239. STUN/TURN user name.
  240. .TP
  241. .B
  242. \fB\-w\fP
  243. STUN/TURN user password.
  244. .TP
  245. .B
  246. \fB\-W\fP
  247. TURN REST API secret. The "plain text" secret e.g. "north"
  248. that is stored in the value column of the turn_secret
  249. table in the database if dynamic, or the static\-auth\-secret
  250. value set in the configuration file if using static.
  251. .TP
  252. .B
  253. \fB\-C\fP
  254. This is the timestamp/username separator symbol (character) in
  255. TURN REST API. The default value is :.
  256. .TP
  257. .B
  258. \fB\-F\fP
  259. Cipher suite for TLS/DTLS. Default value is DEFAULT.
  260. .TP
  261. .B
  262. \fB\-o\fP
  263. the ORIGIN STUN attribute value.
  264. .TP
  265. .B
  266. \fB\-a\fP
  267. Bandwidth for the bandwidth request in ALLOCATE. The default value is zero.
  268. .PP
  269. See the examples in the "examples/scripts" directory.
  270. .PP
  271. ======================================
  272. .SS NAME
  273. \fB
  274. \fBturnutils_peer \fP\- a simple UDP\-only echo backend server.
  275. \fB
  276. .SS SYNOPSIS
  277. .nf
  278. .fam C
  279. $ \fIturnutils_peer\fP [\fB\-v\fP] [\fIoptions\fP]
  280. .fam T
  281. .fi
  282. .fam T
  283. .fi
  284. .SS DESCRIPTION
  285. This application is used for the test purposes only, as a peer for the \fIturnutils_uclient\fP application.
  286. .TP
  287. .B
  288. Options with required values:
  289. .TP
  290. .B
  291. \fB\-p\fP
  292. Listening UDP port (Default: 3480).
  293. .TP
  294. .B
  295. \fB\-d\fP
  296. Listening interface device (optional)
  297. .TP
  298. .B
  299. \fB\-L\fP
  300. Listening address of \fIturnutils_peer\fP server. Multiple listening addresses can be used, IPv4 and IPv6.
  301. If no listener \fBaddress\fP(es) defined, then it listens on all IPv4 and IPv6 addresses.
  302. .TP
  303. .B
  304. \fB\-v\fP
  305. Verbose
  306. .PP
  307. ========================================
  308. .SS NAME
  309. \fB
  310. \fBturnutils_stunclient \fP\- a basic STUN client.
  311. \fB
  312. .SS SYNOPSIS
  313. .nf
  314. .fam C
  315. $ \fIturnutils_stunclient\fP [\fIoptions\fP] <STUN\-Server\-IP\-address>
  316. .fam T
  317. .fi
  318. .fam T
  319. .fi
  320. .SS DESCRIPTION
  321. It sends a "new" STUN RFC 5389 request (over UDP) and shows the reply information.
  322. .TP
  323. .B
  324. Options with required values:
  325. .TP
  326. .B
  327. \fB\-p\fP
  328. STUN server port (Default: 3478).
  329. .TP
  330. .B
  331. \fB\-L\fP
  332. Local address to use (optional).
  333. .TP
  334. .B
  335. \fB\-f\fP
  336. Force RFC 5780 processing.
  337. .PP
  338. The \fIturnutils_stunclient\fP program checks the results of the first request,
  339. and if it finds that the STUN server supports RFC 5780
  340. (the binding response reveals that) then the \fIturnutils_stunclient\fP makes a couple more
  341. requests with different parameters, to demonstrate the NAT discovery capabilities.
  342. .PP
  343. This utility does not support the "old" "classic" STUN protocol (RFC 3489).
  344. .PP
  345. =====================================
  346. .SS NAME
  347. \fB
  348. \fBturnutils_rfc5769check \fP\- a utility that tests the correctness of STUN protocol implementation.
  349. \fB
  350. .SS SYNOPSIS
  351. .nf
  352. .fam C
  353. $ \fIturnutils_rfc5769check\fP
  354. .fam T
  355. .fi
  356. .fam T
  357. .fi
  358. .SS DESCRIPTION
  359. \fIturnutils_rfc5769check\fP tests the correctness of STUN protocol implementation
  360. against the test vectors predefined in RFC 5769 and prints the results of the
  361. tests on the screen. This utility is used only for the compilation
  362. check procedure, it is not copied to the installation destination.
  363. .TP
  364. .B
  365. Usage:
  366. .PP
  367. $ \fIturnutils_rfc5769check\fP
  368. .PP
  369. =====================================
  370. .SS NAME
  371. \fB
  372. \fBturnutils_natdiscovery \fP\- a utility that discovers NAT mapping and filtering
  373. \fBbehavior according RFC5780.
  374. \fB
  375. .SS SYNOPSIS
  376. .nf
  377. .fam C
  378. $ \fIturnutils_natdiscovery\fP [\fIoptions\fP] <STUN\-Server\-FQDN\-or\-IP\-address>
  379. .fam T
  380. .fi
  381. .fam T
  382. .fi
  383. .SS DESCRIPTION
  384. \fIturnutils_natdiscovery\fP discovers the NAT Mapping and Filtering behavior, to
  385. determine if that NAT is currently using Endpoint\-Independent,
  386. Address\-Dependent, or Address and Port\-Dependent Mapping and/or to determine if
  387. that NAT is currently using Endpoint\-Independent, Address\-Dependent, or Address
  388. and Port\-Dependent Filtering.
  389. .PP
  390. Use either \fB\-m\fP, \fB\-f\fP, \fB\-c\fP flag to discover NAT behavior.
  391. .PP
  392. Flags:
  393. .TP
  394. .B
  395. \fB\-m\fP
  396. NAT mapping behavior discovery
  397. .TP
  398. .B
  399. \fB\-f\fP
  400. NAT filtering behavior discovery
  401. .TP
  402. .B
  403. \fB\-c\fP
  404. NAT collision behavior discovery
  405. .PP
  406. Options with required values:
  407. .TP
  408. .B
  409. \fB\-p\fP
  410. STUN server port (Default: 3478)
  411. .TP
  412. .B
  413. \fB\-L\fP
  414. Local address to use (optional)
  415. .TP
  416. .B
  417. \fB\-A\fP
  418. Secondary Local address (optional)
  419. Required for collision discovery
  420. .PP
  421. Usage:
  422. .PP
  423. $ \fIturnutils_natdiscovery\fP \fB\-m\fP \fB\-f\fP stun.example.com
  424. .PP
  425. =====================================
  426. .SS NAME
  427. \fB
  428. \fBturnutils_oauth \fP\- a utility that helps OAuth access_token generation/encryption and validation/decyption
  429. \fB
  430. .SS SYNOPSIS
  431. .nf
  432. .fam C
  433. $ \fIturnutils_oauth\fP [\fIoptions\fP]
  434. .fam T
  435. .fi
  436. .fam T
  437. .fi
  438. .SS DESCRIPTION
  439. \fIturnutils_oauth\fP utilitiy provides help in OAuth access_token encryption and/or
  440. decryption with AEAD (Atuthenticated Encryption with Associated Data). It helps
  441. for an Auth Server in access_token creation, and also for debuging purposes it
  442. helps the access_token validation and decryption. This utility inputs all the
  443. keys and lifetimes and any related information that are needed for encryption
  444. or decryption of an access_token. It outputs a JSON with all OAuth PoP
  445. parameters that need to pass to the client. Output is generated accoriding
  446. RFC7635 Appendix B, Figure 8. This utility could help to build an Auth Server
  447. service, but be awere that this utility does not generate "session key" /
  448. "mac_key" and not verifies lifetime of "session key" / "mac_key" or "Auth key".
  449. For more details, and for the access_token structure, read rfc7635, and see
  450. the example in examples/scripts/oauth.sh.
  451. .PP
  452. Use either \fB\-e\fP and/or \fB\-d\fP flag to encrypt or decrypt access_token.
  453. .PP
  454. Flags:
  455. .TP
  456. .B
  457. \fB\-h\fP, \fB\-\-help\fP
  458. usage
  459. .TP
  460. .B
  461. \fB\-v\fP, \fB\-\-verbose\fP
  462. verbose mode
  463. .TP
  464. .B
  465. \fB\-e\fP, \fB\-\-encrypt\fP
  466. encrypt token
  467. .TP
  468. .B
  469. \fB\-d\fP, \fB\-\-decrypt\fP
  470. decrypt validate token
  471. .PP
  472. Options with required values:
  473. .TP
  474. .B
  475. \fB\-i\fP, \fB\-\-server\-name\fP
  476. server name (max. 255 char)
  477. .TP
  478. .B
  479. \fB\-j\fP, \fB\-\-auth\-key\-id\fP
  480. Auth key id (max. 32 char)
  481. .TP
  482. .B
  483. \fB\-k\fP, \fB\-\-auth\-key\fP
  484. base64 encoded Auth key
  485. .TP
  486. .B
  487. \fB\-l\fP
  488. \fB\-\-auth\-key\-timestamp\fP Auth key timestamp (sec since epoch)
  489. .TP
  490. .B
  491. \fB\-m\fP, \fB\-\-auth\-key\-lifetime\fP
  492. Auth key lifetime in sec
  493. .TP
  494. .B
  495. \fB\-n\fP, \fB\-\-auth\-key\-as\-rs\-alg\fP
  496. Authorization \fBServer\fP(AS) \- Resource \fBServer\fP(RS) encryption algorithm
  497. .TP
  498. .B
  499. \fB\-o\fP, \fB\-\-token\-nonce\fP
  500. base64 encoded nonce \fBbase64\fP(12 octet) = 16 char
  501. .TP
  502. .B
  503. \fB\-p\fP, \fB\-\-token\-mac\-key\fP
  504. base64 encoded MAC key \fBbase64\fP(32 octet) = 44 char
  505. .TP
  506. .B
  507. \fB\-q\fP, \fB\-\-token\-timestamp\fP
  508. timestamp in format 64 bit unsigned (Native format \- Unix),
  509. so 48 bit for secs since epoch UTC + 16 bit for 1/64000 fractions of a second.
  510. e.g.: the actual unixtimestamp 16 bit left shifted. (Default: actual gmtime)
  511. .TP
  512. .B
  513. \fB\-r\fP, \fB\-\-token\-lifetime\fP
  514. lifetime in sec (Default: 3600)
  515. .TP
  516. .B
  517. \fB\-t\fP, \fB\-\-token\fP
  518. base64 encoded encrypted token for validation and decryption
  519. .TP
  520. .B
  521. \fB\-u\fP, \fB\-\-hmac\-alg\fP
  522. stun client hmac algorithm
  523. .PP
  524. Usage:
  525. .PP
  526. $ \fIturnutils_natdiscovery\fP
  527. .PP
  528. ===================================
  529. .SH DOCS
  530. After installation, run the command:
  531. .PP
  532. $ man \fIturnutils\fP
  533. .PP
  534. or in the project root directory:
  535. .PP
  536. $ man \fB\-M\fP man \fIturnutils\fP
  537. .PP
  538. to see the man page.
  539. .PP
  540. =====================================
  541. .SH FILES
  542. /etc/turnserver.conf
  543. .PP
  544. /var/db/turndb
  545. .PP
  546. /usr/local/var/db/turndb
  547. .PP
  548. /var/lib/turn/turndb
  549. .PP
  550. /usr/local/etc/turnserver.conf
  551. .PP
  552. =================================
  553. .SH DIRECTORIES
  554. /usr/local/share/\fIturnserver\fP
  555. .PP
  556. /usr/local/share/doc/\fIturnserver\fP
  557. .PP
  558. /usr/local/share/examples/\fIturnserver\fP
  559. .PP
  560. ===================================
  561. .SH STANDARDS
  562. new STUN RFC 5389
  563. .PP
  564. TURN RFC 5766
  565. .PP
  566. TURN\-TCP extension RFC 6062
  567. .PP
  568. TURN IPv6 extension RFC 6156
  569. .PP
  570. STUN/TURN test vectors RFC 5769
  571. .PP
  572. STUN NAT behavior discovery RFC 5780
  573. .PP
  574. ====================================
  575. .SH SEE ALSO
  576. \fIturnserver\fP, \fIturnadmin\fP
  577. .RE
  578. .PP
  579. ======================================
  580. .SS WEB RESOURCES
  581. project page:
  582. .PP
  583. https://github.com/coturn/coturn/
  584. .PP
  585. Wiki page:
  586. .PP
  587. https://github.com/coturn/coturn/wiki
  588. .PP
  589. forum:
  590. .PP
  591. https://groups.google.com/forum/?fromgroups=#!forum/turn\-server\-project\-rfc5766\-turn\-server/
  592. .RE
  593. .PP
  594. ======================================
  595. .SS AUTHORS
  596. Oleg Moskalenko <[email protected]>
  597. .PP
  598. Gabor Kovesdan http://kovesdan.org/
  599. .PP
  600. Daniel Pocock http://danielpocock.com/
  601. .PP
  602. John Selbie ([email protected])
  603. .PP
  604. Lee Sylvester <[email protected]>
  605. .PP
  606. Erik Johnston <[email protected]>
  607. .PP
  608. Roman Lisagor <[email protected]>
  609. .PP
  610. Vladimir Tsanev <[email protected]>
  611. .PP
  612. Po\-sheng Lin <[email protected]>
  613. .PP
  614. Peter Dunkley <[email protected]>
  615. .PP
  616. Mutsutoshi Yoshimoto <[email protected]>
  617. .PP
  618. Federico Pinna <[email protected]>
  619. .PP
  620. Bradley T. Hughes <[email protected]>
  621. .PP
  622. Mihaly Meszaros <[email protected]>