1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/friendica_ynh.git synced 2024-09-03 18:36:14 +02:00

add fail2ban

This commit is contained in:
Éric Gaspar 2023-08-21 10:13:29 +02:00
parent 57c3bb36f9
commit 76aa357057
5 changed files with 20 additions and 1 deletions

View file

@ -33,6 +33,13 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP FAIL2BAN CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
#=================================================
# BACKUP VARIOUS FILES
#=================================================

View file

@ -88,6 +88,9 @@ ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"<HOST>\".*$"
#=================================================
# INSTALL FRIENDICA
#=================================================

View file

@ -21,7 +21,9 @@ ynh_remove_nginx_config
ynh_remove_fpm_config
# Remove the app-specific logrotate config
ynh_remove_logrotate
#ynh_remove_logrotate
ynh_remove_fail2ban_config
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"

View file

@ -41,6 +41,10 @@ ynh_restore_file "/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
ynh_systemd_action --action=restart --service_name=fail2ban
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -122,6 +122,9 @@ ynh_add_nginx_config
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"<HOST>\".*$"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================