logrotate cron job fails for denyhosts

Bug #490020 reported by Mike.lifeguard
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
denyhosts (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: denyhosts

The logrotate cron job for denyhosts fails:

You have new mail in /var/mail/mikelifeguard
mikelifeguard@binnie:/var/log$ mail
Mail version 8.1.2 01/15/2001. Type ? for help.
"/var/mail/mikelifeguard": 1 message 1 new
>N 1 root@mikelifeguar Sun Nov 29 06:41 22/999 Cron <root@binnie> test -x
& 1
Message 1:
From root@ Sun Nov 29 06:41:51 2009
Envelope-to: root@
Delivery-date: Sun, 29 Nov 2009 06:41:51 -0400
From: root@ (Cron Daemon)
To: root@
Subject: Cron <root@binnie> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
Content-Type: text/plain; charset=ANSI_X3.4-1968
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <LOGNAME=root>
Date: Sun, 29 Nov 2009 06:41:51 -0400

/etc/cron.daily/logrotate:
test: 91: /etc/hosts.deny: unexpected operator

There is some discussion at http://serverfault.com/questions/69722/weekly-cron-logrotate-denyhosts-error

ProblemType: Bug
Architecture: i386
Date: Sun Nov 29 14:02:05 2009
DistroRelease: Ubuntu 9.10
Package: denyhosts 2.6-5
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, user)
 LANG=en_CA.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-15.50-generic-pae
SourcePackage: denyhosts
Uname: Linux 2.6.31-15-generic-pae i686

Revision history for this message
Mike.lifeguard (mikelifeguard) wrote :
Revision history for this message
Jan Schneider (yunosh) wrote :

It still fails with the most recent version, though with different errors now:

/etc/cron.daily/logrotate:
/etc/denyhosts.conf: 28: SECURE_LOG: not found
/etc/denyhosts.conf: 36: HOSTS_DENY: not found
/etc/denyhosts.conf: 60: PURGE_DENY: not found
/etc/denyhosts.conf: 95: BLOCK_SERVICE: not found
/etc/denyhosts.conf: 110: DENY_THRESHOLD_INVALID: not found
/etc/denyhosts.conf: 121: DENY_THRESHOLD_VALID: not found
/etc/denyhosts.conf: 131: DENY_THRESHOLD_ROOT: not found
/etc/denyhosts.conf: 142: DENY_THRESHOLD_RESTRICTED: not found
/etc/denyhosts.conf: 155: WORK_DIR: not found
/etc/denyhosts.conf: 200: LOCK_FILE: not found
/etc/denyhosts.conf: 221: ADMIN_EMAIL: not found
/etc/denyhosts.conf: 232: SMTP_HOST: not found
/etc/denyhosts.conf: 233: SMTP_PORT: not found
/etc/denyhosts.conf: 252: Syntax error: newline unexpected
error: error running non-shared postrotate script for /var/log/denyhosts of '/var/log/denyhosts '
run-parts: /etc/cron.daily/logrotate exited with return code 1

The problem is that /etc/logrotate.d/denyhosts sources /etc/denyhosts.conf which is *not* a valid shell script, because there are space around equal signs of the configuration settings, e.g.:
SECURE_LOG = /var/log/auth.log

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in denyhosts (Ubuntu):
status: New → Confirmed
Revision history for this message
Jeroen Hensing (hensing) wrote :

Seems to be fixed on debian in 2.6.9 of denyhosts: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=608672#32

Changes:
 denyhosts (2.6-9) unstable; urgency=low
 .
   * New Maintainer (Closes: #614581)
   * debian/denyhosts.logrotate: Do not source /etc/denyhosts.conf since it may not be a valid shell script (Closes: #608672)
   * debian/dh_reenable: Added reasonable error message when script is not run as root (Closes: #619390)
   * debian/denyhosts.init:
     - Added support for the "status" action (Closes: #547036)
     - Fixed messages in "restart" and "force-reload" actions which were being output incorrectly.
   * Updated Vcs tags to recommended format
   * Added a patch to correct /bin/env to /usr/bin/env
   * debian/denyhosts.doc-base: Added to register FAQ with doc-base
   * Fixed postinst script to make /var/lib/denyhosts 0750 instead of 0200

Revision history for this message
Derek White (d-man97) wrote :

2.6-9 or 2.6-10 appears to be in Ubuntu 12.04 repos (https://launchpad.net/ubuntu/precise/amd64/denyhosts) - can anyone verify that the cronjob is working properly now?

Also, still waiting for this to hit the 11.10 repos...any idea if/when?

Revision history for this message
Jeroen Hensing (hensing) wrote :

check at: https://launchpad.net/ubuntu/+source/denyhosts/2.6-9
just verified this at a friend running 11.10, he had it installed... (for completion: 12.04 is on denyhosts 2.6-10)...

anybody who can verify this is resolved? no longer treating the logrotate as a shell script seems to have fixed the issue...

Revision history for this message
Jeroen Hensing (hensing) wrote :

just ran logrotate with a (--reinstall´d version of) denyhosts on 12.04, so with config file including all the spaces.....
no problems as far as I can tell... nice work! :)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.