Create turn certificate if needed

This commit is contained in:
Bob Mottram 2016-03-25 15:42:30 +00:00
parent f72c92b08e
commit b9f6d1cf19
1 changed files with 17 additions and 4 deletions

View File

@ -10387,10 +10387,25 @@ function install_sip_turn {
apt-get -y install turnserver
# create a nonce if needed
if [ ! $VOIP_TURN_NONCE ]; then
VOIP_TURN_NONCE="$(openssl rand -base64 32 | cut -c1-30)"
fi
# create a certificate if needed
if [ ! -f /etc/ssl/certs/$DEFAULT_DOMAIN_NAME.pem ]; then
if [ ! -f /etc/ssl/certs/$DEFAULT_DOMAIN_NAME.crt ]; then
if [ ! -f /etc/ssl/certs/$DEFAULT_DOMAIN_NAME.dhparam ]; then
if [[ $LETSENCRYPT_ENABLED != "yes" ]]; then
${PROJECT_NAME}-addcert -h $DEFAULT_DOMAIN_NAME --dhkey $DH_KEYLENGTH
else
${PROJECT_NAME}-addcert -e $DEFAULT_DOMAIN_NAME -s $LETSENCRYPT_SERVER --dhkey $DH_KEYLENGTH --email $MY_EMAIL_ADDRESS
fi
check_certificates $DEFAULT_DOMAIN_NAME
fi
fi
fi
echo '##' > /etc/turnserver/turnserver.conf
echo '# TurnServer configuration file.' >> /etc/turnserver/turnserver.conf
echo '#' >> /etc/turnserver/turnserver.conf
@ -10487,14 +10502,12 @@ function install_sip_turn {
echo '## Certification Authority file.' >> /etc/turnserver/turnserver.conf
echo "ca_file = \"/etc/ssl/certs/ca-certificates.crt\"" >> /etc/turnserver/turnserver.conf
echo '' >> /etc/turnserver/turnserver.conf
echo '## Server certificate file.' >> /etc/turnserver/turnserver.conf
echo '## Server certificate file.' >> /etc/turnserver/turnserver.conf
if [ -f /etc/ssl/certs/$DEFAULT_DOMAIN_NAME.pem ]; then
echo "cert_file = \"/etc/ssl/certs/$DEFAULT_DOMAIN_NAME.pem\"" >> /etc/turnserver/turnserver.conf
else
if [ -f /etc/ssl/certs/$DEFAULT_DOMAIN_NAME.crt ]; then
echo "cert_file = \"/etc/ssl/certs/$DEFAULT_DOMAIN_NAME.crt\"" >> /etc/turnserver/turnserver.conf
else
echo "cert_file = \"/etc/ssl/certs/$DEFAULT_DOMAIN_NAME.crt\"" >> /etc/turnserver/turnserver.conf
fi
fi
echo '' >> /etc/turnserver/turnserver.conf