Set up an enterprise-level POP3 POP3 server

Source: Internet
Author: User
Article Title: set up an enterprise-level POP3 POP3 server. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
   I. Overview
This article describes how to use the open source software Procmail and Qpopper to set up a POP3 server for enterprise customers, while ensuring excellent performance and security. This section describes how to set Procmail and Qpopper to store user emails using the hash spool directory structure.
  
   Step 2:
The software environment is RedHat Linux 6.2.
  
1. download the latest versions of Procmail and Qpopper.
  
The latest version of Procmail is now 3.21, which can be downloaded from [url = www.procmail.org/procmail-3.21.tar.gz] Http://www.procmail.org/procmail-3.21.tar.gzdownload. [/Url] the latest version of Qpopper is now 4.0, which can be downloaded from http://www.eudora.com/qpopper_general/
  
2. Compile Procmail
  
Assume that the downloaded file is stored in/root.
  
# Cd/root
  
# Tar xvfz procmail-3.21.tar.gz
# Cd procmail-3.21
  
# Vi src/authenticate. c
Change # define MAILSPOOLHASH followed by 0 to 2 (level-2 hash directory to improve server performance, especially when there are a large number of users)
  
Note: In this case, if the user's mailbox is a jephe@domain.com, the file should exist/usr/mail/j/e/jephe
  
Modify the src/autoconf file. Here, the mail spool directory I use is/usr/mail, then
# Vi src/autoconf
Search/usr/mail, for a in/var/spool/mail/usr/spool/mail/var/mail/usr/mail/spool/mail to for a in/usr/mail
  
# Make
# Make install-suid
  
Run # procmail-v as root to check whether the user's email path is/usr/mail/r/o/root.
  
3. compile Qpopper
  
Assume that the downloaded file is in/root
  
# Cd/root
# Tar xvfz qpopper4.0.4.tar.gz
# Cd qpopper4.0.4
# Vi popper/pop_extend.c
Change "IMPLEMENTATION % s %. * s % s-version-% s \ r \ n" to "IMPLEMENTATION \ r \ n ".
Why?
If this parameter is not changed, you can use the telnet server 110 command and the user username and passpassword command to obtain the qpopper version number of the server.
  
#./Configure -- enable-hash-spool = 2 -- enable-log-login -- enable-server-mode -- enable-shy
-- Enable-spool-dir =/usr/mail -- enable-specialauth -- enable-temp-drop-dir =/var/spool/cache
-- Enable-fast-update -- disable-check-pw-max -- disable-old-spool-loc
  
Note:
  
You can also compile the program to an independent running mode.
-- Enable-standalone, so you do not need to set and/etc/inetd in the xinetd described below. in conf, the Command Behavior/usr/local/sbin/popper-S-F-s-c-R-T120 is directly run.
  
Note: -- enable-specialauth: Use the/etc/shadow password for authentication.
-- Enable-hash-spool = 2 use level-2 hash structure
-- Enable-spool-dir =/usr/mail: the user's mailbox file is/usr/mail/j/e/jephe
  
About -- enable-fast-update?
If the partition of your temporary spool directory/var/spool/cache is different from that of mail spool/usr/mail, do not use -- enable-fast-update, not only do you not enjoy the benefits of the fast-update mode, but you will also leave Redundant Error messages in maillog.
  
# Make
# Make install
  
You need to create a two-layer hash directory structure under/usr/mail and/var/spool/cache, and you can write a script for it.
  
Edit the/etc/inetd. conf file
Comment out the rows starting with pop-3 and add the following rows later:
Pop-3 stream tcp nowait.400 root/usr/local/sbin/popper-F-S-s-c-R-T120
  
For Redhat 7.1, create a file pop3 under/etc/xinetd. d, which contains the following content:
  
Service pop3
{
Socket_type = stream
Protocol = tcp
Wait = no
User = root
Server =/usr/local/sbin/popper
Server_args = qpopper-S-F-s-c-R-T120
Port = 110
}
  
If you set ALL: ALL in/etc/hosts. deny, enter
  
Popper: ALL
  
In addition, in Redhat 7, there is a file ipop3 under/etc/xinetd. d, which is the default pop3 service. You should delete this file or comment out the service.
  
3. Create a POP3 User
  
You do not need to allocate the home directory to the mail User or set the home directory to/usr/mail/j/e (assuming the user is jephe). Use the following command to create a user.
  
# Useradd mailuser1-c "Mail User1"-g mail-d/dev/null-s/bin/false
  
Then you can write a batch of commands and use chpasswd to give each user the same password.
  
A. First, use passwd to set the password for mailuser1. Assume it is "abc123" and check the password in/etc/shadow. On my machine, "abc123" is $1 $ G22Plicn $ r5.bSe0U7DbaHN7tCevTR/
  
B. create a new file/tmp/password. Each line contains a user name: password. You can use the following command to obtain cat/etc/passwd | awk-F: '{print $1}' | sed-e's/$/: $1 $ G22Plicn $ r5.bSe0U7DbaHN7tCevTR \ // G'
  
C. Run chpasswd </tmp/password

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.