2019-05-06 19:31:34 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD MODIFICATIONS
|
|
|
|
#=================================================
|
|
|
|
# MODIFY URL IN NGINX CONF
|
|
|
|
#=================================================
|
2020-11-12 15:39:12 +01:00
|
|
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
2019-05-06 19:31:34 +02:00
|
|
|
|
2023-03-06 13:24:53 +01:00
|
|
|
ynh_change_url_nginx_config
|
|
|
|
|
2022-10-19 00:46:33 +02:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC MODIFICATIONS
|
2020-11-12 15:39:12 +01:00
|
|
|
#=================================================
|
|
|
|
# SETUP FAIL2BAN
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Configuring Fail2Ban..." --weight=10
|
|
|
|
|
|
|
|
# Remove the config file with $old_domain
|
|
|
|
ynh_remove_fail2ban_config
|
|
|
|
|
|
|
|
# Add config file with $new_domain
|
2023-03-06 13:29:34 +01:00
|
|
|
ynh_add_fail2ban_config --logpath="/var/log/nginx/${new_domain}-error.log" --failregex="^.*authentication failure\" while reading response header from upstream, client: <HOST>,.*$" --max_retry=5
|
2020-11-12 15:39:12 +01:00
|
|
|
|
2019-05-08 17:24:49 +02:00
|
|
|
#=================================================
|
2022-10-19 00:46:33 +02:00
|
|
|
# UPDATE A CONFIG FILE
|
2019-05-08 17:24:49 +02:00
|
|
|
#=================================================
|
2022-10-19 00:46:33 +02:00
|
|
|
ynh_script_progression --message="Updating a configuration file..." --weight=2
|
2019-05-08 17:24:49 +02:00
|
|
|
|
|
|
|
if [ $change_domain -eq 1 ]
|
|
|
|
then
|
|
|
|
# Change domain in Kanboard configuration
|
2023-03-06 13:24:53 +01:00
|
|
|
ynh_replace_string --match_string="'${old_domain}'" --replace_string="'${new_domain}'" --target_file="${install_dir}/config.php"
|
2019-05-08 17:24:49 +02:00
|
|
|
fi
|
2019-05-06 19:31:34 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2022-05-27 23:17:20 +02:00
|
|
|
ynh_script_progression --message="Change of URL completed for $app" --last
|