1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/opensondage_ynh.git synced 2024-09-03 19:46:28 +02:00

Fix nginx alias_traversal (#26)

* Fix nginx alias_traversal

* Update check_process
This commit is contained in:
Jean-Baptiste 2018-03-18 08:55:44 +01:00 committed by JimboJoe
parent 59f3b9765c
commit 8d5b7edcae
4 changed files with 21 additions and 6 deletions

View file

@ -16,13 +16,8 @@
upgrade=1 upgrade=1
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
wrong_user=1
wrong_path=1
incorrect_path=1 incorrect_path=1
corrupt_source=0
fail_download_source=0
port_already_use=0 port_already_use=0
final_path_already_use=0
;;; Levels ;;; Levels
Level 1=auto Level 1=auto
Level 2=auto Level 2=auto

View file

@ -1,4 +1,6 @@
location __PATH__ { #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
alias __FINALPATH__/; alias __FINALPATH__/;
if ($scheme = http) { if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;

View file

@ -86,6 +86,15 @@ ynh_setup_source "$final_path"
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
if [ "$path_url" == "/" ]
then
# ynh panel is only for non-root installs
ynh_replace_string " include conf.d/" " #include conf.d/" "../conf/nginx.conf"
else
# add rewrite for alias_traversal protection
ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf"
fi
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config

View file

@ -107,6 +107,15 @@ ynh_setup_source "$final_path"
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
if [ "$path_url" == "/" ]
then
# ynh panel is only for non-root installs
ynh_replace_string " include conf.d/" " #include conf.d/" "../conf/nginx.conf"
else
# add rewrite for alias_traversal protection
ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf"
fi
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config