Qmail Relay
Another Qmail+vpopmail+mysql+courier-imap Install guide
Install Qmail+vpopmail+dspam+courier using ports
Qmail MTA parameters
Qmail and DomainKeys
Qmail and Spam
Installing qmail, vpopmail on mysql, courier imapd
Look no where else, go to QmailRocks. I followed the document and successfully installed them on FC6 in 45minutes.Static mail routing
Edit /var/qmail/control/smtproutessmtproutes
example.com:1.2.3.4
Remove spam mail on qmail-queue
use qmail-removeqmail-remove useful options:
qmail-remove [options] -e use extended POSIX regular expressions -i search case insensitively [default: case sensitive] -n <bytes> limit our search to the first <bytes> bytes of each file -p <pattern> specify the pattern to search for -q <queuedir> specify the base qmail queue dir [default: /var/qmail/queue] -d actually remove files not yank them, no -p will delete all the messages! -y <yankdir> directory to put files yanked from the queue [default: <queuedir>/yanked]
or use qmHandle http://sourceforge.net/projects/qmhandle
qmHandle v1.3.2 Copyright 1998-2003 Michele Beltrame Available parameters: -a : try to send queued messages now (qmail must be running) -l : list message queues -L : list local message queue -R : list remote message queue -s : show some statistics -mN : display message number N -dN : delete message number N -fsender : delete message from sender -f're' : delete message from senders matching regular expression re -Stext : delete all messages that have/contain text as Subject -h're' : delete all messages with headers matching regular expression re (case insensitive) -b're' : delete all messages with body matching regular expression re (case insensitive) -H're' : delete all messages with headers matching regular expression re (case sensitive) -B're' : delete all messages with body matching regular expression re (case sensitive) -t're' : flag messages with recipients in regular expression 're' for earlier retry (note: this lengthens the time message can stay in queue) -D : delete all messages in the queue (local and remote)
svc -d /service/qmail
svc -d /service/smtp
qmail-remove -i -p "Subject: Failure Notice" -n 512 -d
svc -u /service/qmail
svc -u /service/smtp
svc -d /service/smtp
qmail-remove -i -p "Subject: Failure Notice" -n 512 -d
svc -u /service/qmail
svc -u /service/smtp
NetQmail Installation on Fedora C5 x86_64
Obtain netqmail
Download from www.qmail.orgExtract package & patch qmail
Extract netqmail-1.05.tar.gz & qmail-1.03.tar.gz inside netqmailpatch -p1 < ../netqmail-1.05.patch
Adding necessary users
groupadd nofiles
useradd -g nofiles -d /var/qmail/alias alias
useradd -g nofiles -d /var/qmail qmaild
useradd -g nofiles -d /var/qmail qmaill
useradd -g nofiles -d /var/qmail qmailp
groupadd qmail
useradd -g qmail -d /var/qmail qmailq
useradd -g qmail -d /var/qmail qmailr
useradd -g qmail -d /var/qmail qmails
useradd -g nofiles -d /var/qmail/alias alias
useradd -g nofiles -d /var/qmail qmaild
useradd -g nofiles -d /var/qmail qmaill
useradd -g nofiles -d /var/qmail qmailp
groupadd qmail
useradd -g qmail -d /var/qmail qmailq
useradd -g qmail -d /var/qmail qmailr
useradd -g qmail -d /var/qmail qmails
Compile qmail
make setup check
Basic config on qmail
Under qmail source dir, run ./config to start a basic config. The followings will be displayed:Your hostname is www.ericyu.com. Your host's fully qualified name in DNS is server.linuxserver27.com. Putting server.linuxserver27.com into control/me... Putting linuxserver27.com into control/defaultdomain... Putting linuxserver27.com into control/plusdomain... Checking local IP addresses: 0.0.0.0: PTR lookup failed. I assume this address has no DNS name. 127.0.0.1: PTR lookup failed. I assume this address has no DNS name. 64.106.250.143: PTR lookup failed. I assume this address has no DNS name. 67.15.179.25: Adding server.linuxserver27.com to control/locals... If there are any other domain names that point to you, you will have to add them to /var/qmail/control/locals. You don't have to worry about aliases, i.e., domains with CNAME records.
Copying /var/qmail/control/locals to /var/qmail/control/rcpthosts...
Now qmail will refuse to accept SMTP messages except to those hosts.
Make sure to change rcpthosts if you add hosts to locals or virtualdomains!
If there are problems with FQDN, run config-fast your.host.name and edit the files under /var/qmail/control directly.
Install qmail aliases
root:/usr/local/src/qmail-1.03# cd ~alias
root:/var/qmail/alias# echo adam > .qmail-root
root:/var/qmail/alias# echo bob > .qmail-postmaster
root:/var/qmail/alias# echo bob > .qmail-mailer-daemon
root:/var/qmail/alias# echo adam > .qmail-root
root:/var/qmail/alias# echo bob > .qmail-postmaster
root:/var/qmail/alias# echo bob > .qmail-mailer-daemon
Setup daemontools & create control directories
If these tools are not installed, obtain the necessary packages listed below:daemontools-0.70-8
ucspi-tcp-0.88-7
Then
mkdir -p /var/qmail/supervise/qmail-send/log
mkdir -p /var/qmail/supervise/qmail-smtpd/log
chmod +t /var/qmail/supervise/qmail-send
chmod +t /var/qmail/supervise/qmail-smtpd
mkdir -p /var/log/qmail/qmail-send
mkdir -p /var/log/qmail/qmail-smtpd
chown -R qmaill /var/log/qmail
mkdir -p /var/qmail/supervise/qmail-smtpd/log
chmod +t /var/qmail/supervise/qmail-send
chmod +t /var/qmail/supervise/qmail-smtpd
mkdir -p /var/log/qmail/qmail-send
mkdir -p /var/log/qmail/qmail-smtpd
chown -R qmaill /var/log/qmail
create file /var/qmail/supervise/qmail-send/run
run
#!/bin/sh
exec /var/qmail/rc
exec /var/qmail/rc
create file /var/qmail/supervise/qmail-send/log/run
run
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s2500000 /var/log/qmail/qmail-send
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s2500000 /var/log/qmail/qmail-send
create file /var/qmail/supervise/qmail-smtpd/run
run
#!/bin/sh
QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
exec /usr/local/bin/softlimit -m 3000000 \
/usr/local/bin/tcpserver -H -R -v -p -x /etc/tcp.smtp.cdb \
-u $QMAILDUID -g $NOFILESGID 0 smtp /var/qmail/bin/qmail-smtpd 2>&1
QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
exec /usr/local/bin/softlimit -m 3000000 \
/usr/local/bin/tcpserver -H -R -v -p -x /etc/tcp.smtp.cdb \
-u $QMAILDUID -g $NOFILESGID 0 smtp /var/qmail/bin/qmail-smtpd 2>&1
create file /var/qmail/supervise/qmail-smtpd/log/run
run
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s2500000 /var/log/qmail/qmail-smtpd
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s2500000 /var/log/qmail/qmail-smtpd
Access Control
create file /etc/tcp.smtp192.168.13.:allow,RELAYCLIENT="" 1.2.3.:allow,RELAYCLIENT="" :allow
run
tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
Create the qmail rc file in /var/qmail/rc
rc
#!/bin/sh
exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start '|dot-forward .forward
|preline procmail'
exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start '|dot-forward .forward
|preline procmail'
Or if dot-forward is missing
rc
#!/bin/sh
exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start '|preline procmail'
exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start '|preline procmail'
Starting / stopping qmail
Daemontools will start qmail in a few seondsln -s /var/qmail/supervise/* /service/
Restart qmail
svc -t /service/qmail-send
svc -t /service/qmail-smtpd
svc -t /service/qmail-smtpd
Stopping qmail
svc -h
svc ?
svc ?
Configure pop3 daemon
On Fedora, install uw-imap-2006e-2.fc5 using yum. Then go to /etc/xinetd.d and enable ipop3 service.Integrating Qmail with Spamassassin
Spamassassin can be invoked at delivery time or at queue time. Obtain & install spamassassin rpm.At delivery time:
Change /var/qmail/rc to
rc
#!/bin/sh
exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start '|spamassassin -P |preline procmail'
exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start '|spamassassin -P |preline procmail'
At queue time:
Rename /var/qmail/bin/qmail-queue to /var/qmail/bin/qmail-queue.orig
Create /var/qmail/bin/qmail-queue
qmail-queue
#!/bin/sh
spamassassin -P | qmail-queue.orig
spamassassin -P | qmail-queue.orig
Create an account to store spamassasin setting
mkdir ~qmaild/.spamassassin chown qmaild.nofiles ~qmaild/.spamassassin chmod u=rwx,g=rx,o= ~qmaild/.spamassassin
Edit run script for qmail-smtpd
run
#!/bin/sh
QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
exec softlimit -m 4000000 \
tcpserver -v -R -l 0 -x /etc/qmail/tcp.smtp.cdb -c `"$MAXSMTPD`" \
-u `"$QMAILDUID`" -g `"$NOFILESGID`" 0 smtp qmail-smtpd 2>&1
QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
exec softlimit -m 4000000 \
tcpserver -v -R -l 0 -x /etc/qmail/tcp.smtp.cdb -c `"$MAXSMTPD`" \
-u `"$QMAILDUID`" -g `"$NOFILESGID`" 0 smtp qmail-smtpd 2>&1
The line with "exec softlimit -m 2000000" tells tcpserver, to limit all subprocesses to a maximum memory consumption of two (2) million bytes. If this results in to little memory the spamassassin process may die. Yury Gusev is using (by now) "exec softlimit -m 66000000". Please tell us your experiences. It should also be considered to run the spamassassin daemon, and only invoke spamc, the spamassassin client with this setup, instead of launching a whole spamassassin process for each mail. (reference: http://www.magma.com.ni/~jorge/spamassassin.html)
There are no comments on this page. [Add comment]