Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 501666 - app-admin/logcheck ignores config, mails wrong user
Summary: app-admin/logcheck ignores config, mails wrong user
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Paweł Hajdan, Jr. (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-18 08:16 UTC by John Harlan
Modified: 2016-10-17 01:04 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
/etc/logcheck/logcheck.conf (logcheck_logcheck-conf.txt,2.63 KB, text/plain)
2014-02-18 08:16 UTC, John Harlan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Harlan 2014-02-18 08:16:43 UTC
Created attachment 370694 [details]
/etc/logcheck/logcheck.conf

Synopsis: logcheck will send mail to "logcheck" when logcheck.cron is executed by cron; but not when executed by root.

Full description: When cron (vixie-cron) runs logcheck.cron logcheck tries to mail the results to "logcheck", even though logcheck.conf specifies a different user for receiving logcheck's mail.

When root executes logcheck.cron logcheck correctly mails it's output to the specified user.

Relavent bits & files:

######
### /etc/logcheck/logcheck.conf
###
### Note: included as attachment as it is many lines and only includes one line of relavence, see mail.log if you don't want to open it.
######
#...
REPORTLEVEL="server"

# Controls the address mail goes to:
# *NOTE* the script does not set a default value for this variable!
# Should be set to an offsite "emailaddress@some.domain.tld"

SENDMAILTO="perth"

# Send the results as attachment or not.
# 0=not as attachment; 1=as attachment; 2=as gzip attachment
# Default is 0

MAILASATTACH=0
#...


######
### /etc/logcheck/logcheck.logfiles
######

# these files will be checked by logcheck
# This has been tuned towards a default syslog install
/var/log/auth.log
/var/log/cron.log
/var/log/daemon.log
/var/log/debug
/var/log/kern.log
/var/log/mail.err
/var/log/mail.info
/var/log/mail.log
/var/log/mail.warn
/var/log/messages
/var/log/syslog
/var/log/user.log


######
###Excerpt from cronusers:
######

logcheck
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.XXXXUyTAdz installed on Sun Feb 16 02:45:30 2014)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
@hourly /etc/logcheck/logcheck.cron


######
###Excerpt from /var/log/cron.log
######

Feb 17 23:00:01 TutxaPlex cron[6453]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 17 23:00:01 TutxaPlex cron[6455]: (logcheck) CMD (/etc/logcheck/logcheck.cron)
Feb 17 23:10:01 TutxaPlex cron[6481]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 17 23:20:01 TutxaPlex cron[6501]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 17 23:30:01 TutxaPlex cron[6521]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 17 23:40:01 TutxaPlex cron[6542]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 17 23:50:01 TutxaPlex cron[6562]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 17 23:59:01 TutxaPlex cron[6601]: (root) CMD (rm -f /var/spool/cron/lastrun/cron.hourly)
Feb 18 00:00:01 TutxaPlex cron[6608]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 18 00:00:01 TutxaPlex cron[6609]: (logcheck) CMD (/etc/logcheck/logcheck.cron)
Feb 18 00:10:01 TutxaPlex cron[6634]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 18 00:20:01 TutxaPlex cron[6654]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 18 00:30:01 TutxaPlex cron[6674]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 18 00:40:01 TutxaPlex cron[6693]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 18 00:50:01 TutxaPlex cron[6718]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 18 00:59:01 TutxaPlex cron[6744]: (root) CMD (rm -f /var/spool/cron/lastrun/cron.hourly)
Feb 18 01:00:01 TutxaPlex cron[6749]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 18 01:00:01 TutxaPlex cron[6750]: (logcheck) CMD (/etc/logcheck/logcheck.cron)
Feb 18 01:10:01 TutxaPlex cron[6796]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 18 01:20:01 TutxaPlex cron[6817]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 18 01:30:01 TutxaPlex cron[6865]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 18 01:40:01 TutxaPlex cron[6944]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 18 01:50:01 TutxaPlex cron[6962]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 18 01:59:01 TutxaPlex cron[10147]: (root) CMD (rm -f /var/spool/cron/lastrun/cron.hourly)
Feb 18 02:00:01 TutxaPlex cron[10152]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 18 02:00:01 TutxaPlex cron[10153]: (logcheck) CMD (/etc/logcheck/logcheck.cron)
Feb 18 02:10:01 TutxaPlex cron[10458]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)
Feb 18 02:20:01 TutxaPlex cron[10592]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons)



######
### /etc/logcheck/logcheck.cron (-rwxr-xr-x   1 logcheck logcheck  184 Feb 16 02:22 logcheck.cron)
######

#!/bin/bash

set -e

if [ ! -d /var/lock/logcheck ]; then
        mkdir -p /var/lock/logcheck
fi
chown -R logcheck:logcheck /var/lock/logcheck

su -s /bin/bash -c /usr/sbin/logcheck logcheck


######
### Excerpt from /var/log/mail.log
###
### Note: I ran "/etc/logcheck/logcheck.cron" as root, twice; convieniently 0200 occured shortly thereafter and cron ran logcheck.cron once.
######

Feb 18 01:55:09 TutxaPlex postfix/pickup[6863]: 37A703C03B3: uid=109 from=<logcheck>
Feb 18 01:55:09 TutxaPlex postfix/cleanup[8049]: 37A703C03B3: message-id=<20140218065509.37A703C03B3@TutxaPlex.localdomain>
Feb 18 01:55:09 TutxaPlex postfix/qmgr[3435]: 37A703C03B3: from=<logcheck@TutxaPlex.localdomain>, size=63918, nrcpt=1 (queue active)
Feb 18 01:55:09 TutxaPlex postfix/local[8053]: 37A703C03B3: to=<perth@TutxaPlex.localdomain>, orig_to=<perth>, relay=local, delay=0.32, delays=0.27/0/0/0.05, dsn=2.0.0, status=sent (delivered to maildir)
Feb 18 01:55:09 TutxaPlex postfix/qmgr[3435]: 37A703C03B3: removed
Feb 18 01:57:00 TutxaPlex postfix/pickup[6863]: E4B7C3C03B3: uid=109 from=<logcheck>
Feb 18 01:57:00 TutxaPlex postfix/cleanup[9106]: E4B7C3C03B3: message-id=<20140218065700.E4B7C3C03B3@TutxaPlex.localdomain>
Feb 18 01:57:00 TutxaPlex postfix/qmgr[3435]: E4B7C3C03B3: from=<logcheck@TutxaPlex.localdomain>, size=599, nrcpt=1 (queue active)
Feb 18 01:57:01 TutxaPlex postfix/local[9110]: E4B7C3C03B3: to=<perth@TutxaPlex.localdomain>, orig_to=<perth>, relay=local, delay=0.13, delays=0.09/0/0/0.04, dsn=2.0.0, status=sent (delivered to maildir)
Feb 18 01:57:01 TutxaPlex postfix/qmgr[3435]: E4B7C3C03B3: removed
Feb 18 02:00:01 TutxaPlex postfix/pickup[6863]: 125763C0134: uid=109 from=<logcheck>
Feb 18 02:00:01 TutxaPlex postfix/cleanup[10169]: 125763C0134: message-id=<20140218070001.125763C0134@TutxaPlex.localdomain>
Feb 18 02:00:01 TutxaPlex postfix/qmgr[3435]: 125763C0134: from=<logcheck@TutxaPlex.localdomain>, size=565, nrcpt=1 (queue active)
Feb 18 02:00:01 TutxaPlex postfix/local[10172]: 125763C0134: to=<logcheck@TutxaPlex.localdomain>, orig_to=<logcheck>, relay=local, delay=0.13, delays=0.09/0/0/0.04, dsn=5.2.0, status=bounced (maildir delivery failed: create maildir file /dev/null/.maildir/tmp/1392706801.P10172.TutxaPlex: Not a directory)
Feb 18 02:00:01 TutxaPlex postfix/cleanup[10169]: 26DD73C0A05: message-id=<20140218070001.26DD73C0A05@TutxaPlex.localdomain>
Feb 18 02:00:01 TutxaPlex postfix/bounce[10173]: 125763C0134: sender non-delivery notification: 26DD73C0A05
Feb 18 02:00:01 TutxaPlex postfix/qmgr[3435]: 26DD73C0A05: from=<>, size=2662, nrcpt=1 (queue active)
Feb 18 02:00:01 TutxaPlex postfix/qmgr[3435]: 125763C0134: removed
Feb 18 02:00:01 TutxaPlex postfix/local[10172]: 26DD73C0A05: to=<logcheck@TutxaPlex.localdomain>, relay=local, delay=0.08, delays=0.03/0/0/0.04, dsn=5.2.0, status=bounced (maildir delivery failed: create maildir file /dev/null/.maildir/tmp/1392706801.P10172.TutxaPlex: Not a directory)
Feb 18 02:00:01 TutxaPlex postfix/qmgr[3435]: 26DD73C0A05: removed

P.S.: I apologise for any non-compliance whith bug submission standards, I'm trying to go to bed and haven't read the linked wiki. I also apologise for any missing relavent data, such as the environment that cron executes commands inside of. Should someone choose to request such data please point me in the right direction for retreiving what you need; I'm not stupid or excessively ignorant, but many parts of Linux remain unexplored. Finally, you can probably talk to me here: perth@irc.freenode.net/#Gentoo from 11pm-2a UTC-5
Comment 1 John Harlan 2014-02-18 08:22:56 UTC
# emerge --info logcheck
Portage 2.2.7 (default/linux/amd64/13.0/desktop/kde, gcc-4.7.3, glibc-2.17, 3.10.7-gentoo-r1 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.10.7-gentoo-r1-x86_64-AMD_FX-tm-8350_Eight-Core_Processor-with-gentoo-2.2
KiB Mem:    16324772 total,  13573728 free
KiB Swap:    8388604 total,   8388604 free
Timestamp of tree: Sun, 16 Feb 2014 00:15:01 +0000
ld GNU ld (GNU Binutils) 2.23.2
app-shells/bash:          4.2_p45
dev-java/java-config:     2.1.12-r1
dev-lang/python:          2.7.5-r3, 3.2.5-r3, 3.3.2-r2
dev-util/cmake:           2.8.11.2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.12.6, 1.13.4
sys-devel/binutils:       2.23.2
sys-devel/gcc:            4.7.3-r1
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.9 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo sublime-text
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/otrs/Kernel/Config.pm /var/lib/otrs/Kernel/Config/GenericAgent.pm"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://ftp.ussg.iu.edu/pub/linux/gentoo http://lug.mtu.edu/gentoo/ ftp://lug.mtu.edu/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j6"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/sublime-text"
SYNC="rsync://rsync25.us.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 berkdb bindist bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus declarative dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif git gpm iconv ipv6 jpeg kde kipi lcms ldap libnotify mad mmx mng modules mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf phonon plasma png policykit ppds qt3support qt4 readline sdl semantic-desktop session spell sse sse2 ssl startup-notification subversion svg tcpd tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xcb xcomposite xinerama xml xscreensaver xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

app-admin/logcheck-1.3.15-r1 was built with the following:
USE="(multilib) (policykit)" ABI_X86="64"
Comment 2 John Harlan 2014-02-21 19:40:22 UTC
Here is the output of strace -CfirTy, sorry if it's too excessive. Also note that I have changed from executing /etc/logcheck/logcheck.cron from logcheck's crontab to placing logcheck.cron in /etc/cron.hourly/. I have also edited the file to allow the strace command.

https://drive.google.com/file/d/0B69JgP3UT2EIakZzdlBYWU5rYU0/edit?usp=sharing
2.3M compressed, 29M uncompressed

New contents of /etc/cron.hourly/logcheck.cron 
#!/bin/bash

set -e

if [ ! -d /var/lock/logcheck ]; then
        mkdir -p /var/lock/logcheck
fi
chown -R logcheck:logcheck /var/lock/logcheck

su -s /bin/bash -c "strace -CfirTy -o /etc/logcheck/logs/logcheck_$(date --iso-8601=hours).strace /usr/sbin/logcheck" logcheck
Comment 3 John Harlan 2016-10-17 01:04:39 UTC
2 years old, no action, closing.
I don't even know if this was a valid bug report. I'm thinking I'd only been running Gentoo for a few months when I opened this, and I'm not currently aware of any issues w/ logrotate's mailing. I see mails are shown as sent to my user currently.