summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xroles/apps/coturn/contrib/turn-create-time-limited-user.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/roles/apps/coturn/contrib/turn-create-time-limited-user.sh b/roles/apps/coturn/contrib/turn-create-time-limited-user.sh
new file mode 100755
index 00000000..0d4947fc
--- /dev/null
+++ b/roles/apps/coturn/contrib/turn-create-time-limited-user.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 <expiry-seconds>"
+ exit 1
+fi
+
+
+secret="{{ coturn_auth_secret }}"
+
+time=$(date +%s)
+username=$(( $time + $1 ))
+
+echo username: "$username"
+echo password: $(echo -n "$username" | openssl dgst -binary -sha1 -hmac "$secret" | openssl base64)