BILL’S QMAIL
 
经过苦苦两个月……qmail终于配置完成,兴奋无比,感谢bill ,一路走来,将日志发布出来与大家共享!
Getting Started
  • DNS
Before we begin, make sure DNS (mx record) is properly setup. If you were using "merchbox.com" as your virtual domain, here's how your host lookups would look after setting up dns:
[shupp@ns1 toaster]$ host -t mx merchbox.com
merchbox.com. mail is handled by 0 mail.merchbox.com.
[shupp@ns1 toaster]$ host -t a mail.merchbox.com
mail.merchbox.com. has address 216.234.249.114
主机名也应正确:
/etc/sysconfig/network
Like this HOSTNAME= qmail.abc.com
/etc/hosts
Like this 192.168.1.1 qmail.abc.com qmail
  • Remove existing smtp/pop/imap servers
Now we must remove any existing installations of sendmail/postfix and disable pop/imap servers. To remove sendmail and postfix from an rpm based distribution, try this:
rpm -e --nodeps sendmail postfix
Unless you have other services that absolutely have to run on this machine, I recommend shutting down inetd or xinetd altogether and removing it from your startup scripts. The only thing you'll need (outside of what we're about to isntall) is ssh, which is probably installed already. This will likely shut off any pop3 or imap servers, as well as other unneccessary ports. Otherwise, disable them manually.
To be sure that these services are disabled, try telnetting to ports 25, 110, and 143 and make sure your connections are refused.
  • Download Packages
I keep my software source in /var/src. If you want to put it in another location, set the location below, and all paths will be updated.
umask 0022
mkdir -p /var/src/tar
cd /var/src/tar
wget [url]http://cr.yp.to/daemontools/daemontools-0.76.tar.gz[/url]
wget [url]http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz[/url]
wget [url]http://shupp.org/software/netqmail-1.05.tar.gz[/url]
wget [url]http://shupp.org/software/libdomainkeys-0.68.tar.gz[/url]
wget [url]http://shupp.org/patches/libdomainkeys.diff[/url]
wget [url]http://shupp.org/patches/qmail-toaster-0.9.1.patch.bz2[/url]
wget [url]http://shupp.org/patches/doublebounce-trim.patch[/url]
wget [url]http://shupp.org/software/vpopmail-5.4.18.tar.gz[/url]
wget [url]http://shupp.org/patches/vpopmail-5.4.18-cumulative.patch[/url]
wget [url]http://shupp.org/software/autorespond-2.0.4.tar.gz[/url]
wget [url]http://shupp.org/patches/autorespond-2.0.4-2.0.5.patch[/url]
wget [url]http://shupp.org/software/qmailadmin-1.2.11.tar.gz[/url]
wget [url]http://shupp.org/software/qmailadmin-help-1.0.8.tar.gz[/url]
wget [url]http://cr.yp.to/software/ezmlm-0.53.tar.gz[/url]
wget [url]http://shupp.org/software/ezmlm-idx-0.443.tar.gz[/url]
wget [url]http://shupp.org/software/courier-imap-4.1.2.tar.bz2[/url]
wget [url]http://shupp.org/software/courier-authlib-0.59.1.tar.bz2[/url]
wget [url]http://shupp.org/patches/vpopmail_courier_cram-1.diff[/url]
wget [url]http://shupp.org/software/squirrelmail-1.4.9a.tar.bz2[/url]
wget [url]http://shupp.org/software/quota_usage-1.3.1-1.2.7.tar.gz[/url]
wget [url]http://shupp.org/software/toaster-scripts-0.9.0.tar.gz[/url]
cd ../
tar -xzf tar/netqmail-1.05.tar.gz
cd netqmail-1.05
./collate.sh
正常情况应该出来7项
Install Software
Now that you have downloaded all the software packages to /var/src, please go through each of these installation steps as the appear, and in this order, unless you really know what you're doing. (Because if you did, you wouldn't be reading this, right?)
The below steps assume that your "rc" directories are in /etc/ and your "init.d" path is "/etc/init.d" . If yours are different, please substitue paths accordingly.
  • daemontools
daemontools is a collection of tools for managing UNIX services. It will monitor qmail-send, and qmail-smtpd, and qmail-pop3d services.
Info: [url]http://cr.yp.to/daemontools.html[/url]
Install:
mkdir -p /package
chmod 1755 /package
cd /package
tar -xpzf /var/src/tar/daemontools-0.76.tar.gz
cd admin/daemontools-0.76
patch -p1 < /var/src/netqmail-1.05/other-patches/daemontools-0.76.errno.patch
package/install
# add the "clear" service
cd ../
mkdir clear
touch clear/down
cat > clear/run <&lt;EOF
#!/bin/sh
yes '' | head -4000 | tr '\n' .
# When you want to clear the service errors, just run this:
# svc -o /service/clear
EOF
chmod +x clear/run
chmod a-w clear/down
ln -s /package/admin/clear /service/clear
To verify that daemontools is running, make sure that `ps ax` reports '/bin/sh /command/svscanboot' and 'svscan /service' as running.
Install Software
  • ucspi-tcp
ucspi-tcp contains tcpserver and tcpclient, command line tools for building client-server applications.
Info: [url]http://cr.yp.to/ucspi-tcp.html[/url]
Install:
cd /var/src
tar -xzf tar/ucspi-tcp-0.88.tar.gz
cd ucspi-tcp-0.88
patch -p1 &lt; /var/src/netqmail-1.05/other-patches/ucspi-tcp-0.88.errno.patch
# NOTE: If you are on the x86_64 platform, you need to remove the "-02" argument to gcc in conf-cc. See
this for details
make
make setup check
  • qmail
qmail is allegedly the second most popular MTA in use, known for speed and security.
Info: [url]http://www.qmail.org[/url]
The patch you will apply later is a composite of these existing patches:
  • smtp auth (cram-md5)
  • starttls support
  • support oversize dns packets (not necessary if you use dnscache)
  • qregex (regular expression matching in badmailfrom and badmailto)
  • reread concurrency via HUP
  • big concurrency (set the spawn limit above 255)
  • maildir++ patch
  • qmail-queue (to allow for virus scanners, part of netqmail)
  • chkuser (check for local users, envelope syntax) with user extensions enabled (for TMDA)
  • spam throttle
  • spf
  • surbl support in qmail-smtpd
  • domainkeys support
Install:
mkdir /var/qmail
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
cd /var/src
tar -xzf tar/toaster-scripts-0.9.0.tar.gz
cd netqmail-1.05/netqmail-1.05
# NOTE: RedHat/Fedora users may need to link certain include files for the TLS patch.
# Issue the command below only if make fails:
ln -s /usr/kerberos/include/com_err.h /usr/kerberos/include/krb5.h \
/usr/kerberos/include/profile.h /usr/include/
# as well as remove the sendmail link if it still exists:
rm /usr/sbin/sendmail
make
make setup check
# NOTE: qmail will be patched AFTER vpopmail is installed
# turn on SPF checking
echo 3 > /var/qmail/control/spfbehavior
# Setup the primary administrator's email address.
# This address will receive mail for root, postmaster, and mailer-daemon.
# Replace "[email]admin@example.com[/email]" with your email address
(cd ~alias; echo "[email]admin@example.com[/email]" &gt; .qmail-postmaster ;\
echo "[email]admin@example.com[/email]" &gt; .qmail-mailer-daemon ;\
echo "[email]admin@example.com[/email]" &gt; .qmail-root )
chmod 644 ~alias/.qmail*
cd /var/src/netqmail-1.05/netqmail-1.05
./config-fast `hostname --long`
(此处用自己的域名代替hostname --long)
Configure:
add qmail man pages to MANPATH Edit /etc/man.config
o Add "MANPATH /var/qmail/man"
o NOTE: Debian users should set MANDATORY_MANPATH rather than MANPATH
cd /var/src
cp toaster-scripts-0.9.0/rc /var/qmail/rc
chmod 755 /var/qmail/rc
mkdir /var/log/qmail
echo ./Maildir/ &gt;/var/qmail/control/defaultdelivery
cp toaster-scripts-0.9.0/qmailctl /var/qmail/bin/
chmod 755 /var/qmail/bin/qmailctl
ln -s /var/qmail/bin/qmailctl /usr/bin
ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
# Now create the supervise directories/scripts for the qmail services:
mkdir -p /var/qmail/supervise/qmail-send/log
mkdir -p /var/qmail/supervise/qmail-smtpd/log
mkdir -p /var/qmail/supervise/qmail-pop3d/log
mkdir -p /var/qmail/supervise/qmail-pop3ds/log
cp /var/src/toaster-scripts-0.9.0/send.run /var/qmail/supervise/qmail-send/run
cp /var/src/toaster-scripts-0.9.0/send.log.run /var/qmail/supervise/qmail-send/log/run
cp /var/src/toaster-scripts-0.9.0/smtpd.run /var/qmail/supervise/qmail-smtpd/run
cp /var/src/toaster-scripts-0.9.0/smtpd.log.run /var/qmail/supervise/qmail-smtpd/log/run
cp /var/src/toaster-scripts-0.9.0/pop3d.run /var/qmail/supervise/qmail-pop3d/run
cp /var/src/toaster-scripts-0.9.0/pop3d.log.run /var/qmail/supervise/qmail-pop3d/log/run
# NOTE: If you are using stunnel version 4, you should use pop3ds.run.v4
# instead of pop3ds.run below.
# Type "stunnel -V" (v. 3) or "stunnel -version" (v. 4) to see what version is installed.
# You will also need to copy over stunnel.conf like so:
#
# cp /var/src/toaster-scripts-0.9.0/stunnel.conf /var/qmail/supervise/qmail-pop3ds/
cp /var/src/toaster-scripts-0.9.0/pop3ds.run /var/qmail/supervise/qmail-pop3ds/run
cp /var/src/toaster-scripts-0.9.0/pop3ds.log.run /var/qmail/supervise/qmail-pop3ds/log/run
echo 20 &gt; /var/qmail/control/concurrencyincoming
chmod 644 /var/qmail/control/concurrencyincoming
chmod 755 /var/qmail/supervise/qmail-send/run
chmod 755 /var/qmail/supervise/qmail-send/log/run
chmod 755 /var/qmail/supervise/qmail-smtpd/run
chmod 755 /var/qmail/supervise/qmail-smtpd/log/run
chmod 755 /var/qmail/supervise/qmail-pop3d/run
chmod 755 /var/qmail/supervise/qmail-pop3d/log/run
chmod 755 /var/qmail/supervise/qmail-pop3ds/run
chmod 755 /var/qmail/supervise/qmail-pop3ds/log/run
mkdir -p /var/log/qmail/smtpd
mkdir -p /var/log/qmail/pop3d
mkdir -p /var/log/qmail/pop3ds
chown -R qmaill /var/log/qmail
# allow daemontools to start qmail
ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service
# verify that it's running with qmailctl
sleep 5
qmailctl stat
Now let's compile libdomainkeys, we'll need that later:
cd /var/src
tar -xzf tar/libdomainkeys-0.68.tar.gz
cd libdomainkeys-0.68
patch -p0 < ../tar/libdomainkeys.diff
make
Install Software
  • Vpopmail
Vpopmail is a virtual domain package add-on for qmail. It can handle multiple domains on a single IP address, and none of the user accounts are /etc/passwd or "system" accounts.
Info: [url]http://vpopmail.sf.net[/url]
Install:
groupadd -g 89 vchkpw
useradd -u 89 -g vchkpw vpopmail
cd /var/src
tar -xzf tar/vpopmail-5.4.18.tar.gz
cd vpopmail-5.4.18
patch -p0 &lt; ../tar/vpopmail-5.4.18-cumulative.patch
# NOTE: If you are on the x86_64 platform, you need to set the CFLAGS compiler environment by prefacing the next command with "CFLAGS=-fPIC" , like so: "CFLAGS=-fPIC ./configure ..."
./configure --enable-logging=v
make
make install-strip
# NOTE: If you are on the x86_64 platform, you need to edit cdb/compile to add the -fPIC argument to cc. It should look something like this: 'exec gcc -fPIC -02 -c ${1+"$@"}' After editing compile, do "make && make install-strip" again. see this post for more details
echo '127.:allow,RELAYCLIENT=""' > ~vpopmail/etc/tcp.smtp
(cd ~vpopmail/etc ; tcprules tcp.smtp.cdb tcp.smtp.tmp < tcp.smtp)
# install the vpopmail start script
cp /var/src/toaster-scripts-0.9.0/vpopmailctl /var/qmail/bin/vpopmailctl
chmod 755 /var/qmail/bin/vpopmailctl
ln -s /var/qmail/bin/vpopmailctl /usr/bin
# add qmail toaster patch now that vpopmail is installed
cd /var/src/netqmail-1.05/netqmail-1.05
bunzip2 -c ../../tar/qmail-toaster-0.9.1.patch.bz2 | patch -p0
make clean
make
qmailctl stop
make setup check
# NOTE: the following command needs to be run after any future re-installs of qmail as it will chown this directory back to qmail
chown -R vpopmail:vchkpw /var/qmail/spam
make cert
# enter your company's information
make tmprsadh
# NOTE: This may take a LONG time
# now add the followowing line to your crontab via `crontab -e` to update these temp keys each night
01 01 * * * /var/qmail/bin/update_tmprsadh > /dev/null 2&gt;&1
# start qmail back up
qmailctl start
# allow daemontools to start vpopmail
ln -s /var/qmail/supervise/qmail-pop3d /var/qmail/supervise/qmail-pop3ds /service
# verify that it's running with vpopmailctl
sleep 5
vpopmailctl stat
Install Software
  • Courier-IMAP
Courier-IMAP will supply IMAP/SIMAP access.
Info: [url]http://www.courier-mta.org/imap/[/url]
NOTE: If you are on a system that does not use GNU make, such as FreeBSD, install GNU make and substitue 'gmake' for 'make' during the install of courier-authlib and courier-imap. Most Linux systems use GNU make.
Install Courier's Auth Library:
cd /var/src
tar -xjf tar/courier-authlib-0.59.1.tar.bz2
cd courier-authlib-0.59.1
patch -p0 < ../tar/vpopmail_courier_cram-1.diff
./configure
# NOTE: RedHat/Fedora users need to add "--with-redhat"
make
make install-strip
make install-configure
cp courier-authlib.sysvinit /etc/init.d/courier-authlib
chmod 755 /etc/init.d/courier-authlib
ln -s ../init.d/courier-authlib /etc/rc0.d/K30courier-authlib
ln -s ../init.d/courier-authlib /etc/rc1.d/K30courier-authlib
ln -s ../init.d/courier-authlib /etc/rc2.d/S80courier-authlib
ln -s ../init.d/courier-authlib /etc/rc3.d/S80courier-authlib
ln -s ../init.d/courier-authlib /etc/rc4.d/S80courier-authlib
ln -s ../init.d/courier-authlib /etc/rc5.d/S80courier-authlib
ln -s ../init.d/courier-authlib /etc/rc6.d/K30courier-authlib
Configure:
Edit /usr/local/etc/authlib/authdaemonrc
o Change authmodulelist= "..." to authmodulelist= "authvchkpw"
o Start Authlib's Authdaemon Server
o /etc/init.d/courier-authlib start
Install Courier-IMAP:
cd /var/src
tar -xjf tar/courier-imap-4.1.2.tar.bz2
cd courier-imap-4.1.2
# build as vpopmail
chown -R vpopmail:vchkpw ../courier-imap-4.1.2
su vpopmail
umask 0022
# configure may take some time...
./configure
# NOTE: RedHat/Fedora users need to add '--with-redhat'
make
exit
make install-strip
make install-configure
cp courier-imap.sysvinit /etc/init.d/courier-imap
chmod 755 /etc/init.d/courier-imap
ln -s ../init.d/courier-imap /etc/rc0.d/K30courier-imap
ln -s ../init.d/courier-imap /etc/rc1.d/K30courier-imap
ln -s ../init.d/courier-imap /etc/rc2.d/S80courier-imap
ln -s ../init.d/courier-imap /etc/rc3.d/S80courier-imap
ln -s ../init.d/courier-imap /etc/rc4.d/S80courier-imap
ln -s ../init.d/courier-imap /etc/rc5.d/S80courier-imap
ln -s ../init.d/courier-imap /etc/rc6.d/K30courier-imap
Configure:
Edit /usr/lib/courier-imap/etc/imapd
o Change 'IMAPDSTART=NO' to 'IMAPDSTART=YES'
o add " AUTH=CRAM-MD5" to IMAP_CAPABILITY to enable secure authentication (CRAM-MD5)
Edit /usr/lib/courier-imap/etc/imapd-ssl
o Change 'IMAPDSSLSTART=NO' to 'IMAPDSSLSTART=YES'
o optional: The first time courier-imap is started, the SSL certificate is first created using 'localhost' as the 'common name'. If you want to change this to match your hostname, you can customize the CN line in /usr/lib/courier-imap/etc/imapd.cnf (and pop3d.cnf of you choose to use courier's pop3d) so that the common name matches your server name BEFORE you start the server for the first time.
Start IMAP server
/etc/init.d/courier-imap start
Install Software
  • SquirrelMail
SquirrelMail is a web based IMAP client
Info: [url]http://www.squirrelmail.org[/url]
NOTE: This section assumes that your apache ServerRoot is /var/www and that your DocumentRoot is /var/www/html, and also that your web server runs as apache:apache
Install:
cd /var/src
tar -xjf tar/squirrelmail-1.4.9a.tar.bz2
cd squirrelmail-1.4.9a
cd plugins
tar -xzf ../../tar/quota_usage-1.3.1-1.2.7.tar.gz
cp quota_usage/config.php.sample quota_usage/config.php
cd ../
./configure
here you will have to set a few options:
o go to Server Settings (2),goto server (A) Server Software (8) and change the Server Software from "other" to "courier" (a)
o From the main menu, go to General Options (4) and change Data Direcotry (2) to "/var/www/data/" , change "Allow server thread sort" (10) to y, and change "Allow server-side sorting" (11) to y.
o From the main menu, go to Plugins and enable the quota_usage plugin, along with any others you prefer
o Save settings
o quit
# move the data directory into place and change permissions to the user:group that the web server runs as:
mv data /var/www/
chown -R apache:apache /var/www/data
# install squirrelmail
cd ../
mv squirrelmail-1.4.9a /var/www/html/
Install Software
  • autorespond
Autorespond is compatible autoresponder/vacation type tool that works well with vdelivermail and qmailadmin.
Info: [url]http://qmailadmin.sf.net[/url]
Install:
cd /var/src
tar -xzf tar/autorespond-2.0.4.tar.gz
cd autorespond-2.0.4
patch -p1 &lt; ../tar/autorespond-2.0.4-2.0.5.patch
make
make install
Install Software
  • ezmlm-idx
Fast, full featured Mailing List Manager configureable from qmailadmin.
Info: [url]http://www.ezmlm.org[/url]
Install:
cd /var/src
tar -xzf tar/ezmlm-0.53.tar.gz
tar -xzf tar/ezmlm-idx-0.443.tar.gz
mv ezmlm-idx-0.443/* ezmlm-0.53/
cd ezmlm-0.53
patch -p0 &lt; idx.patch
make
make setup
Install Software
  • QmailAdmin
QmailAdmin can handle nearly all virtual email administration tasks for you from a web browser, except for adding and removing virtual domains.
Info: [url]http://sourceforge.net/projects/qmailadmin[/url]
Install:
cd /var/src
tar -xzf tar/qmailadmin-1.2.11.tar.gz
cd qmailadmin-1.2.11
./configure --enable-help --enable-htmldir=/var/www/html --enable-cgibindir=/var/www/cgi-bin
make
make install-strip
cd ../
tar -xzf tar/qmailadmin-help-1.0.8.tar.gz
cd qmailadmin-help-1.0.8
mkdir /var/www/html/p_w_picpaths/qmailadmin/help
cp -rp * /var/www/html/p_w_picpaths/qmailadmin/help
Your toaster installation is done! Now we're ready to take it for a test drive.
Test Drive
Here we'll add a virtual domain, 'test.com', and test sending/receiving mail. Substitue 'test.com' for whatever domain you setup DNS for.
# Add the domain to vpopmail
/home/vpopmail/bin/vadddomain test.com [password]
This creates the default "postmaster" account for test.com. You will use this account with qmailadmin. Try adding/removing users with qmailadmin here:
[url]http://mail.test.com/cgi-bin/qmailadmin[/url]
To test out quota usage support, create a user with a 6MB quota like so:
/home/vpopmail/bin/vadduser -q 6MB [email]user@test.com[/email] [password]
# verify the user settings, and create the "maildirsize" file
/home/vpopmail/bin/vuserinfo [email]user@test.com[/email]
Now, to log into SquirrelMail as [email]user@test.com[/email], point your browser here:
[url]http://mail.test.com/squirrelmail-1.4.9a/[/url]
Send yourself a message. If you get it, it's likely you're up and running.
To test your POP server, try telnetting to port 110 and logging in.
# telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
+OK &lt;25248.1175148975@localhost>
user [email]user@test.com[/email]
+OK
pass [password]
+OK logged in.
quit
+OK
Connection closed by foreign host.
Test your IMAP server in the same way:
# telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
* OK Courier-IMAP ready. Copyright 1998-2001 Double Precision, Inc. See COPYING for distribution information.
a001 login [email]user@test.com[/email] [password]
a001 OK LOGIN Ok.
a001 logout
* BYE Courier-IMAP server shutting down
a001 OK LOGOUT completed
Connection closed by foreign host.
To test our SSL/TLS connections, all you need to do is duplicate the same tests above, but use openssl's s_client tool to handle encryption.
# for pop:
openssl s_client -connect localhost:995
# for imap:
openssl s_client -connect localhost:993
# for smtp/tls:
openssl s_client -crlf -starttls smtp -connect localhost:25
NOTE: If you get an error like this:
20656:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:s23_clnt.c:473:
your qmail install might need the cipher lists. Debian does this, I don't know why. The following commands will fix it:
openssl ciphers &gt; /var/qmail/control/tlsclientciphers
openssl ciphers &gt; /var/qmail/control/tlsserverciphers
Options
Here, you can add 4 tools that together will prevent viruses from reaching your system via email, and tag spam for client filtering
  • SpamAssassin
SpamAssassin is the leading open source spam scanner. We'll be installing SpamAssassin via CPAN below.
NOTE: Debian users should have installed the SpamAssassin prerequisites during 'Debian Notes' eariler. RPM distributions may want to use 'yum install spamassassin' instead of CPAN below, so that you get all the dependencies. If the RPM of SpamAssassin is out of date, you could then simply do 'yum uninstall spamassassin', and follow the CPAN installation below, as you'll have the dependencies.
Info: [url]http://www.spamassassin.org[/url]
Install:
cd /root
perl -MCPAN -e shell
o conf prerequisites_policy ask
install Mail::SpamAssassin
quit
# run spamd under daemontools
mkdir -p /var/qmail/supervise/spamd/log
mkdir -p /var/log/spamd
chown qmaill /var/log/spamd
cp /var/src/toaster-scripts-0.9.0/spamd.run /var/qmail/supervise/spamd/run
cp /var/src/toaster-scripts-0.9.0/spamd.log.run /var/qmail/supervise/spamd/log/run
chmod 755 /var/qmail/supervise/spamd/run
chmod 755 /var/qmail/supervise/spamd/log/run
cp /var/src/toaster-scripts-0.9.0/local.cf /etc/mail/spamassassin/local.cf
mkdir /etc/mail/spamassassin/.spamassassin/
chown vpopmail /etc/mail/spamassassin/.spamassassin/
ln -s /var/qmail/supervise/spamd /service
Options
  • ClamAV
This open source virus scanner will be called by simscan.
Info: [url]http://clamav.sf.net[/url]
NOTE: You need gmp-devel installed to verify the digital signatures of the virus database.
Install:
groupadd clamav
useradd -g clamav clamav
cd /var/src/tar
wget [url]http://shupp.org/software/clamav-0.90.2.tar.gz[/url]
wget [url]http://shupp.org/patches/clamav-0.90.2.patch[/url]
cd ../
tar -xzf tar/clamav-0.90.2.tar.gz
cd clamav-0.90.2
patch -p0 < ../tar/clamav-0.90.2.patch
./configure
make
make install-strip
# setup freshclam
touch /var/log/freshclam.log
chmod 600 /var/log/freshclam.log
chown clamav /var/log/freshclam.log
cp /var/src/toaster-scripts-0.9.0/freshclam /etc/init.d/freshclam
chmod 755 /etc/init.d/freshclam
ln -s ../init.d/freshclam /etc/rc0.d/K30freshclam
ln -s ../init.d/freshclam /etc/rc1.d/K30freshclam
ln -s ../init.d/freshclam /etc/rc2.d/S80freshclam
ln -s ../init.d/freshclam /etc/rc3.d/S80freshclam
ln -s ../init.d/freshclam /etc/rc4.d/S80freshclam
ln -s ../init.d/freshclam /etc/rc5.d/S80freshclam
ln -s ../init.d/freshclam /etc/rc6.d/K30freshclam
# add freshclam.log to logrotate
cp /var/src/toaster-scripts-0.9.0/freshclam.logrotate /etc/logrotate.d/freshclam
# run clamd under daemontools
mkdir -p /var/qmail/supervise/clamd/log
mkdir -p /var/log/clamd
chown clamav /var/log/clamd
cp ../toaster-scripts-0.9.0/clamd.run /var/qmail/supervise/clamd/run
cp ../toaster-scripts-0.9.0/clamd.log.run /var/qmail/supervise/clamd/log/run
chmod 755 /var/qmail/supervise/clamd/run
chmod 755 /var/qmail/supervise/clamd/log/run
# Start clamd and freshclam
ln -s /var/qmail/supervise/clamd /service
/etc/init.d/freshclam start
Options
  • ripmime
ripmime is a tool for extracting MIME p_w_uploads from email, and is used by simscan.
Info: [url]http://www.pldaniels.com/ripmime/[/url]
Install:
cd /var/src/tar
wget [url]http://shupp.org/software/ripmime-1.4.0.6.tar.gz[/url]
cd ..
tar -xzf tar/ripmime-1.4.0.6.tar.gz
cd ripmime-1.4.0.6
make
make install
Options
  • Simscan
Your qmail installation is already patched (qmail-queue patch) to support simscan, a new tool for using virus/spam scanners with qmail. The nice thing is that it prevents viruses (and optionally spam) from even getting into your queue. This is different from qmail-scanner, which will quarantine infected messages instead of stopping them at the SMTP level.
Info: [url]http://inter7.com/?page=simscan[/url]
Install:
cd /var/src/tar
wget [url]http://shupp.org/software/simscan-1.3.1.shupp2.tar.gz[/url]
cd ../
tar -xzf tar/simscan-1.3.1.shupp2.tar.gz
cd simscan-1.3.1.shupp2
./configure --enable-user=clamav \
--enable-clamav=y \
--enable-spam=y \
--enable-spam-passthru=y \
--enable-per-domain=y \
--enable-ripmime \
--enable-attach=y \
--enable-received=y
make
make install-strip
# add default rules for simscan
echo ":clam=yes,spam=yes,spam_passthru=yes,attach=.vbs:.lnk:.scr:.wsh:.hta:.pif" > /var/qmail/control/simcontrol
# update /var/qmail/control/simcontrol.cdb
/var/qmail/bin/simscanmk
# put versions for received header in /var/qmail/control/simversions.cdb
/var/qmail/bin/simscanmk -g
# turn on scanning
echo ':allow,QMAILQUEUE="/var/qmail/bin/simscan"' &gt;&gt; ~vpopmail/etc/tcp.smtp
qmailctl cdb
  • TMDA
If you want the option to be very aggressive about spam control, TMDA (Tagged Message Delivery Agent) is a challenge based tool that requires a sender to confirm their sending address before the incoming message is delivered. I don't use it myself, but many people do.
Info: [url]http://www.tmda.net[/url]
Install:
cd /var/src/tar
wget [url]http://shupp.org/software/tmda-1.1.11.tgz[/url]
wget [url]http://shupp.org/software/tmda-cgi-0.16.3.tar.bz2[/url]
wget [url]http://shupp.org/patches/tmda-cgi-parent_re.patch[/url]
cd ../
tar -xzf tar/tmda-1.1.11.tgz
cd tmda-1.1.11
./compileall
cd ../
mv tmda-1.1.11 /usr/local/
ln -s /usr/local/tmda-1.1.11 /usr/local/tmda
# Now we'll install the vpopmail related scripts
cp /var/src/toaster-scripts-0.9.0/vadduser-tmda /home/vpopmail/bin/
cp /var/src/toaster-scripts-0.9.0/vpopmail-vdir.sh /home/vpopmail/bin/
cp /var/src/toaster-scripts-0.9.0/vtmdarc /home/vpopmail/etc/
# Setup tmda-ofmipd
mkdir -p /var/qmail/supervise/tmda-ofmipd/log
mkdir -p /var/qmail/supervise/tmda-ssl/log
mkdir /var/log/tmda-ofmipd/
mkdir /var/log/tmda-ssl/
chown vpopmail /var/log/tmda-*
cp /var/src/toaster-scripts-0.9.0/tmda-ofmipd.run /var/qmail/supervise/tmda-ofmipd/run
cp /var/src/toaster-scripts-0.9.0/tmda-ofmipd.log.run /var/qmail/supervise/tmda-ofmipd/log/run
# NOTE: If you are using stunnel version 4, you should use tmda.ssl.run.v4 instead of tmda-ofmipd.ssl.run below. Type 'stunnel -V' (v. 3) or 'stunnel -version' (v. 4) to see what version is installed. You will also need to copy over stunnel.conf like so: cp /var/src/toaster-scripts-0.9.0/tmda-stunnel.conf /var/qmail/supervise/tmda-ssl/stunnel.conf
cp /var/src/toaster-scripts-0.9.0/tmda-ofmipd.ssl.run /var/qmail/supervise/tmda-ssl/run
cp /var/src/toaster-scripts-0.9.0/tmda-ofmipd.ssl.log.run /var/qmail/supervise/tmda-ssl/log/run
chmod 755 /var/qmail/supervise/tmda-ofmipd/run
chmod 755 /var/qmail/supervise/tmda-ofmipd/log/run
chmod 755 /var/qmail/supervise/tmda-ssl/run
chmod 755 /var/qmail/supervise/tmda-ssl/log/run
ln -s /var/qmail/supervise/tmda-ofmipd /var/qmail/supervise/tmda-ssl /service/
# Setup tmda-cgi
cd /var/src
tar -xjf tar/tmda-cgi-0.16.3.tar.bz2
cd tmda-cgi-0.16.3
patch -p0 < ../tar/tmda-cgi-parent_re.patch
rm -r skel/uninstall/%\(Parent\)s/
cd ../
mv tmda-cgi-0.16.3 /usr/local/
cd /usr/local/tmda-cgi-0.16.3
./configure \
-t /var/www/cgi-bin/tmda.cgi \
-p /home/vpopmail/bin/vchkpw \
-m single-user \
-l "vpopmail1 /home/vpopmail/bin/vuserinfo ~" \
-i /usr/local/tmda-cgi-0.16.3/ \
-d /display
# NOTE: If you installed vpopmail somewhere other than /home/vpopmail, you'll need to update refernces in defaults.ini here
make
make install
chown vpopmail:vchkpw /var/www/cgi-bin/tmda.cgi
chmod ug+s /var/www/cgi-bin/tmda.cgi
o Now, you'll need to add an alias directive to your web server. Add the following to /etc/httpd/httpd.conf (or where ever your conf file is), and restart Apache:
Alias /display /usr/local/tmda-cgi-0.16.3/display/
Now, you should be able to point your browser to /cgi-bin/tmda.cgi, log in with your email address and password, and add/edit/remove tmda for your account. Note that the .qmail files created by tmda WILL show up in QmailAdmin.
Options
  • QmailMRTG7
This is a great tool for graphing your mail server's activity.
Info: [url]http://inter7.com/?page=qmailmrtg7[/url]
Install:
cd /var/src/tar
mkdir /var/www/html/qmailmrtg
wget [url]http://shupp.org/software/qmailmrtg7-4.2.tar.gz[/url]
wget [url]http://shupp.org/patches/qmailmrtg7-4.2-cfg.patch[/url]
cd ../
tar -xzf tar/qmailmrtg7-4.2.tar.gz
cd qmailmrtg7-4.2
patch -p0 &lt; ../tar/qmailmrtg7-4.2-cfg.patch
make
make install
# Edit qmail.mrtg.cfg and change all instances of FQDN to your hostname
cp qmail.mrtg.cfg /etc/
indexmaker --section=title /etc/qmail.mrtg.cfg > /var/www/html/qmailmrtg/index.html
# now run mrtg 3 times to get rid of initial cron errors
env LANG=C mrtg /etc/qmail.mrtg.cfg
env LANG=C mrtg /etc/qmail.mrtg.cfg
env LANG=C mrtg /etc/qmail.mrtg.cfg
o Add the following line to your crontab
0-55/5 * * * * env LANG=C /usr/bin/mrtg /etc/qmail.mrtg.cfg &gt; /dev/null
Options
  • QmailAdmin Limits
QmailAdmin can set per domain limits/defaults, which is really useful for hosting companies with different mail packages. This is covered in detail in the INSTALL file of qmailadmin (/var/src/qmailadmin-1.2.11/INSTALL).
Smtp 认证失效,用户名密码不正确
认证通不过,修改下面这个文件 ,将-m修改的大点儿
vim /var/qmail/supervise/qmail-smtpd/run
#!/bin/sh
QMAILDUID=`id -u vpopmail`
NOFILESGID=`id -g vpopmail`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
exec /usr/local/bin/softlimit -m 50000000 \

转载于:https://blog.51cto.com/liguxk/122617

LINUX 邮件服务器qmail 架设相关推荐

  1. 在Linux下安装邮件服务器Qmail(一)

    在Linux下安装邮件服务器Qmail(一) 我还未测试,收藏 在Linux下安装邮件服务器Qmail 功能列表 SMTP服务器:SMTP-AUTH认证(Plain,Login,CRAM-MD5)TL ...

  2. 转--Linux邮件服务器软件比较

    Linux邮件服务器软件比较 出处:www.5dmail.net 作者:5dmail  几年以前,Linux环境下可以选择 的可以免费邮件服务器软件只有Sendmail,但是由于Sendmail的缺陷 ...

  3. Linux邮件服务器搭建实验

    Linux邮件服务器搭建实验 前言 本文重点在于后面的搭建过程,前面会简单介绍邮件服务原理与工作流程,如果有什么错误或遗漏的地方,欢迎大家指正批评,谢谢. 基本理论说明 电子邮件服务器是处理邮件交换的 ...

  4. 到底谁牛 Linux邮件服务器软件比较

    到底谁牛 Linux邮件服务器软件比较 [转载] 几年以前,Linux环境下可以选择 的可以免费邮件服务器软件只有Sendmail,但是由于Sendmail的缺陷,一些开发 者先后开发了若干种其他的邮 ...

  5. linux邮件实验,linux邮件服务器实验报告

    <linux邮件服务器实验报告>由会员分享,可在线阅读,更多相关<linux邮件服务器实验报告(11页珍藏版)>请在人人文库网上搜索. 1.实 验 报 告专业: 计算机科学与技 ...

  6. linux 邮件服务器 并给外网发送邮件,Linux下判断公网IP是否改变,并发送邮件通知...

    考虑到大家都是在自己家里架设服务器,IP是动态的,随时可能改变.为保证IP改变的时候能及时更新域名指向地址,在服务器上挂一个脚本判断IP是否已经改变,并主动发送邮件通知--这显得非常重要. 实现方法有 ...

  7. Linux邮件服务器Postfix,qmaill,Sendmail之比拼

    几年以前,Linux环境下可以选择的可以免费邮件服务器软件只有Sendmail,但是由于Sendmail的缺陷,一些开发者先后开发了若干种其他的邮件服务器软件.当前,运行在Linux环境下免费的邮件服 ...

  8. linux 邮件服务器pop3,linux下的邮件服务器

    既然总结了windows下的邮件服务器,那么linux下的邮件服务器也一起总结一下. 在中职技能比赛中邮件服务器不管是linux和windows原理都是一样,只不过实现的方式有所区别,windows2 ...

  9. Linux 邮件服务器 之跟我一步一步来实现一个邮件系统

    上一篇介绍了邮件服务器的各组件功能和原理,这次来由浅的入深来一步步实现一个邮件系统. 实验环境: 操作系统 CentOS release 5.11 64位 postfix-2.11.6 courier ...

最新文章

  1. 用python做一个输入半径值计算圆的面积保留两位小数_1063 计算谱半径 (20分)
  2. Java编程:排序算法——希尔排序
  3. 目录-换热器工艺设计
  4. visio常用快捷键_visio2003常用快捷键有哪些
  5. 查看 Python 内置函数的方法
  6. 【基因组学】系统发育分析-进化树的相关知识点
  7. 【word】公式排版问题
  8. 【详细】endnote中英文文献混排
  9. 【DRM】PlayReady数字版权保护系统
  10. 安卓源码目录最全解析
  11. 4个高质量站点推荐值得收藏
  12. FreePascal - Typhon在Windows10 X64下的使用问题!
  13. python3 + wxpython 实现RSA加密聊天室
  14. Why WPF's Text is Blurry?
  15. RS-485总线布线规范
  16. 怎么把动图放到word里_word文档如何插入动图?
  17. 2022-2028全球与中国电子漏水检测设备市场现状及未来发展趋势
  18. java学习-画图小程序
  19. 离开 FB 两年后,Instagram 创始人干嘛去了?
  20. 2020老年产业过去|现在|未来:疫情促进“线上化”,各分支加速融合创新

热门文章

  1. 如何在.NET控制台应用程序中获取应用程序的路径?
  2. 电脑遇到蓝屏代码0x000007b问题如何解决
  3. RabbitMQ的入门程序test测试代码
  4. shell脚本验证ssh连通性_ssh远程管理服务
  5. mybatis jar包_Spring4+SpringMVC+MyBatis整合思路
  6. 力扣——盛最多水的容器
  7. 复合选择器-并集选择器(HTML、CSS)
  8. 优先级(HTML、CSS)
  9. oracle indices,Oracle PL/SQL INDICES
  10. 解决eclipse为什么不能查看源码