1
0
CISS.2024.vps.bookworm.hard.../lib/mod/do_change_logrotate.lib
2024-08-01 19:06:49 +01:00

35 lines
2.0 KiB
Bash

#!/bin/bash
###########################################################################################
# Debian Bookworm VPS Hardening Setup Script V5.0.128.2024.07.24 #
###########################################################################################
# Copyright (c) 2019 - 2024, Marc Weidner, Centurion Intelligence Consulting Agency #
# https://coresecret.eu/ #
# Licensed under the EUROPEAN UNION PUBLIC LICENCE v. 1.2 https://eupl.eu/1.2/en/ #
###########################################################################################
# https://keys.openpgp.org/vks/v1/by-fingerprint/A6D46A56AE17A185AB0F6DB77095A8A13CBE0FA3 #
# Fingerprint A6D4 6A56 AE17 A185 AB0F 6DB7 7095 A8A1 3CBE 0FA3 ## valid till: 01.01.2031 #
###########################################################################################
# Module: exdo_change_logrotate #
###########################################################################################
# shellcheck disable=SC2129 disable=SC2162
set -o errexit # Exit if a command fails.
set -o nounset # Exit if an unset variable is used.
set -o pipefail # Exit if a pipeline fails.
set -o noclobber # Prevent output redirection ">", ">&", "<>" from overwriting existing files.
set +o history # Temporarily turn off history, to avoid sensitive information leakage.
exdo_change_logrotate() {
clear
date >>"$LOG_INS"
echo -e "\033[33m++++ ++++ ++++ ++++ ++++ ++++ ++ Updating Logrotate - ...\033[0m" | tee -a "$LOG_INS"
sed -i "s/weekly/daily/" /etc/logrotate.d/fail2ban
sed -i "s/rotate 4/rotate $LOGROTATE_COUNT/" /etc/logrotate.d/fail2ban
sed -i "s/weekly/daily/" /etc/logrotate.d/ufw
sed -i "s/rotate 4/rotate $LOGROTATE_COUNT/" /etc/logrotate.d/ufw
date >>"$LOG_INS"
echo -e "\033[32m++++ ++++ ++++ ++++ ++++ ++++ ++ Updating Logrotate - done\033[0m" | tee -a "$LOG_INS"
sleep "$SLEEPTIMER"
clear
}