turnutils.1 15 KB

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