Postfix Integrated Environment (Postfix + MySQL + Cyrus-Sasl2 + Courier-IMAP + IGENUS + PostFixAdmin)

xiaoxiao2021-03-06  42

Install software system

1), install mysql4.0.x

In order to distinguish between the system's software system, all we manually compiler software (daemon) software is installed in / usr / server.

$ tar -zxvf mysql-4.0.21.tar.gz

$ cd mysql-4.0.21

$ ./configure --prefix = / usr / server / mysql --localStatedir = / usr / server / mysql / db --with-unix-socket-path = / tmp / mysql.sock --with-mysqld-user = Mysql --with-charset = gb2312 --with-extra-charsets = all

$ Make

$ su root

# make install

Next, install the MySQL database

#ProupAdd MySQL

# pw useradd mysql -g mysql

# scripts / mysql_install_db

# chown -r mysql: mysql / usr / server / mysql / db

Finally, you need to set the ROOT password of MySQL

# / usr / server / mysql / bin / mysqld_safe &

# / usr / server / mysql / bin / mysqladmin -uroot password 'Your_password_goes_here'

After the password setting is complete, temporarily close the MySQL service:

# kill% 1

2), install cyrus-sasl2

Because we want to query the MySQL database, we need to add support for MySQL when compiling cyrus-sasl2, and we open two support for Plain and Login:

$ tar -zxvf cyrus-sasl-2.1.19.tar.gz

$ CD Cyrus-SASL-1.2.19

$ ./configure --disable-anon -enable-plain --enable-login --enable-sql --with-mysql = / usr / server / mysql

$ Make

$ su root

# make install

According to SASL installation instructions, you need to create a SymbLink:

# ln -s / usr / local / lib / sasl2 / usr / lib / sasl2

3), install postfix2.1.x

First, establish a Postfix, PostDrop group, and postfix users according to PostFix installation instructions:

#ProupAdd Postfix

#ProupAdd PostDrop

# PW useradd postfix -g postfix -g postdrop

After the user and the establishment are good, we can start compiling postfix:

$ tar -zxvf postfix-2.1.4.tar.gz

$ CD Postfix-2.1.4

$ Make Tidy

$ Make makefiles' CCARGS = -DHAS_MYSQL -I / usr / server / mysql / include / mysql -DUSE_SASL_AUTH -I / usr / local / include / sasl '' AUXLIBS = -L / usr / server / mysql / lib / mysql -lmysqlclient -LM -LZ -L / USR / local / lib -lsasl2 '

$ Make

$ su root

# make install

You may get the following tips when you execute make install (if you don't have to pay: P):

/usr/libexec/ld-elf.so.1: shared object "libmysqlclient.so.12" not found because our MySQL is not installed in the default directory, so you need to tell Postfix to find LibmysqlClient.so .12, using ldconfig can achieve this:

# ldconfig -m / usr / server / mysql / lib / mysql

Then there will be many problems in Make Install, but postfix has set up the default answer to us. You can use these answers directly, so we just need to press Enter directly.

Here, postfix that supports mysql and SASL certification is already installed.

4) Install Courier-IMAP

$ tar -jxvf coIr-IMAP-3.0.7.tar.bz2

$ CD Courier-IMAP-3.0.7

$ ./configure --prefix = / usr / server / course - imap --with-authmysql --enable-unicode

The following error prompts may occur when performing configure:

Configure: Error: --with-authmysql specified but no mysqlclient.so

Configure: error: / usr / local / bin / bash './configure' failed for authlib

This is because Courier-IMAP uses mysql_config to get some compile parameters (include, libs, cflags, socket, etc.), but we are installing mysql in non-usr / local, so the default PATH does not work, you need us To make Courier-IMAP can search mysql_config:

$ EXPORT PATH = "$ PATH: / USR / Server / MySQL / BIN"

The shell used above is SH, if it is CSH, execute

$ SETENV PATH "$ {PATH}: / usr / server / mysql / bin"

Then execute the configure script again:

$ ./configure --prefix = / server / groupier-imap --with-authmysql --enable-unicode

$ Make

$ su root

# make install

Configuration system 1), create user data table structure

Here, we use the postfixadmin-2.0.5 table structure, now let's unpack PostFixAdmin:

$ TAR -ZXVF PostFixAdmin-2.0.5.tgz

$ CD PostfixAdmin-2.0.5

There is a Database.txt file in postfixadmin-2.0.5.tgz, which describes the structure of each table, which is as follows:

###########################################

# Postfix Admin Release 2.x #

###########################################

#

# CopyRight (C) 2002, 2003, 2004 High5!

# Created by: Mischa Peters

#

# This is The Complete Database Structure for Postfix Admin.

# If you are installing from scratch you can use this file OtherWise You

#need to use the table_changes.txt or table_backup_mx.txt That Comes with postfix admin. #

# There Are 2 entries for a database user in the file.

# One you can use for postfix and one for postfix admin.

#

# I i) Run this file twice (2x) You will get an error on the user credr.

# T go around you can Either Comment The Lines Below "Use MySQL" UnTil "use postfix".

# Or you can remove the users from the database and run it..

#

# You can create the database from the shell with:

#

# mysql -u root [-p]

## postfix / mysql # Use mysql; # Postfix User & PasswordInsert INTO USER (Host, User, Password) Values ​​('localhost', 'postfix ", Password (' postfix ')); Insert Into DB (Host, DB, User , SELECT_PRIV) VALUES ('POSTFIX', 'PASTFIX', 'Postfix', 'Y'); # Postfix Admin User & PasswordInsert Into User (Host, User, Password) Values ​​('localhost', 'postfixadmin ", password (' PostfixAdmin ')); Insert Into DB (Host, DB, User, SELECT_PRIV, INSERT_PRIV, UPDATE_PRIV, DELETE_PRIV) VALUES (' localhost ',' postfix ',' postfixadmin ',' y ',' Y ',' Y ',' Y '); FLUSH PRIVILEGES;. GRANT USAGE ON postfix * TO postfix @ localhost; GRANT SELECT, INSERT, DELETE, UPDATE ON postfix * TO postfix @ localhost;. GRANT USAGE ON postfix * TO postfixadmin @ localhost;. GRANT SELECT, INSERT , Delete, update on postfix. * To postfixadmin @ localhost; crete database postfix; use postfix;

## Table Structure for Table Admin # Create Table Admin (Username Varchar (255) Not Null Default ', Password Varchar (255) Not Null Default', Created DateTime Not Null Default '0000-00-00 00:00:00 ', Modified DateTime Not Null Default' 0000-00-00 00 00: 00: 00 ', Active Tinyint (1) Not Null Default' 1 ', Primary Key (UserName) postfix Admin - Virtual Admins'; ## Table structure for table alias # CREATE TABLE alias (address varchar (255) NOT NULL default '', goto text NOT NULL, domain varchar (255) NOT NULL default '', created datetime NOT NULL Default '0000-00-00 00: 00: 00', Modified DateTime Not Null Default '0000-00-00: 00: Active Tinyint (1) Not Null Default' 1 ', Primary Key (Address), Key Address (address) type = myisam comment = 'postfix admin - virtual aliases';

## Table structure for table domain # CREATE TABLE domain (domain varchar (255) NOT NULL default '', description varchar (255) NOT NULL default '', aliases int (10) NOT NULL default '-1', mailboxes int ( 10) Not null default '-1', Maxquota Int (10) Not Null Default '-1', Transport Varchar (255) Default Null, Backupmx Tinyint (1) Not Null Default '0', Created DateTime Not Null Default '0000 -00-00 00: 00: MODIFIED dateTime Not Null Default '0000-00-00 00 00: 00: 00', Active Tinyint (1) Not Null Default '1', Primary Key (Domain), Key Domain Domain) "Type = myisam comment = 'postfix admin - virtual domains';

## Table structure for table domain_admins # CREATE TABLE domain_admins (username varchar (255) NOT NULL default '', domain varchar (255) NOT NULL default '', created datetime NOT NULL default '0000-00-00 00:00:00 ', active tinyint (1) NOT NULL default' 1 ', KEY username (username)) TYPE = MyISAM COMMENT =' Postfix Admin - Domain Admins'; ## Table structure for table log # CREATE TABLE log (timestamp datetime NOT NULL default '0000-00-00: 00: Username varchar (255) Not null default', domain varchar (255) Not null default ', action varchar (255) Not null default', Data VARCHAR (255 NOT NULL Default '', key timestamp (timestamp) type = myisam comment = 'postfix admin - log';

## Table structure for table mailbox # CREATE TABLE mailbox (username varchar (255) NOT NULL default '', password varchar (255) NOT NULL default '', name varchar (255) NOT NULL default '', maildir varchar (255) NOT NULL default '', quota int (10) NOT NULL default '-1', domain varchar (255) NOT NULL default '', created datetime NOT NULL default '0000-00-00 00: 00: 00', modified datetime NOT NULL Default '0000-00-00 00: 00 00 00 00 00 00: Active Tinyint (1) Not Null Default' 1 ', Primary Key (UserName), Key UserName (UserName) Type = Myisam Comment =' Postfix Admin - Virtual Mailboxes';

## Table structure for table vacation # CREATE TABLE vacation (email varchar (255) NOT NULL default '', subject varchar (255) NOT NULL default '', body text NOT NULL, cache text NOT NULL, domain varchar (255) NOT Null Default '', Created DateTime Not Null Default '0000-00-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00- 00 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 00 00 00 00 00 00 00 00 00 00: 1) Not Null Default' 1 ', Primary Key (Email) TYPE = MyISAM Comment = 'Postfix Admin - Virtual Vacation'; now imports the table structure into mysql:

$ / usr / server / mysql / bin / mysql -u root -p

2) Configuring postfix

First, you need to change some of the basic parameters in /etc/postfix/main.cf, please modify according to your own actual situation, this example is CNFUG.ORG as an example:

myhostname = mail.cnfug.org

mydomain = cnfug.org

Myorigin = $ mydomain

MyDestination = $ MyHostName, Localhost. $ mydomain, localhost (not using $ mydomain here) because we will use VirtualHost

INET_INTERFACES = ALL

Alias_maps = Hash: / etc / postfix / aliases

Generate a AliaSES table

# Postalias / etc / postfix / aliases

After setting the above basic parameters, you need to set up VirtualHost. In this case, we store all the emails in / var / mailbox, because IGENUS is to create files and storage information in the user mailbox directory, So ask the user to write permission to the user's mailbox directory, so we are here to set the UID and GID of the user mailbox to the UID and GID of the web server to ensure that IGENUS is working properly, this example is the UID of the web server And GID is 80. Join in /etc/postfix/main.cf:

Virtual_mailbox_domains = mysql: /etc/postfix/mysql/mysql_mailbox_domains.cf

Virtual_mailbox_base = / var / mailbox /

Virtual_mailbox_maps = mysql: /etc/postfix/mysql/mysql_mailbox_maps.cf

Virtual_minimum_uid = 80

Virtual_UID_MAPS = Static: 80

Virtual_gid_maps = static: 80

Virtual_Alias_maps = mysql: /etc/postfix/mysql/mysql_alias_maps.cf

The virtual domain name supports configuration is relatively simple. According to the word, you can understand, but you need to pay attention, / var / mailbox / final "/" can not be omitted.

After setting the basic parameters of the virtual domain name, you need to set each MySQL query profile. We uniformly store all the MySQL query profiles in / etc / postfix / mysql, each query configuration file is as follows: (1) /etc/postfix/mysql/mysql_mailbox_domains.cf

User = postfix

Password = postfix

DBNAME = Postfix

Table = domainselect_field = domainwhere_field = domainaddom_conditions = and active = '1'

(2) /etc/postfix/mysql/mysql_mailbox_maps.cf

User = postfix

Password = postfix

DBNAME = Postfix

Table = mailboxselect_field = maildirwhere_field = usernameAdditional_conditions = and active = '1'

(3) /etc/postfix/mysql/mysql_alias_maps.cf

User = postfix

Password = postfix

DBNAME = Postfix

Table = aliasslect_field = gotowhere_field = addressadditional_conditions = and active = '1'

Next to open SASL authentication (in order to join the old MUA-compatible support, join the support of Broken_SASL_AUTH_CLIENTS, add: in /etc/postfix/main.cf:

SMTPD_SASL_AUTH_ENABLE = YES

SMTPD_SASL_Application_name = SMTPD

Broken_SASL_AUTH_CLIENTS = YES

SMTPD_SASL_LOCAL_DOMAIN = CNFUG.ORG

SMTPD_RECIPIENT_RESTRICTIONS = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

Finally, we need to build / var / mailbox directory:

# MKDIR / VAR / MAILBOX

# chown www: www / var / mailbox

3) Configure SASL certification

When you configure postfix, we set the SASL configuration file used by Postfix as SMTPD, so now we need to configure SASL to let it know how to read authentication information from MySQL:

# vi /usr/local/lib/sasl2/smtpd.conf

PWCHECK_METHOD: AUXPROP

Mech_list: plain login

AUXPROP_PLUGIN: SQL

SQL_ENGINE: MySQL

SQL_HOSTNAMES: Localhost

SQL_USER: Postfix

SQL_Passwd: Postfix

SQL_DATABASE: Postfix

SQL_SELECT: SELECT Password from mailbox where username = '% u @% r' and domain = '% r' and activ = '1'

In the above option, you can understand it, where the% u in SQL_SELECT is the username,% R is represented by the realm, which is usually the domain name of the user (if the domain name is not included in the username, the default is the server Domain name), because the user name generated by PostFixAdmin is user@domain.ltd, not the standard user form, so we need to set the WHERNAME = '% u $% r', the 'username @ domain name'. 4) Configuring Courier-IMAP

To let Courier-IMAP read the authentication information in MySQL correctly, you need to configure Authmysql configuration file / usr / server / channel-iMap / etc / authorsqlrc, this example is as follows:

MySQL_Server Localhost

Mysql_socket /tmp/mysql.sock

MySQL_USERNAME POSTFIX

MySQL_Password Postfix

MySQL_DATABASE Postfix

MySQL_USER_TABLE MAILBOX

MYSQL_LOGIN_FIELD usernameMYSQL_CLEAR_PWFIELD passwordMYSQL_UID_FIELD '80'MYSQL_GID_FIELD' 80'MYSQL_HOME_FIELD '/ var / mailbox /' MYSQL_MAILDIR_FIELD maildirMYSQL_NAME_FIELD nameMYSQL_QUOTA_FIELD quotaMYSQL_WHERE_CLAUSE active = '1'

Like the configuration in postfix, / var / mailbox / final "/" characters cannot be omitted.

Next, configure authdaemonrc:

# cp /usr/server/courier-imap/etc/authdaemonrc.dist / usr / server / channel-iMap / etc / Authdaemonrc

Because we only use the Authmysql module here, we can remove other verification modules, edit the Authdaemonrc file, will:

AuthmoduleList = "Authcustom AuthcRam Authuserdb Authmysql Authpam"

Change to:

AuthmoduleList = "authmysql"

Finally, the POP3D and IMAPD are configured, here we use their default settings directly:

# cp /usr/server/courier-imap/etc/pop3d.dist / usr / server / channel - iMap / etc / pop3d

# cp /usr/server/courier-Imap/etc/pop3d-ssl.dist / usr / server / court- IMAP / ETC / POP3D-SSL

# cp /usr/server/courier-Imap/etc/imapd.dist / usr / server / channel-iMap / etc / iMapd

# cp /usr/server/courier-imap/etc/imapd-ssl.dist / usr / server / channel-iMap / etc / iMapd-SSL

Start service 1), mysql

# /usr/server/mysql/share/mysql/mysql.server start

To ensure that Postfix and later process can search correctly, you are set to the LDConfig search path here: # ldconfig -m / usr / server / mysql / lib / mysql

2), postfix

# / usr / sbin / postfix start

3), Courier-IMAP

# / usr / server / setier-imap / libexec / authlib / authdaemond start

# /usr/server/courier-imap/libexec/pop3d.rc start

# /usr/server/courier-imap/libexec/imapd.rc start

If you want the system to automatically run these services when you start, you can directly add the commands of these boot services to /etc/rc.local (here is as an example of BSD UNIX, if it is a non-BSD UNIX system, please /etc/rc.local is changed to the corresponding system self-start file name).

The test system is ongoing the next step, we can test the background system to ensure that the background system has been working properly. First establish a test user:

$ / usr / server / mysql / bin / mysql -upostfix -p

Mysql> USE Postfix;

Mysql> Insert Into Domain (Domain, Active) Values ​​('cnfug.org', '1');

Mysql> Insert Into Mailbox (Username, Password, Name, MAILDIR, DOMAIN, ACTIVE) VALUES ('Test@cnfug.org', 'Test', 'Tester', 'cnfug.org/test/mAildIr/' ,'cnfug. ORG ',' 1 ');

mysql> quit;

Test postfix:

$ Echo "Hello World" | mail -s "test mail" test@cnfug.org

$ ls -al / var / mailboxdrwx ------ 3 WWW WWW 512 OCT 16 23:15 cnfug.org $ ls -al /var/mailbox/cnfug.orgdrw----- 3 WWW WWW 512 OCT 16 23:15 .drwxr-xr-x 7 WWW WWW 512 Oct 16 23:24 ..drwx ------ 3 WWW WWW 512 OCT 16 23:15 Test $ ls -al /var/mailbox/cnfug.org/ TestDrwx ------ 3 WWW WWW 512 Oct 16 23:15 .drwx ------ 3 WWW WWW 512 Oct 16 23:15 ..drwx ------ WWW WWW 512 OCT 16 23: 15 MAILDIR $ ls -al /var/mailbox/cnfug.org/test/mailDirdrw----- 5 www www 512 Oct 16 23:15 .drwx ------ 3 WWW WWW 512 Oct 16 23:15 ..drwx ------ 2 WWW WWW 512 Oct 16 23:15 Curdrwx ------ 2 WWW WWW 512 Oct 16 23:18 NewDrwx ------ 2 WWW WWW 512 Oct 16 23:18 TMP

The result of the above LS refrigerated can be seen, a directory named cnfug.org has been established by postfix, and you can see the directory structure for /var/mailbox/domain.ltd/Username/mAildir/, which is completely the same. Test SMTP certification:

$ telnet localhost 25

Trying 127.0.0.1 ...

Connected to Localhost.

Escape Character is '^]'.

220 mail.cnfug.org ESMTP Postfix

Ehlo cnfug.org

250-mail.cnfug.org

250-Pipelining

250-Size 10240000

250-VRFY

250-ETRN

250-auth login plain

250-auth = login plain

250 8bitmime

Auth login

334 vxnlcm5hbwu6

DGVZDEBJBMZ1ZY5VCMC =

334 UGFZC3DVCMQ6

DGVZDA ==

235 Authentication Successful

The user name used in the test is Test@cnfug.org password is Test, and our test is successful.

Test POP3

$ TELNET LOCALHOST 110

Trying 127.0.0.1 ...

Connected to Localhost.

Escape Character is '^]'.

Ok hello there.

User test@cnfug.org

OK Password Required.

Pass test

OK Logged in.

The above tips indicate that our POP3 login is successful :).

Installation Configuration PostfixAdmin-2.0.5 and IGENUS_2.0.2

Now all daemons have been working properly, and now we start installing the management interface and user interface.

1), install postfixadmin-2.0.5postfixadmin can be obtained at http://high5.net/postfixadmin, after downloading is a file called PostFixAdmin-2.0.5.tgz

$ TAR -ZXVF PostFixAdmin-2.0.5.tgz

$ mv postfixadmin-2.0.5 PostfixAdmin

$ CD PostfixAdmin

In order to make postfixadmin work properly, some small settings need to be made, copy config.inc.php.sample in the postfixadmin directory to config.inc.php, then edit the parameters:

$ cp config.inc.php.sample config.inc.php

$ vi config.inc.php

The configuration in this example is as follows:

// Language Config

// Language Files Are Located IN './languages'.

$ Conf ['default_language'] = 'cn';

// Database Config // 'database_type' is for future reference $ CONF [ 'database_type'] = 'mysql';. $ CONF [ 'database_host'] = 'localhost'; $ CONF [ 'database_user'] = 'postfixadmin'; $ Conf ['Database_password'] = 'Postfix'; $ conf ['database_name'] = 'postfix'; $ conf ['encrypt'] = 'cleartext';

//Mailboxes // if you want to store the mailboxes per domain set this to 'yes'' .// Example: /usr/local/virtual/domain.tld/username@domain.tld /conf['domain_path '] =' YES '; // if you don't wantbo since the domain in your mailbox set this to' no '.// Example: /usr/local/virtual/domain.tld/username full / cred['domain_in_mailbox'] = ' NO ';

// quota // when you want to enforce quota for your mailbox users set this to 'yes'. $ Conf ['quota'] = 'yes'

// WHEN USING MAILDROP USE '102400' OtherWise Use '1048576' $ conf ['Quota_Multiplier'] = '1048576';

We use the plain text communication here ($ conf ['encrypt'] = 'cleartext';), the mailbox's storage format uses the form of Domain.ltd/UserName, so set:

$ Conf ['Domain_Path'] = 'YES';

$ Conf ['Domain_IN_MAILBOX'] = 'NO';

According to the above settings, when postfixAdmin creates a new virtual user, its maildir's format is domain.ltd/username, but IGENUS is working in Domain.ltd/UserName/mAildir, so we need to do a little little to PostfixAdmin. Modify to make it compatible with IGENUS.

First modify the create-mailbox.php in the postfixadmin directory, find the file:

IF ($ conf ['Domain_Path'] == "YES")

{

IF ($ conf ['Domain_IN_MAILBOX'] == "YES")

{

$ MAILDIR = $ fdomain. "/". $ fusername. "/";

}

Else

{

$ MAILDIR = $ fdomain. "/". - PPOST ['fusername']. "/";

}

}

Else

{

$ MAILDIR = $ fusername. "/";

}

Added after it:

// Compat for iGenus

$ MAILDIR. = "maildir /";

At the same time, modify the create-mailbox.php in the postfixadmin / admin directory, find the file:

IF ($ conf ['Domain_Path'] == "YES")

{

IF ($ conf ['Domain_IN_MAILBOX'] == "YES")

{

$ MAILDIR = $ fdomain. "/". $ fusername. "/";

}

Else

{

$ MAILDIR = $ fdomain. "/". - PPOST ['fusername']. "/";

}

}

Else

{

$ MAILDIR = $ fusername. "/";

}

Added after it:

// Compat for iGenus

$ MAILDIR. = "maildir /";

Here our postfixAdmin changes the basic completion, in addition, we use postfixadmin's Chinese language pack ($ conf ['default_language'] = 'CN';), because this language package is based on postfixadmin2.0.4 So use in 2.0.5, you need to make a small modification so that it can display Chinese code correctly:

$ vi languages ​​/ cn.lang

Find the front line of this file as downgrade:

$ Pang ['yes'] = 'is';

Add:

$ Pang ['charSet'] = 'GB2312';

Save exit, here, PostFixAdmin changes have been completed, now you can copy or upload this directfixadmin to your web directory, then open the browser, enter the postfixadmin management interface http://www.yourdomain.com /PostfixAdmin/admin/index.php, here you can create new domain names and administrators (note that the domain name should be built first, and then build administrators). Then use the newly established administrator to http://www.yourdomain.com/postfixadmin/index.php to create the mailbox.

2) Install IGENUS_2.0.2

You get IGENUS_2.0.2_20040901_RELEASE.TGZ from www.igenus.org, unlocked it:

$ tar -zxvf iGenus_2.0.2_20040901_release.tgz

$ cd igenus

Since IGENUS uses its own table structure, it is necessary to use all the features of IGENUS on the basis of Postfix. Here we will no longer discuss. In this article, we will introduce you how to make users log in. In iGenus, and normal emails and emails, other features will no longer be introduced.

First, you need to modify the IGENUS configuration file, let others know how to connect to mySQL:

$ CD Config

$ vi config_inc.php

Modify the following according to your actual situation (in the configuration in the configuration):

$ Cfg_basepath = "/ htdocs / mail / iGenus"; // iGenus absolute path

// mysql $ cfg_mysql_host = 'localhost'; $ cfg_mysql_user = 'postfixadmin'; // Because the user needs to change the password in IGENUS, it is necessary to use a PostFixAdmin user who has write permissions to the database instead of postfix users with read-only privileges. $ Cfg_mysql_pass = 'postfix'; $ cfg_mysql_db = 'postfix';

// Temp Directory for maildir listing, mail body decodeing etc. $ Cfg_temp = $ cfg_basepath. "/ Temp"; // Here we set the temporary directory of IGENUS to the TEMP directory in the IGENUS installation directory

Now you need to create a TEMP folder and make it read and write by the user of the web server:

$ mkdir iGenus / Temp

$ chmod 777 iGenus / Temp

At the same time, it is necessary to use PostfixAdmin's table structure, we need to modify the login.php file in the IGENUS directory to enable users to log in normally.

$ vi login.php

Modify it:

$ query = "SELECT * from vpopmail where pw_name = '$ post_name' and pw_domain = '$ post_domain'";

Change to:

$ query = "Select * from mailbox where username = '$ pos_name @ $ pos_domain' and active = '1';

will:

$ HOME = $ DATA ['PW_DIR'];

$ POST_PASSWD2 = $ DATA ['Pw_Passwd'];

$ PW_ID = $ DATA ['PW_ID'];

$ PW_SHELL = $ DATA ['Pw_Shell'];

$ pw_gecos = $ data ['pw_gecos'];

$ PW_GID = $ DATA ['PW_GID'];

$ PW_DOMAIN = STRTOLOWER ($ DATA ['Pw_Domain']);

$ PW_NAME = STRTOLOWER ($ DATA ['PW_NAME']);

change into:

$ home = "/ var / mail /". $ data ['maildir']. "../";

$ Pos_passwd2 = $ data ['password'];

$ PW_SHELL = $ DATA ['Quota'];

$ PW_GECOS = $ data ['name'];

$ PW_DOMAIN = STRTOLOWER ($ DATA ['Domain']); $ PW_NAME = STRTOLOWER ($ DATA ['Username']);

Among them $ home = "/ var / mail /". $ Data ['maildir']. "../"; Tell the path to IGENUS mail storage, "/ var / mail /" to store the directory for our email, When IGENUS is read and write, add a string "maildir /" after the $ HOME variable, but our mysql data sheet contains "maildir /" in the maildir field, so in order to get the correct path to the iGenus, we In the last plus string "../"

Will 1 100 lines:

IF ($ home! = "&& ($ post_passwd2 == crypt ($ post_passwd, $ pos_passwd2))) {

Change to:

IF ($ HOME! = "&& $ post_passwd2 == $ pos_passwd) {

Note or delete:

$ _SESSION ['g_id'] = $ PW_ID;

Save the modification, now you can log in to IGENUS.

Here, our Postfix Powered mail system has been completed.

转载请注明原文地址:https://www.9cbs.com/read-71063.html

New Post(0)