Matthew(黑夜编码人) < matthew@cnfug.org >
@ 2004/10/16
一、安装软件系统
1)、安装MySQL4.0.x
为了与系统的软件系统区分开,这里将所有我们手动编译的服务器(DAEMON)软件安装在/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
# make install
接下来安装mysql数据库
# scripts/mysql_install_db
# chown -R mysql:mysql /usr/server/mysql/db
最后需要设置mysql的root口令
# /usr/server/mysql/bin/mysqld_safe &
# /usr/server/mysql/bin/mysqladmin -uroot password 'your_password_goes_here'
口令设置完成后,暂时关闭mysql服务:
# kill %1
2)、安装Cyrus-sasl2
因为要查询MySQL数据库,所以我们需要在编译cyrus-sasl2时加上对MySQL的支持,同时我们打开了对plain和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 --with-mysql-includes=/usr/server/mysql/include/mysql --with-mysql-libs=/usr/server/mysql/lib/mysql
$ make
# make install
按照sasl的安装说明,需要建立一个symblink:
# ln -s /usr/local/lib/sasl2 /usr/lib/sasl2
3)、安装Postfix2.1.x
首先,按照postfix的安装说明,建立postfix、postdrop组和postfix用户:
# pw groupadd postfix
# pw groupadd postdrop
# pw useradd postfix -g postfix -G postdrop
用户和组建立好后,我们就可以开始编译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
# make install
在执行make install的时候可能会得到如下的提示(如果没有就不用理会了:p):
/usr/libexec/ld-elf.so.1: Shared object "libmysqlclient.so.12" not found
这是因为我们的mysql不是安装在默认目录中的,所以需要告诉postfix应该到哪里去找libmysqlclient.so.12,使用ldconfig就可以达到这个目的:
# ldconfig -m /usr/server/mysql/lib/mysql
然后再执行make install这里会出现很多问题,但postfix已经为我们设置好了默认的答案,直接使用这些答案就可以使postfix正常工作了,所以我们只要直接按回车就可以了。
到这里,支持mysql和sasl认证的postfix就已经安装成功了。
4)、安装Courier-imap
$ tar -jxvf courier-imap-3.0.7.tar.bz2
$ cd courier-imap-3.0.7
$ ./configure --prefix=/server/courier-imap --with-authmysql
在执行configure的时候有可能会出现如下的错误提示:
configure: error: --with-authmysql specified but no mysqlclient.so
configure: error: /usr/local/bin/bash './configure' failed for authlib
这是因为courier-imap会使用mysql_config来取得一些编译参数(include、libs、cflags、socket等),但我们是将mysql安装在非/usr/local中,所以默认的PATH就不起作用,需要我们来使courier-imap能够搜索到mysql_config:
$ export PATH="$PATH:/usr/server/mysql/bin"
然后再次执行configure脚本:
$ ./configure --prefix=/server/courier-imap --with-authmysql
$ make
# make install
二、配置系统
1)、建立用户数据表结构
这里,我们直接使用postfixadmin-2.0.5的表结构,现在我们来解开postfixadmin:
$ tar -zxvf postfixadmin-2.0.5.tgz
$ cd postfixadmin-2.0.5
在postfixadmin-2.0.5.tgz中有一个DATABASE.TXT文件,其中描述了各个表的结构,它的内容如下:
#############################
# 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.
#
# If you run this file twice (2x) you will get an error on the user creation in MySQL.
# To go around this you can either comment the lines below "USE MySQL" until "USE postfix".
# Or you can remove the users from the database and run it again.
#
# You can create the database from the shell with:
#
# mysql -u root [-p] < DATABASE.TXT
#
# Postfix / MySQL
#
USE mysql;
# Postfix user & password
INSERT INTO user (Host, User, Password) VALUES ('localhost','postfix',password('postfix'));
INSERT INTO db (Host, Db, User, Select_priv) VALUES ('localhost','postfix','postfix','Y');
# Postfix Admin user & password
INSERT 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;
CREATE 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',
active tinyint(1) NOT NULL default '1',
PRIMARY KEY (username),
KEY username (username)
) TYPE=MyISAM COMMENT='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: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:00',
modified datetime NOT NULL default '0000-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: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',
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',
active tinyint(1) NOT NULL default '1',
PRIMARY KEY (email),
KEY email (email)
) TYPE=MyISAM COMMENT='Postfix Admin - Virtual Vacation';
现在将表结构导入到mysql中:
$ /usr/server/mysql/bin/mysql -u root -p < DATABASE.TXT
2)、配置postfix
首先需要更改/etc/postfix/main.cf中的一些基本参数,请按照自己的实际情况修改,本例以域名cnfug.org为例:
myhostname = mail.cnfug.org
mydomain = cnfug.org
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost (这里没有使用$mydomain是因为我们将使用virtualhost)
inet_interfaces = all
在设置好以上基本参数后就需要设置支持virtualhost了,在本例中我们将所有的邮件全部存放在/var/mailbox中,同时因为iGENUS要在用户邮箱目录(Maildir)中建立文件和存放信息,所以就要求web服务器的用户要对用户邮箱目录有写的权限,所以我们在这里就将用户邮箱的uid和gid设置成web服务器的uid和gid以确保iGENUS正常工作,本例中web服务器的uid和gid都为80。在/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
虚拟域名支持的配置比较简单,根据字意就可以看明白,不过有一点需要注意,/var/mailbox/最后的"/"字符不能省略。
在设置好虚拟域名的基本参数后,就需要设置每个MySQL查询配置文件了,我们将所有的MySQL查询配置文件统一存放在/etc/postfix/mysql中,每个查询配置文件的内容分别如下:
(1) /etc/postfix/mysql/mysql_mailbox_domains.cf
user = postfix
password = postfix
dbname = postfix
table = domain
select_field = domain
where_field = domain
additional_conditions = and active='1'
(2) /etc/postfix/mysql/mysql_mailbox_maps.cf
user = postfix
password = postfix
dbname = postfix
table = mailbox
select_field = maildir
where_field = username
additional_conditions = and active='1'
(3) /etc/postfix/mysql/mysql_alias_maps.cf
user = postfix
password = postfix
dbname = postfix
table = alias
select_field = goto
where_field = address
additional_conditions = and active='1'
接下来开启sasl认证(为了与旧的MUA兼容所以加入broken_sasl_auth_clients的支持),在/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 = reject_unauth_destination
接下来设置alias_maps,在/etc/postfix/main.cf中加入:
alias_maps = hash:/etc/postfix/aliases
现在用postalias生成aliases.db
# cd /etc/postfix
# postalias aliases
最后就是建立/var/mailbox目录:
# mkdir /var/mailbox
# chown -R www:www /var/mailbox
3)、配置sasl认证
在配置postfix的时候,我们设置了postfix使用的sasl配置文件为smtpd,所以现在我们需要配置sasl让它知道怎么从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 active='1'
上面的选项中根本字意就可以了解它的意思,其中sql_select中的%u表示是用户名,%r表示是realm,通常为用户的域名(如果用户名中没有包含域名,则默认为服务器的域名),因为postfixadmin生成的用户名是user@domain.ltd的形式,而非标准的user形式,所以我们需要设置WHERE语句为username='%u$%r'即'用户名@域名'。
4)、配置courier-imap
要让courier-imap能够正确的读取MySQL中的认证信息,就需要配置authmysql的配置文件/usr/server/courier-imap/etc/authmysqlrc,本例中其内容如下:
MYSQL_SERVER localhost
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_USERNAME postfix
MYSQL_PASSWORD postfix
MYSQL_DATABASE postfix
MYSQL_USER_TABLE mailbox
MYSQL_LOGIN_FIELD username
MYSQL_CLEAR_PWFIELD password
MYSQL_UID_FIELD '80'
MYSQL_GID_FIELD '80'
MYSQL_HOME_FIELD '/var/mailbox/'
MYSQL_MAILDIR_FIELD maildir
MYSQL_NAME_FIELD name
MYSQL_QUOTA_FIELD quota
MYSQL_WHERE_CLAUSE active='1'
同postfix中的配置一样,/var/mailbox/最后的"/"字符不能省略。
接下来配置authdaemonrc:
# cp /usr/server/courier-imap/etc/authdaemonrc.dist /usr/server/courier-imap/etc/authdaemonrc
因为我们这里只使用了authmysql模块,所以我们可以把其它验证模块去掉,编辑authdaemonrc文件,将其中的:
authmodulelist="authcustom authcram authuserdb authmysql authpam"
改成:
authmodulelist="authmysql"
最后就是配置pop3d和imapd了,这里我们直接使用其默认设置:
# cp /usr/server/courier-imap/etc/pop3d.dist /usr/server/courier-imap/etc/pop3d
# cp /usr/server/courier-imap/etc/pop3d-ssl.dist /usr/server/courier-imap/etc/pop3d-ssl
# cp /usr/server/courier-imap/etc/imapd.dist /usr/server/courier-imap/etc/imapd
# cp /usr/server/courier-imap/etc/imapd-ssl.dist /usr/server/courier-imap/etc/imapd-ssl
三、启动服务
1)、MySQL
# /usr/server/mysql/share/mysql/mysql.server start
为了确保postfix以及以后的进程能够正确的搜索到libmysqlclient,在这里将mysql的lib设置到ldconfig的搜索路径中:
# ldconfig -m /usr/server/mysql/lib/mysql
2)、Postfix
# /usr/sbin/postfix start
3)、Courier-imap
# /usr/server/courier-imap/libexec/authlib/authdaemond start
# /usr/server/courier-imap/libexec/pop3d.rc start
# /usr/server/courier-imap/libexec/imapd.rc start
如果你想系统在启动的时候自动运行以上这些服务,可以直接将上面的这些启动服务的命令加入到/etc/rc.local中(这里是以BSD UNIX为例子,如果是非BSD UNIX系统请自行将/etc/rc.local更改为相应系统自启动文件名)。
四、测试系统
在进行下一步前,我们可以先对后台系统进行一下测试,以确保后台系统已经正常工作。
首先建立一个测试用户:
$ /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;
测试postfix:
$ echo "hello world" | mail test@cnfug.org
$ ls -al /var/mailbox
drwx------ 3 www www 512 Oct 16 23:15 cnfug.org
$ ls -al /var/mailbox/cnfug.org
drwx------ 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/test
drwx------ 3 www www 512 Oct 16 23:15 .
drwx------ 3 www www 512 Oct 16 23:15 ..
drwx------ 5 www www 512 Oct 16 23:15 Maildir
$ ls -al /var/mailbox/cnfug.org/test/Maildir
drwx------ 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 cur
drwx------ 2 www www 512 Oct 16 23:18 new
drwx------ 2 www www 512 Oct 16 23:18 tmp
上面ls反回的结果可以看到,一个名为cnfug.org的目录已经被postfix建立,同时可以看到目录结构为/var/mailbox/DOMAIN.LTD/USERNAME/Maildir/,这与我们设置的完全相同。
测试SMTP认证:
$ 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
测试中使用的用户名是test@cnfug.org密码是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.
上面的提示表示我们的pop3登录也成功了 :)。
五、安装配置Postfixadmin-2.0.5和iGENUS_2.0.2
现在所有的后台服务已经正常工作了,现在我们就开始安装管理界面和用户界面。
1)、安装postfixadmin-2.0.5
postfixadmin可以在http://high5.net/postfixadmin处得到,下载后是一个名为postfixadmin-2.0.5.tgz的文件
$ tar -zxvf postfixadmin-2.0.5.tgz
$ mv postfixadmin-2.0.5 postfixadmin
$ cd postfixadmin
为了让postfixadmin正常工作,需要进行一些小的设置,将postfixadmin目录中的config.inc.php.sample复制为config.inc.php,然后编辑其中的参数:
$ cp config.inc.php.sample config.inc.php
$ vi config.inc.php
本例中的配置如下:
// 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'] = 'postfixadmin';
$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 want to have the domain in your mailbox set this to 'NO'.
// Example: /usr/local/virtual/domain.tld/username
$CONF['domain_in_mailbox'] = 'NO';
// Quota
// When you want to enforce quota for your mailbox users set this to 'YES'.
$CONF['quota'] = 'YES';
$CONF['quota_multiplier'] = '1048576';
为了兼容性,所以我们在这里使用明文口令方式($CONF['encrypt']='cleartext';),邮箱的存储格式使用domain.ltd/username的形式,所以设置:
$CONF['domain_path'] = 'YES';
$CONF['domain_in_mailbox'] = 'NO';
按照上面的设置,在postfixadmin建立新的虚拟用户的时候,其maildir的格式为domain.ltd/username,但iGENUS是在domain.ltd/username/Maildir中进行操作,所以我们需要对postfixadmin做一点小的修改以使其与iGENUS兼容。
首先修改postfixadmin目录中的create-mailbox.php,找到该文件中的:
if ($CONF['domain_path'] == "YES")
{
if ($CONF['domain_in_mailbox'] == "YES")
{
$maildir = $fDomain . "/" . $fUsername . "/";
}
else
{
$maildir = $fDomain . "/" . $_POST['fUsername'] . "/";
}
}
else
{
$maildir = $fUsername . "/";
}
在其后面增加:
// Compat for iGENUS
$maildir .= "Maildir/";
同时修改postfixadmin/admin目录中的create-mailbox.php,找到该文件中的:
if ($CONF['domain_path'] == "YES")
{
if ($CONF['domain_in_mailbox'] == "YES")
{
$maildir = $fDomain . "/" . $fUsername . "/";
}
else
{
$maildir = $fDomain . "/" . $_POST['fUsername'] . "/";
}
}
else
{
$maildir = $fUsername . "/";
}
在其后面增加:
// Compat for iGENUS
$maildir .= "Maildir/";
到这里我们的postfixadmin就修改基本完成,另外,在这里我们使用了postfixadmin的中文语言包($CONF['default_language'] = 'cn';),由于这个语言包是在postfixadmin2.0.4的基础上制作的,所以在2.0.5中使用需要做一个小的修改,以使其能够正确的显示中文编码:
$ vi languages/cn.lang
找到该文件最前面的如下行:
$PALANG['YES'] = '是';
在该行前面加入:
$PALANG['charset'] = 'gb2312';
保存退出,到此,postfixadmin的修改就已经全部完成,现在可以将postfixadmin这个目录复制或上传到你的web目录中了,然后打开浏览器,进入postfixadmin的管理界面http://www.yourdomain.com/postfixadmin/admin/index.php,这里就可以新建域名和管理员了(注意,通过应该先建域名,再建立管理员)。然后用新建立的管理员登录到http://www.yourdomain.com/postfixadmin/index.php中就可以建立该域的邮箱了。
2)、安装iGENUS_2.0.2
从www.igenus.org处得到igenus_2.0.2_20040901_release.tgz,将其解开:
$ tar -zxvf igenus_2.0.2_20040901_release.tgz
$ cd igenus
由于igenus使用了自己的表结构,所以要在postfix的基础上使用igenus的所有功能,还需要进行比较大的修改,这里我们就不再讨论,本文中我们就向大家介绍如何使用户能够登录到igenus中,并且正常的发邮件和收邮件,其它功能就不再介绍。
首先需要修改igenus的配置文件,让其它知道如何与MySQL连接:
$ cd config
$ vi config_inc.php
根据你的实际情况修改以下内容(配置中的中文为笔者说明):
$CFG_BASEPATH = "/htdocs/mail/igenus"; //iGENUS的绝对路径
// Mysql
$CFG_MYSQL_HOST = 'localhost';
$CFG_MYSQL_USER = 'postfixadmin'; //因为用户需要在igenus中更改密码等,所以需要使用对数据库具有写权限的postfixadmin用户,而非拥有只读权限的postfix用户
$CFG_MYSQL_PASS = 'postfix';
$CFG_MYSQL_DB = 'postfix';
// Temp directory for maildir listing,mail body decodeing etc.
$CFG_TEMP = $CFG_BASEPATH."/temp"; //这里我们将igenus的临时目录设置为igenus安装目录下的temp目录
现在需要建立temp文件夹,并使其可被web服务器的用户读写:
$ mkdir igenus/temp
$ chmod 777 igenus/temp
同时要使igenus使用Postfixadmin的表结构,我们需要修改igenus目录中的login.php文件,以使用户能够正常登录。
$ vi login.php
修改其中的:
$query = "SELECT * FROM vpopmail WHERE pw_name='$Post_name' and pw_domain='$Post_domain'";
为:
$query = "SELECT * FROM mailbox WHERE username='$Post_name@$Post_domain' and active='1'";
将:
$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']);
修改为:
$home = "/var/mail/" . $data['maildir'] . "../";
$Post_passwd2 = $data['password'];
$pw_shell = $data['quota'];
$pw_gecos = $data['name'];
$pw_domain = strtolower($data['domain']);
$pw_name = strtolower($data['username']);
其中$home = "/var/mail/" . $data['maildir'] . "../";是告诉iGENUS邮件存储的路径,"/var/mail/"为我们的邮件存放目录,同时因为iGENUS进行读写邮件时会在$home变量后面加上字符串"Maildir/",但我们的MySQL数据表mailbox中的maildir字段中已经包含"Maildir/",所以为了让iGENUS得到正确的路径,我们在最后加上了字符串"../"
修改:
if ($pw_gid & 0x04){
PutLogs($pw_id, 'login', "no priv to login","$Post_name@$Post_domain", $sql);
ErrorExit(-2); // 用户无权登录
}
if ($home !="" && ($Post_passwd2 == crypt($Post_passwd,$Post_passwd2))){
为:
if ($pw_gid & 0x04){
PutLogs($pw_id, 'login', "no priv to login","$Post_name@$Post_domain", $sql);
ErrorExit(-2); // 用户无权登录
}
if ($home !="" && ($Post_passwd2 == $Post_passwd)){
注释或者删除:
$_SESSION['G_ID'] = $pw_id;
保存修改,现在你就可以登录到igenus中了。
到这里,我们的Postfix Powered的邮件系统已经完成 :)
如果要使IMAP支持中文就需要在编译的时候加上unicode的支持,即:
./configure --prefix=/server/courier-imap --with-authmysql --enable-unicode
好文,谢谢。
要是能再加上一些igenus设置就完美了。:)
恩,不错不错
为什么不用port安装,而且这中间丢了很多步聚.
初学者收下了,
谢谢Matthew!
本人按照文章的方法做,出现不少问题(可能本人是学者所致),那位大侠能将中间的步骤补齐吗?
多谢多谢!
我基本是按照我的笔记写的呀? 少了些什么呢?
我照著裝, 認證有問題 好可惜 但是找不出有哪裡錯了
不知道前輩能否把Quota的部分說詳細一點呢?
补充:
1、有朋友说igenus不能登录,后来发现是文中少写了一句:
编辑igenus的login.php,将第100行:
if ($home !="" && ($Post_passwd2 == crypt($Post_passwd,$Post_passwd2))){
改成:
if ($home !="" && $Post_passwd2 == $Post_passwd){
2、关于邮箱使用率显示不正确的问题
编辑postfixadmin中的config.inc.php
设置如下内容:
// When using maildrop use '102400' otherwise use '1048576'
$CONF['quota_multiplier'] = '1048576';
quota_multiplier默认为102400,改成1048576就可以了。
smtpd_sasl_local_domain = n7systems.com
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
$ echo "hello world" | test@cnfug.org
是怎么回事?
webmail运行不了
按文章的方法修改后的igenus和postfixadmin都运行不了。:(
在登录页面(http://192.168.0.xx/login.php?Cmd=login)上输入完用户、域、密码后出现如下提示:
Fatal error: Call to undefined function: mysql_connect() in /usr/local/igenus/login.php on line 64
管理页面也进不了
http://192.168.0.xx/postfixadmin/admin/list-admin.php
出现一个空白页面??
有那们大虾成功运行了的“igenus”和“postfixadmin”能把修改好的以下文件Email(tdls@163.net)给我吗?多谢多谢!
postfixadmin的“config.inc.php”、“create-mailbox.php”、“admin/create-mailbox.php”
igenus的“config/config_inc.php”、“login.php”
误人子弟呀,我来补齐一部分吧.
请一定要使用ports来安装:关于参数可以考虑,db42。
1、apache和mysql就不说了,说说phpmyadmin吧,在/usr/ports/database/phpmyadmin下,修改makefile,其安装路径是www/,如果你的apache路径是/www/data/或者是其它的,请对照修改。有一处。
2、关于postfixadmin也是一样的,需要修改安装路径,将www/替换为www/data/,有很多处。
3、建立用户和数库最好使用phpmyadmin,直观简单,注意权限的分配。导入数据也用它的 sql查询。
4、使用 postfixadmin第一次在http://localhost/postfixadmin/admin/下
如果使用它建立域名和邮箱,一定要注意保存邮箱的目录有写入权限。
system: FreeBSD 4.10
以上是步骤与作者的基本相同.除了我把cyrus-sasl定置安装在/usr/local/cyrus-sasl下.
在编译postfix时出现如下error
-g -O -I. -I../../include -DFREEBSD4 -c dict_mysql.c
dict_mysql.c:118: mysql.h: No such file or directory
*** Error code 1
Stop in /usr/local/src/postfix-2.1.5/src/global.
*** Error code 1
Stop in /usr/local/src/postfix-2.1.5.
为什么我的postfix频繁报:
fatal:open database /etc/aliases.db:No such file or directory
设置alias_maps
iGENUS是安全性很差的WEBMAIL系统
>smtpd_sasl_local_domain = n7systems.com
>smtpd_recipient_restrictions = >permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
>$ echo "hello world" | test@cnfug.org
对不起,这里写错了,应该是:
smtpd_sasl_local_domain = cnfug.org
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
$ echo "hello world" | test@cnfug.org
这是一个postfixadmin的config.inc.php的例子:
<?php
//
// File: config.inc.php
//
if (ereg ("config.inc.php", $_SERVER['PHP_SELF']))
{
header ("Location: login.php");
exit;
}
// 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'] = 'postfixadmin';
$CONF['database_name'] = 'postfix';
// Site Admin
// Define the Site Admins email address below.
// This will be used to send emails from to create mailboxes.
$CONF['admin_email'] = 'postmaster@domain.tld';
// Mail Server
// Hostname (FQDN) of your mail server.
// This is used to send email to Postfix in order to create mailboxes.
$CONF['smtp_server'] = "localhost";
$CONF['smtp_port'] = "25";
// Encrypt
// In what way do you want the passwords to be crypted?
// md5crypt = internal postfix admin md5
// system = whatever you have set as your PHP system default
// cleartext = clear text passwords (ouch!)
$CONF['encrypt'] = 'cleartext';
// Generate Password
// Generate a random password for a mailbox and display it.
// If you want to automagicly generate paswords set this to 'YES'.
$CONF['generate_password'] = 'NO';
// Page Size
// Set the number of entries that you would like to see
// in one page.
$CONF['page_size'] = '100';
// Default Aliases
// The default aliases that need to be created for all domains.
$CONF['default_aliases'] = array (
'abuse' => 'abuse@domain.tld',
'hostmaster' => 'hostmaster@domain.tld',
'postmaster' => 'postmaster@domain.tld',
'webmaster' => 'webmaster@domain.tld'
);
// 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 want to have the domain in your mailbox set this to 'NO'.
// Example: /usr/local/virtual/domain.tld/username
$CONF['domain_in_mailbox'] = 'NO';
// Default Domain Values
// Specify your default values below. Quota in MB.
$CONF['aliases'] = '100';
$CONF['mailboxes'] = '100';
$CONF['maxquota'] = '100';
// 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';
// Virtual Vacation
// If you want to use virtual vacation for you mailbox users set this to 'YES'.
// NOTE: Make sure that you install the vacation module. http://high5.net/postfixadmin/
$CONF['vacation'] = 'NO';
// Alias Control
// Postfix Admin inserts an alias in the alias table for every mailbox it creates.
// The reason for this is that when you want catch-all and normal mailboxes
// to work you need to have the mailbox replicated in the alias table.
// If you want to take control of these aliases as well set this to 'YES'.
$CONF['alias_control'] = 'NO';
// Logging
// If you don't want logging set this to 'NO';
$CONF['logging'] = 'YES';
// Header
// Some header configuration.
// If you don't want the Postfix Admin logo to appear set this to 'NO'.
$CONF['logo'] = 'YES';
$CONF['header_text'] = ':: Welcome to Postfix Admin ::';
// Footer
// Below information will be on all pages.
// If you don't want the footer information to appear set this to 'NO'.
$CONF['show_footer_text'] = 'YES';
$CONF['footer_text'] = 'Return to domain.tld';
$CONF['footer_link'] = 'http://domain.tld';
?>
postfixadmin/create-mailbox.php
--------------------------------
<?php
//
// File: create-mailbox.php
//
// Template File: create-mailbox.tpl
//
// Template Variables:
//
// tMessage
// tUsername
// tName
// tQuota
// tDomain
//
// Form POST \ GET Variables:
//
// fUsername
// fPassword
// fPassword2
// fName
// fQuota
// fDomain
// fActive
// fMail
//
require ("./variables.inc.php");
require ("./config.inc.php");
require ("./functions.inc.php");
include ("./languages/" . check_language () . ".lang");
$SESSID_USERNAME = check_session ();
$list_domains = list_domains_for_admin ($SESSID_USERNAME);
if ($_SERVER['REQUEST_METHOD'] == "GET")
{
$tQuota = $CONF['maxquota'];
$pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text'];
$pCreate_mailbox_name_text = $PALANG['pCreate_mailbox_name_text'];
$pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text'];
if (isset ($_GET['domain'])) $tDomain = $_GET['domain'];
include ("./templates/header.tpl");
include ("./templates/menu.tpl");
include ("./templates/create-mailbox.tpl");
include ("./templates/footer.tpl");
}
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
$pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text'];
$pCreate_mailbox_name_text = $PALANG['pCreate_mailbox_name_text'];
$pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text'];
$fUsername = $_POST['fUsername'] . "@" . $_POST['fDomain'];
$fUsername = strtolower ($fUsername);
$fPassword = $_POST['fPassword'];
$fPassword2 = $_POST['fPassword2'];
$fName = $_POST['fName'];
$fDomain = $_POST['fDomain'];
if (isset ( $_POST['fQuota'])) $fQuota = $_POST['fQuota'];
if (isset ( $_POST['fActive'])) $fActive = $_POST['fActive'];
if (isset ( $_POST['fMail'])) $fMail = $_POST['fMail'];
if (!check_owner ($SESSID_USERNAME, $fDomain))
{
$error = 1;
$tUsername = $_POST['fUsername'];
$tName = $fName;
$tQuota = $fQuota;
$tDomain = $fDomain;
$pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error1'];
}
if (!check_mailbox ($fDomain))
{
$error = 1;
$tUsername = $_POST['fUsername'];
$tName = $fName;
$tQuota = $fQuota;
$tDomain = $fDomain;
$pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error3'];
}
if (empty ($fUsername) or !check_email ($fUsername))
{
$error = 1;
$tUsername = $_POST['fUsername'];
$tName = $fName;
$tQuota = $fQuota;
$tDomain = $fDomain;
$pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error1'];
}
if (empty ($fPassword) or ($fPassword != $fPassword2))
{
if ($CONF['generate_password'] == "YES")
{
$fPassword = generate_password ();
}
else
{
$error = 1;
$tUsername = $_POST['fUsername'];
$tName = $fName;
$tQuota = $fQuota;
$tDomain = $fDomain;
$pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text_error'];
}
}
if (!check_quota ($fQuota, $fDomain))
{
$error = 1;
$tUsername = $_POST['fUsername'];
$tName = $fName;
$tQuota = $fQuota;
$tDomain = $fDomain;
$pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text_error'];
}
$result = db_query ("SELECT * FROM alias WHERE address='$fUsername'");
if ($result['rows'] == 1)
{
$error = 1;
$tUsername = $_POST['fUsername'];
$tName = $fName;
$tQuota = $fQuota;
$tDomain = $fDomain;
$pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error2'];
}
if ($error != 1)
{
$password = pacrypt ($fPassword);
if ($CONF['domain_path'] == "YES")
{
if ($CONF['domain_in_mailbox'] == "YES")
{
$maildir = $fDomain . "/" . $fUsername . "/";
}
else
{
$maildir = $fDomain . "/" . $_POST['fUsername'] . "/";
}
}
else
{
$maildir = $fUsername . "/";
}
// add by matthew
// for compat with courier-imap
$maildir .= "Maildir/";
if (!empty ($fQuota)) $quota = $fQuota * $CONF['quota_multiplier'];
if ($fActive == "on") $fActive = 1;
$result = db_query ("INSERT INTO alias (address,goto,domain,created,modified,active) VALUES ('$fUsername','$fUsername','$fDomain',NOW(),NOW(),'$fActive')");
if ($result['rows'] != 1)
{
$tDomain = $fDomain;
$tMessage = $PALANG['pAlias_result_error'] . "<br />($fUsername -> $fUsername)</br />";
}
$result = db_query ("INSERT INTO mailbox (username,password,name,maildir,quota,domain,created,modified,active) VALUES ('$fUsername','$password','$fName','$maildir','$quota','$fDomain',NOW(),NOW(),'$fActive')");
if ($result['rows'] != 1)
{
$tDomain = $fDomain;
$tMessage .= $PALANG['pCreate_mailbox_result_error'] . "<br />($fUsername)<br />";
}
else
{
db_log ($SESSID_USERNAME, $fDomain, "create mailbox", "$fUsername");
$tDomain = $fDomain;
$tMessage = $PALANG['pCreate_mailbox_result_succes'] . "<br />($fUsername";
if ($CONF['generate_password'] == "YES")
{
$tMessage .= " / $fPassword)</br />";
}
else
{
$tMessage .= ")</br />";
}
$tQuota = $CONF['maxquota'];
if ($fMail == "on")
{
$fTo = $fUsername;
$fFrom = $SESSID_USERNAME;
$fHeaders = "To: " . $fTo . "\n";
$fHeaders .= "From: " . $fFrom . "\n";
if (!empty ($PALANG['charset']))
{
$fHeaders .= encode_header ($PALANG['pSendmail_subject_text'], $PALANG['charset']) . "\n";
$fHeaders .= "MIME-Version: 1.0\n";
$fHeaders .= "Content-Type: text/plain; charset=" . $PALANG['charset'] . "\n";
$fHeaders .= "Content-Transfer-Encoding: 8bit\n";
}
else
{
$fHeaders .= "Subject: " . $PALANG['pSendmail_subject_text'] . "\n\n";
}
$fHeaders .= $PALANG['pSendmail_body_text'];
if (!smtp_mail ($fTo, $fFrom, $fHeaders))
{
$tMessage .= "<br />" . $PALANG['pSendmail_result_error'] . "<br />";
}
else
{
$tMessage .= "<br />" . $PALANG['pSendmail_result_succes'] . "<br />";
}
}
}
}
include ("./templates/header.tpl");
include ("./templates/menu.tpl");
include ("./templates/create-mailbox.tpl");
include ("./templates/footer.tpl");
}
?>
postfixadmin/admin/create-mailbox.php
----------------------------------------
<?php
//
// File: create-mailbox.php
//
// Template File: create-mailbox.tpl
//
// Template Variables:
//
// tMessage
// tUsername
// tName
// tQuota
// tDomain
//
// Form POST \ GET Variables:
//
// fUsername
// fPassword
// fPassword2
// fName
// fQuota
// fDomain
// fActive
// fMail
//
require ("../variables.inc.php");
require ("../config.inc.php");
require ("../functions.inc.php");
include ("../languages/" . check_language () . ".lang");
$list_domains = list_domains ();
if ($_SERVER['REQUEST_METHOD'] == "GET")
{
$tQuota = $CONF['maxquota'];
$pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text'];
$pCreate_mailbox_name_text = $PALANG['pCreate_mailbox_name_text'];
$pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text'];
if (isset ($_GET['domain'])) { $tDomain = $_GET['domain']; }
include ("../templates/header.tpl");
include ("../templates/admin_menu.tpl");
include ("../templates/create-mailbox.tpl");
include ("../templates/footer.tpl");
}
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
$pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text'];
$pCreate_mailbox_name_text = $PALANG['pCreate_mailbox_name_text'];
$pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text'];
$fUsername = $_POST['fUsername'] . "@" . $_POST['fDomain'];
$fUsername = strtolower ($fUsername);
$fPassword = $_POST['fPassword'];
$fPassword2 = $_POST['fPassword2'];
$fName = $_POST['fName'];
$fDomain = $_POST['fDomain'];
if (isset ( $_POST['fQuota'])) $fQuota = $_POST['fQuota'];
if (isset ( $_POST['fActive'])) $fActive = $_POST['fActive'];
if (isset ( $_POST['fMail'])) $fMail = $_POST['fMail'];
if (!check_mailbox ($fDomain))
{
$error = 1;
$tUsername = $_POST['fUsername'];
$tName = $fName;
$tQuota = $fQuota;
$tDomain = $fDomain;
$pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error3'];
}
if (empty ($fUsername) or !check_email ($fUsername))
{
$error = 1;
$tUsername = $_POST['fUsername'];
$tName = $fName;
$tQuota = $fQuota;
$tDomain = $fDomain;
$pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error1'];
}
if (empty ($fPassword) or ($fPassword != $fPassword2))
{
if ($CONF['generate_password'] == "YES")
{
$fPassword = generate_password ();
}
else
{
$error = 1;
$tUsername = $_POST['fUsername'];
$tName = $fName;
$tQuota = $fQuota;
$tDomain = $fDomain;
$pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text_error'];
}
}
if (!check_quota ($fQuota, $fDomain))
{
$error = 1;
$tUsername = $_POST['fUsername'];
$tName = $fName;
$tQuota = $fQuota;
$tDomain = $fDomain;
$pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text_error'];
}
$result = db_query ("SELECT * FROM alias WHERE address='$fUsername'");
if ($result['rows'] == 1)
{
$error = 1;
$tUsername = $_POST['fUsername'];
$tName = $fName;
$tQuota = $fQuota;
$tDomain = $fDomain;
$pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error2'];
}
if ($error != 1)
{
$password = pacrypt ($fPassword);
if ($CONF['domain_path'] == "YES")
{
if ($CONF['domain_in_mailbox'] == "YES")
{
$maildir = $fDomain . "/" . $fUsername . "/";
}
else
{
$maildir = $fDomain . "/" . $_POST['fUsername'] . "/";
}
}
else
{
$maildir = $fUsername . "/";
}
// add by matthew
// for compat with courier-imap
$maildir .= "Maildir/";
if (!empty ($fQuota)) $quota = $fQuota * $CONF['quota_multiplier'];
if ($fActive == "on") $fActive = 1;
$result = db_query ("INSERT INTO alias (address,goto,domain,created,modified,active) VALUES ('$fUsername','$fUsername',
'$fDomain',NOW(),NOW(),'$fActive')");
if ($result['rows'] != 1)
{
$tDomain = $fDomain;
$tMessage = $PALANG['pAlias_result_error'] . "($fUsername -> $fUsername)";
}
$result = db_query ("INSERT INTO mailbox (username,password,name,maildir,quota,domain,created,modified,active) VALUES (
'$fUsername','$password','$fName','$maildir','$quota','$fDomain',NOW(),NOW(),'$fActive')");
if ($result['rows'] != 1)
{
$tDomain = $fDomain;
$tMessage .= $PALANG['pCreate_mailbox_result_error'] . "($fUsername)";
}
else
{
db_log ($CONF['admin_email'], $fDomain, "create mailbox", $fUsername);
$tDomain = $fDomain;
$tMessage = $PALANG['pCreate_mailbox_result_succes'] . "($fUsername";
if ($CONF['generate_password'] == "YES")
{
$tMessage .= " / $fPassword)";
}
else
{
$tMessage .= ")";
}
$tQuota = $CONF['maxquota'];
if ($fMail == "on")
{
$fTo = $fUsername;
$fFrom = $CONF['admin_email'];
$fHeaders = "To: " . $fTo . "\n";
$fHeaders .= "From: " . $fFrom . "\n";
if (!empty ($PALANG['charset']))
{
$fHeaders .= encode_header ($PALANG['pSendmail_subject_text'], $PALANG['charset']) . "\n";
$fHeaders .= "MIME-Version: 1.0\n";
$fHeaders .= "Content-Type: text/plain; charset=" . $PALANG['charset'] . "\n";
$fHeaders .= "Content-Transfer-Encoding: 8bit\n";
}
else
{
$fHeaders .= "Subject: " . $PALANG['pSendmail_subject_text'] . "\n\n";
}
$fHeaders .= $PALANG['pSendmail_body_text'];
if (!smtp_mail ($fTo, $fFrom, $fHeaders))
{
$tMessage .= "" . $PALANG['pSendmail_result_error'] . "";
}
else
{
$tMessage .= "" . $PALANG['pSendmail_result_succes'] . "";
}
}
}
}
include ("../templates/header.tpl");
include ("../templates/admin_menu.tpl");
include ("../templates/create-mailbox.tpl");
include ("../templates/footer.tpl");
}
?>
igenus/config/config_inc.php
-------------------------------
<?php
/*-
* iGENUS webmail
*
* Copyright (c) 1999-2001 by iGENUS Inc.
* All rights reserved.
* Author: Qiong Wu <wuqiong@igenus.org>
*
* $Id: config_inc.php,v 1.26 2004/09/01 01:22:37 wuqiong Exp $
*/
$CFG_BASEPATH = "/var/www/igenus"; //请更改成你自己的WWW路径
// Mysql
$CFG_MYSQL_HOST = 'localhost';
$CFG_MYSQL_USER = 'postfixadmin';
$CFG_MYSQL_PASS = 'postfixadmin';
$CFG_MYSQL_DB = 'postfix';
// vpopmail configure
$CFG_VPOPMAIL_MYSQL_LARGE_SITE = 0; // defualt is no. please see vpopmail configure help.
// default for Language
$CFG_LANGUAGE = gb; // gb - Chinese GB
// big5 - Chinese Big5
// en - English
// jp - Japanese
// fr - French
// br - Portuguese
$CFG_GMT = "GMT"; // GMT time local
$CFG_CHARSET[''] = "gb2312";
$CFG_CHARSET['gb'] = "gb2312";
$CFG_CHARSET['big5'] = "big5";
$CFG_CHARSET['en'] = ""; // iso8859-1
$CFG_CHARSET['fr'] = "";
$CFG_CHARSET['br'] = "";
$CFG_CHARSET['it'] = "";
// default for web page Themes
$CFG_THEMES = "generic";
$CFG_TEMPLATE = "";
// Temp directory for maildir listing,mail body decodeing etc.
$CFG_TEMP = $CFG_BASEPATH."/temp";
$CFG_TEMP_MOD = 0755;
$CFG_MAILBOX_MOD = 0700;
$CFG_MAILBOX_BASE = "/var/mailbox/"; //这个为自己添加的变量,用在login.php中
$CFG_MAILBOX['inbox'] = ".";
$CFG_MAILBOX['outbox'] = ".Outbox";
$CFG_MAILBOX['draft'] = ".Draft";
$CFG_MAILBOX['trash'] = ".Trash";
// Mailbox
$CFG_BOX_OUT = '';
$CFG_BOX_TRASH = '';
$CFG_BOX_DRAFT = '';
//quota
$CFG_SIZEPERSECTOR = 1024;
// pop3 MailServer configure
$CFG_POP_FILE = "$SG_HOME/.popconfig";
$CFG_USERBOX_LIST = "$SG_HOME/.box_list";
$CFG_USERSIGN = "$SG_HOME/.sign";
$CFG_USERCONFIG = "$SG_HOME/.config";
// User configure
if(is_file($CFG_USERCONFIG)) include "$CFG_USERCONFIG";
$get_Lang = trim($_GET['Lang']);
if($SG_LANG!='') $CFG_LANGUAGE = $SG_LANG;
if($get_Lang!='') $CFG_LANGUAGE = $get_Lang;
//
if($CFG_List_NumPerPage==0) $CFG_List_NumPerPage = 20;
if($CFG_List_AutoRefresh==0) $CFG_List_AutoRefresh = 120;
if( empty($CFG_Prev_Alternative) ) $CFG_Prev_Alternative = 'Html';
if( empty($CFG_Prev_IsRead) ) $CFG_Prev_IsRead = 'yes';
if( empty($CFG_Send_Encoding) ) $CFG_Send_Encoding = 'Base64';
if( empty($CFG_POP_NumPer) ) $CFG_POP_NumPer = 50;
if( empty($CFG_POP_Timeout) ) $CFG_POP_Timeout = 30;
if( empty($CFG_Timeout) ) $CFG_Timeout = 600;
$CFG_HTML_SIGN = "<p class='sign'>
<BR>---------------------------------------------------------<BR>
HTTP://WWW.CNFUG.ORG
</P>";
$CFG_PLAIN_SIGN="---------------------------------------------------------
HTTP://WWW.CNFUG.ORG";
$CFG_AUTORESPOND_PROM = "/usr/local/bin/autorespond";
$CFG_NETDISK_PATH = "/var/netdisk"; //这个为网络硬盘的路径
$CFG_NETDISK_DEFAULT_QUOTA = 100; // MB
define('CFG_BUFF_NUM', 50);
define('CFG_DEBUG', TRUE);
?>
igenus/login.php
----------------------------------------------------------------------------
<?php
/*-
* iGENUS webmail
*
* Copyright (c) 1999-2001 by iGENUS Inc.
* All rights reserved.
* Author: Qiong Wu <wuqiong@igenus.org>
*
* $Id: login.php,v 1.29 2004/09/01 01:22:37 wuqiong Exp $
*/
session_start();
unset($_SESSION['G_USERNAME']);
unset($_SESSION['G_DOMAIN']);
unset($_SESSION['G_HOME']);
unset($_SESSION['G_TIME']);
unset($_SESSION['G_QUOTA']);
unset($_SESSION['G_NICKNAME']);
unset($_SESSION['G_ID']);
unset($_SESSION['G_LANG']);
include "config/config_inc.php";
include "include/fun_inc.php";
include "language/$CFG_LANGUAGE"."_inc.php";
if(!isset($_COOKIE['LoginDomain'])){
$Cookies_Domain = strtolower($_SERVER["HTTP_HOST"]);
if(preg_match("/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1.3}.[0-9]{1,3}/", $Cookies_Domain))
$Cookies_Domain = '';
list($Cookies_Domain,$null) = split(':', $Cookies_Domain, 2);
$Cookies_Domain = str_replace('mail.','',$Cookies_Domain);
}
else $Cookies_Domain = $_COOKIE['LoginDomain'];
$http_host = split(':',strtolower($_SERVER["HTTP_HOST"]));
$OUT['domain'] = str_replace('mail.','', $http_host[0]);
// Post
$Post_name = $_POST['name'];
$Post_domain = $_POST['domain'];
$Post_username = $_POST['name'] . '@' . $_POST['domain'];
$Post_passwd = $_POST['passwd'];
$Post_Lang = $_POST['Lang'];
// Get
$Get_Cmd = $_GET['Cmd'];
$Get_Code = $_GET['Code'];
$Get_Lang = $_GET['Lang'];
$errorlogin = 0; // 0 - success
// -1 - user not exist
// -2 - password error
// -3 - domain not exist
if (($Get_Cmd=="login") && ($Post_name!="") && ($Post_passwd !="") && ($Post_domain!="")){
session_start();
// 设置 cookies_LoginDomain
setcookie("LoginDomain",$Post_domain,time()+3600*24*365);
// list($Post_name,$Post_domain) = split("@",$user,2);
$sql = mysql_connect($CFG_MYSQL_HOST, $CFG_MYSQL_USER, $CFG_MYSQL_PASS);
mysql_select_db($CFG_MYSQL_DB,$sql);
if ($CFG_VPOPMAIL_MYSQL_LARGE_SITE){
$Vpopmail_Domain = ereg_replace("\.","_",$Post_domain);
$query = "SELECT * FROM $Vpopmail_Domain WHERE pw_name='$Post_name'";
}else{
$query = "SELECT * FROM mailbox WHERE username='$Post_username' and domain='$Post_domain' and active='1'";
}
// echo $query;
$result = @mysql_query($query,$sql);
$rows = @mysql_num_rows($result);
if($rows !=1 ){
PutLogs('0', 'login', "user not exist","$Post_name@$Post_domain", $sql);
ErrorExit(-1); // user not exist!
}
$data = mysql_fetch_array($result);
$pw_username = strtolower($data['username']);
$Post_passwd2 = $data['password'];
$home = $CFG_MAILBOX_BASE . $data['maildir'] . "../";
$pw_domain = strtolower($data['domain']);
$pw_quota = $data['quota'];
$pw_nickname = $data['name'];
if ($pw_gid & 0x04){
PutLogs($pw_username, 'login', "no priv to login","$Post_name@$Post_domain", $sql);
ErrorExit(-2); // 用户无权登录
}
if ($home !="" && $Post_passwd2 == $Post_passwd){
//$_SESSION['G_ID'] = $pw_id;
$_SESSION['G_USERNAME'] = $pw_username;
$_SESSION['G_HOME'] = $home;
$_SESSION['G_DOMAIN'] = $pw_domain;
$_SESSION['G_TIME'] = time();
$_SESSION['G_LANG'] = $Post_Lang;
$_SESSION['G_QUOTA'] = $pw_quota;
$_SESSION['G_NICKNAME'] = $pw_nickname;
// 建立用户临时文件目录
if ( !is_dir($CFG_TEMP) ){
@mkdir($CFG_TEMP,$CFG_TEMP_MOD)||
die("Error create directory $CFG_TEMP,you must make $CFG_TEMP directory manual.Please read the INSTALL file.");
}
if ( !is_dir("$CFG_TEMP/$SG_DOMAIN") ) {
mkdir("$CFG_TEMP/$SG_DOMAIN",$CFG_TEMP_MOD)||die("Error create directory $SG_DOMAIN");
}
if ( !is_dir("$CFG_TEMP/$SG_DOMAIN/$SG_USERNAME") ) {
mkdir("$CFG_TEMP/$SG_DOMAIN/$SG_USERNAME",$CFG_TEMP_MOD)||die("Error create directory $SG_USERNAME");
}
chdir("$CFG_TEMP/$SG_DOMAIN/$SG_USERNAME");
// 成功登录
PutLogs($pw_username, 'login', "success","$Post_name@$Post_domain", $sql);
header("Location: index.php");
exit();
}else{
PutLogs($pw_username, 'login', "error password", "$Post_name@$Post_domain", $sql);
ErrorExit(-3); //用户密码错误
}
}
$mesg = $LANG_LOGIN_WELCOME;
if($Get_Cmd==error){
switch($Get_Code){
case -1:
$mesg = $LANG_LOGIN_ERROR_USER_NOT_EXIST;
break;
case -2:
$mesg = $LANG_LOGIN_ERROR_USER_NO_PRIV;
break;
case -3:
$mesg = $LANG_LOGIN_ERROR_PASSWD;
break;
}
}
function PutLogs($username, $action, $content, $email, $sql){
$query = "insert logs set username='".$username."',".
"ip='".$_SERVER['REMOTE_ADDR']."',".
"action='login',".
"time=now(),".
"email='$email',".
"content='$content'";
// echo $query;
@mysql_query($query, $sql);
mysql_close($sql);
}
function ErrorExit($errorcode){
header("Location: login.php?Cmd=error&Code=$errorcode");
exit();
}
// load Template
$OUT['CHARSET'] = $CFG_CHARSET[$Get_Lang]; // 页面字符编码设置
$OUT['MESG'] = $mesg; // 欢迎及错误提示信息
$OUT['COOKIES_DOMAIN'] = $Cookies_Domain; // 上次登录使用的域
$OUT['LANG'] = $Get_Lang; // 登录后显示语言
include "template/_login.php";
?>
>为什么我的postfix频繁报:
>fatal:open database /etc/aliases.db:No such file or directory
执行一次以下命令:
# cd /etc
# postalias aliases
另外,文中已经提到,关于igenus需要做很多修改才能正常的工作,这里只是能登录,所以大家如果还有什么对igenus不清楚的请到http://www.igenus.org中查看相关的文章,另外,您也可以考虑使用Overlook,它直接使用imap读数据,所以基本不需要改它的代码即可工作:http://freshmeat.net/projects/overlookwebmail/
由于本文是仓促写出来的,所以文中会有很多错误,还请大家原谅,但这种方案是完全可以正常工作的,如果大家还发现有什么问题,请及时在这里留言,以便我即时的更正,感谢!
我建议你把所有的错误都从修正一下好吗?
别外我想要一份没有错误的,请发到我的邮箱好吗?
我建议你把能用PORTS安装的软件都用PORTS来安装,这样更有利于初学者。
谢谢,个人意见,仅供参考!!
应该尽量修改几个postfix mysql配置文件,少修改igenus(修改igenus比较麻烦),推荐不用postfixadmin,用igenus admin
关于postfix /etc/aliases.db报错是因为这一行
> mydestination = $myhostname, localhost.$mydomain, localhost (这里没有使用$mydomain是因为我们将使用virtualhost)
如果是用 mydestination = $mydomain 就需要aliases.db
另外igenus有个严重漏洞,file.php中需要对$path和$filename两个变量做过滤。
想问一下安装postfix时候新建的user和group(就是postfix),和apache配置文件httpd.conf中的user和group,以及postfix配置文件main.cf中的virtual_uid_maps、virtual_gid_maps,还有courier-imap中的配置文件authmysqlrc中的MYSQL_GID_FIELD、MYSQL_UID_FIELD的关系是什么?
我在foxmail中新建一帐户,只要用户名存在,不用密码,为什么也能通过postfix发邮件?难道smtp认证没有配置好?可是我用你提供的测试smtp认证的那堆东西,又是通过的。
/var/mailbox的权限应该怎么设置?我每次发信之后,总要chmod -R 777 /var/mailbox才能收到信,要不然就出现权限不对之类的提示。
postfix的user、group只运行postfix daemon的用户,使用postfix就可以了。
httpd中的user、group和postfix中的virtual_uid_maps、virtual_gid_maps以及courier-imap中的gid、uid是同一用户,因为他们都是用于读(写)邮件(mailbox),所以需要设置成同一帐号。
不要使用foxmail测试,因为我发现foxmail会自动尝试使用pop3的用户名和密码来进行smtp认证,推荐使用outlook做测试。
另外,有请大家把操作中发现的错误贴也来,以便整理一份没有错误的文章出来.感谢!
我前些时候看过很多资料除了本文中提到所安装、配置的组件之外,还提及到需要安装PAM-MYSQL,Cyrus-sasl-saslauthd 这两个组件,请问按照本文介绍的方法去做,是否还需要安装
PAM-MYSQL,Cyrus-sasl-saslauthd 这两个组件呢?谢谢。。。。
强烈建议参照这篇攻略:
http://mske.com/index.php?option=content&task=view&id=10&Itemid=28
在这篇文章中,只要把/var/mail,权限设为www,postfix和Courier-imap 中gid和uid设为80,添加新用户这样做就可以了:
在数据库中添加用户,然后给该用户发一封欢迎信,这个用户就成功建立了。
而本文中的使用
# echo "hello world" | test@cnfug.org
test@cnfug.org: Command not found.
到底是什么意思吗?
有没有maildrop有什么区别?
经我测试本文没有问题。我是在redhat9.0下照着做的,redhat下除了ldconfig和freebsd不一样,其它没什么区别。
建议作者写下个版本的时候,尽量写详细一点,还有目录的权限及涉及到的uid和gid也能交代的清楚一点,还有postfix admin的表结构及字段的含义是否也能加以说明。如果加入maildrop有好处的话,建议下个版本加入maildrop部分。
由于igenus设置麻烦,我用squirrelmail比较简单。就是不知道怎么把界面调成中文的。
我等菜鸟对作者无私奉献深表谢意!
最新进度报告,在本地freebsd 5.21上已经实验成功,但奇怪的是如果使用postfixadmin来建立邮箱(config.inc.php 里加密部分设置使用MD5加密,不使用明码),smtp验证不成功,但pop3验证通过,我后来重新编译sasl-2.1.20时加上--enable-cram --enable-digest,重新测试smtp验证依然失败,pop3还是通过,我在想使用明码保存密码不太安全,希望使用加密方式,哪位朋友有这方面经验的请指教小弟一下,谢谢。
找了一下资料,发现pwcheck_method是saslauthd,密码只能是明文的,
如果pwcheck_method是auxprop的话,那么密码是不是也只能用明文的?
如果你怕不安全,可以加入tls(ssl)部分。
http://cngnu.org/technology/Postfix_II.html
Cyrus-SASL的mysql认证方式不支持加密的密码,而Courier-IMAP的mysql认证却使用加密的密码。
能还将wmail作为webmail呢,感觉igenus发信太慢.
在网上搜索到一篇文章,
http://www.viperstrike.com/~lopaka/sysadmin/cyrus-sasl-mysql-encrypt/
里面有讲到可以使用patch令sasl2支持md5加密的密码验证.还没做试验.有兴趣的朋友
可以先看看.
=====================================================================================
用户和组建立好后,我们就可以开始编译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
# make install
=========================================================================================
本人在执行完上述步骤后,提示说没有 /usr/server/mysql/lib/mysql ,可我明明有这个东西呀,希望得到大家的指点!谢谢!!!
我装完后,启动postfix,怎么没有看到/var/mailbox/目录啊,它是不是应该由postfix创建的
我发的邮件都不知道发到哪里了
Dec 22 17:29:20 convision pop3d: chdir "/var/mailbox/": No such file or directory
为什么?
不用web界面,如何添加用户啊
完全按照作者描述的做,出现如下问题:
(1)$ echo "hello world" | test@cnfug.org 有问题,和上面网友提到的错误一样
(2)无 /var/mailbox 目录,具体怎么处理,怎样使得系统发第一封信时自动建立邮箱?
(3)
$ telnet localhost 25
...
dGVzdA==
535 Error: authentication failed
查看 /var/log/auth.log 和 /var/log/messages 中的日志,如下:
Dec 25 16:56:17 email postfix/smtpd[581]: SQL engine 'mysql' not supported
Dec 25 16:56:17 email postfix/smtpd[581]: auxpropfunc error no mechanism available
> Dec 22 17:29:20 convision pop3d: chdir "/var/mailbox/": No such file or directory
> 为什么?
文中有部分错误,应该为这样。
首先应该建立/var/mailbox目录:
# mkdir /var/mailbox
# chown www:www /var/mailbox
(这里用户www的uid为80,gid也为80)
然后再:
# echo "Hello World" | mail test@cnfug.org
根据我收集到的信息,已经重新更正了文中的错误,如果大家还发现有什么问题,麻烦及时告诉我(matthew@cnfug.org),感谢!
> 我前些时候看过很多资料除了本文中提到所安装、配置的组件之外,还提及到需要安装PAM-MYSQL,Cyrus-> sasl-saslauthd 这两个组件,请问按照本文介绍的方法去做,是否还需要安装
> PAM-MYSQL,Cyrus-sasl-saslauthd 这两个组件呢?谢谢。。。。
如果按照本文中的方法,是不需要的.
建议作者尽量将系统的初始条件写清楚,
比如系统是最小化安装,还是其它方式什
么安装的,系统必须包含的软件包是什么
等等。如果作者列写的步骤比较完善的话
,初学者碰到的一系列错误往往就是因为
系统的初始条件差异所导致的。
重大bug,如果客户端选择smtp需要认证,那就必须要正确密码,如果客户端选择无需smtp认证,根本无需认证都可发信。
选择认证:
postfix/smtpd[26262]:sql plugin doing query SELECT password FROM mailbox WHERE username='test@freebsd.com' and domain='freebsd.com' and active='1';
postfix/smtpd[26262]: commit transaction
postfix/smtpd[26262]:sql plugin Parse the username test@freebsd.com
postfix/smtpd[26262]:sql plugin try and connect to a host
postfix/smtpd[26262]:sql plugin trying to open db 'postfxi' on host 'localhost'
选择无需认证:
postfix/smtpd[5595]:sql auxprop plugin using mysql engine
重大BUG,如果SMTP选择需要认证,用户密码必须正确才能发信,如果选择无需smtp认证,那可以不认证直接发信。
你是在什么环境下测试的呢?
另外,有几点需要注意:
1、如果使用了permit_mynetworks,则不要使用与你的/etc/postfix/main.cf中的mynetworks同一网段中的机器测试。
2、不要使用foxmail测试,使用outlook做测试,不知道为什么foxmail会自动使用pop3的用户名和密码进行认证。
我用outlook做的 一样啊
另外,我要使用虚拟域怎么用啊,有时好像不能自己件路径
如果是按照文在的做法,所以的文件全部放在/var/mailbox/youdomain.com中。
各位谨记,postfix在向本地域发信时,如果客户端部选中smtp认证,同样可以发信的。
> 各位谨记,postfix在向本地域发信时,如果客户端部选中smtp认证,同样可以发信的。
是的,向本地域发是不需要验证的,否则就不能接收其它邮件服务器发过来的邮件了。
我的服务器没有互联网域名,用其他网站发送的邮件就无法接收了,应该如何更改才能接收的到,这样才能与其他邮件服务器互通啊
垃圾文章
我按照文章上说的做啦 postfix smtp认证 postfixadmin 发信都正常 但POP3认证 和 iGENUS无法登陆!!
不知道 什么问题 谁知道是怎么回事? 请指点一下 谢谢!!
POP3认证有什么错误提示吗?
mail# telnet localhost 110
Trying ::1...
Connected to localhost.
Escape character is '^]'.
+OK Hello there.
user test@cnfug.org
+OK Password required.
pass test
-ERR Login failed.
vi /var/mailbox/maillog
Jun 13 12:48:00 mail postfix/master[5244]: terminating on signal 15
Jun 13 12:48:28 mail authdaemond.mysql: failed to connect to mysql server (server=localhost., userid=postfix.)
Jun 13 12:48:33 mail pop3d: LOGIN FAILED, ip=[::1]
Jun 13 13:31:51 mail authdaemond.mysql: restarting authdaemond children
Jun 13 13:31:51 mail authdaemond.mysql: modules="authmysql", daemons=5
Jun 13 13:31:55 mail authdaemond.mysql: modules="authmysql", daemons=5
Jun 13 13:32:22 mail authdaemond.mysql: failed to connect to mysql server (server=localhost., userid=postfix.)
Jun 13 13:32:27 mail pop3d: LOGIN FAILED, ip=[::1]
Jun 13 13:34:26 mail authdaemond.mysql: failed to connect to mysql server (server=localhost., userid=postfix.)
Jun 13 13:34:31 mail pop3d: LOGIN FAILED, ip=[::1]
Jun 13 13:34:38 mail pop3d: LOGOUT, ip=[::1]
我都弄了两天啦 ! 快愁死我啦 !! 请您帮帮忙吧!!谢谢
看来是连接MYSQL出错,你的mysql.sock是在/tmp中吗?
还有就是注意authmysqlrc中的配置每行后面不能有空格,你检查一下是不是某行后面有空格?
非常感谢 matthem !!! 按照您的文章 我成功的配置了邮件系统,其中出现的问题,正是您上面提到的!!
开始的时候不知道什么地方出了问题,查了好久,最后我安装了4.0版本的curyer-imap,同样的配置 但日志信息比前一版本详细,最后找到了问题的原因!! 就是authmysqlrc配置文件的空格问题!!! 可气啊!!!
您当初是不是也遇到了同样的问题呢??? 不管怎样!!! 这篇文章都不愧是一篇好文章!!! 强力支持!!!
我按照这篇文章做的,POP3认证没有问题,就是IGENUS登陆不了 提示
“该用户不存在,请使用正确的用户和密码重新登录! ”
我查看MYSQL数据库,确认用户和密码没有问题,并且在config_inc.php 文件中设置的用户名和密码没有错误,而且authmysqlrc文件中没行后没有空格,不知道问题出在哪里?请指教,万分感谢!!
我的telnet 127.0.0.1 110 端口时提示下面的错误
[root@test local]# telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
+OK Hello there.
user user3@test.edu
+OK Password required.
pass 111111
-ERR chdir Maildir failed
Connection closed by foreign host.
查看maillog提示:
Jun 28 14:36:19 test pop3d: Connection, ip=[::ffff:127.0.0.1]
Jun 28 14:36:29 test pop3d: chdir Maildir: No such file or directory
请问是什么原因呢?
> coffee_45 在 June 28, 2005 03:05 PM 说道:
> 查看maillog提示:
> Jun 28 14:36:19 test pop3d: Connection, ip=[::ffff:127.0.0.1]
> Jun 28 14:36:29 test pop3d: chdir Maildir: No such file or directory
> 请问是什么原因呢?
这是因为用户邮箱目录不存在的原因,你检查一下你的用户邮箱(即/var/mailbox/domain.com/user/Maildir)存在吗?
如果不存在,你向该用户发一封邮件,postfix就会自动为你创建。
楼主,我按照你文一步一步做,出错,怎么回事?
我用telnet:
[root@mail saslfinger-1.0]# telnet foxtec.oicp.net 25
Trying 219.128.39.40...
Connected to foxtec.oicp.net.
Escape character is '^]'.
220 mail.foxtec.oicp.net ESMTP Postfix
ehlo foxtec
250-mail.foxtec.oicp.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250 8BITMIME
auth plain dGVzdEBmb3h0ZWMub2ljcC5uZXQAdGVzdEBmb3h0ZWMub2ljcC5uZXQAdGVzdA==
535 Error: authentication failed
auth login
334 VXNlcm5hbWU6
dGVzdEBmb3h0ZWMub2ljcC5uZXQ=
334 UGFzc3dvcmQ6
dGVzdA==
535 Error: authentication failed
quit
221 Bye
Connection closed by foreign host.
[root@mail saslfinger-1.0]#
maillog:
Dec 20 14:17:10 mail postfix/postfix-script: fatal: usage: postfix start (or stop, reload, abort, flush, check, set-permissions, upgrade-configuration)
Dec 20 14:17:14 mail postfix/postfix-script: refreshing the Postfix mail system
Dec 20 14:17:14 mail postfix/master[2726]: reload configuration
Dec 20 14:17:23 mail postfix/smtpd[8050]: connect from unknown[219.128.39.40]
Dec 20 14:17:44 mail postfix/smtpd[8050]: warning: SASL authentication failure: Password verification failed
Dec 20 14:17:44 mail postfix/smtpd[8050]: warning: unknown[219.128.39.40]: SASL plain authentication failed
Dec 20 14:18:06 mail postfix/smtpd[8050]: warning: unknown[219.128.39.40]: SASL login authentication failed
Dec 20 14:18:08 mail postfix/smtpd[8050]: disconnect from unknown[219.128.39.40]
我发现 postfix ,sasl根本就没访问mysql,mysqllog为空.
测试sasl失败?
[root@mail saslfinger-1.0]# testsaslauthd -u postfix -p postfix -r foxtec.oicp.net -s smtp
0: NO "authentication failed"
问题好像是sasl根本就不能连接mysql,sasl工作不正常,要怎么搞???
本功能正在开发中,目前不能使用,敬请原谅。
√ 期刊在线投稿: /journal/contribute.html
√ 本文打印于《CNFUG期刊》,欢迎访问 http://www.cnfug.net 获取更多技术文章。
© 2003-2006 CNFUG(China FreeBSD User Group) All rights reserved.
Powered by FreeBSD
重新修改了一下,修正了一些错误 :p