1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse_ynh.git synced 2024-09-03 20:26:38 +02:00

Typos and misc fixes

This commit is contained in:
Jimmy Monin 2018-07-05 21:46:24 +02:00 committed by Josue-T
parent bc31ff4760
commit e1065d80a8
5 changed files with 37 additions and 32 deletions

View file

@ -57,9 +57,9 @@ yunohost app setting synapse turnserver_tls_port
yunohost app setting synapse turnserver_alt_tls_port yunohost app setting synapse turnserver_alt_tls_port
``` ```
The turnserver will also chose a port dynamicly when a new call start. The is between 49153 - 49193. The turnserver will also choose a port dynamically when a new call starts. The range is between 49153 - 49193.
For some security reason the ports range (49153 - 49193) isn't automatically open by default. If you want to use the synapse server for voip or conferencing you will need to open this port range manually. To do this just run this command : For some security reason the ports range (49153 - 49193) isn't automatically open by default. If you want to use the synapse server for voip or conferencing you will need to open this port range manually. To do this just run this command:
``` ```
yunohost firewall allow Both 49153:49193 yunohost firewall allow Both 49153:49193
@ -67,9 +67,9 @@ yunohost firewall allow Both 49153:49193
You might also need to open these ports (if it is not automatically done) on your ISP box. You might also need to open these ports (if it is not automatically done) on your ISP box.
To prevent the situation when the server is behind a NAT, the public IP is written in the turnserver config. By this the turnserver can send his real public IP to the client. For more information see [the coturn example config file](https://github.com/coturn/coturn/blob/master/examples/etc/turnserver.conf#L102-L120). So if your IP change you could run the script `/opt/yunohost/__SYNAPSE_INSTANCE_NAME__/Coturn_config_rotate.sh` to update your config. To prevent the situation when the server is behind a NAT, the public IP is written in the turnserver config. By this the turnserver can send its real public IP to the client. For more information see [the coturn example config file](https://github.com/coturn/coturn/blob/master/examples/etc/turnserver.conf#L102-L120).So if your IP changes, you could run the script `/opt/yunohost/__SYNAPSE_INSTANCE_NAME__/Coturn_config_rotate.sh` to update your config.
If you have a dynamic ip adresse you also might need to update this config automatically. To do that just edit a file named : `/etc/cron.d/coturn_config_rotate` and add the fooling contenant (just adapt the __SYNAPSE_INSTANCE_NAME__ which could be `synapse` or mybe `synapse__1`). If you have a dynamic IP address, you also might need to update this config automatically. To do that just edit a file named `/etc/cron.d/coturn_config_rotate` and add the following content (just adapt the __SYNAPSE_INSTANCE_NAME__ which could be `synapse` or maybe `synapse__2`).
``` ```
*/15 * * * * root bash /opt/yunohost/__SYNAPSE_INSTANCE_NAME__/Coturn_config_rotate.sh; */15 * * * * root bash /opt/yunohost/__SYNAPSE_INSTANCE_NAME__/Coturn_config_rotate.sh;

View file

@ -151,27 +151,27 @@ else
PS1="" PS1=""
cp ../conf/virtualenv_activate $final_path/bin/activate cp ../conf/virtualenv_activate $final_path/bin/activate
ynh_replace_string __FINAL_PATH__ $final_path $final_path/bin/activate ynh_replace_string __FINAL_PATH__ $final_path $final_path/bin/activate
# We set all necessary environement variable to create a python virtualenvironnement. # We set all necessary environement variable to create a python virtualenvironnement.
source $final_path/bin/activate source $final_path/bin/activate
pip install --upgrade pip pip install --upgrade pip
pip install --upgrade setuptools pip install --upgrade setuptools
pip install --upgrade cffi ndg-httpsclient psycopg2 lxml pip install --upgrade cffi ndg-httpsclient psycopg2 lxml
# Download and check the checksum for the synapse source # Download and check the checksum for the synapse source
src_url=$(grep 'SOURCE_URL=' "$YNH_CWD/../conf/python_source.src" | cut -d= -f2-) src_url=$(grep 'SOURCE_URL=' "$YNH_CWD/../conf/python_source.src" | cut -d= -f2-)
src_sum=$(grep 'SOURCE_SUM=' "$YNH_CWD/../conf/python_source.src" | cut -d= -f2-) src_sum=$(grep 'SOURCE_SUM=' "$YNH_CWD/../conf/python_source.src" | cut -d= -f2-)
wget -nv -O synapse_source.tar.gz "$src_url" wget -nv -O synapse_source.tar.gz "$src_url"
echo "${src_sum} synapse_source.tar.gz" | sha256sum -c --status \ echo "${src_sum} synapse_source.tar.gz" | sha256sum -c --status \
|| ynh_die "Corrupt source" || ynh_die "Corrupt source"
pip install --upgrade synapse_source.tar.gz pip install --upgrade synapse_source.tar.gz
# Fix issue with msgpack see https://github.com/YunoHost-Apps/synapse_ynh/issues/29 # Fix issue with msgpack see https://github.com/YunoHost-Apps/synapse_ynh/issues/29
test -e $final_path/lib/python2.7/site-packages/msgpack/__init__.py || (\ test -e $final_path/lib/python2.7/site-packages/msgpack/__init__.py || (\
pip uninstall -y msgpack-python msgpack; \ pip uninstall -y msgpack-python msgpack; \
pip install msgpack-python) pip install msgpack-python)
# This fonction was defined while we call "source $final_path/bin/activate". By this fonction de undo what does "$final_path/bin/activate" # This fonction was defined while we call "source $final_path/bin/activate". By this fonction de undo what does "$final_path/bin/activate"
deactivate deactivate
fi fi
@ -262,7 +262,7 @@ else
ynh_replace_string '__IPV4__,' "" "$coturn_config_path" ynh_replace_string '__IPV4__,' "" "$coturn_config_path"
fi fi
if [[ -n "$public_ip6" ]] && ynh_valide_ip6 "$public_ip6" if [[ -n "$public_ip6" ]] && ynh_validate_ip6 "$public_ip6"
then then
ynh_replace_string '__IPV6__' "$public_ip6" "$coturn_config_path" ynh_replace_string '__IPV6__' "$public_ip6" "$coturn_config_path"
else else
@ -341,7 +341,7 @@ _matrix._tcp.$domain. 3600 IN SRV 10 0 $synapse_tls_port $domain.
You also need to open the TCP port $synapse_tls_port on your ISP box if it's not automatically done. You also need to open the TCP port $synapse_tls_port on your ISP box if it's not automatically done.
Your synapse server also implements a turnserver (for VoIP), to have this fully functional server it's recommended to read the 'Turnserver' section in the README available here : https://github.com/YunoHost-Apps/synapse_ynh . Your synapse server also implements a turnserver (for VoIP), to have this fully functional please read the 'Turnserver' section in the README available here: https://github.com/YunoHost-Apps/synapse_ynh .
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/synapse_ynh" If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/synapse_ynh"

View file

@ -74,15 +74,15 @@ adduser turnserver ssl-cert
# RECONFIGURE THE TURNSERVER # RECONFIGURE THE TURNSERVER
#================================================= #=================================================
# To be sure that a the restoration the IP adress in coturn config is same than the real adress 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
# Retrive specific settings # Retrieve specific settings
turnserver_tls_port=$(ynh_app_setting_get $app turnserver_tls_port) turnserver_tls_port=$(ynh_app_setting_get $app turnserver_tls_port)
turnserver_alt_tls_port=$(ynh_app_setting_get $app turnserver_alt_tls_port) turnserver_alt_tls_port=$(ynh_app_setting_get $app turnserver_alt_tls_port)
turnserver_pwd=$(ynh_app_setting_get $app turnserver_pwd) turnserver_pwd=$(ynh_app_setting_get $app turnserver_pwd)
cli_port=$(ynh_app_setting_get $app cli_port) cli_port=$(ynh_app_setting_get $app cli_port)
# WARRNING : theses command are used in INSTALL, UPGRADE # WARNING : these commands are used in INSTALL, UPGRADE
# For any update do it in all files # For any update do it in all files
coturn_config_path="/etc/matrix-$app/coturn.conf" coturn_config_path="/etc/matrix-$app/coturn.conf"
@ -170,7 +170,7 @@ ynh_use_logrotate /var/log/matrix-$app
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
# WARRNING : theses command are used in INSTALL, UPGRADE, RESTORE # WARNING : these commands are used in INSTALL, UPGRADE, RESTORE
# For any update do it in all files # For any update do it in all files
chown $synapse_user:root -R $final_path chown $synapse_user:root -R $final_path
chown $synapse_user:root -R /var/lib/matrix-$app chown $synapse_user:root -R /var/lib/matrix-$app
@ -209,7 +209,7 @@ _matrix._tcp.$domain. 3600 IN SRV 10 0 $synapse_tls_port $domain.
You also need to open the TCP port $synapse_tls_port on your ISP box if it's not automatically done. You also need to open the TCP port $synapse_tls_port on your ISP box if it's not automatically done.
Your synapse server also implements a turnserver (for VoIP), to have this fully functional server it's recommended to read the 'Turnserver' section in the README available here : https://github.com/YunoHost-Apps/synapse_ynh . Your synapse server also implements a turnserver (for VoIP), to have this fully functional please read the 'Turnserver' section in the README available here: https://github.com/YunoHost-Apps/synapse_ynh .
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/synapse_ynh" If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/synapse_ynh"

View file

@ -77,7 +77,7 @@ fi
# Install/upgrade synapse in virtualenv # Install/upgrade synapse in virtualenv
# WARRNING : theses command are used in INSTALL, UPGRADE # WARNING : these commands are used in INSTALL, UPGRADE
# For any update do it in all files # For any update do it in all files
if [ -n "$(uname -m | grep arm)" ] if [ -n "$(uname -m | grep arm)" ]
@ -91,26 +91,26 @@ else
PS1="" PS1=""
cp ../conf/virtualenv_activate $final_path/bin/activate cp ../conf/virtualenv_activate $final_path/bin/activate
ynh_replace_string __FINAL_PATH__ $final_path $final_path/bin/activate ynh_replace_string __FINAL_PATH__ $final_path $final_path/bin/activate
# We set all necessary environement variable to create a python virtualenvironnement. # We set all necessary environement variable to create a python virtualenvironnement.
source $final_path/bin/activate source $final_path/bin/activate
pip install --upgrade setuptools pip install --upgrade setuptools
pip install --upgrade cffi ndg-httpsclient psycopg2 lxml pip install --upgrade cffi ndg-httpsclient psycopg2 lxml
# Download and check the checksum for the synapse source # Download and check the checksum for the synapse source
src_url=$(grep 'SOURCE_URL=' "$YNH_CWD/../conf/python_source.src" | cut -d= -f2-) src_url=$(grep 'SOURCE_URL=' "$YNH_CWD/../conf/python_source.src" | cut -d= -f2-)
src_sum=$(grep 'SOURCE_SUM=' "$YNH_CWD/../conf/python_source.src" | cut -d= -f2-) src_sum=$(grep 'SOURCE_SUM=' "$YNH_CWD/../conf/python_source.src" | cut -d= -f2-)
wget -nv -O synapse_source.tar.gz "$src_url" wget -nv -O synapse_source.tar.gz "$src_url"
echo "${src_sum} synapse_source.tar.gz" | sha256sum -c --status \ echo "${src_sum} synapse_source.tar.gz" | sha256sum -c --status \
|| ynh_die "Corrupt source" || ynh_die "Corrupt source"
pip install --upgrade synapse_source.tar.gz pip install --upgrade synapse_source.tar.gz
# Fix issue with msgpack see https://github.com/YunoHost-Apps/synapse_ynh/issues/29 # Fix issue with msgpack see https://github.com/YunoHost-Apps/synapse_ynh/issues/29
test -e $final_path/lib/python2.7/site-packages/msgpack/__init__.py || (\ test -e $final_path/lib/python2.7/site-packages/msgpack/__init__.py || (\
pip uninstall -y msgpack-python msgpack; \ pip uninstall -y msgpack-python msgpack; \
pip install msgpack-python) pip install msgpack-python)
# This fonction was defined while we call "source $final_path/bin/activate". By this fonction de undo what does "$final_path/bin/activate" # This fonction was defined while we call "source $final_path/bin/activate". By this fonction de undo what does "$final_path/bin/activate"
deactivate deactivate
fi fi
@ -172,7 +172,7 @@ then
ynh_app_setting_set $app turnserver_alt_tls_port $turnserver_alt_tls_port ynh_app_setting_set $app turnserver_alt_tls_port $turnserver_alt_tls_port
ynh_app_setting_set $app cli_port $cli_port ynh_app_setting_set $app cli_port $cli_port
yunohost firewall allow Both $turnserver_alt_tls_port > /dev/null 2>&1 yunohost firewall allow Both $turnserver_alt_tls_port > /dev/null 2>&1
# Configure systemd # Configure systemd
@ -242,7 +242,7 @@ else
ynh_replace_string '__IPV4__,' "" "$coturn_config_path" ynh_replace_string '__IPV4__,' "" "$coturn_config_path"
fi fi
if [[ -n "$public_ip6" ]] && ynh_valide_ip6 "$public_ip6" if [[ -n "$public_ip6" ]] && ynh_validate_ip6 "$public_ip6"
then then
ynh_replace_string '__IPV6__' "$public_ip6" "$coturn_config_path" ynh_replace_string '__IPV6__' "$public_ip6" "$coturn_config_path"
else else

View file

@ -2,21 +2,26 @@
app_instance=__APP__ app_instance=__APP__
# Validate an IP address syntax
#
# usage: ynh_validate_ip ip_address_family ip_address
# | arg: ip_address_family - either 4 (for IPv4) or 6 (for IPv6)
# | arg: ip_address - IP address to validate
ynh_validate_ip() ynh_validate_ip()
{ {
# http://stackoverflow.com/questions/319279/how-to-validate-ip-address-in-python#319298 # http://stackoverflow.com/questions/319279/how-to-validate-ip-address-in-python#319298
local IP_ADDRESS_FAMILY=$1 local ip_address_family=$1
local IP_ADDRESS=$2 local ip_address=$2
[ "$IP_ADDRESS_FAMILY" == "4" ] || [ "$IP_ADDRESS_FAMILY" == "6" ] || return 1 [ "$ip_address_family" == "4" ] || [ "$ip_address_family" == "6" ] || return 1
python /dev/stdin << EOF python /dev/stdin << EOF
import socket import socket
import sys import sys
family = { "4" : socket.AF_INET, "6" : socket.AF_INET6 } family = { "4" : socket.AF_INET, "6" : socket.AF_INET6 }
try: try:
socket.inet_pton(family["$IP_ADDRESS_FAMILY"], "$IP_ADDRESS") socket.inet_pton(family["$ip_address_family"], "$ip_address")
except socket.error: except socket.error:
sys.exit(1) sys.exit(1)
sys.exit(0) sys.exit(0)
@ -35,7 +40,7 @@ else
external_IP_line="${external_IP_line/'__IPV4__,'/}" external_IP_line="${external_IP_line/'__IPV4__,'/}"
fi fi
if [[ -n "$public_ip6" ]] && ynh_valide_ip 6 "$public_ip6" if [[ -n "$public_ip6" ]] && ynh_validate_ip 6 "$public_ip6"
then then
external_IP_line="${external_IP_line/'__IPV6__'/$public_ip6}" external_IP_line="${external_IP_line/'__IPV6__'/$public_ip6}"
else else
@ -44,4 +49,4 @@ fi
sed --in-place "s@^external-ip=.*\$@$external_IP_line@g" "/etc/matrix-$app_instance/coturn.conf" sed --in-place "s@^external-ip=.*\$@$external_IP_line@g" "/etc/matrix-$app_instance/coturn.conf"
exit 0 exit 0