Build a qmail mail system in Linux

Source: Internet
Author: User
Tags email account qmail
In Linux, the qmail mail system-Linux Enterprise Application-Linux server application information is structured. The following is a detailed description. (1) Features
Security in order to verify the security of Qmail, Qmail's supporters even paid a $1000 reward to find the security vulnerability of Qmail. After one year, the prize was not received and donated to the Free Software Foundation. At present, the author of Qmail has also contributed $500 to seek for Qmail security vulnerabilities.

Speed: Qmail can deliver about one million emails in a medium-scale system, and even process more than 486 emails on a single 0.1 million-day basis, supporting parallel delivery. Qmail supports concurrent mail delivery and can deliver about 20 emails at the same time. Currently, the bottleneck of mail delivery lies in the SMTP protocol. It takes more than 10 seconds to deliver an email to another Internet host through STMP. The author of Qmail proposed QMTP (Quick Mail Transfer Protocol) to accelerate Mail delivery and obtain support in Qmail. Qmail is designed to deliver millions of mails per day on a 16 m machine.

Reliability: to ensure reliability, Qmail returns the result of successful processing only when the email is correctly written to the disk, even if a system crash or power failure occurs during disk writing, you can also re-deliver the email without losing the certificate.

It is particularly simple to manage virtual domains, and even a third-party add-on called vchkpw is developed to support virtual pseudo POP domains. With this software package, POP3 users do not need to have a formal account of the system.

Use ezmlm to support user-controlled mail lists.

Email users are isolated from system accounts. You do not need to set a system account for the email account, which increases security.
(The above is taken from the Internet. The original author's signature is not found. If the original author happens to see it, please contact me. Thank you)
(2) Software
* Qmail-1.03.tar.gz qmail basic system package
* Ucspi-tcp-0.88.tar.gz tcpserver Service Program
* Daemontools-0.76.tar.gz monitoring tools
* Checkpassword-0.90.tar.gz pop3 authentication user program
* Cmd5checkpw-0.22.tar.gz system validators
* Vpopmail-5.2.0.tar.gz virtual domain user pop3 support
* Vqsignup-0.5.tar.gz web-based user registration
* Sqwebmail-3.3.7.tar.gz webmail
* Qmailadmin-0.42.tar.gz virtual domain web-based management
* Ezmlm-0.53.tar.gz List Management
* Autorespond-1.0.0.tar.gz auto-reply Program
* Qmail-smtpd-auth-0.30.tar.gz SMTP authentication patch
(3) installation and configuration
①. Prepare the installation environment
Set the server working environment and compiling environment, prepare all software packages, and set the users and groups when qmail is running.
Mkdir/var/qmail
Groupadd nofiles
Useradd-g nofiles-d/var/qmail/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 nofiles-d/var/qmail qmailq
Useradd-g nofiles-d/var/qmail qmailr
Useradd-g nofiles-d/var/qmail qmails
# Reference URL
# Http://cr.yp.to/

②. Install the tcpserver Service Program
Tar xvf ucspi-tcp-0.88.tar
Cd ucspi-tcp-0.88
Make
Make setup check
③. System verification program (optional)
# Tar zxvf cmd5checkpw-0.22.tar.gz
# Mkdir/usr/man
# Mkdir/usr/man/man8
# Cd cmd5checkpw-0.22
# Make
# Make install
4. Install the pop3 USER verification program
Tar xvf checkpassword-0.90.tar
Cd checkpassword-0.90
Make
Make setup check
Chmod 4755/bin/checkpassword
⑤. Unpackage qmail
# Tar xvzf qmail-1.03.tar.gz
6. SMTP patch
Tar zxvf qmail-smtpd-auth-0.30.tar.gz
Cd qmail-smtpd-auth-0.30
Cp base64.c base64.h README. auth ../qmail-1.03/
Patch-d ../qmail-1.03 <auth. patch
7. Install qmail-1.03
Cd qmail-1.03
Make setup check
./Config-fast $ HOSTNAME
# Set the Qmail server host name
Cd ~ Alias;
Touch. qmail-postmaster. qmail-mailer-daemon. qmail-root
Chmod 644 ~ Alias/. qmail *
Echo "127.0.0.1: allow, RELAYCLIENT =">/etc/tcp. smtp
Sed's/Mailbox/Maildir // '/var/qmail/boot/home>/var/qmail/rc
Chmod 755/var/qmail/rc
Csh-cf "/var/qmail/rc &"
Guest. Install pop3 support for virtual domain users
Groupadd vchkpw
Useradd-g vchkpw vpopmail
Su vpopmail
Mkdir ~ Vpopmail/etc
Echo "127.0.0.1: allow, RELAYCLIENT ="> ~ Vpopmail/etc/tcp. smtp
Echo ": allow">/etc/tcp. smtp
/Usr/local/bin/tcprules/etc/tcp. smtp. cdb/etc/tcp. smtp. tmp </etc/tcp. smtp
Tar xvzf vpopmail-5.2.1.tar.gz
Cd vpopmail-5.2.1
# Modify the host, user, and password of the database connected to the header file
# Add mysql support
# Copy include and lib to/usr/local/include/mysql and/usr/local/lib/mysql respectively
./Configure -- enable-defaultquota = 10485760 -- enable-deliver-filter = y
-- Enable-default-domain = xxxx.com -- enable-mysql = y
Make
Make install-strip
Cd ~ Vpopmail/bin
./Vadddomain xxxx.com
./Vadduser test@xxxx.com
Chmod 6755 ~ Vpopmail/bin/vchkpw
# Convert the cdb file to the mysql database if necessary
#./Vconvert-c-s
This will convert them all from the vpasswd. cdb format to the default
Single table database

#./Vconvert-c-s virtualdomain1 virtualdomain2...
Will convert the list of virtual domains from vpasswd. cdb layout
Single table database

Modify Sendmail to Qmail.
### Skip

# Killall-TERM sendmail
# Mv/usr/lib/sendmail/usr/lib/sendmail.org
# Mv/usr/sbin/sendmail/usr/sbin/sendmail.org
# Mv/etc/rc. d/init. d/sendmail/etc/rc. d/init. d/sendmail.org
# Ln-s/var/qmail/bin/sendmail/usr/lib/sendmail
# Ln-s/var/qmail/bin/sendmail/usr/sbin/sendmail
# Cp/root/qmail-start/etc/rc. d/init. d/-f
# Cp/root/qmail/databytes/var/qmail/control/-f
# Ln-s/etc/rc. d/init. d/qmail/etc/rc. d/rc3.d/S98qmail

Creating a Qmail control script

#! /Bin/sh
Case "$1" in
Start)
Echo "starting qmail ............ "
/Var/qmail/rc &
Echo "start smtp service ............. "
/Usr/local/bin/tcpserver-v-x/etc/tcp. smtp. cdb 0 smtp
/Var/qmail/bin/qmail-smtpd 2> & 1 |/var/qmail/bin/splogger
Smtpd 3 &
Echo "start pop3 service :"
/Usr/local/bin/tcpserver-H-R 0 pop3/var/qmail/bin/
Qmail-popup $ HOSTNAME/home/vpopmail/bin/vchkpw
/Var/qmail/bin/qmail-pop3d Maildir &
;;
Stop)
Echo "stop qmail :"
Killall-9 tcpserver
Killall-9 qmail-lspawn
;;
Restart)
$0 stop
$0 start
;;
*)
Echo-n "Usage: $0 {start | stop | restart }"
Exit 1
;;
Esac
Exit 0

Installing the Monitoring Tool
Tar zxvf daemontools-0.70.tar.gz
Cd daemontools-0.70
Make
Make setup check
# The execution file will be installed in/usr/local/bin;
# Use this tool after installation
# Mkdir/var/run/qmail
# Supervise/var/run/qmail/var/qmail/rc to start qmail. You can also use svc to disable or restart qmail and svstat to monitor qmail running status.
Manage. Install Mail List Management
Tar zxvf ezmlm-0.53.tar.gz
Cd ezmlm-0.53
Make
Make man
Make setup
Installing the auto-reply Program
Tar zxvf autorespond-2.0.2.tar.gz
Make
Make install
Forbidden. Install virtual domain web Management
Tar zxvf qmailadmin-0.81.tar.gz
Cd qmailadmin-0.81
# Before installation, consider meeting the following requirements:
A. Do you have a vpopmail user vchkpw?
B. Location of the cgi-bin directory
C. Location of the ezmlm directory
D. Location of the autorespond directory

./Configure -- enable-cgibindir =/home/boban/public_html/cgi-bin
Make
Make install-strip

Check whether the installation is correct, and check whether the user and password set above can be successfully logged in.

Installing. Install the SqWebMail package
Tar zxvf sqwebmail-3.3.7.tar.gz
Cd sqwebmail-3.3.7
./Configure -- without-authpam -- without-authuserdb
-- Without-authpwd -- without-authshadow -- without-authldap
-- Without-authdaemon -- with-authvchkpw
-- Enable-imageurl =/images
-- Enable-cgibindir =/www/html/cmgmail/cgi-bin
-- Enable-imagedir =/www/html/cmgmail/images
Make configure-check
Make
# If db. h cannot be found in the case of make, cp/usr/include/db1/db. h/usr/include/db. h can be used.
Make check
Make install-strip
Make install-configure
# Run the verification program
/Usr/local/share/sqwebmail/libexec/authlib/authdaemond start
Examples. SqWebmail Culture
Cd sqwebmail/html/
# Enter the directory of the sqwebmail webpage
Make clone from = en-us to = zh-cn
Echo cn50 zh-cn> zh-cn/LANGUAGE_PREF
Echo zh_CN> zh-cn/LOCALE
Echo gb2312> zh-cn/CHARSET
Echo chinese> zh-cn/ISPELLDICT
# Then, just give all the web pages under zh-cn to the Chinese language.
Installing. Install vqsignup
Tar xvfz vqsignup-0.5.tar.gz
Cd vqsignup-0.5
/* If vpopmail is installed in the default path, you do not need to change it */
# A. Modify the Makefile file: FLAGS =-I/home/vpopmail/include
# Modify-I/home/vpopmail/include to indicate the true vpopmail/include directory;
# Modify the following line
# $ (CC) $ (FLAGS)-o $ (BIN) $ (OBJS)-L/home/vpopmail/lib-lvpopmail-lcrypt
# Change-L/home/vpopmail/lib to the true vpopmail/lib directory.
/* Or you can set the environment variable before make */

./Configure -- enable-cgibindir =/home/boban/public_html/cgi-bin -- enable-htmldir =/home/boban/public_html/vmail
Make
Make check
Make install-strip
# Edit the vqsignup. conf file in the cgi-bin directory
# Modify all "add_domain" rows and add your real domain to delete other rows.
# Change the vqsignup_text/*. html file to indicate the path of the row containing "result _ *" to the correct path.
# Modify all the files in the vqsignup_text directory so that they only contain the domains you want to support. You can also customize these pages to make them look better.
# Modify the vqsignup.html file in the documentrootdirectory so that it only contains the domain you want to support. You can also customize this page to make it look better.
# D. Try to register a new user.

The above has passed the test under my PC RedHat 7.3 and RedHat 6.2 respectively !!

[Additional description]


Comment on the following lines
======================================
# Modify the host, user, and password of the database connected to the header file
# Add mysql support
# Copy include and lib to/usr/local/include/mysql and/usr/local/lib/mysql respectively
======================================
Correct understanding:
The modified header file is vauthmysql under vpopmail source code. h. In addition, the file under include should be copied to/usr/local/include/mysql, rather than the entire directory. The same is true for lib.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.