secure_relay_with_db_redis.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. #
  3. # This is an example how to start a TURN Server in
  4. # secure mode with Redis database for users
  5. # with the long-term credentials mechanism.
  6. #
  7. # We start here a TURN Server listening on IPv4 address
  8. # 127.0.0.1 and on IPv6 address ::1. We use 127.0.0.1 as
  9. # IPv4 relay address, and we use ::1 as IPv6 relay address.
  10. #
  11. # Other options:
  12. #
  13. # 1) set bandwidth limit on client session 3000000 bytes per second (--max-bps).
  14. # 2) use fingerprints (-f)
  15. # 3) use 3 relay threads (-m 3)
  16. # 4) use min UDP relay port 32355 and max UDP relay port 65535
  17. # 5) "-r north.gov" means "use authentication realm north.gov"
  18. # 6) --redis-userdb="ip=127.0.0.1 dbname=2 password=turn connect_timeout=30"
  19. # means that local Redis database 0 will be used,
  20. # database password is "turn", and connection timeout 30 seconds.
  21. # 7) --redis-statsdb="ip=127.0.0.1 dbname=3 password=turn connect_timeout=30"
  22. # means that we want to use Redis for status and statistics information,
  23. # and this will be the database number 3.
  24. # 8) "--cert=example_turn_server_cert.pem" sets the OpenSSL certificate file name.
  25. # 9) "--pkey=example_turn_server_pkey.pem" sets the OpenSSL private key name.
  26. # 10) "--log-file=stdout" means that all log output will go to the stdout.
  27. # 11) --cipher-list=ALL means that we support all OpenSSL ciphers
  28. # 12) --oauth - support oAuth security dialog
  29. # 13) --cli-password=secret means that cli password set to "secret"
  30. # Other parameters (config file name, etc) are default.
  31. if [ -d examples ] ; then
  32. cd examples
  33. fi
  34. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib/:/usr/local/mysql/lib/
  35. export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/usr/local/lib/:/usr/local/mysql/lib/
  36. PATH="./bin/:../bin/:../../bin/:${PATH}" turnserver --server-name="blackdow.carleon.gov" --syslog -a -L 127.0.0.1 -L ::1 -E 127.0.0.1 -E ::1 ---allow-loopback-peers -max-bps=3000000 -f -m 3 --min-port=32355 --max-port=65535 -r north.gov --redis-userdb="ip=127.0.0.1 dbname=2 password=turn connect_timeout=30" --redis-statsdb="ip=127.0.0.1 dbname=3 password=turn connect_timeout=30" --cert=turn_server_cert.pem --pkey=turn_server_pkey.pem --log-file=stdout --cipher-list=ALL --oauth --cli-password=secret $@