Bob Mottram vor 8 Jahren
Ursprung
Commit
98c312fec5
2 geänderte Dateien mit 66 neuen und 33 gelöschten Zeilen
  1. 40
    33
      src/freedombone-logging
  2. 26
    0
      src/freedombone-utils-setup

+ 40
- 33
src/freedombone-logging Datei anzeigen

@@ -35,6 +35,44 @@ export TEXTDOMAINDIR="/usr/share/locale"
35 35
 
36 36
 WEBSERVER_LOG_LEVEL='warn'
37 37
 
38
+function turn_off_rsys_logging {
39
+    sed -i 's|mail,news.none.*|mail,news.none      /dev/null|g' /etc/rsyslog.conf
40
+    sed -i 's|auth,authpriv.\*.*|auth,authpriv.\*         /dev/null|g' /etc/rsyslog.conf
41
+    sed -i 's|mail.info.*|mail.info            /dev/null|g' /etc/rsyslog.conf
42
+    sed -i 's|mail.warn.*|mail.warn            /dev/null|g' /etc/rsyslog.conf
43
+    sed -i 's|mail.err.*|mail.err            /dev/null|g' /etc/rsyslog.conf
44
+    sed -i 's|daemon.\*.*|daemon.\*              /dev/null|g' /etc/rsyslog.conf
45
+    sed -i 's|mail.\*.*|mail.\*              /dev/null|g' /etc/rsyslog.conf
46
+    sed -i 's|user.\*.*|user.\*              /dev/null|g' /etc/rsyslog.conf
47
+    sed -i 's|news.none;mail.none.*|news.none;mail.none /dev/null|g' /etc/rsyslog.conf
48
+    sed -i 's|\*.\*;auth,authpriv.none.*|\*.\*;auth,authpriv.none      /dev/null|g' /etc/rsyslog.conf
49
+    sed -i 's|#cron.\*|cron.\*|g' /etc/rsyslog.conf
50
+    sed -i 's|cron.\*.*|cron.\*             /dev/null|g' /etc/rsyslog.conf
51
+    shred -zu /var/log/wtmp*
52
+    shred -zu /var/log/debug*
53
+    shred -zu /var/log/cron.*
54
+    shred -zu /var/log/auth.*
55
+    shred -zu /var/log/mail.*
56
+    shred -zu /var/log/daemon.*
57
+    shred -zu /var/log/user.*
58
+    shred -zu /var/log/messages*
59
+}
60
+
61
+function turn_on_rsys_logging {
62
+    sed -i 's|mail,news.none.*|mail,news.none      -/var/log/messages|g' /etc/rsyslog.conf
63
+    sed -i 's|auth,authpriv.\*.*|auth,authpriv.\*         /var/log/auth.log|g' /etc/rsyslog.conf
64
+    sed -i 's|mail.info.*|mail.info            -/var/log/mail.info|g' /etc/rsyslog.conf
65
+    sed -i 's|mail.warn.*|mail.warn            -/var/log/mail.warn|g' /etc/rsyslog.conf
66
+    sed -i 's|mail.err.*|mail.err            /var/log/mail.err|g' /etc/rsyslog.conf
67
+    sed -i 's|daemon.\*.*|daemon.\*              -/var/log/daemon.log|g' /etc/rsyslog.conf
68
+    sed -i 's|mail.\*.*|mail.\*              -/var/log/mail.log|g' /etc/rsyslog.conf
69
+    sed -i 's|user.\*.*|user.\*              -/var/log/user.log|g' /etc/rsyslog.conf
70
+    sed -i 's|news.none;mail.none.*|news.none;mail.none -/var/log/debug|g' /etc/rsyslog.conf
71
+    sed -i 's|\*.\*;auth,authpriv.none.*|\*.\*;auth,authpriv.none      -/var/log/syslog|g' /etc/rsyslog.conf
72
+    sed -i 's|#cron.\*|cron.\*|g' /etc/rsyslog.conf
73
+    sed -i 's|cron.\*.*|cron.\*             /var/log/cron.log|g' /etc/rsyslog.conf
74
+}
75
+
38 76
 if [ ! "$1" ]; then
39 77
     exit 1
40 78
 fi
@@ -95,19 +133,7 @@ if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
95 133
         fi
96 134
         sed -i 's|log_error =.*|log_error = /var/log/mysql/error.log|g' /etc/mysql/my.cnf
97 135
     fi
98
-
99
-    sed -i 's|mail,news.none.*|mail,news.none      -/var/log/messages|g' /etc/rsyslog.conf
100
-    sed -i 's|auth,authpriv.\*.*|auth,authpriv.\*         /var/log/auth.log|g' /etc/rsyslog.conf
101
-    sed -i 's|mail.info.*|mail.info            -/var/log/mail.info|g' /etc/rsyslog.conf
102
-    sed -i 's|mail.warn.*|mail.warn            -/var/log/mail.warn|g' /etc/rsyslog.conf
103
-    sed -i 's|mail.err.*|mail.err            /var/log/mail.err|g' /etc/rsyslog.conf
104
-    sed -i 's|daemon.\*.*|daemon.\*              -/var/log/daemon.log|g' /etc/rsyslog.conf
105
-    sed -i 's|mail.\*.*|mail.\*              -/var/log/mail.log|g' /etc/rsyslog.conf
106
-    sed -i 's|user.\*.*|user.\*              -/var/log/user.log|g' /etc/rsyslog.conf
107
-    sed -i 's|news.none;mail.none.*|news.none;mail.none -/var/log/debug|g' /etc/rsyslog.conf
108
-    sed -i 's|\*.\*;auth,authpriv.none.*|\*.\*;auth,authpriv.none      -/var/log/syslog|g' /etc/rsyslog.conf
109
-    sed -i 's|#cron.\*|cron.\*|g' /etc/rsyslog.conf
110
-    sed -i 's|cron.\*.*|cron.\*             /var/log/cron.log|g' /etc/rsyslog.conf
136
+    turn_on_rsys_logging
111 137
 else
112 138
     if [ -d /etc/tor ]; then
113 139
         sed -i 's|#Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
@@ -180,26 +206,7 @@ else
180 206
         sed -i 's|logtarget.*|logtarget = /dev/null|g' /etc/fail2ban/fail2ban.conf
181 207
         shred -zu /var/log/fail2ban.*
182 208
     fi
183
-    sed -i 's|mail,news.none.*|mail,news.none      /dev/null|g' /etc/rsyslog.conf
184
-    sed -i 's|auth,authpriv.\*.*|auth,authpriv.\*         /dev/null|g' /etc/rsyslog.conf
185
-    sed -i 's|mail.info.*|mail.info            /dev/null|g' /etc/rsyslog.conf
186
-    sed -i 's|mail.warn.*|mail.warn            /dev/null|g' /etc/rsyslog.conf
187
-    sed -i 's|mail.err.*|mail.err            /dev/null|g' /etc/rsyslog.conf
188
-    sed -i 's|daemon.\*.*|daemon.\*              /dev/null|g' /etc/rsyslog.conf
189
-    sed -i 's|mail.\*.*|mail.\*              /dev/null|g' /etc/rsyslog.conf
190
-    sed -i 's|user.\*.*|user.\*              /dev/null|g' /etc/rsyslog.conf
191
-    sed -i 's|news.none;mail.none.*|news.none;mail.none /dev/null|g' /etc/rsyslog.conf
192
-    sed -i 's|\*.\*;auth,authpriv.none.*|\*.\*;auth,authpriv.none      /dev/null|g' /etc/rsyslog.conf
193
-    sed -i 's|#cron.\*|cron.\*|g' /etc/rsyslog.conf
194
-    sed -i 's|cron.\*.*|cron.\*             /dev/null|g' /etc/rsyslog.conf
195
-    shred -zu /var/log/wtmp*
196
-    shred -zu /var/log/debug*
197
-    shred -zu /var/log/cron.*
198
-    shred -zu /var/log/auth.*
199
-    shred -zu /var/log/mail.*
200
-    shred -zu /var/log/daemon.*
201
-    shred -zu /var/log/user.*
202
-    shred -zu /var/log/messages*
209
+    turn_off_rsys_logging
203 210
 fi
204 211
 
205 212
 systemctl restart syslog

+ 26
- 0
src/freedombone-utils-setup Datei anzeigen

@@ -147,6 +147,29 @@ function install_backports_kernel {
147 147
     fi
148 148
 }
149 149
 
150
+function turn_off_rsys_logging {
151
+    sed -i 's|mail,news.none.*|mail,news.none      /dev/null|g' /etc/rsyslog.conf
152
+    sed -i 's|auth,authpriv.\*.*|auth,authpriv.\*         /dev/null|g' /etc/rsyslog.conf
153
+    sed -i 's|mail.info.*|mail.info            /dev/null|g' /etc/rsyslog.conf
154
+    sed -i 's|mail.warn.*|mail.warn            /dev/null|g' /etc/rsyslog.conf
155
+    sed -i 's|mail.err.*|mail.err            /dev/null|g' /etc/rsyslog.conf
156
+    sed -i 's|daemon.\*.*|daemon.\*              /dev/null|g' /etc/rsyslog.conf
157
+    sed -i 's|mail.\*.*|mail.\*              /dev/null|g' /etc/rsyslog.conf
158
+    sed -i 's|user.\*.*|user.\*              /dev/null|g' /etc/rsyslog.conf
159
+    sed -i 's|news.none;mail.none.*|news.none;mail.none /dev/null|g' /etc/rsyslog.conf
160
+    sed -i 's|\*.\*;auth,authpriv.none.*|\*.\*;auth,authpriv.none      /dev/null|g' /etc/rsyslog.conf
161
+    sed -i 's|#cron.\*|cron.\*|g' /etc/rsyslog.conf
162
+    sed -i 's|cron.\*.*|cron.\*             /dev/null|g' /etc/rsyslog.conf
163
+    shred -zu /var/log/wtmp*
164
+    shred -zu /var/log/debug*
165
+    shred -zu /var/log/cron.*
166
+    shred -zu /var/log/auth.*
167
+    shred -zu /var/log/mail.*
168
+    shred -zu /var/log/daemon.*
169
+    shred -zu /var/log/user.*
170
+    shred -zu /var/log/messages*
171
+}
172
+
150 173
 function initial_setup {
151 174
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
152 175
         return
@@ -330,6 +353,9 @@ function setup_utils {
330 353
     read_config_param "PROJECT_REPO"
331 354
     write_config_param "PROJECT_REPO" "$PROJECT_REPO"
332 355
 
356
+    function_check turn_off_rsys_logging
357
+    turn_off_rsys_logging
358
+
333 359
     function_check install_backports_kernel
334 360
     install_backports_kernel
335 361