turnutils.1 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. .\" Text automatically generated by txt2man
  2. .TH TURN 1 "07 September 2016" "" ""
  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 informations 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 and/or \fB\-f\fP flag to discover NAT Mapping and/or Filtering.
  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. .PP
  402. Options with required values:
  403. .TP
  404. .B
  405. \fB\-p\fP
  406. STUN server port (Default: 3478)
  407. .TP
  408. .B
  409. \fB\-L\fP
  410. Local address to use (optional)
  411. .PP
  412. Usage:
  413. .PP
  414. $ \fIturnutils_natdiscovery\fP \fB\-m\fP \fB\-f\fP stun.example.com
  415. .PP
  416. =====================================
  417. .SS NAME
  418. \fB
  419. \fBturnutils_oauth \fP\- a utility that helps OAuth access_token generation/encryption and validation/decyption
  420. \fB
  421. .SS SYNOPSIS
  422. .nf
  423. .fam C
  424. $ \fIturnutils_oauth\fP [\fIoptions\fP]
  425. .fam T
  426. .fi
  427. .fam T
  428. .fi
  429. .SS DESCRIPTION
  430. \fIturnutils_oauth\fP utilitiy provides help in OAuth access_token encryption and/or
  431. decryption with AEAD (Atuthenticated Encryption with Associated Data). It helps
  432. for an Auth Server in access_token creation, and also for debuging purposes it
  433. helps the access_token validation and decryption. This utility inputs all the
  434. keys and lifetimes and any related informations that are needed for encryption
  435. or decryption of an access_token. It outputs a JSON with all OAuth PoP
  436. parameters that need to pass to the client. Output is generated accoriding
  437. RFC7635 Appendix B, Figure 8. This utility could help to build an Auth Server
  438. service, but be awere that this utility does not generate "session key" /
  439. "mac_key" and not verifies lifetime of "session key" / "mac_key" or "Auth key".
  440. For more details, and for the access_token structure, read rfc7635, and see
  441. the example in examples/scripts/oauth.sh.
  442. .PP
  443. Use either \fB\-e\fP and/or \fB\-d\fP flag to encrypt or decrypt access_token.
  444. .PP
  445. Flags:
  446. .TP
  447. .B
  448. \fB\-h\fP, \fB\-\-help\fP
  449. usage
  450. .TP
  451. .B
  452. \fB\-v\fP, \fB\-\-verbose\fP
  453. verbose mode
  454. .TP
  455. .B
  456. \fB\-e\fP, \fB\-\-encrypt\fP
  457. encrypt token
  458. .TP
  459. .B
  460. \fB\-d\fP, \fB\-\-decrypt\fP
  461. decrypt validate token
  462. .PP
  463. Options with required values:
  464. .TP
  465. .B
  466. \fB\-i\fP, \fB\-\-server\-name\fP
  467. server name (max. 255 char)
  468. .TP
  469. .B
  470. \fB\-j\fP, \fB\-\-auth\-key\-id\fP
  471. Auth key id (max. 32 char)
  472. .TP
  473. .B
  474. \fB\-k\fP, \fB\-\-auth\-key\fP
  475. base64 encoded Auth key
  476. .TP
  477. .B
  478. \fB\-l\fP
  479. \fB\-\-auth\-key\-timestamp\fP Auth key timestamp (sec since epoch)
  480. .TP
  481. .B
  482. \fB\-m\fP, \fB\-\-auth\-key\-lifetime\fP
  483. Auth key lifetime in sec
  484. .TP
  485. .B
  486. \fB\-n\fP, \fB\-\-auth\-key\-as\-rs\-alg\fP
  487. Authorization \fBServer\fP(AS) \- Resource \fBServer\fP(RS) encryption algorithm
  488. .TP
  489. .B
  490. \fB\-o\fP, \fB\-\-token\-nonce\fP
  491. base64 encoded nonce \fBbase64\fP(12 octet) = 16 char
  492. .TP
  493. .B
  494. \fB\-p\fP, \fB\-\-token\-mac\-key\fP
  495. base64 encoded MAC key \fBbase64\fP(32 octet) = 44 char
  496. .TP
  497. .B
  498. \fB\-q\fP, \fB\-\-token\-timestamp\fP
  499. timestamp in format 64 bit unsigned (Native format \- Unix),
  500. so 48 bit for secs since epoch UTC + 16 bit for 1/64000 fractions of a second.
  501. e.g.: the actual unixtimestamp 16 bit left shifted. (Default: actual gmtime)
  502. .TP
  503. .B
  504. \fB\-r\fP, \fB\-\-token\-lifetime\fP
  505. lifetime in sec (Default: 3600)
  506. .TP
  507. .B
  508. \fB\-t\fP, \fB\-\-token\fP
  509. base64 encoded encrypted token for validation and decryption
  510. .TP
  511. .B
  512. \fB\-u\fP, \fB\-\-hmac\-alg\fP
  513. stun client hmac algorithm
  514. .PP
  515. Usage:
  516. .PP
  517. $ \fIturnutils_natdiscovery\fP
  518. .PP
  519. ===================================
  520. .SH DOCS
  521. After installation, run the command:
  522. .PP
  523. $ man \fIturnutils\fP
  524. .PP
  525. or in the project root directory:
  526. .PP
  527. $ man \fB\-M\fP man \fIturnutils\fP
  528. .PP
  529. to see the man page.
  530. .PP
  531. =====================================
  532. .SH FILES
  533. /etc/turnserver.conf
  534. .PP
  535. /var/db/turndb
  536. .PP
  537. /usr/local/var/db/turndb
  538. .PP
  539. /var/lib/turn/turndb
  540. .PP
  541. /usr/local/etc/turnserver.conf
  542. .PP
  543. =================================
  544. .SH DIRECTORIES
  545. /usr/local/share/\fIturnserver\fP
  546. .PP
  547. /usr/local/share/doc/\fIturnserver\fP
  548. .PP
  549. /usr/local/share/examples/\fIturnserver\fP
  550. .PP
  551. ===================================
  552. .SH STANDARDS
  553. new STUN RFC 5389
  554. .PP
  555. TURN RFC 5766
  556. .PP
  557. TURN\-TCP extension RFC 6062
  558. .PP
  559. TURN IPv6 extension RFC 6156
  560. .PP
  561. STUN/TURN test vectors RFC 5769
  562. .PP
  563. STUN NAT behavior discovery RFC 5780
  564. .PP
  565. ====================================
  566. .SH SEE ALSO
  567. \fIturnserver\fP, \fIturnadmin\fP
  568. .RE
  569. .PP
  570. ======================================
  571. .SS WEB RESOURCES
  572. project page:
  573. .PP
  574. https://github.com/coturn/coturn/
  575. .PP
  576. Wiki page:
  577. .PP
  578. https://github.com/coturn/coturn/wiki
  579. .PP
  580. forum:
  581. .PP
  582. https://groups.google.com/forum/?fromgroups=#!forum/turn\-server\-project\-rfc5766\-turn\-server/
  583. .RE
  584. .PP
  585. ======================================
  586. .SS AUTHORS
  587. Oleg Moskalenko <[email protected]>
  588. .PP
  589. Gabor Kovesdan http://kovesdan.org/
  590. .PP
  591. Daniel Pocock http://danielpocock.com/
  592. .PP
  593. John Selbie ([email protected])
  594. .PP
  595. Lee Sylvester <[email protected]>
  596. .PP
  597. Erik Johnston <[email protected]>
  598. .PP
  599. Roman Lisagor <[email protected]>
  600. .PP
  601. Vladimir Tsanev <[email protected]>
  602. .PP
  603. Po\-sheng Lin <[email protected]>
  604. .PP
  605. Peter Dunkley <[email protected]>
  606. .PP
  607. Mutsutoshi Yoshimoto <[email protected]>
  608. .PP
  609. Federico Pinna <[email protected]>
  610. .PP
  611. Bradley T. Hughes <[email protected]>
  612. .PP
  613. Mihaly Meszaros <[email protected]>