mirror of
https://github.com/YunoHost-Apps/galene_ynh.git
synced 2024-09-03 18:36:31 +02:00
Fix
This commit is contained in:
parent
97fff21c16
commit
97a98e16c2
5 changed files with 73 additions and 103 deletions
|
@ -1,10 +1,10 @@
|
||||||
lt-cred-mech
|
lt-cred-mech
|
||||||
use-auth-secret
|
use-auth-secret
|
||||||
static-auth-secret=__TURNPWD__
|
static-auth-secret=__TURNSERVER_PWD__
|
||||||
realm=__DOMAIN__
|
realm=__DOMAIN__
|
||||||
|
|
||||||
tls-listening-port=__TLS_PORT__
|
tls-listening-port=__TURNSERVER_TLS_PORT__
|
||||||
alt-tls-listening-port=__TLS_ALT_PORT__
|
alt-tls-listening-port=__TURNSERVER_ALT_TLS_PORT__
|
||||||
min-port=49153
|
min-port=49153
|
||||||
max-port=49193
|
max-port=49193
|
||||||
cli-port=__CLI_PORT__
|
cli-port=__CLI_PORT__
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"urls": [
|
"urls": [
|
||||||
"turn:__DOMAIN__:__TLS_PORT__",
|
"turn:__DOMAIN__:__TURNSERVER_TLS_PORT__",
|
||||||
"turn:__DOMAIN__:__TLS_ALT_PORT__",
|
"turn:__DOMAIN__:__TURNSERVER_ALT_TLS_PORT__",
|
||||||
"turn:__DOMAIN__:__TLS_PORT__?transport=tcp",
|
"turn:__DOMAIN__:__TURNSERVER_TLS_PORT__?transport=tcp",
|
||||||
"turn:__DOMAIN__:__TLS_ALT_PORT__?transport=tcp",
|
"turn:__DOMAIN__:__TURNSERVER_ALT_TLS_PORT__?transport=tcp",
|
||||||
"turn:__DOMAIN__:__TLS_PORT__?transport=udp",
|
"turn:__DOMAIN__:__TURNSERVER_TLS_PORT__?transport=udp",
|
||||||
"turn:__DOMAIN__:__TLS_ALT_PORT__?transport=udp"
|
"turn:__DOMAIN__:__TURNSERVER_ALT_TLS_PORT__?transport=udp"
|
||||||
],
|
],
|
||||||
"username": "__APP__",
|
"username": "__APP__",
|
||||||
"credential": "__TURNPWD__",
|
"credential": "__TURNSERVER_PWD__",
|
||||||
"credentialType": "hmac-sha1"
|
"credentialType": "hmac-sha1"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -183,15 +183,7 @@ ynh_print_ON
|
||||||
|
|
||||||
coturn_config_path="/etc/$app/coturn.conf"
|
coturn_config_path="/etc/$app/coturn.conf"
|
||||||
|
|
||||||
cp ../conf/coturn/turnserver.conf "$coturn_config_path"
|
ynh_add_config --template="../conf/coturn/turnserver.conf" --destination="$coturn_config_path"
|
||||||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$coturn_config_path"
|
|
||||||
ynh_replace_string --match_string=__DOMAIN__ --replace_string=$domain --target_file="$coturn_config_path"
|
|
||||||
ynh_replace_string --match_string=__TLS_PORT__ --replace_string=$turnserver_tls_port --target_file="$coturn_config_path"
|
|
||||||
ynh_replace_string --match_string=__TLS_ALT_PORT__ --replace_string=$turnserver_alt_tls_port --target_file="$coturn_config_path"
|
|
||||||
ynh_replace_string --match_string=__CLI_PORT__ --replace_string=$cli_port --target_file="$coturn_config_path"
|
|
||||||
ynh_print_OFF
|
|
||||||
ynh_replace_string --match_string=__TURNPWD__ --replace_string=$turnserver_pwd --target_file="$coturn_config_path"
|
|
||||||
ynh_print_ON
|
|
||||||
|
|
||||||
# Get public IP and set as external IP for coturn
|
# Get public IP and set as external IP for coturn
|
||||||
# note: '|| true' is used to ignore the errors if we can't get the public ipv4 or ipv6
|
# note: '|| true' is used to ignore the errors if we can't get the public ipv4 or ipv6
|
||||||
|
@ -218,30 +210,13 @@ mkdir -p "$groups"
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
cp ../conf/passwd $final_path/data/passwd
|
ynh_add_config --template="../conf/passwd" --destination="$final_path/data/passwd"
|
||||||
ynh_replace_string --match_string=__ADMIN__ --replace_string=$admin --target_file="$final_path/data/passwd"
|
|
||||||
ynh_replace_string --match_string=__PASSWORD__ --replace_string=$password --target_file="$final_path/data/passwd"
|
|
||||||
|
|
||||||
mv "../conf/groupname.json" "$final_path/groups/$group_name.json"
|
|
||||||
ynh_replace_string --match_string=__ADMIN__ --replace_string=$admin --target_file="$final_path/groups/$group_name.json"
|
|
||||||
ynh_replace_string --match_string=__PASSWORD__ --replace_string=$password --target_file="$final_path/groups/$group_name.json"
|
|
||||||
|
|
||||||
cp ../conf/ice-servers.json $final_path/data/ice-servers.json
|
|
||||||
ynh_replace_string --match_string=__DOMAIN__ --replace_string=$domain --target_file="$final_path/data/ice-servers.json"
|
|
||||||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/data/ice-servers.json"
|
|
||||||
ynh_replace_string --match_string=__TLS_PORT__ --replace_string=$turnserver_tls_port --target_file="$final_path/data/ice-servers.json"
|
|
||||||
ynh_replace_string --match_string=__TLS_ALT_PORT__ --replace_string=$turnserver_alt_tls_port --target_file="$final_path/data/ice-servers.json"
|
|
||||||
ynh_print_OFF
|
|
||||||
ynh_replace_string --match_string=__TURNPWD__ --replace_string=$turnserver_pwd --target_file="$final_path/data/ice-servers.json"
|
|
||||||
ynh_print_ON
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
|
||||||
ynh_store_file_checksum --file="$final_path/data/passwd"
|
ynh_store_file_checksum --file="$final_path/data/passwd"
|
||||||
|
|
||||||
|
ynh_add_config --template="../conf/groupname.json" --destination="$final_path/groups/$group_name.json"
|
||||||
ynh_store_file_checksum --file="$final_path/groups/$group_name.json"
|
ynh_store_file_checksum --file="$final_path/groups/$group_name.json"
|
||||||
|
|
||||||
|
ynh_add_config --template="../conf/ice-servers.json" --destination="$final_path/data/ice-servers.json"
|
||||||
ynh_store_file_checksum --file="$final_path/data/ice-servers.json"
|
ynh_store_file_checksum --file="$final_path/data/ice-servers.json"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -258,8 +233,7 @@ ynh_use_logrotate --logfile "/var/log/$app"
|
||||||
# WARNING : theses command are used in INSTALL, UPGRADE
|
# WARNING : theses command are used in INSTALL, UPGRADE
|
||||||
# For any update do it in all files
|
# For any update do it in all files
|
||||||
|
|
||||||
cp ../sources/Coturn_config_rotate.sh $final_path/Coturn_config_rotate.sh
|
ynh_add_config --template="../sources/Coturn_config_rotate.sh" --destination="$final_path/Coturn_config_rotate.sh"
|
||||||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/Coturn_config_rotate.sh"
|
|
||||||
chmod +x $final_path/Coturn_config_rotate.sh
|
chmod +x $final_path/Coturn_config_rotate.sh
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -33,6 +33,10 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
group_name=$(ynh_app_setting_get --app=$app --key=group_name)
|
group_name=$(ynh_app_setting_get --app=$app --key=group_name)
|
||||||
turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port)
|
turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port)
|
||||||
turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tls_port)
|
turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tls_port)
|
||||||
|
cli_port=$(ynh_app_setting_get --app=$app --key=cli_port)
|
||||||
|
ynh_print_OFF
|
||||||
|
turnserver_pwd=$(ynh_app_setting_get --app=$app --key=turnserver_pwd)
|
||||||
|
ynh_print_ON
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|
@ -122,48 +126,40 @@ then
|
||||||
chmod 640 /etc/ssl/private/dh2048.pem
|
chmod 640 /etc/ssl/private/dh2048.pem
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
# #=================================================
|
||||||
# RECONFIGURE THE TURNSERVER
|
# # RECONFIGURE THE TURNSERVER
|
||||||
#=================================================
|
# #=================================================
|
||||||
ynh_script_progression --message="Reconfiguring Coturn..." --weight=23
|
# ynh_script_progression --message="Reconfiguring Coturn..." --weight=23
|
||||||
|
|
||||||
# To be sure that at the restoration the IP address in coturn config is the same as the real address we remake the coturn config
|
# # To be sure that at the restoration the IP address in coturn config is the same as the real address we remake the coturn config
|
||||||
|
|
||||||
# Retrieve specific settings
|
# # WARNING : these commands are used in INSTALL, UPGRADE
|
||||||
turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port)
|
# # For any update do it in all files
|
||||||
turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tls_port)
|
|
||||||
cli_port=$(ynh_app_setting_get --app=$app --key=cli_port)
|
|
||||||
ynh_print_OFF
|
|
||||||
turnserver_pwd=$(ynh_app_setting_get --app=$app --key=turnserver_pwd)
|
|
||||||
ynh_print_ON
|
|
||||||
|
|
||||||
# WARNING : these commands are used in INSTALL, UPGRADE
|
# coturn_config_path="/etc/$app/coturn.conf"
|
||||||
# For any update do it in all files
|
|
||||||
|
|
||||||
coturn_config_path="/etc/$app/coturn.conf"
|
# cp ../settings/conf/coturn/turnserver.conf "$coturn_config_path"
|
||||||
|
|
||||||
cp ../settings/conf/coturn/turnserver.conf "$coturn_config_path"
|
# ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$coturn_config_path"
|
||||||
|
# ynh_replace_string --match_string=__DOMAIN__ --replace_string=$domain --target_file="$coturn_config_path"
|
||||||
|
# ynh_replace_string --match_string=__TLS_PORT__ --replace_string=$turnserver_tls_port --target_file="$coturn_config_path"
|
||||||
|
# ynh_replace_string --match_string=__TLS_ALT_PORT__ --replace_string=$turnserver_alt_tls_port --target_file="$coturn_config_path"
|
||||||
|
# ynh_replace_string --match_string=__CLI_PORT__ --replace_string=$cli_port --target_file="$coturn_config_path"
|
||||||
|
# ynh_print_OFF
|
||||||
|
# ynh_replace_string --match_string=__TURNPWD__ --replace_string=$turnserver_pwd --target_file="$coturn_config_path"
|
||||||
|
# ynh_print_ON
|
||||||
|
|
||||||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$coturn_config_path"
|
# # Get public IP and set as external IP for coturn
|
||||||
ynh_replace_string --match_string=__DOMAIN__ --replace_string=$domain --target_file="$coturn_config_path"
|
# # note : '|| true' is used to ignore the errors if we can't get the public ipv4 or ipv6
|
||||||
ynh_replace_string --match_string=__TLS_PORT__ --replace_string=$turnserver_tls_port --target_file="$coturn_config_path"
|
# public_ip4="$(curl ip.yunohost.org)" || true
|
||||||
ynh_replace_string --match_string=__TLS_ALT_PORT__ --replace_string=$turnserver_alt_tls_port --target_file="$coturn_config_path"
|
# public_ip6="$(curl ipv6.yunohost.org)" || true
|
||||||
ynh_replace_string --match_string=__CLI_PORT__ --replace_string=$cli_port --target_file="$coturn_config_path"
|
|
||||||
ynh_print_OFF
|
|
||||||
ynh_replace_string --match_string=__TURNPWD__ --replace_string=$turnserver_pwd --target_file="$coturn_config_path"
|
|
||||||
ynh_print_ON
|
|
||||||
|
|
||||||
# Get public IP and set as external IP for coturn
|
# if ( [[ -n "$public_ip4" ]] && ynh_validate_ip4 --ip_address="$public_ip4" || [[ -n "$public_ip6" ]] && ynh_validate_ip6 --ip_address="$public_ip6" )
|
||||||
# note : '|| true' is used to ignore the errors if we can't get the public ipv4 or ipv6
|
# then
|
||||||
public_ip4="$(curl ip.yunohost.org)" || true
|
# echo "external-ip=${public_ip4}/${public_ip6}" >> "$coturn_config_path"
|
||||||
public_ip6="$(curl ipv6.yunohost.org)" || true
|
# fi
|
||||||
|
|
||||||
if ( [[ -n "$public_ip4" ]] && ynh_validate_ip4 --ip_address="$public_ip4" || [[ -n "$public_ip6" ]] && ynh_validate_ip6 --ip_address="$public_ip6" )
|
# ynh_store_file_checksum --file="$coturn_config_path"
|
||||||
then
|
|
||||||
echo "external-ip=${public_ip4}/${public_ip6}" >> "$coturn_config_path"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ynh_store_file_checksum --file="$coturn_config_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# OPEN THE PORT
|
# OPEN THE PORT
|
||||||
|
|
|
@ -47,6 +47,20 @@ if [ -z "$final_path" ]; then
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$final_path/groups" ]; then
|
||||||
|
# Define app's groups directory
|
||||||
|
groups="$final_path/groups"
|
||||||
|
#Create groups folder
|
||||||
|
mkdir -p "$groups"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$final_path/data" ]; then
|
||||||
|
# Define app's data directory
|
||||||
|
data="$final_path/data"
|
||||||
|
# Create data folder
|
||||||
|
mkdir -p "$data"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -96,10 +110,10 @@ then
|
||||||
ynh_secure_remove --file="$tmpdir"
|
ynh_secure_remove --file="$tmpdir"
|
||||||
|
|
||||||
# Recreate certificates
|
# Recreate certificates
|
||||||
pushd "$final_path"
|
pushd "$final_path/data"
|
||||||
ynh_exec_warn_less openssl req -newkey rsa:2048 -nodes -keyout data/key.pem -x509 -days 365 -out data/cert.pem \
|
ynh_exec_warn_less openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out cert.pem \
|
||||||
-subj "/C=/ST=/L=/O=/OU=/CN=/emailAddress="
|
-subj "/C=/ST=/L=/O=/OU=/CN=/emailAddress="
|
||||||
chmod 640 data/{key.pem,cert.pem}
|
chmod 640 {key.pem,cert.pem}
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -166,15 +180,7 @@ ynh_script_progression --message="Updating Coturn config..." --weight=1
|
||||||
|
|
||||||
coturn_config_path="/etc/$app/coturn.conf"
|
coturn_config_path="/etc/$app/coturn.conf"
|
||||||
|
|
||||||
cp ../conf/coturn/turnserver.conf $coturn_config_path
|
ynh_add_config --template="../conf/coturn/turnserver.conf" --destination="$coturn_config_path"
|
||||||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$coturn_config_path"
|
|
||||||
ynh_replace_string --match_string=__DOMAIN__ --replace_string=$domain --target_file="$coturn_config_path"
|
|
||||||
ynh_replace_string --match_string=__TLS_PORT__ --replace_string=$turnserver_tls_port --target_file="$coturn_config_path"
|
|
||||||
ynh_replace_string --match_string=__TLS_ALT_PORT__ --replace_string=$turnserver_alt_tls_port --target_file="$coturn_config_path"
|
|
||||||
ynh_replace_string --match_string=__CLI_PORT__ --replace_string=$cli_port --target_file="$coturn_config_path"
|
|
||||||
ynh_print_OFF
|
|
||||||
ynh_replace_string --match_string=__TURNPWD__ --replace_string=$turnserver_pwd --target_file="$coturn_config_path"
|
|
||||||
ynh_print_ON
|
|
||||||
|
|
||||||
# Get public IP and set as external IP for coturn
|
# Get public IP and set as external IP for coturn
|
||||||
# note : '|| true' is used to ignore the errors if we can't get the public ipv4 or ipv6
|
# note : '|| true' is used to ignore the errors if we can't get the public ipv4 or ipv6
|
||||||
|
@ -195,26 +201,20 @@ ynh_store_file_checksum --file="$coturn_config_path"
|
||||||
# WARNING : theses command are used in INSTALL, UPGRADE
|
# WARNING : theses command are used in INSTALL, UPGRADE
|
||||||
# For any update do it in all files
|
# For any update do it in all files
|
||||||
|
|
||||||
cp ../sources/Coturn_config_rotate.sh $final_path/Coturn_config_rotate.sh
|
ynh_add_config --template="../sources/Coturn_config_rotate.sh" --destination="$final_path/Coturn_config_rotate.sh"
|
||||||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/Coturn_config_rotate.sh"
|
|
||||||
chmod +x $final_path/Coturn_config_rotate.sh
|
chmod +x $final_path/Coturn_config_rotate.sh
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
cp ../conf/passwd $final_path/data/passwd
|
ynh_backup_if_checksum_is_different --file="$final_path/data/passwd"
|
||||||
ynh_replace_string --match_string=__ADMIN__ --replace_string=$admin --target_file="$final_path/data/passwd"
|
ynh_add_config --template="../conf/passwd" --destination="$final_path/data/passwd"
|
||||||
ynh_replace_string --match_string=__PASSWORD__ --replace_string=$password --target_file="$final_path/data/passwd"
|
ynh_store_file_checksum --file="$final_path/data/passwd"
|
||||||
|
|
||||||
cp ../conf/ice-servers.json $final_path/data/ice-servers.json
|
ynh_backup_if_checksum_is_different --file="$final_path/data/ice-servers.json"
|
||||||
ynh_replace_string --match_string=__DOMAIN__ --replace_string=$domain --target_file="$final_path/data/ice-servers.json"
|
ynh_add_config --template="../conf/ice-servers.json" --destination="$final_path/data/ice-servers.json"
|
||||||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/data/ice-servers.json"
|
ynh_store_file_checksum --file="$final_path/data/ice-servers.json"
|
||||||
ynh_replace_string --match_string=__TLS_PORT__ --replace_string=$turnserver_tls_port --target_file="$final_path/data/ice-servers.json"
|
|
||||||
ynh_replace_string --match_string=__TLS_ALT_PORT__ --replace_string=$turnserver_alt_tls_port --target_file="$final_path/data/ice-servers.json"
|
|
||||||
ynh_print_OFF
|
|
||||||
ynh_replace_string --match_string=__TURNPWD__ --replace_string=$turnserver_pwd --target_file="$final_path/data/ice-servers.json"
|
|
||||||
ynh_print_ON
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
|
Loading…
Add table
Reference in a new issue