README.turnutils 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. GENERAL INFORMATION
  2. A set of turnutils_* programs provides some utility functionality to be used
  3. for testing and for setting up the TURN server.
  4. 1. turnutils_uclient: emulates multiple UDP,TCP,TLS or DTLS clients.
  5. (this program is provided for the testing purposes only !)
  6. The compiled binary image of this program is located in bin/
  7. sub-directory.
  8. 2. turnutils_peer: a simple stateless UDP-only "echo" server,
  9. to be used as the final server in relay pattern ("peer"). For every incoming
  10. UDP packet, it simply echoes it back.
  11. (this program is provided for the testing purposes only !)
  12. When the test clients are communicating in the client-to-client manner
  13. (when the "turnutils_uclient" program is used with "-y" option) then the
  14. turnutils_peer is not needed.
  15. The compiled binary image of this program is located in bin/ subdirectory.
  16. 3. turnutils_stunclient: a simple STUN client example.
  17. The compiled binary image of this program is located in bin/ subdirectory.
  18. 4. turnutils_rfc5769check: a utility that checks the correctness of the
  19. STUN/TURN protocol implementation. This utility is used only for the compilation
  20. check procedure, it is not copied to the installation destination.
  21. In the "examples/scripts" subdirectory, you will find the examples of command lines to be used
  22. to run the programs. The scripts are meant to be run from examples/ subdirectory, for example:
  23. $ cd examples
  24. $ ./scripts/secure_relay.sh
  25. 5. turnutils_natdiscovery: a utility that provides NAT behavior discovery
  26. according RFC5780. This utility discovers the actual NAT Mapping and Filtering
  27. behavior. Be aweare that at least two different listening IP addresses should
  28. be configured to be able to work properly!
  29. 6. turnutils_oauth: a utility that provides OAuth access_token
  30. generation(AEAD encryption), validation and decryption. This utility inputs
  31. all the keys and lifetimes and any related informations that needed for
  32. creation and validationi of an access_token. It outputs a JSON with all OAuth
  33. PoP parameters that need to pass to the client. Output is generated accoriding
  34. RFC7635 Appendix B, Figure 8.
  35. For more details, and for the access_token structure, read rfc7635, and see
  36. script in examples/scripts/oauth.sh.
  37. =====================================
  38. NAME
  39. turnutils_uclient - this client emulation application is supplied for the test purposes only.
  40. SYNOPSIS
  41. $ turnutils_uclient [-tTSvsyhcxg] [options] <TURN-Server-IP-address>
  42. DESCRIPTION
  43. It was designed to simulate multiple clients. It uses asynch IO API in
  44. libevent to handle multiple clients. A client connects to the relay,
  45. negotiates the session, and sends multiple (configured number) messages to the server (relay),
  46. expecting the same number of replies. The length of the messages is configurable.
  47. The message is an arbitrary octet stream.
  48. The number of the messages to send is configurable.
  49. Flags:
  50. -t Use TCP for communications between client and TURN server (default is UDP).
  51. -b Use SCTP for communications between client and TURN server (default is UDP).
  52. -T Use TCP for the relay transport (default - UDP). Implies options -t, -y, -c,
  53. and ignores flags and options -s, -e, -r and -g. Can be used together
  54. with -b.
  55. -P Passive TCP (RFC6062 with active peer). Implies -T.
  56. -S Secure SSL connection: SSL/TLS for TCP, DTLS for UDP, TLS/SCTP for SCTP.
  57. -U Secure unencrypted connection (suite eNULL): SSL/TLS for TCP, DTLS for UDP.
  58. -v Verbose.
  59. -s Use "Send" method in TURN; by default, it uses TURN Channels.
  60. -y Use client-to-client connections:
  61. RTP/RTCP pair of channels to another RTP/RTCP pair of channels.
  62. with this option the turnutils_peer application is not used,
  63. as the allocated relay endpoints are talking to each other.
  64. -h Hang on indefinitely after the last sent packet.
  65. -c Do not create rtcp connections.
  66. -x Request IPv6 relay address (RFC6156).
  67. -X IPv4 relay address explicitly requested.
  68. -g Set DONT_FRAGMENT parameter in TURN requests.
  69. -D Do mandatory channel padding even for UDP (like pjnath).
  70. -N do negative tests (some limited cases only).
  71. -R do negative protocol tests.
  72. -O DOS attack mode.
  73. -M Use TURN ICE Mobility.
  74. -I Do not set permissions on TURN relay endpoints
  75. (for testing the non-standard server relay functionality).
  76. -G Generate extra requests (create permissions, channel bind).
  77. -B Random disconnect after a few initial packets.
  78. -Z Dual allocation (SSODA). Implies -c option.
  79. -J Use oAuth with default test key kid='north'.
  80. Options with required values:
  81. -l Message length (Default: 100 Bytes).
  82. -i Certificate file (for secure connections only, optional).
  83. -k Private key file (for secure connections only).
  84. -E CA file for server certificate verification,
  85. if the server certificate to be verified.
  86. -p TURN Server port (Defaults: 3478 unsecure, 5349 secure).
  87. -n Number of messages to send (Default: 5).
  88. -d Local interface device (optional, Linux only).
  89. -L Local IP address (optional).
  90. -m Number of clients (Default: 1, 2 or 4, depending on options).
  91. -e Peer address.
  92. -r Peer port (Default: 3480).
  93. -z Per-session packet interval in milliseconds (Default: 20).
  94. -u STUN/TURN user name.
  95. -w STUN/TURN user password.
  96. -W TURN REST API secret. The "plain text" secret e.g. "north"
  97. that is stored in the value column of the turn_secret
  98. table in the database if dynamic, or the static-auth-secret
  99. value set in the configuration file if using static.
  100. -C This is the timestamp/username separator symbol (character) in
  101. TURN REST API. The default value is :.
  102. -F Cipher suite for TLS/DTLS. Default value is DEFAULT.
  103. -o the ORIGIN STUN attribute value.
  104. -a Bandwidth for the bandwidth request in ALLOCATE. The default value is zero.
  105. See the examples in the "examples/scripts" directory.
  106. ======================================
  107. NAME
  108. turnutils_peer - a simple UDP-only echo backend server.
  109. SYNOPSIS
  110. $ turnutils_peer [-v] [options]
  111. DESCRIPTION
  112. This application is used for the test purposes only, as a peer for the turnutils_uclient application.
  113. Options with required values:
  114. -p Listening UDP port (Default: 3480).
  115. -d Listening interface device (optional)
  116. -L Listening address of turnutils_peer server. Multiple listening addresses can be used, IPv4 and IPv6.
  117. If no listener address(es) defined, then it listens on all IPv4 and IPv6 addresses.
  118. -v Verbose
  119. ========================================
  120. NAME
  121. turnutils_stunclient - a basic STUN client.
  122. SYNOPSIS
  123. $ turnutils_stunclient [options] <STUN-Server-IP-address>
  124. DESCRIPTION
  125. It sends a "new" STUN RFC 5389 request (over UDP) and shows the reply information.
  126. Options with required values:
  127. -p STUN server port (Default: 3478).
  128. -L Local address to use (optional).
  129. -f Force RFC 5780 processing.
  130. The turnutils_stunclient program checks the results of the first request,
  131. and if it finds that the STUN server supports RFC 5780
  132. (the binding response reveals that) then the turnutils_stunclient makes a couple more
  133. requests with different parameters, to demonstrate the NAT discovery capabilities.
  134. This utility does not support the "old" "classic" STUN protocol (RFC 3489).
  135. =====================================
  136. NAME
  137. turnutils_rfc5769check - a utility that tests the correctness of STUN protocol implementation.
  138. SYNOPSIS
  139. $ turnutils_rfc5769check
  140. DESCRIPTION
  141. turnutils_rfc5769check tests the correctness of STUN protocol implementation
  142. against the test vectors predefined in RFC 5769 and prints the results of the
  143. tests on the screen. This utility is used only for the compilation
  144. check procedure, it is not copied to the installation destination.
  145. Usage:
  146. $ turnutils_rfc5769check
  147. =====================================
  148. NAME
  149. turnutils_natdiscovery - a utility that discovers NAT mapping and filtering
  150. behavior according RFC5780.
  151. SYNOPSIS
  152. $ turnutils_natdiscovery [options] <STUN-Server-FQDN-or-IP-address>
  153. DESCRIPTION
  154. turnutils_natdiscovery discovers the NAT Mapping and Filtering behavior, to
  155. determine if that NAT is currently using Endpoint-Independent,
  156. Address-Dependent, or Address and Port-Dependent Mapping and/or to determine if
  157. that NAT is currently using Endpoint-Independent, Address-Dependent, or Address
  158. and Port-Dependent Filtering.
  159. Use either -m and/or -f flag to discover NAT Mapping and/or Filtering.
  160. Flags:
  161. -m NAT mapping behavior discovery
  162. -f NAT filtering behavior discovery
  163. Options with required values:
  164. -p STUN server port (Default: 3478)
  165. -L Local address to use (optional)
  166. Usage:
  167. $ turnutils_natdiscovery -m -f stun.example.com
  168. =====================================
  169. NAME
  170. turnutils_oauth - a utility that helps OAuth access_token generation/encryption and validation/decyption
  171. SYNOPSIS
  172. $ turnutils_oauth [options]
  173. DESCRIPTION
  174. turnutils_oauth utilitiy provides help in OAuth access_token encryption and/or
  175. decryption with AEAD (Atuthenticated Encryption with Associated Data). It helps
  176. for an Auth Server in access_token creation, and also for debuging purposes it
  177. helps the access_token validation and decryption. This utility inputs all the
  178. keys and lifetimes and any related informations that are needed for encryption
  179. or decryption of an access_token. It outputs a JSON with all OAuth PoP
  180. parameters that need to pass to the client. Output is generated accoriding
  181. RFC7635 Appendix B, Figure 8. This utility could help to build an Auth Server
  182. service, but be awere that this utility does not generate "session key" /
  183. "mac_key" and not verifies lifetime of "session key" / "mac_key" or "Auth key".
  184. For more details, and for the access_token structure, read rfc7635, and see
  185. the example in examples/scripts/oauth.sh.
  186. Use either -e and/or -d flag to encrypt or decrypt access_token.
  187. Flags:
  188. -h, --help usage
  189. -v, --verbose verbose mode
  190. -e, --encrypt encrypt token
  191. -d, --decrypt decrypt validate token
  192. Options with required values:
  193. -i, --server-name server name (max. 255 char)
  194. -j, --auth-key-id Auth key id (max. 32 char)
  195. -k, --auth-key base64 encoded Auth key
  196. -l --auth-key-timestamp Auth key timestamp (sec since epoch)
  197. -m, --auth-key-lifetime Auth key lifetime in sec
  198. -n, --auth-key-as-rs-alg Authorization Server(AS) - Resource Server(RS) encryption algorithm
  199. -o, --token-nonce base64 encoded nonce base64(12 octet) = 16 char
  200. -p, --token-mac-key base64 encoded MAC key base64(32 octet) = 44 char
  201. -q, --token-timestamp timestamp in format 64 bit unsigned (Native format - Unix),
  202. so 48 bit for secs since epoch UTC + 16 bit for 1/64000 fractions of a second.
  203. e.g.: the actual unixtimestamp 16 bit left shifted. (Default: actual gmtime)
  204. -r, --token-lifetime lifetime in sec (Default: 3600)
  205. -t, --token base64 encoded encrypted token for validation and decryption
  206. -u, --hmac-alg stun client hmac algorithm
  207. Usage:
  208. $ turnutils_natdiscovery
  209. ===================================
  210. DOCS
  211. After installation, run the command:
  212. $ man turnutils
  213. or in the project root directory:
  214. $ man -M man turnutils
  215. to see the man page.
  216. =====================================
  217. FILES
  218. /etc/turnserver.conf
  219. /var/db/turndb
  220. /usr/local/var/db/turndb
  221. /var/lib/turn/turndb
  222. /usr/local/etc/turnserver.conf
  223. =================================
  224. DIRECTORIES
  225. /usr/local/share/turnserver
  226. /usr/local/share/doc/turnserver
  227. /usr/local/share/examples/turnserver
  228. ===================================
  229. STANDARDS
  230. new STUN RFC 5389
  231. TURN RFC 5766
  232. TURN-TCP extension RFC 6062
  233. TURN IPv6 extension RFC 6156
  234. STUN/TURN test vectors RFC 5769
  235. STUN NAT behavior discovery RFC 5780
  236. ====================================
  237. SEE ALSO
  238. turnserver, turnadmin
  239. ======================================
  240. WEB RESOURCES
  241. project page:
  242. https://github.com/coturn/coturn/
  243. Wiki page:
  244. https://github.com/coturn/coturn/wiki
  245. forum:
  246. https://groups.google.com/forum/?fromgroups=#!forum/turn-server-project-rfc5766-turn-server/
  247. ======================================
  248. AUTHORS
  249. Oleg Moskalenko <[email protected]>
  250. Gabor Kovesdan http://kovesdan.org/
  251. Daniel Pocock http://danielpocock.com/
  252. John Selbie ([email protected])
  253. Lee Sylvester <[email protected]>
  254. Erik Johnston <[email protected]>
  255. Roman Lisagor <[email protected]>
  256. Vladimir Tsanev <[email protected]>
  257. Po-sheng Lin <[email protected]>
  258. Peter Dunkley <[email protected]>
  259. Mutsutoshi Yoshimoto <[email protected]>
  260. Federico Pinna <[email protected]>
  261. Bradley T. Hughes <[email protected]>
  262. Mihaly Meszaros <[email protected]>