mirror of
https://github.com/YunoHost-Apps/shaarli_ynh.git
synced 2024-09-03 20:26:10 +02:00
parent
225d5fe51e
commit
4a7390447f
3 changed files with 4 additions and 4 deletions
|
@ -31,7 +31,7 @@ pkg_dependencies="php-cli php-gettext php-curl php-intl php-gd php-mbstring open
|
||||||
# | arg: failregex - Failregex to be looked for by fail2ban
|
# | arg: failregex - Failregex to be looked for by fail2ban
|
||||||
# | arg: max_retry - Maximum number of retries allowed before banning IP address - default: 3
|
# | arg: max_retry - Maximum number of retries allowed before banning IP address - default: 3
|
||||||
# | arg: ports - Ports blocked for a banned IP address - default: http,https
|
# | arg: ports - Ports blocked for a banned IP address - default: http,https
|
||||||
ynh_add_fail2ban_config () {
|
ynh_add_fail2ban_config_temp () {
|
||||||
# Process parameters
|
# Process parameters
|
||||||
logpath=$1
|
logpath=$1
|
||||||
failregex=$2
|
failregex=$2
|
||||||
|
@ -66,7 +66,7 @@ EOF
|
||||||
ynh_store_file_checksum "$finalfail2banjailconf"
|
ynh_store_file_checksum "$finalfail2banjailconf"
|
||||||
ynh_store_file_checksum "$finalfail2banfilterconf"
|
ynh_store_file_checksum "$finalfail2banfilterconf"
|
||||||
|
|
||||||
systemctl restart fail2ban
|
service fail2ban restart
|
||||||
local fail2ban_error="$(journalctl -u fail2ban | tail -n50 | grep "WARNING.*$app.*")"
|
local fail2ban_error="$(journalctl -u fail2ban | tail -n50 | grep "WARNING.*$app.*")"
|
||||||
if [ -n "$fail2ban_error" ]
|
if [ -n "$fail2ban_error" ]
|
||||||
then
|
then
|
||||||
|
|
|
@ -159,7 +159,7 @@ ynh_use_logrotate "$final_path/data/log.txt"
|
||||||
# SETUP FAIL2BAN
|
# SETUP FAIL2BAN
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Add Fail2Ban configuration..."
|
ynh_print_info "Add Fail2Ban configuration..."
|
||||||
ynh_add_fail2ban_config "$final_path/data/log.txt" "\s-\s<HOST>\s-\sLogin failed for user.*$" 5
|
ynh_add_fail2ban_config_temp "$final_path/data/log.txt" "\s-\s<HOST>\s-\sLogin failed for user.*$" 5
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
|
|
@ -135,7 +135,7 @@ ynh_use_logrotate --non-append
|
||||||
# SETUP FAIL2BAN
|
# SETUP FAIL2BAN
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Upgrading Fail2Ban configuration..."
|
ynh_print_info "Upgrading Fail2Ban configuration..."
|
||||||
ynh_add_fail2ban_config "$final_path/data/log.txt" "\s-\s<HOST>\s-\sLogin failed for user.*$" 5
|
ynh_add_fail2ban_config_temp "$final_path/data/log.txt" "\s-\s<HOST>\s-\sLogin failed for user.*$" 5
|
||||||
|
|
||||||
# Set right permissions
|
# Set right permissions
|
||||||
chown -R $app: $final_path
|
chown -R $app: $final_path
|
||||||
|
|
Loading…
Add table
Reference in a new issue