Use vpopmail to manage the qmail mail account database

Source: Internet
Author: User
Tags email account mail account qmail
Article Title: Use vpopmail to manage the database of the qmail mail account. 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.
Abstract: This article discusses how to use vpopmail to separate a qmail account from a system account based on "qmail system user installation and configuration, solution for storing email accounts in database files.
  
Hardware environment: HP Netserver E60 128M memory single Nic
  
Software environment: redhat6.2 vpopmail4.9.4 qmail1.3 Mysql-3.23.22-beta ucspi-tcp-0.88
  
Preface
Implementing a mail system with multiple domains on a single mail server is one of the concerns of qmail users. To solve this problem, Inter7 developed a GPL-authorized vpopmail (vchkpw) to make it easy for users to Implement Virtual email domains and non-system accounts on a qmail mail server. It has the following features:
  
All qmail configurations and data files provide detailed modification commands.
  
Only one system account is used, and all related processes run under a single UID/GID.
Supports virtual domains based on named and IP addresses.
Use NFS securely. The Three-Level Balance Tree filling technology is used to dynamically create mail directories for 10 to 10 million users.
Configurable record functions are provided based on real-world management requirements.
Supports Oracle, Sybase,
Mysql, LDAP,/etc/passwd,/etc/shadow, and the default cdb user authentication information storage method.
Pass the data directly to Maildir to the qmail-pop3d,. qmail file, or any other Maildir program.
There is no need to provide many. qmail files for the virtual domain. Each domain has its own directory in the vpopmail user's home directory, and each domain has an independent password file.
The detailed command program can be used in script files and remote management.
All the vpopmail features of the C library are described in detail.
The following software packages are provided to enhance the features of qmail + vpopmail:
  
  
  
  
QmailAdmin is a web-based vpopmail management tool.
  
Vqsignup is a cgi program based on the vpopmail management tool. It allows users to apply for their own email accounts.
  
Courier IMAP server.
  
SqWebMail
Web-based email client program.
  
  
  
1. Install Mysql;
  
The source code of the rpm package is used by the author. Therefore, the rpm package must be unlocked first:
  
[Root @ radiusd ideal] # rpm-ivh MySQL-3.23.22-1.src.rpm
MySQL ####################################### ###########
  
Then:
  
[Root @ radiusd ideal] # cd/usr/src/redhat/SOURCES/
[Root @ radiusd SOURCES] # ls-al
Total 6432
Drwxr-xr-x 2 root 4096 Oct 29:07.
Drwxr-xr-x 7 root 4096 Oct 30 30 2000 ..
-Rw-r -- 1 root 6560696 Jul 30 mysql-3.23.22-beta.tar.gz
-Rw-r -- 1 root 3082 Jul 30 :23 mysql.gif
  
  
[Root @ radiusd SOURCES] # tar xvgz mysql-3.23.22-beta.tar.gz
  
Decompress the source code package, it will generate a mysql-3.23.22-beta subdirectory in the current directory, which contains the source code of mysql, and then use the following command to install:
  
./Configure
Make
Make install
Scripts/mysql_install_db
  
The Mysql database server is installed. The command to start the mysql server is:
/Usr/local/mysql/bin/safe_mysqld &
  
Now we have installed and run the mysql database server. Below we should set up basic user permission information. By default, mysql has a default user with full database access control and the name is root. Therefore, you should first add an access password for this user:
  
[Root @ radiusd src] # mysql-u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-
  
Welcome to the MySQL monitor. Commands end with; or g.
Your MySQL connection id is 183 to server version: 3.23.22-beta
  
Type 'help' for help.
  
Mysql>
In this way, the customer program of the mysql server is entered, and then the SQL statement command is issued:
  
UPDATE user SET Password = PASSWORD ('new _ password') WHERE user = 'root ';
Flush privileges;
  
New_password is the password set for the mysql root User. However, it is generally recommended to create another user with the same permissions as root. The command is as follows:
  
Insert into user
VALUES ('host', 'user', 'passwd ',
'Y ', 'y', 'y ');
  
Generally, mysql and icradius servers run on the same server. At this time, the host is localhost. If your icradius server runs on another server, then you need to set the host name for your icradius server. The user name you set. The password is the user's password.
  
2. Installation Process of vpopmail
  
1. decompress the software package:
  
[Root @ www src] # tar xvfz vpopmail-4.9.4.tar.gz
  
2. Add required groups and users:
  
[Root @ www vpopmail-4.9.4] #/usr/sbin/groupadd vchkpw
[Root @ www vpopmail-4.9.4] #/usr/sbin/useradd-g vchkpw vpopmail
  
To store the vpopmail user's home directory in another directory, use the following command:
  
[Root @ www vpopmail-4.9.4] #/usr/sbin/useradd-g vchkpw-d/path/to/where/you/want vpopmail
3. Create ~ Vpopmail/etc/tcp. smtp File
  
If you have a class c address of 192.168.0, the file should contain the following content:
  
127.0.0.: allow, RELAYCLIENT = ""
10.1.1.: allow, RELAYCLIENT = ""
: Allow
  
If you have multiple C addresses, you must include the entries corresponding to the C addresses in the file.
  
4. Configure and compile vpopmail:
  
[Root @ www vpopmail-4.9.4] #./configure
The [root @ www vpopmail-4.9.4] # make
[Root @ www vpopmail-4.9.4] # make install-strip
  
5. Support for roaming users
  
To allow a roaming user to forward mail (mail relay) through the mail server, use the following configuration options:
  
[Root @ www vpopmail-4.9.4] #./configure -- enable-roaming-users = y
  
Set crontab and run:
  
[Root @ www etc] # crontab-e
  
Add the following content:
40 ***/home/vpopmail/bin/clearopensmtp 2> & 1>/dev/null
  
The principle behind roaming users is that when a roaming user uses pop3 to obtain a mail, the address is allowed to forward mail through the mail server within a certain period of time.
  
6. Add a virtual domain
  
[Root @ www/] # cd/home/vpopmail/bin
[Root @ www/] #./vadddomain test.com
Or:
[Root @ www/] #./vadddomain test.com password-for-postmaster
  
This command will modify several qmail configuration files:
  
/Var/qmail/control/locals
/Var/qmail/control/rcpthosts
/Var/qmail/control/morercpthosts (if rcpthosts> than 50 lines)
/Var/qmail/control/virtualdomains
/Var/qmail/users/assign
/Var/qmail/users/cdb
  
At the same time, the following directories or files will be created:
  
~ Vpopmail/domains/test.com
~ Vpopmail/domains/test.com/postmaster/Maildir...
~ Vpopmail/domains/test.com/vpasswd
~ Vpopmail/domains/test.com/vpasswd.cdb
  
Then, restart the qmail process to update the configuration:/etc/rc. d/init. d/qmailstartup restart.
  
6. Add new POP mail users
  
[Root @ www/] # cd/home/vpopmail/bin/
[Root @ www bin/] #./vadduser newuser@test.com
Or
[Root @ www bin/] #./vadduser newuser@test.com
  
In this case, the user's email domain needs to be specified test.com, and this user is added
~ Vpopmail/domains/test.com.
  
7. Delete pop mail users
  
[Root @ www bin/] #/home/vpopmail/bin/vdeluser newuser@test.com
  
8. modify a POP user password:
  
[Root @ www bin/] #/home/vpopmail/bin/vpasswd newuser@test.com
  
9. Combining vchkpw and qmail-pop3d
  
When using vpopmail, you need to change the run script of pop:
  
#! /Bin/sh
Exec/usr/local/bin/tcpserver-v-H-R 0 pop-3-u vpopmail-g vchkpw/var/qmail/bin/qmail-popup domain1.com/home/vpopmail /bin/vchkpw/var/qmail/bin/qmail-pop3d Maildir 2
> & 1 |
/Var/qmail/bin/splogger pop3d
  
Note: everything from exec to "|" is in the same row.
  
3. vpopmail detailed configuration options
  
-- Enable-roaming-users = n | y if mail relay is enabled after pop3 authentication is passed, it is disabled by default.
  
If this method is set to yes, when a user passes pop3 authentication, the IP address of the user is added to the list that allows the mail relay through the mail server. A cronjob program named clearopensmtp can be used to remove this IP address from the list of permitted email addresses after a period of time. This option requires the-x/etc/tcp. smtp. cdb option to use tcpserver to run the smtp server.
-- Enable-hardquota = # | n sets or opens the disk quota. NOQUOTA is unlimited.
  
Set Disk Quota for no email account, missing

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.