InQmailConfiguration inSMTPNot complex. See the following.
I. Operating System
RatHat Linux 6.2
2. Required Software
1. qmail-1.03 (www.qmail.org)
2. checkpassword (cr. yp. to/checkpwd.html) or vpopmail (www.inter7.com/vpopmail)
3. qmail-smtpd.c (www.nimh.org/hacks/qmail-smtpd.c) Key Files
In fact, both qmail and checkpassword can be compiled and in use. In this way, only one file is needed,
And does not affect normal use.
Iii. Software Installation
1. Install qmail, checkpassword, or vpopmail normally.
2. Set relay rules.
Relay means that the server accepts smtp requests from the client and forwards emails sent from the client to a third party.
Relay must be controllable. It is very easy to control relay under qmail, as long as the environment variable of the smtp process accessed by the client
Including (RELAYCLIENT = ""), the relay is allowed; otherwise, the relay is rejected. The implementation method is to apply the relay request in/etc/tcp. smtp
And then use tcprules to generate a rule table. This is because
You do not need to set any IP address in advance. Therefore, the default rule is set to "only relay this server ".
Echo '1970. 0.0.1: allow, RELAYCLIENT = "" '>/etc/tcp. smtp
/Usr/local/bin/tcprules/etc/tcp. smtp. cdb/etc/tcp. smtp. tmp </etc/tcp. smtp
3, copy the qmail-smtpd.c to the qmail source file directory, it is best to back up the original file first.
Compile qmail-smtpd separately. (Vi Makefile; find the command related to qmail-smtpd)
./Compile qmail-smtpd.c
./Load qmail-smtpd rcpthosts. o commands. o timeoutread. o \
Timeoutwrite. o ip. o ipme. o ipalloc. o control. o constmap. o \
Received. o date822fmt. o now. o qmail. o cdb. a fd. a wait. \
Datetime. a getln. a open. a sig. a case. a env. a stralloc. \
Alloc. a substdio. a error. a str. a fs. a auto_qmail.o 'cat \
Socket. lib'
4. Copy the newly generated qmail-smtpd to the/var/qmail/bin directory. To be different from the original execution file,
Here we change the new execution file to a qmail-smtpd.auth.
5. Set/bin/checkpassword or/home/vpopmail/bin/vchkpw to SetUID and SetGID. This point
Important. Otherwise, the authentication fails. This is because the smtpd process is executed by qmaild. While the password verification program
It was originally used only for pop3 processes and executed by root or vpopmail respectively to read the shadow or password in the database,
And retrieve the user's mail directory. Qmaild has no permission to perform these operations. If the smtp process needs to call password verification
You must use setuid and setgid. In fact, this is very reassuring. Both of these two password verification programs are equipped
The source code is very safe. You only need to put it in a safe directory (set other users except qmaild.
You do not have the permission to execute other SHELL accounts ).
Chmod 4755/bin/checkpassword or
Chmod 4755/home/vpopmail/bin/vchkpw
6. Command Line test:
If vpopmail is used, replace/bin/checkpassword with/home/vpopmail/bin/vchkpw.
# Su-qmaild-c "/var/qmail/bin/qmail-popup localhost/bin/checkpassword pwd" <press enter>
+ OK, <18789.978689240 @ localhost>
User realuser <press enter>
+ OK
Pass password <press enter>
If the result shows the user directory, it indicates the operation is successful. If "-ERR authorization failed" is displayed
In addition to the password, you also need to check whether the directories of the user's superiors are readable and whether the permissions of the password verification program are set correctly.
7. Modify the smtpd startup command line. It turns out to be:
/Usr/local/bin/tcpserver-H-R-l 0-t 1-c 100-x/etc/tcp. smtp. cdb-u604-g601 \
0 smtp/var/qmail/bin/qmail-smtpd 2> & 1 |/var/qmail/bin/splogger smtpd 3 &
(604 is the UID of qmaild and 601 is the GID of qmaild:
/Usr/local/bin/tcpserver-H-R-l 0-t 1-c 100-x/etc/tcp. smtp. cdb-u604-g601 \
0 smtp/var/qmail/bin/qmail-smtpd.auth/bin/checkpassword/bin/true 2> & 1 \
|/Var/qmail/bin/splogger smtpd 3 &
If vpopmail is used, replace/bin/checkpassword with/home/vpopmail/bin/vchkpw.
8. KILL the original smtpd process and start the new smtpd process.
9. Use the mail software of OutlookExpress and Netscape 4.6 or later on the client for verification.
4. The above settings have been verified by both checkpassword and vpopmail methods.
Through the above introduction, we all know how to configure SMTP in Qmail. I hope it will help you!
- Learn more about Qmail's working principles and configuration files
- Qmail mail system log and Management
- Clear Qmail queues
- Qmail Introduction
- Analysis on Installation Process of Qmail mail server in Linux
- Linux-qmail virus/spam
- Qmail on the mail server in Linux