mirror of
https://github.com/YunoHost-Apps/opensondage_ynh.git
synced 2024-09-03 19:46:28 +02:00
Fix nginx alias_traversal
This commit is contained in:
parent
db5c5a0cc1
commit
b724405d26
4 changed files with 21 additions and 7 deletions
|
@ -16,13 +16,7 @@
|
||||||
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
|
|
||||||
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
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue