From 37f459efd2972742bdfee20a12b40e51b5cd00db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 26 Sep 2023 12:28:43 +0200 Subject: [PATCH] Fix /var/log/app creation before fail2ban run --- scripts/install | 5 +++++ scripts/restore | 2 ++ 2 files changed, 7 insertions(+) diff --git a/scripts/install b/scripts/install index ef7b1ff..555fd5b 100755 --- a/scripts/install +++ b/scripts/install @@ -36,6 +36,11 @@ ynh_add_systemd_config yunohost service add "$app" --description="httpsh on ttyd web terminal" --log="/var/log/$app/$app.log" +mkdir "/var/log/$app" +touch "/var/log/$app/$app.log" +chown -R "$app:$app" "/var/log/$app" +chmod -R 750 "/var/log/$app" + ynh_use_logrotate ynh_add_fail2ban_config --logpath="/var/log/$app/$app.log" --failregex="^error: maximum authentication attempts exceeded for .* from $" diff --git a/scripts/restore b/scripts/restore index e10dfc1..15bf90d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -34,6 +34,8 @@ yunohost service add "$app" --description="httpsh on ttyd web terminal" --log="/ mkdir "/var/log/$app" touch "/var/log/$app/$app.log" chown -R "$app:$app" "/var/log/$app" +chmod -R 750 "/var/log/$app" + ynh_restore_file --origin_path="/etc/logrotate.d/$app"