mirror of
https://github.com/YunoHost-Apps/redirect_ynh.git
synced 2024-09-03 20:16:10 +02:00
Merge 3ae5107044
into 783a2e4a45
This commit is contained in:
commit
5d4ce44b9e
8 changed files with 24 additions and 49 deletions
|
@ -16,7 +16,8 @@ license = "AGPL-3.0-or-later"
|
|||
website = "https://en.wikipedia.org/wiki/Reverse_proxy"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
yunohost = ">= 11.2.18"
|
||||
helpers_version = "2.1"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = "not_relevant"
|
||||
|
|
|
@ -5,12 +5,12 @@ URL_REGEX_SECURE='^(http://(127\.[0-9]+\.[0-9]+\.[0-9]+|localhost)|https://.*)(:
|
|||
|
||||
_validate_redirect_uri() {
|
||||
if [[ ! $target =~ $URL_REGEX_VALID ]]; then
|
||||
ynh_die --message="Invalid destination: $target" 1
|
||||
ynh_die "Invalid destination: $target" 1
|
||||
fi
|
||||
|
||||
# Avoid uncrypted remote destination with reverse proxy mode
|
||||
# Indeed the SSO send the password in all requests in HTTP headers
|
||||
if [[ "$redirect_type" = "reverseproxy" ]] && [[ ! $target =~ $URL_REGEX_SECURE ]]; then
|
||||
ynh_print_warn --message="Reverseproxying using cleartext HTTP to a possibly external machine ($target) is insecure ... please be super careful about this."
|
||||
ynh_print_warn "Reverseproxying using cleartext HTTP to a possibly external machine ($target) is insecure ... please be super careful about this."
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -13,10 +7,10 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
# Copy the conf files
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -1,26 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
||||
ynh_script_progression "Updating NGINX web server configuration..."
|
||||
|
||||
mv ../conf/{"nginx-$redirect_type.conf",nginx.conf}
|
||||
ynh_change_url_nginx_config
|
||||
ynh_config_change_url_nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||
ynh_script_progression "Change of URL completed for $app"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -14,13 +8,13 @@ _validate_redirect_uri
|
|||
#=================================================
|
||||
# CONFIGURE NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
ynh_script_progression "Configuring NGINX web server..."
|
||||
|
||||
mv ../conf/{"nginx-$redirect_type.conf",nginx.conf}
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
ynh_script_progression "Installation of $app completed"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -13,10 +7,10 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
ynh_config_remove_nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
ynh_script_progression "Removal of $app completed"
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||
ynh_restore "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_script_progression "Reloading NGINX web server..."
|
||||
ynh_systemctl --service=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
ynh_script_progression "Restoration completed for $app"
|
||||
|
|
|
@ -12,20 +12,20 @@ if [[ "${redirect_type:-}" == *"proxy"* ]]; then
|
|||
else
|
||||
redirect_type="redirect"
|
||||
fi
|
||||
ynh_app_setting_set --app=$app --key='redirect_type' --value=$redirect_type
|
||||
ynh_app_setting_set --key='redirect_type' --value=$redirect_type
|
||||
|
||||
if [[ -z "${target:-}" ]] && [[ -n "${redirect_path:-}" ]]; then
|
||||
target="$redirect_path"
|
||||
ynh_app_setting_delete --app=$app --key=redirect_path
|
||||
ynh_app_setting_set --app=$app --key=target --value="$target"
|
||||
ynh_app_setting_delete --key=redirect_path
|
||||
ynh_app_setting_set --key=target --value="$target"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
ynh_script_progression "Configuring NGINX web server..."
|
||||
|
||||
mv ../conf/{nginx-$redirect_type.conf,nginx.conf}
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
ynh_script_progression "Upgrade of $app completed"
|
||||
|
|
Loading…
Add table
Reference in a new issue