1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/leed_ynh.git synced 2024-09-03 19:26:32 +02:00

Merge pull request #9 from YunoHost-Apps/testing

Fix alias_traversal
This commit is contained in:
Maniack Crudelis 2018-01-04 19:44:36 +01:00 committed by GitHub
commit e078fc8d87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 5 deletions

View file

@ -1,4 +1,5 @@
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

@ -6,7 +6,7 @@
"en": "Leed is a minimalistic RSS feed aggregator which allows quick and non-intrusive reading of feeds.", "en": "Leed is a minimalistic RSS feed aggregator which allows quick and non-intrusive reading of feeds.",
"fr": "Leed est un agrégateur RSS minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive." "fr": "Leed est un agrégateur RSS minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive."
}, },
"version": "1.8.3~ynh1", "version": "1.8.3~ynh2",
"url": "http://leed.idleman.fr/", "url": "http://leed.idleman.fr/",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"maintainer": { "maintainer": {

View file

@ -454,6 +454,11 @@ EOF
ynh_store_file_checksum "$finalfail2banfilterconf" ynh_store_file_checksum "$finalfail2banfilterconf"
sudo systemctl restart fail2ban sudo systemctl restart fail2ban
if local fail2ban_error="$(tail -n50 /var/log/fail2ban.log | grep "WARNING Command.*$app.*addfailregex")"
then
echo "[ERR] Fail2ban fail to load the jail for $app" >&2
echo "WARNING${fail2ban_error#*WARNING}" >&2
fi
} }
# Remove the dedicated fail2ban config (jail and filter conf files) # Remove the dedicated fail2ban config (jail and filter conf files)

View file

@ -68,9 +68,20 @@ then
# Make a backup of the original nginx config file if modified # Make a backup of the original nginx config file if modified
ynh_backup_if_checksum_is_different "$nginx_conf_path" ynh_backup_if_checksum_is_different "$nginx_conf_path"
# Replace locations starting with old_path # Move from sub path to root
# Look for every location possible patterns (see https://nginx.org/en/docs/http/ngx_http_core_module.html#location) if [ "$new_path" == "/" ]
ynh_replace_string "location\( \(=\|~\|~\*\|\^~\)\)\? $old_path" "location\1 $new_path" "$nginx_conf_path" then
ynh_replace_string "^.*rewrite.*\^$old_path" "#sub_path_only&" "$nginx_conf_path"
ynh_replace_string "\(rewrite *\^\)$old_path\$ $old_path/*" "\1$new_path$ $new_path" "$nginx_conf_path"
# Move to a sub path
else
ynh_replace_string "^#sub_path_only" "" "$nginx_conf_path"
ynh_replace_string "\(rewrite *\^\)$old_path\$ $old_path/*" "\1$new_path$ $new_path/" "$nginx_conf_path"
fi
ynh_replace_string "location ${old_path%/}/" "location ${new_path%/}/" "$nginx_conf_path"
# Calculate and store the nginx config file checksum # Calculate and store the nginx config file checksum
ynh_store_file_checksum "$nginx_conf_path" ynh_store_file_checksum "$nginx_conf_path"

View file

@ -72,6 +72,10 @@ ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie d
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
if [ "$path_url" != "/" ]
then
ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf"
fi
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================

View file

@ -92,6 +92,10 @@ ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie d
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
if [ "$path_url" != "/" ]
then
ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf"
fi
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================