diff --git a/src/freedombone-logging b/src/freedombone-logging index 1b15ffc8..ce2e875e 100755 --- a/src/freedombone-logging +++ b/src/freedombone-logging @@ -35,6 +35,44 @@ export TEXTDOMAINDIR="/usr/share/locale" WEBSERVER_LOG_LEVEL='warn' +function turn_off_rsys_logging { + sed -i 's|mail,news.none.*|mail,news.none /dev/null|g' /etc/rsyslog.conf + sed -i 's|auth,authpriv.\*.*|auth,authpriv.\* /dev/null|g' /etc/rsyslog.conf + sed -i 's|mail.info.*|mail.info /dev/null|g' /etc/rsyslog.conf + sed -i 's|mail.warn.*|mail.warn /dev/null|g' /etc/rsyslog.conf + sed -i 's|mail.err.*|mail.err /dev/null|g' /etc/rsyslog.conf + sed -i 's|daemon.\*.*|daemon.\* /dev/null|g' /etc/rsyslog.conf + sed -i 's|mail.\*.*|mail.\* /dev/null|g' /etc/rsyslog.conf + sed -i 's|user.\*.*|user.\* /dev/null|g' /etc/rsyslog.conf + sed -i 's|news.none;mail.none.*|news.none;mail.none /dev/null|g' /etc/rsyslog.conf + sed -i 's|\*.\*;auth,authpriv.none.*|\*.\*;auth,authpriv.none /dev/null|g' /etc/rsyslog.conf + sed -i 's|#cron.\*|cron.\*|g' /etc/rsyslog.conf + sed -i 's|cron.\*.*|cron.\* /dev/null|g' /etc/rsyslog.conf + shred -zu /var/log/wtmp* + shred -zu /var/log/debug* + shred -zu /var/log/cron.* + shred -zu /var/log/auth.* + shred -zu /var/log/mail.* + shred -zu /var/log/daemon.* + shred -zu /var/log/user.* + shred -zu /var/log/messages* +} + +function turn_on_rsys_logging { + sed -i 's|mail,news.none.*|mail,news.none -/var/log/messages|g' /etc/rsyslog.conf + sed -i 's|auth,authpriv.\*.*|auth,authpriv.\* /var/log/auth.log|g' /etc/rsyslog.conf + sed -i 's|mail.info.*|mail.info -/var/log/mail.info|g' /etc/rsyslog.conf + sed -i 's|mail.warn.*|mail.warn -/var/log/mail.warn|g' /etc/rsyslog.conf + sed -i 's|mail.err.*|mail.err /var/log/mail.err|g' /etc/rsyslog.conf + sed -i 's|daemon.\*.*|daemon.\* -/var/log/daemon.log|g' /etc/rsyslog.conf + sed -i 's|mail.\*.*|mail.\* -/var/log/mail.log|g' /etc/rsyslog.conf + sed -i 's|user.\*.*|user.\* -/var/log/user.log|g' /etc/rsyslog.conf + sed -i 's|news.none;mail.none.*|news.none;mail.none -/var/log/debug|g' /etc/rsyslog.conf + sed -i 's|\*.\*;auth,authpriv.none.*|\*.\*;auth,authpriv.none -/var/log/syslog|g' /etc/rsyslog.conf + sed -i 's|#cron.\*|cron.\*|g' /etc/rsyslog.conf + sed -i 's|cron.\*.*|cron.\* /var/log/cron.log|g' /etc/rsyslog.conf +} + if [ ! "$1" ]; then exit 1 fi @@ -95,19 +133,7 @@ if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then fi sed -i 's|log_error =.*|log_error = /var/log/mysql/error.log|g' /etc/mysql/my.cnf fi - - sed -i 's|mail,news.none.*|mail,news.none -/var/log/messages|g' /etc/rsyslog.conf - sed -i 's|auth,authpriv.\*.*|auth,authpriv.\* /var/log/auth.log|g' /etc/rsyslog.conf - sed -i 's|mail.info.*|mail.info -/var/log/mail.info|g' /etc/rsyslog.conf - sed -i 's|mail.warn.*|mail.warn -/var/log/mail.warn|g' /etc/rsyslog.conf - sed -i 's|mail.err.*|mail.err /var/log/mail.err|g' /etc/rsyslog.conf - sed -i 's|daemon.\*.*|daemon.\* -/var/log/daemon.log|g' /etc/rsyslog.conf - sed -i 's|mail.\*.*|mail.\* -/var/log/mail.log|g' /etc/rsyslog.conf - sed -i 's|user.\*.*|user.\* -/var/log/user.log|g' /etc/rsyslog.conf - sed -i 's|news.none;mail.none.*|news.none;mail.none -/var/log/debug|g' /etc/rsyslog.conf - sed -i 's|\*.\*;auth,authpriv.none.*|\*.\*;auth,authpriv.none -/var/log/syslog|g' /etc/rsyslog.conf - sed -i 's|#cron.\*|cron.\*|g' /etc/rsyslog.conf - sed -i 's|cron.\*.*|cron.\* /var/log/cron.log|g' /etc/rsyslog.conf + turn_on_rsys_logging else if [ -d /etc/tor ]; then sed -i 's|#Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc @@ -180,26 +206,7 @@ else sed -i 's|logtarget.*|logtarget = /dev/null|g' /etc/fail2ban/fail2ban.conf shred -zu /var/log/fail2ban.* fi - sed -i 's|mail,news.none.*|mail,news.none /dev/null|g' /etc/rsyslog.conf - sed -i 's|auth,authpriv.\*.*|auth,authpriv.\* /dev/null|g' /etc/rsyslog.conf - sed -i 's|mail.info.*|mail.info /dev/null|g' /etc/rsyslog.conf - sed -i 's|mail.warn.*|mail.warn /dev/null|g' /etc/rsyslog.conf - sed -i 's|mail.err.*|mail.err /dev/null|g' /etc/rsyslog.conf - sed -i 's|daemon.\*.*|daemon.\* /dev/null|g' /etc/rsyslog.conf - sed -i 's|mail.\*.*|mail.\* /dev/null|g' /etc/rsyslog.conf - sed -i 's|user.\*.*|user.\* /dev/null|g' /etc/rsyslog.conf - sed -i 's|news.none;mail.none.*|news.none;mail.none /dev/null|g' /etc/rsyslog.conf - sed -i 's|\*.\*;auth,authpriv.none.*|\*.\*;auth,authpriv.none /dev/null|g' /etc/rsyslog.conf - sed -i 's|#cron.\*|cron.\*|g' /etc/rsyslog.conf - sed -i 's|cron.\*.*|cron.\* /dev/null|g' /etc/rsyslog.conf - shred -zu /var/log/wtmp* - shred -zu /var/log/debug* - shred -zu /var/log/cron.* - shred -zu /var/log/auth.* - shred -zu /var/log/mail.* - shred -zu /var/log/daemon.* - shred -zu /var/log/user.* - shred -zu /var/log/messages* + turn_off_rsys_logging fi systemctl restart syslog diff --git a/src/freedombone-utils-setup b/src/freedombone-utils-setup index 3c05a631..530cfaef 100755 --- a/src/freedombone-utils-setup +++ b/src/freedombone-utils-setup @@ -147,6 +147,29 @@ function install_backports_kernel { fi } +function turn_off_rsys_logging { + sed -i 's|mail,news.none.*|mail,news.none /dev/null|g' /etc/rsyslog.conf + sed -i 's|auth,authpriv.\*.*|auth,authpriv.\* /dev/null|g' /etc/rsyslog.conf + sed -i 's|mail.info.*|mail.info /dev/null|g' /etc/rsyslog.conf + sed -i 's|mail.warn.*|mail.warn /dev/null|g' /etc/rsyslog.conf + sed -i 's|mail.err.*|mail.err /dev/null|g' /etc/rsyslog.conf + sed -i 's|daemon.\*.*|daemon.\* /dev/null|g' /etc/rsyslog.conf + sed -i 's|mail.\*.*|mail.\* /dev/null|g' /etc/rsyslog.conf + sed -i 's|user.\*.*|user.\* /dev/null|g' /etc/rsyslog.conf + sed -i 's|news.none;mail.none.*|news.none;mail.none /dev/null|g' /etc/rsyslog.conf + sed -i 's|\*.\*;auth,authpriv.none.*|\*.\*;auth,authpriv.none /dev/null|g' /etc/rsyslog.conf + sed -i 's|#cron.\*|cron.\*|g' /etc/rsyslog.conf + sed -i 's|cron.\*.*|cron.\* /dev/null|g' /etc/rsyslog.conf + shred -zu /var/log/wtmp* + shred -zu /var/log/debug* + shred -zu /var/log/cron.* + shred -zu /var/log/auth.* + shred -zu /var/log/mail.* + shred -zu /var/log/daemon.* + shred -zu /var/log/user.* + shred -zu /var/log/messages* +} + function initial_setup { if [[ $(is_completed $FUNCNAME) == "1" ]]; then return @@ -330,6 +353,9 @@ function setup_utils { read_config_param "PROJECT_REPO" write_config_param "PROJECT_REPO" "$PROJECT_REPO" + function_check turn_off_rsys_logging + turn_off_rsys_logging + function_check install_backports_kernel install_backports_kernel