1
0

README.turnutils 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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, etc. Be aware that on TURN server side two different listening IP
  28. addresses should 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 information 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, -f, -c, -H flag to discover NAT behavior.
  160. Flags:
  161. -m NAT mapping behavior discovery
  162. -f NAT filtering behavior discovery
  163. -t NAT mapping lifetime behavior discovery
  164. Requires a timer (-T)
  165. -c NAT collision behavior discovery
  166. -H NAT hairpinning behavior discovery
  167. -P Add 1500 byte Padding to the behavior discovery
  168. Applicable with all except NAT mapping Lifetime discovery
  169. Options with required values:
  170. -p STUN server port (Default: 3478)
  171. -L Local address to use (optional)
  172. -l Local port to use (use with -L)
  173. -A Secondary Local address (optional)
  174. Required for collision discovery
  175. -T Mapping lifetime timer (sec)
  176. Used by mapping lifetime behavior discovery
  177. Usage:
  178. $ turnutils_natdiscovery -m -f stun.example.com
  179. =====================================
  180. NAME
  181. turnutils_oauth - a utility that helps OAuth access_token generation/encryption and validation/decyption
  182. SYNOPSIS
  183. $ turnutils_oauth [options]
  184. DESCRIPTION
  185. turnutils_oauth utility provides help in OAuth access_token encryption and/or
  186. decryption with AEAD (Atuthenticated Encryption with Associated Data). It helps
  187. for an Auth Server in access_token creation, and also for debugging purposes it
  188. helps the access_token validation and decryption. This utility inputs all the
  189. keys and lifetimes and any related information that are needed for encryption
  190. or decryption of an access_token. It outputs a JSON with all OAuth PoP
  191. parameters that need to pass to the client. Output is generated accoriding
  192. RFC7635 Appendix B, Figure 8. This utility could help to build an Auth Server
  193. service, but be awere that this utility does not generate "session key" /
  194. "mac_key" and not verifies lifetime of "session key" / "mac_key" or "Auth key".
  195. For more details, and for the access_token structure, read rfc7635, and see
  196. the example in examples/scripts/oauth.sh.
  197. Use either -e and/or -d flag to encrypt or decrypt access_token.
  198. Flags:
  199. -h, --help usage
  200. -v, --verbose verbose mode
  201. -e, --encrypt encrypt token
  202. -d, --decrypt decrypt validate token
  203. Options with required values:
  204. -i, --server-name server name (max. 255 char)
  205. -j, --auth-key-id Auth key id (max. 32 char)
  206. -k, --auth-key base64 encoded Auth key
  207. -l --auth-key-timestamp Auth key timestamp (sec since epoch)
  208. -m, --auth-key-lifetime Auth key lifetime in sec
  209. -n, --auth-key-as-rs-alg Authorization Server(AS) - Resource Server(RS) encryption algorithm
  210. -o, --token-nonce base64 encoded nonce base64(12 octet) = 16 char
  211. -p, --token-mac-key base64 encoded MAC key base64(32 octet) = 44 char
  212. -q, --token-timestamp timestamp in format 64 bit unsigned (Native format - Unix),
  213. so 48 bit for secs since epoch UTC + 16 bit for 1/64000 fractions of a second.
  214. e.g.: the actual unixtimestamp 16 bit left shifted. (Default: actual gmtime)
  215. -r, --token-lifetime lifetime in sec (Default: 3600)
  216. -t, --token base64 encoded encrypted token for validation and decryption
  217. -u, --hmac-alg stun client hmac algorithm
  218. Usage:
  219. $ turnutils_natdiscovery
  220. ===================================
  221. DOCS
  222. After installation, run the command:
  223. $ man turnutils
  224. or in the project root directory:
  225. $ man -M man turnutils
  226. to see the man page.
  227. =====================================
  228. FILES
  229. /etc/turnserver.conf
  230. /var/db/turndb
  231. /usr/local/var/db/turndb
  232. /var/lib/turn/turndb
  233. /usr/local/etc/turnserver.conf
  234. =================================
  235. DIRECTORIES
  236. /usr/local/share/turnserver
  237. /usr/local/share/doc/turnserver
  238. /usr/local/share/examples/turnserver
  239. ===================================
  240. STANDARDS
  241. new STUN RFC 5389
  242. TURN RFC 5766
  243. TURN-TCP extension RFC 6062
  244. TURN IPv6 extension RFC 6156
  245. STUN/TURN test vectors RFC 5769
  246. STUN NAT behavior discovery RFC 5780
  247. ====================================
  248. SEE ALSO
  249. turnserver, turnadmin
  250. ======================================
  251. WEB RESOURCES
  252. project page:
  253. https://github.com/coturn/coturn/
  254. Wiki page:
  255. https://github.com/coturn/coturn/wiki
  256. forum:
  257. https://groups.google.com/forum/?fromgroups=#!forum/turn-server-project-rfc5766-turn-server/
  258. ======================================
  259. AUTHORS
  260. See the AUTHORS.md file in the coturn source distribution.