summaryrefslogtreecommitdiff
path: root/roles/apps/coturn/contrib/turn-create-time-limited-user.sh
blob: 0d4947fc78672ab9730127ae4ac327b1bebc10f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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)