I'm running my own new Debian Sarge system, and I am having a lot of problems with e-mail. I tried to follow the Linux Bible 2005's guide to setting up an e-mail server but it just wouldn't work. I'm using Postfix and a couple other custom components. Here's some of the important files:
/etc/postfix/main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
myhostname = ############
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
mailbox_command = /usr/bin/maildrop -d ${USER}
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtp_tls_auth_only = no
smtp_use_tls = yes
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_cert_file = /etc/ssl/private/mail.pem
smtpd_tls_key_file = $smtpd_tls_cert_file
smtpd_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
/etc/postfix/master.cf
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - - - - smtpd -o smtpd_use_tls=yes
#submission inet n - - - - smtpd
# -o smtpd_etrn_restrictions=reject
#628 inet n - - - - qmqpd
pickup fifo n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr fifo n - - 300 1 qmgr
#qmgr fifo n - - 300 1 oqmgr
rewrite unix - - - - - trivial-rewrite
bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
proxymap unix - - n - - proxymap
smtp unix - - - - - smtp
relay unix - - - - - smtp
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - - - - showq
error unix - - - - - error
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
#
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# maildrop. See the Postfix MAILDROP_README file for details.
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -d -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
# only used by postfix-tls
tlsmgr fifo - - n 300 1 tlsmgr
smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes
587 inet n - n - - smtpd -o smtpd_enforce_tls=yes
/usr/local/sbin/clam-mailscan
#!/usr/bin/env python
from sys import stdin, stdout
from os import execv, popen, umask, unlink
from tempfile import mktemp
CLAMSCAN='/usr/bin/clamscan'
umask(0077)
errors = []
tmpfn = mktemp()
tmpfh = open(tmpfn, 'w+b')
while True:
rbuf = stdin.read(1024)
if rbuf == '':
break
tmpfh.write(rbuf)
tmpfh.close()
vscan = popen("%s --no-summary --stdout --infected --mbox %s" % \
(CLAMSCAN, tmpfn), 'r')
while True:
rbuf = vscan.readline()
if rbuf == '':
break
if rbuf.find("FOUND"):
errors.append(rbuf[rbuf.find(':')+2:-1])
vscan.close()
tmpfh = open(tmpfn, 'r')
if len(errors) > 0:
while True:
rbuf = tmpfh.readline()
if rbuf == '\n':
break
stdout.write(rbuf)
for e in errors:
stdout.write('X-Virus-Alert: %s in message\n' % e)
stdout.write('\n')
while True:
rbuf = tmpfh.read(1024)
if rbuf == '':
break
stdout.write(rbuf)
tmpfh.close()
unlink(tmpfn)
/etc/maildroprc
# Global maildrop filter file
DEFAULT="$HOME/Maildir"
if ( $SIZE < 60000 )
{
xfilter "/usr/bin/spamc -f"
}
xfilter "/usr/local/sbin/clam-mailscan"
if (/^X-Spam-Flag: YES/ || /^X-Virus-Alert:/ )
{
exception {
to "$DEFAULT/.Trash/"
}
}
Here's a sample e-mail that I got through IMAP. Notice that there's an extra line at the start and therefore most e-mail readers think there's no headers to the e-mail. Really hard to read SPAM e-mails when you have to parse the headers yourself and read MIME in plaintext:
Return-Path:
X-Original-To: dan@######.com
Delivered-To: dan@######.com
Received: from localhost (S010600301b146d46.ed.shawcable.net [68.151.69.138])
by ####################.com (Postfix) with SMTP id 10B53140144A
for ; Sun, 19 Nov 2006 21:23:43 -0500 (EST)
Message-ID: <000001c70c4a$e73d0e80$0100007f@localhost>
From: "Omar Henderson"
To:
Subject: 0EM Software
Date: Sun, 19 Nov 2006 19:23:36 -0700
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0001_01C70C4A.E73D0E80"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.3790.1039
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1039
X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on
###########################
X-Spam-Level:
X-Spam-Status: No, score=0.0 required=5.0 tests=HTML_60_70,HTML_MESSAGE
autolearn=ham version=3.0.3
------=_NextPart_000_0001_01C70C4A.E73D0E80
Content-Type: text/plain;
charset="windows-1251"
Content-Transfer-Encoding: quoted-printable
World leading manufacturers. The most popular software. Best price.
a. MS Windows XP Professional with SP2 - $49.95
b. Adobe Photoshop CS2 V 9.0 - $69.95
c. Microsoft Office XP Professional - $49.95
d. Adobe Acrobat 5.0 - $39.95
e. ..............................
More then 300 items...
So if anyone can give tips as to why there's an extra line in all my e-mail that's filtered through ClamAV and Spamasassin. Actually, of note may be that if the e-mail comes from the system itself (such as the mail command or from a website on the server) then the headers do not have the extra line and are filtered.
If you need any more information, please advise what to give ya.
Thanks,
Dan
Bookmark/Search this post with:
Bump?
No ideas? I tried searching for "headers with leading line debian linux" on Google to find the answer again and the top result was, sadly, this exact page with still no answer. ;-)
Thanks
Well, I figured this problem out. The 'clam-mailscan' file had a line that added an extra line to the start of the mail. No reason why it should be there.....