turnutils.1 14 KB

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