Serious BUG in /usr/local/directadmin/custombuild/sa-update causing spamd to stop

wattie

Verified User
Joined
May 31, 2008
Messages
1,235
Location
Bulgaria
The bug is related to FreeBSD OS and the file /usr/local/directadmin/custombuild/sa-update which is by default run in a cron job few minutes after 4AM every morning.

When that script is executed, spamd is falling down! Here is the log file from a recent (manual) execution:

Code:
Feb 16 11:22:56.527 [98428] dbg: logger: adding facilities: all
Feb 16 11:22:56.527 [98428] dbg: logger: logging level is DBG
Feb 16 11:22:56.527 [98428] dbg: generic: SpamAssassin version 3.4.1
Feb 16 11:22:56.527 [98428] dbg: generic: Perl 5.024001, PREFIX=/usr, DEF_RULES_DIR=/usr/share/spamassassin, LOCAL_RULES_DIR=/etc/mail/spamassassin, LOCAL_ST
ATE_DIR=/var/lib/spamassassin
Feb 16 11:22:56.527 [98428] dbg: config: timing enabled
Feb 16 11:22:56.528 [98428] dbg: config: score set 0 chosen.
Feb 16 11:22:56.535 [98428] dbg: generic: sa-update version svn1652181
Feb 16 11:22:56.535 [98428] dbg: generic: using update directory: /var/lib/spamassassin/3.004001
Feb 16 11:22:56.668 [98428] dbg: diag: perl platform: 5.024001 freebsd
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Digest::SHA1, version 2.13
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: HTML::Parser, version 3.72
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Net::DNS, version 1.07
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: NetAddr::IP, version 4.079
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Time::HiRes, version 1.9733
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Archive::Tar, version 2.24
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: IO::Zlib, version 1.10
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Digest::SHA1, version 2.13
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: MIME::Base64, version 3.15
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: DB_File, version 1.835
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Net::SMTP, version 3.08_01
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module not installed: Mail::SPF ('require' failed)
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Geo::IP, version 1.50
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Net::CIDR::Lite, version 0.21
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Razor2::Client::Agent, version 2.84
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: IO::Socket::IP, version 0.38
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: IO::Socket::INET6, version 2.72
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: IO::Socket::SSL, version 2.044
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Compress::Zlib, version 2.07
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Mail::DKIM, version 0.4
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: DBI, version 1.636
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Getopt::Long, version 2.48
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: LWP::UserAgent, version 6.18
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: HTTP::Date, version 6.02
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Encode::Detect::Detector, version 1.01
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Net::Patricia, version 1.22
Feb 16 11:22:56.669 [98428] dbg: diag: [...] module installed: Net::DNS::Nameserver, version 1493
Feb 16 11:22:56.676 [98428] dbg: util: secure_tmpfile created a temporary file /tmp/.spamassassin98428XmRF36tmp
Feb 16 11:22:56.676 [98428] dbg: channel: attempting channel sought.rules.yerp.org
Feb 16 11:22:56.676 [98428] dbg: channel: using existing directory /var/lib/spamassassin/3.004001/sought_rules_yerp_org
Feb 16 11:22:56.676 [98428] dbg: channel: channel cf file /var/lib/spamassassin/3.004001/sought_rules_yerp_org.cf
Feb 16 11:22:56.676 [98428] dbg: channel: channel pre file /var/lib/spamassassin/3.004001/sought_rules_yerp_org.pre
Feb 16 11:22:56.676 [98428] dbg: channel: metadata version = 3402014020421, from file /var/lib/spamassassin/3.004001/sought_rules_yerp_org.cf
Feb 16 11:22:56.851 [98428] dbg: dns: 1.4.3.sought.rules.yerp.org => 3402014020421, parsed as 3402014020421
Feb 16 11:22:56.851 [98428] dbg: channel: current version is 3402014020421, new version is 3402014020421, skipping channel
Feb 16 11:22:56.851 [98428] dbg: channel: attempting channel updates.spamassassin.org
Feb 16 11:22:56.852 [98428] dbg: channel: using existing directory /var/lib/spamassassin/3.004001/updates_spamassassin_org
Feb 16 11:22:56.852 [98428] dbg: channel: channel cf file /var/lib/spamassassin/3.004001/updates_spamassassin_org.cf
Feb 16 11:22:56.852 [98428] dbg: channel: channel pre file /var/lib/spamassassin/3.004001/updates_spamassassin_org.pre
Feb 16 11:22:56.852 [98428] dbg: channel: metadata version = 1782927, from file /var/lib/spamassassin/3.004001/updates_spamassassin_org.cf
Feb 16 11:22:57.239 [98428] dbg: dns: 1.4.3.updates.spamassassin.org => 1782927, parsed as 1782927
Feb 16 11:22:57.239 [98428] dbg: channel: current version is 1782927, new version is 1782927, skipping channel
Feb 16 11:22:57.239 [98428] dbg: diag: updates complete, exiting with code 1
/usr/local/directadmin/custombuild/sa-update: [B]/etc/init.d/exim: not found[/B]

Note the bold text in the last line - this is not the correct path to exim!

It looks like that the issue is related to this check in the script file:

Code:
if [ "[B]${OS}[/B]" = "FreeBSD" ]; then
        INITDDIR=/usr/local/etc/rc.d
fi


The variable OS is NOT declared anywhere in that file so the check fails. You must add:

Code:
OS=`uname`;

before that and then the script will work fine.
 
Last edited:
Also (after the fix) I get an error in /var/log/sa-update.log when the script is attempting to restart exim:

Code:
...
Feb 16 12:25:43.359 [21381] dbg: dns: 1.4.3.updates.spamassassin.org => 1782927, parsed as 1782927
Feb 16 12:25:43.359 [21381] dbg: channel: current version is 1782927, new version is 1782927, skipping channel
Feb 16 12:25:43.359 [21381] dbg: diag: updates complete, exiting with code 1
Shutting down exim:     [ OK ]
kill: 4835: No such process
Starting exim:          [ OK ]

This is not happening when I restart exim manually:

Code:
root@srv2:/ # /usr/local/etc/rc.d/exim restart
Shutting down exim:     [ OK ]
Starting exim:          [ OK ]
root@srv2:/ #

This is because the /usr/local/etc/rc.d/exim script is attempting to kill spamd itself but the /usr/local/directadmin/custombuild/sa-update script already killed it before that:

killall -9 spamd >/dev/null 2>&1

I guess it is not needed to kill spamd when the exim restart script will do it anyway. But it is not a problem - it can be left that way too (it's just a line in the log, not an actual problem).
 
Back
Top