Posts Tagged ‘debian’

Postfix SMTP relay broken, MX host not found.

Yesterday, all outgoing emails started to accumulate in the Postfix queue with this error:

Jun 29 13:35:02 intranet postfix/smtp[15330]: 88AE28C839: to=, relay=none, delay=8921, delays=8897/4/20/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=myprovider.isp.hosting type=MX: Host not found, try again)

First thing I did, nslookup and dig tests, yep the host can be found, although there is no MX record. Could it be that Postfix absolutely requires the MX record?

As it turns out: no. What actually happened is that I changed DNS settings for this server. I went into /etc/resolv.conf and updated the settings, as a new DNS server was installed and replaced and agin one.

What I didn’t know is that Postfix keeps a cached copy of this resolv.conf in a mini-chroot jail located in /var/spool/postfix/etc/resolv.conf

That file had the old DNS server settings! I changed it for the correct servers, and issued

postfix reload
postqueue -p

Voilà!

Thunderbird complains about invalid certificate

I setup my own mail server on my debian etch server, with IMAP SSL (courier-imap).

I guess I was asleep when I did it, because everytime I connect Thunderbird to my SSL imap account, it complains about the SSL certificate being invalid because the hostname doesn’t match.

rm -rf /etc/courier/*.pem
make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/courier/imapd.pem

I typed my publicly accessible hostname for the server instead of “localhost” and voilà.

EDIT August 25th 2009: As I activated SSL on Postfix, I encountered the very same error message in Thunderbird. This time, however, I discovered that I need to set the “Organizational Unit Name” and “Common Name” in the certificate to match the fully qualified domain name of the machine.

Ex: My mail server runs on “somehost.mybiz.com”, so I’ll put exactly that in both certificate fields.

amavisd-new with spamassassin emailing syncs frequently

I have SpamAssassin with Amavid-new on my Debian Etch server acting as filtering for spam and viruses (along with ClamD).

Every few hours, I receive an email such as this (to root):

From: root@xxxx (Cron Daemon)
To: amavis@xxxx
Subject: Cron <amavis@fry> test -e /usr/sbin/amavisd-new-cronjob && /usr/sbin/amavisd-new-cronjob sa-sync

bayes: synced databases from journal in 1 seconds: 1751 unique entries (3454 total entries

It gets annoying fast.

As I’ve found in Debian bugs list, they’re not 100% sure as how to resolve this issue, being not clearly a bug but rather a communication problem (should we inform the user or not).

Tuomas Jormola came up with an elegant patch that does not redirect the wrongly behaving script to /dev/null, but instead filters it. If it’s the sync message, it removes it, otherwise the message is passed on and will get emailed to root via cron, effectively keeping the ability of reporting errors and problems to the administrators.

To fix it, I opened /usr/sbin/amavisd-new-cronjob, and replaced line 32 (right after “sa-sync”) that was this:

do_amavis_cmd "/usr/bin/sa-learn --sync >/dev/null"

to this:

do_amavis_cmd "/usr/bin/sa-learn --sync 2>&1 | egrep -v '^bayes: synced databases from journal in [0-9]+ seconds: [0-9]+ unique entries \([0-9]+ total entries\)$'"

Weird amavisd-new / perl crash

I just built a new server on Debian 5, using the latest of everything.

After building my amavids-new + spamassassin + clamav + postfix + bayesian learning system, it started to crash with this error:

in amavis log:

amavisd-new Net::Server: Couldn’t fork: [Cannot allocate memory]

in mail.log:

Mar 12 05:15:16 fry amavis[29358]: (29358-08) (!!)TROUBLE in check_mail: parts_decode_ext FAILED: file(1) utility (/usr/bin/file) error: run_command (open pipe): Can’t fork at /usr/lib/perl/5.10/IO/File.pm line 66, <GEN77> line 89. at /usr/sbin/amavisd-new line 2892, <GEN77> line 89.
Mar 12 05:15:16 fry amavis[29358]: (29358-08) (!)PRESERVING EVIDENCE in /var/lib/amavis/tmp/amavis-20090312T051516-29358

Well, after 2 days of googling’ about this problem, i finally found a thread where someone realized he forgot to activate swap on the server, and therefore, fork was failing.

Would I be that kind of admin, that rebuilds a whole server and forgets to mount swap? Yes! That’s me! Thanks Richard!