|
Rozmiar: 6010
Komentarz: s/sbin/bin/
|
Rozmiar: 7752
Komentarz: + podpis, dodatkowe łatki
|
| Usunięcia zostały oznaczone w ten sposób. | Dodatki zostały oznaczone w ten sposób. |
| Linia 27: | Linia 27: |
| === violations.d === | === violations.d/kernel === |
| Linia 29: | Linia 29: |
| {{{#!bsdmake numbers=off --- kernel.orig 2014-12-08 12:24:33.312207000 +0100 +++ kernel 2014-12-09 11:12:54.385550315 +0100 |
{{{#!diff numbers=off --- /usr/local/etc/logcheck/violations.d/kernel 2015-06-30 01:57:35.000000000 +0200 +++ /usr/local/etc/logcheck/violations.d/kernel.new 2015-07-07 05:23:31.130598196 +0200 |
| Linia 38: | Linia 38: |
| === ignore.d.server === {{{#!bsdmake numbers=off |
=== ignore.d.server/cyrus === {{{#!diff numbers=off |
| Linia 57: | Linia 57: |
| === ignore.d.server/kernel === {{{#!diff numbers=off --- /usr/local/etc/logcheck/ignore.d.server/kernel 2015-07-10 15:04:00.081964266 +0200 +++ /usr/local/etc/logcheck/ignore.d.server/kernel.new 2015-07-10 15:03:53.648964998 +0200 @@ -79,3 +79,4 @@ ^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ kernel: imklog [.[:digit:]]+, log source = /proc/kmsg started\.$ ^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ kernel: Kernel logging \(proc\) stopped\.$ ^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ kernel:( \[ *[[:digit:]]+\.[[:digit:]]+\])? kvm: emulating exchange as write$ +^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ kernel:( \[ *[[:digit:]]+\.[[:digit:]]+\])? .*NetScreen device_id= }}} === ignore.d.server/stunnel === {{{#!diff numbers=off --- /usr/local/etc/logcheck/ignore.d.server/stunnel.orig 2015-06-30 01:57:35.000000000 +0200 +++ /usr/local/etc/logcheck/ignore.d.server/stunnel 2015-07-07 02:17:53.273364642 +0200 @@ -5,3 +5,4 @@ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ stunnel(\[[0-9]+\])?: stunnel [0-9.]+ on i386-pc-linux-gnu PTHREAD\+POLL\+IPv6\+LIBWRAP with OpenSSL [0-9a-z.]+ [0-9]{2} \w{3} [0-9]{4}$ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ stunnel(\[[0-9]+\])?: [0-9]+ clients allowed$ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ stunnel(\[[0-9]+\])?: SSL_accept: Peer suddenly disconnected$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ stunnel(\[[0-9]+\])?: LOG[35] }}} |
|
| Linia 63: | Linia 85: |
| albo korzystając z [[PoudriereBinaryPkg|własnego repozytorium]] pakietów: {{{#!shell numbers=off pkg install gnugrep }}} |
|
| Linia 66: | Linia 92: |
| {{{#!bsdmake numbers=off --- /usr/local/sbin/logcheck.orig 2014-12-08 12:24:33.282207000 +0100 +++ /usr/local/sbin/logcheck 2014-12-09 11:21:14.922515719 +0100 |
{{{#!diff numbers=off --- /usr/local/sbin/logcheck 2015-06-02 21:58:07.000000000 +0200 +++ /usr/local/sbin/logcheck.new 2015-06-10 21:37:54.000798776 +0200 |
| Linia 96: | Linia 122: |
| @@ -386,7 +386,7 @@ | @@ -380,13 +380,13 @@ return $RETURN } -# Process a logfile snippet with egrep. +# Process a logfile snippet with /usr/local/bin/egrep. cleanchecked() { clean="$1" |
| Linia 123: | Linia 156: |
| Linia 126: | Linia 160: |
| {i} Wszelkie uwagi proszę kierować do administratora wiki. | {i} ` `<<GetVal(SlownikNewBsd,adm-podpis)>> |
Spis Treści
Konfiguracja logcheck
Uprawnienia do plików
Po zainstalowaniu logcheck (od wersji logcheck-1.2.69_1) trzeba nieco "poprawić" uprawnienia w systemie plików, aby logcheck działał poprawnie:
# dla partycji UFS
#
setfacl -m u:logcheck:rwx /var/log
setfacl -m g:logcheck:r /var/log/security /var/log/auth.log
# dla partycji ZFS
#
setfacl -m u:logcheck:rwx::allow /var/log
setfacl -m g:logcheck:r::allow /var/log/security /var/log/auth.log
chgrp -R logcheck /var/log/sudo/
chown -R logcheck /usr/local/share/logcheck/detectrotate/
Patchowanie wybranych plików
violations.d/kernel
--- /usr/local/etc/logcheck/violations.d/kernel 2015-06-30 01:57:35.000000000 +0200
+++ /usr/local/etc/logcheck/violations.d/kernel.new 2015-07-07 05:23:31.130598196 +0200
@@ -1,2 +1,2 @@
-^\w{3} [ :0-9]{11} [._[:alnum:]-]+ kernel:( \[ *[[:digit:]]+\.[[:digit:]]+\])? [[:alnum:]]+: media error \(bad sector\): status=0x[[:xdigit:]]+ { DriveReady SeekComplete Error }$
+^\w{3} [ :0-9]{11} [._[:alnum:]-]+ kernel:( \[ *[[:digit:]]+\.[[:digit:]]+\])? [[:alnum:]]+: media error \(bad sector\): status=0x[[:xdigit:]]+ \{ DriveReady SeekComplete Error \}$
^\w{3} [ :0-9]{11} [._[:alnum:]-]+ kernel:( \[ *[[:digit:]]+\.[[:digit:]]+\])? end_request: I/O error, dev [[:alnum:]]+, sector [[:digit:]]+
ignore.d.server/cyrus
--- cyrus.orig 2014-03-18 00:18:27.000000000 +0100
+++ cyrus 2014-07-30 00:47:50.000000000 +0200
@@ -4,3 +4,12 @@
^\w{3} [ :0-9]{11} [._[:alnum:]-]+ cyrus/lmtpd\[[0-9]+\]: DBERROR db3: [12] lockers$
^\w{3} [ :0-9]{11} [._[:alnum:]-]+ cyrus/notifyd\[[0-9]+\]: MAIL, , [^[:space:]]+, [^[:space:]]+, \"[ [:alnum:][:punct:]]+\"$
^\w{3} [ :0-9]{11} [._[:alnum:]-]+ cyrus/squatter\[[0-9]+\]: (skipping|indexing) mailbox [[:alpha:]^\.]+\.\.\.$
+^\w{3} [ :0-9]{11} [._[:alnum:]-]+ ctl_cyrusdb\[[0-9]+\]: (done )?checkpointing cyrus databases
+^\w{3} [ :0-9]{11} [._[:alnum:]-]+ pop3s?\[[0-9]+\]: counts: retr
+^\w{3} [ :0-9]{11} [._[:alnum:]-]+ pop3s?\[[0-9]+\]: starttls: TLSv1 with cipher
+^\w{3} [ :0-9]{11} [._[:alnum:]-]+ pop3s?\[[0-9]+\]: imapd:Loading hard-coded DH parameters
+^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (pop3s?|lmtpunix|imap)\[[0-9]+\]: USAGE [^[:space:]]+ user:
+^\w{3} [ :0-9]{11} [._[:alnum:]-]+ pop3s?\[[0-9]+\]: Expunged [0-9]+ messages from user
+^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (pop3s?|imap)\[[0-9]+\]: .* User logged in SESSIONID=
+^\w{3} [ :0-9]{11} [._[:alnum:]-]+ sieve\[[0-9]+\]: .* User logged in
+^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (pop3s?|imap)\[[0-9]+\]: .* starttls:
ignore.d.server/kernel
--- /usr/local/etc/logcheck/ignore.d.server/kernel 2015-07-10 15:04:00.081964266 +0200
+++ /usr/local/etc/logcheck/ignore.d.server/kernel.new 2015-07-10 15:03:53.648964998 +0200
@@ -79,3 +79,4 @@
^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ kernel: imklog [.[:digit:]]+, log source = /proc/kmsg started\.$
^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ kernel: Kernel logging \(proc\) stopped\.$
^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ kernel:( \[ *[[:digit:]]+\.[[:digit:]]+\])? kvm: emulating exchange as write$
+^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ kernel:( \[ *[[:digit:]]+\.[[:digit:]]+\])? .*NetScreen device_id=
ignore.d.server/stunnel
--- /usr/local/etc/logcheck/ignore.d.server/stunnel.orig 2015-06-30 01:57:35.000000000 +0200
+++ /usr/local/etc/logcheck/ignore.d.server/stunnel 2015-07-07 02:17:53.273364642 +0200
@@ -5,3 +5,4 @@
^\w{3} [ :0-9]{11} [._[:alnum:]-]+ stunnel(\[[0-9]+\])?: stunnel [0-9.]+ on i386-pc-linux-gnu PTHREAD\+POLL\+IPv6\+LIBWRAP with OpenSSL [0-9a-z.]+ [0-9]{2} \w{3} [0-9]{4}$
^\w{3} [ :0-9]{11} [._[:alnum:]-]+ stunnel(\[[0-9]+\])?: [0-9]+ clients allowed$
^\w{3} [ :0-9]{11} [._[:alnum:]-]+ stunnel(\[[0-9]+\])?: SSL_accept: Peer suddenly disconnected$
+^\w{3} [ :0-9]{11} [._[:alnum:]-]+ stunnel(\[[0-9]+\])?: LOG[35]
gnugrep
Dla systemów FreeBSD, w których jest bsdgrep (jako domyślny w base system), to konieczność jest modyfikacji logcheck aby korzystał z gnugrep (są jakieś drobne różnice):
portupgrade -N gnugrep
albo korzystając z własnego repozytorium pakietów:
pkg install gnugrep
Oraz zapatchowanie samej binarki:
--- /usr/local/sbin/logcheck 2015-06-02 21:58:07.000000000 +0200
+++ /usr/local/sbin/logcheck.new 2015-06-10 21:37:54.000798776 +0200
@@ -204,7 +204,7 @@
debug "cleanrules: ${dir}/${rulefile}"
if [ -r "${dir}/${rulefile}" ]; then
# pipe to cat on greps to get usable exit status
- egrep --text -v '^[[:space:]]*$|^#' "$dir/$rulefile" | cat \
+ /usr/local/bin/egrep --text -v '^[[:space:]]*$|^#' "$dir/$rulefile" | cat \
>> "$cleaned/$rulefile" \
|| error "Couldn't append to $cleaned/$rulefile."
else
@@ -227,7 +227,7 @@
if [ "$SYSLOGSUMMARY" -eq 1 ] && [ -x "$SYSLOG_SUMMARY" ]; then
debug "report: running syslog-summary - $*"
$SYSLOG_SUMMARY "$TMPDIR/checked" | \
- egrep -v "^Summarizing " | cat >> "$TMPDIR/report" \
+ /usr/local/bin/egrep -v "^Summarizing " | cat >> "$TMPDIR/report" \
|| error "Could not append to report."
else
if [ "$SYSLOGSUMMARY" -eq 1 ] && [ ! -x "$SYSLOG_SUMMARY" ]; then
@@ -309,7 +309,7 @@
debug "greplogoutput: $grepfile"
# Raise entries that match
- egrep --text -f "$raise/$grepfile" "$TMPDIR/logoutput-sorted" | cat \
+ /usr/local/bin/egrep --text -f "$raise/$grepfile" "$TMPDIR/logoutput-sorted" | cat \
> "$TMPDIR/checked" \
|| error "Could not output to $TMPDIR/checked."
@@ -380,13 +380,13 @@
return $RETURN
}
-# Process a logfile snippet with egrep.
+# Process a logfile snippet with /usr/local/bin/egrep.
cleanchecked() {
clean="$1"
if [ -f "$clean" ]; then
debug "cleanchecked - file: $clean"
- egrep --text -v -f "$clean" "$TMPDIR/checked" | cat >> "$TMPDIR/checked.1" \
+ /usr/local/bin/egrep --text -v -f "$clean" "$TMPDIR/checked" | cat >> "$TMPDIR/checked.1" \
|| error "Could not output to $TMPDIR/checked.1."
mv "$TMPDIR/checked.1" "$TMPDIR/checked" \
|| error "Could not move $TMPDIR/checked.1 to $TMPDIR/checked"
@@ -394,7 +394,7 @@
debug "cleanchecked - dir - $clean"
for file in $(ls -1 "$clean/"); do
debug "cleanchecked - dir - $clean/$file"
- egrep --text -v -f "$clean/$file" "$TMPDIR/checked" | cat \
+ /usr/local/bin/egrep --text -v -f "$clean/$file" "$TMPDIR/checked" | cat \
>> "$TMPDIR/checked.1" \
|| error "Could not output to TMPDIR/checked.1."
mv "$TMPDIR/checked.1" "$TMPDIR/checked" \
@@ -641,7 +641,7 @@
|| error "Could not mkdir for log files"
if [ ! "$LOGFILE" ] && [ -r "$LOGFILES_LIST" ]; then
SAVEIFS=$IFS; IFS=$(echo -en "\n\b");
- for file in $(egrep --text -v "(^#|^[[:space:]]*$)" "$LOGFILES_LIST"); do
+ for file in $(/usr/local/bin/egrep --text -v "(^#|^[[:space:]]*$)" "$LOGFILES_LIST"); do
logoutput "$file"
done
IFS=$SAVEIFS
(c) 2004 - 2026 BSD Serwis Krzysztof Stryjek. W przypadku błędów, poprawek proszę kontaktować się z administratorem wiki.
