Add and remove turn users
This commit is contained in:
parent
b9f6d1cf19
commit
854c7f4ac2
|
@ -10523,6 +10523,8 @@ function install_sip_turn {
|
|||
echo '## mod_tmpuser.' >> /etc/turnserver/turnserver.conf
|
||||
echo 'mod_tmpuser = false' >> /etc/turnserver/turnserver.conf
|
||||
|
||||
echo "${MY_USERNAME}:password:${DEFAULT_DOMAIN_NAME}:authorized" > /etc/turnserver/turnusers.txt
|
||||
|
||||
systemctl restart turnserver
|
||||
|
||||
echo 'install_sip_turn' >> $COMPLETION_FILE
|
||||
|
|
|
@ -43,6 +43,7 @@ SSH_PORT=2222
|
|||
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
|
||||
SIP_EXTENSION=
|
||||
FULLBLOG_DOMAIN_NAME=
|
||||
DEFAULT_DOMAIN_NAME=
|
||||
|
||||
if [ ! $MY_USERNAME ]; then
|
||||
echo $'No username was given'
|
||||
|
@ -378,6 +379,14 @@ if [ -f /etc/sipwitch.conf ]; then
|
|||
usermod -aG sipwitch $MY_USERNAME
|
||||
fi
|
||||
|
||||
# add user for SIP STUN/TURN
|
||||
if [ -d /etc/turnserver ]; then
|
||||
if grep -q "DEFAULT_DOMAIN_NAME" $CONFIGURATION_FILE; then
|
||||
DEFAULT_DOMAIN_NAME=$(grep "DEFAULT_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
echo "${MY_USERNAME}:${NEW_USER_PASSWORD}:${DEFAULT_DOMAIN_NAME}:authorized" >> /etc/turnserver/turnusers.txt
|
||||
fi
|
||||
fi
|
||||
|
||||
# add user menu on ssh login
|
||||
if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then
|
||||
echo 'control' >> /home/$MY_USERNAME/.bashrc
|
||||
|
|
|
@ -115,6 +115,11 @@ if grep -q "install_owncloud_repo" $COMPLETION_FILE; then
|
|||
/var/www/owncloud/occ user:delete $MY_USERNAME
|
||||
fi
|
||||
|
||||
# remove user from SIP TURN/STUN
|
||||
if [ -d /etc/turnserver ]; then
|
||||
sed -i "/${MY_USERNAME}:/d" /etc/turnserver/turnusers.txt
|
||||
fi
|
||||
|
||||
userdel -r $MY_USERNAME
|
||||
|
||||
if [ -d /home/$MY_USERNAME ]; then
|
||||
|
|
Loading…
Reference in New Issue