diff --git a/conf/systemd.service b/conf/systemd.service index cff556e..e16a219 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ Type=simple WorkingDirectory=__FINALPATH__/ User=__APP__ Group=__APP__ -ExecStart=__FINALPATH__/galene +ExecStart=__FINALPATH__/galene -http __PORT__ -turn auto LimitNOFILE=65536 [Install] diff --git a/scripts/change_url b/scripts/change_url index 0dbac85..39c368e 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -106,14 +106,14 @@ fi #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=3 +ynh_script_progression --message="Starting a systemd service..." --weight=3 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/install b/scripts/install index 73aa416..9c1dc91 100755 --- a/scripts/install +++ b/scripts/install @@ -86,9 +86,8 @@ port=$(ynh_find_port --port=8443) turnserver_tls_port=$(ynh_find_port --port=5349) turnserver_alt_tls_port=$(ynh_find_port --port=$((turnserver_tls_port+1))) -ynh_app_setting_set --app=$app --key=port --value=$port - # Open the port +ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port ynh_exec_warn_less yunohost firewall allow Both $turnserver_tls_port ynh_exec_warn_less yunohost firewall allow Both $turnserver_alt_tls_port @@ -155,6 +154,7 @@ adduser turnserver ssl-cert #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/systemd.service" # Create a dedicated systemd config ynh_add_systemd_config @@ -256,7 +256,7 @@ setfacl -R -m user:turnserver:rwX /var/log/$app #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 -yunohost service add $app --description="Videoconferencing server" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Videoconferencing server" --log="/var/log/$app/$app.log" --needs_exposed_ports $port yunohost service add coturn-$app --description="Coturn TURN server" --log="/var/log/$app/turnserver.log" --needs_exposed_ports $turnserver_tls_port #================================================= diff --git a/scripts/remove b/scripts/remove index 220f571..bcbe66d 100755 --- a/scripts/remove +++ b/scripts/remove @@ -87,6 +87,12 @@ ynh_remove_logrotate # CLOSE A PORT #================================================= +if yunohost firewall list | grep -q "\- $port$" +then + ynh_script_progression --message="Closing port $port..." --weight=1 + ynh_exec_warn_less yunohost firewall disallow TCP $port +fi + if yunohost firewall list | grep -q "\- $turnserver_tls_port$" then ynh_script_progression --message="Closing port $turnserver_tls_port..." --weight=1 diff --git a/scripts/restore b/scripts/restore index 02ad9c8..fc78d3b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -31,6 +31,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) group_name=$(ynh_app_setting_get --app=$app --key=group_name) +port=$(ynh_app_setting_get --app=$app --key=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) ynh_print_OFF @@ -98,7 +99,7 @@ systemctl enable coturn-$app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 -yunohost service add $app --description="Videoconferencing server" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Videoconferencing server" --log="/var/log/$app/$app.log" --needs_exposed_ports $port yunohost service add coturn-$app --description="Coturn TURN server" --log="/var/log/$app/turnserver.log" --needs_exposed_ports $turnserver_tls_port #================================================= @@ -107,7 +108,6 @@ yunohost service add coturn-$app --description="Coturn TURN server" --log="/var/ ynh_script_progression --message="Starting a systemd service..." --weight=3 ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" -yunohost service add coturn-$app --needs_exposed_ports $turnserver_tls_port #================================================= # CREATE A DH FILE @@ -143,7 +143,6 @@ fi # 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 @@ -165,6 +164,7 @@ fi #================================================= # Ouvre le port dans le firewall +ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port ynh_exec_warn_less yunohost firewall allow Both $turnserver_tls_port ynh_exec_warn_less yunohost firewall allow Both $turnserver_alt_tls_port diff --git a/scripts/upgrade b/scripts/upgrade index 4832579..d4c682c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -110,8 +110,8 @@ then # Recreate certificates pushd "$final_path/data" - 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=" + 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=" chmod 640 {key.pem,cert.pem} popd fi @@ -231,6 +231,7 @@ adduser turnserver ssl-cert #================================================= ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/systemd.service" # Create a dedicated systemd config ynh_add_systemd_config @@ -264,7 +265,7 @@ ynh_use_logrotate --non-append #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 -yunohost service add $app --description="Videoconferencing server" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Videoconferencing server" --log="/var/log/$app/$app.log" --needs_exposed_ports $port yunohost service add coturn-$app --description="Coturn TURN server" --log="/var/log/$app/turnserver.log" --needs_exposed_ports $turnserver_tls_port #=================================================