免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123下一页
最近访问板块 发新帖
查看: 5800 | 回复: 21
打印 上一主题 下一主题

[FreeBSD] 基于FreeBSD的postfix邮件系统+spamassassin+Clamav Antivirus [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-10-19 12:20 |只看该作者 |倒序浏览
架构基于Free BSD和Postfix的IGENUS  Web mail邮件系统
Postfix+MySQL+Cyrus-sasl2+Courier-imap+iGENUS+Postfixadmin+phpMyAdmin
+spamassassin+Clamav Antivirus


[电子牙齿]
http://www.etooth.cn
MSN:blurtooth@msn.com





1、安装系统软件
    1.1安装MySQL
      1.2安装Cyrus-sasl2
1.3安装Postfix
      1.4安装Courier-imap
      1.5安装Apache和PHP
2、配置系统
    2.1建立用户数据表结构
    2.2配置postfix
      2.3配置sasl认证
    2.4配置courier-imap
3、启动服务
    3.1MySQL
      3.2Postfix
      3.3 Courier-imap
4、测试邮件系统
5、安装配置管理软件
    5.1Postfixadmin
      5.2iGENUS
      5.3phpMyAdmin
6、注意事项

7、安装spamassassin防垃圾软件
8、安装Clamav Antivirus杀毒软件


一、安装系统软件
1)、安装MySQL4.0.x
-----------------------------------------
# adduser mysql
# tar -zxvf mysql-4.0.21.tar.gz
# cd mysql-4.0.21
# ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/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/local/mysql/db
# cp support-files/my-medium.cnf /etc/my.cnf
# chown -R root  .
# chown -R mysql var
# chgrp -R mysql .
最后需要设置mysql的root口令
# /usr/local/mysql/bin/mysqld_safe &
# /usr/local/mysql/bin/mysqladmin -uroot password 'your_password_goes_here'
-----------------------------------------

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/local/mysql --with-mysql-includes=/usr/local/mysql/include/mysql --with-mysql-libs=/usr/local/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/local/mysql/include/mysql -DUSE_SASL_AUTH -I/usr/local/include/sasl' 'AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lm -lz -L/usr/local/lib -lsasl2'
# make
# make install
-----------------------------------------

在执行make install的时候可能会得到如下的提示
/usr/libexec/ld-elf.so.1: Shared object "libmysqlclient.so.12" not found
这是因为我们的mysql不是安装在默认目录中的,所以需要告诉postfix应该到哪里去找libmysqlclient.so.12,使用ldconfig就可以达到这个目的:
-----------------------------------------
# ldconfig -m /usr/local/mysql/lib/mysql
-----------------------------------------
然后再执行make install这里会出现很多问题,但postfix已经为我们设置好了默认的答案,直接使用这些答案就可以使postfix正常工作了,所以我们只要直接按回车就可以了。
接着检查端口,应该有如下端口打开:
-----------------------------------------
[root@mail postfix]# netstat -an |grep LISTEN
tcp??0??0 0.0.0.0:25??0.0.0.0:*??LISTEN
-----------------------------------------


4)、安装Courier-imap
-----------------------------------------
$ tar -jxvf courier-imap-3.0.7.tar.bz2(用普通用户)
$ cd courier-imap-3.0.7
$ ./configure --prefix=/usr/local/courier-imap --with-authmysql(用普通用户)(给courier-imap-3.0.7目录以及目录中文件增加权限)
在执行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/local/mysql/bin"
然后再次执行configure脚本:
$ ./configure --prefix=/usr/local/courier-imap --with-authmysql
$ make
# make install(安装courier-imap 时其他步骤用普通用户,make install 用ROOT用户)
-----------------------------------------


5)、安装Apache和PHP
-----------------------------------------
# tar –zxvf apache1.3.33.tar.gz
# cd apache1.3
# ./configure --prefix=/usr/local/apache --enable-module=so
# make;make install clean
# tar –zxvf php-4.3.10.tar.gz
# cd php-4.3
# ./configure --with-mysql=/usr/local/mysql --with-apxs=/usr/local/apache/bin/apxs
# make;make install clean
# cp php.ini-dist /usr/local/lib/php.ini
-----------------------------------------

编辑apache配置文件httpd.conf
-----------------------------------------
# vi /usr/local/apache/conf/httpd.conf
(1)查找 #Listen 12.34.56.78:80 行,将该行下面的内容修改为
Listen 80 #此处为您服务器的IP地址
#Listen []:80
ServerName localhost:80
DocumentRoot "/usr/local/www"
<Directory "/usr/local/www">;
(2)查找LoadModule php4_module modules/libphp4.so 行,在下面添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
这样就可以支持php脚本
(3)查找ServerAdmin you@your.address,在该行最前面添加#,注销该行内容
(4)查找DocumentRoot "/usr/local/apache/htdocs",在该行最前面添加#,注销该行内容
(5)查找DirectoryIndex index.html index.html.var,将那行内容更改为DirectoryIndex index.html index.html.var index.php index.php3 index.phtml index.htm
(6)查找AddDefaultCharset ISO-8859-1,将那行内容更改为AddDefaultCharset gb2312
-----------------------------------------


修改php配置文件php.ini
-----------------------------------------
# vi /usr/local/apache/conf/php.ini
(1)查找max_execution_time = 30,更改为max_execution_time = 600  
(2)查找max_input_time = 60,更改为max_input_time = 600
(3)查找memory_limit = 8M ,更改为memory_limit = 20M
(4)查找display_errors = On,更改为display_errors = Off
(5)查找register_globals = Off,更改为register_globals = On
(6)查找post_max_size = 8M,更改为post_max_size = 20M
(7)查找upload_max_filesize = 2M,更改为upload_max_filesize = 20M
(8)查找session.auto_start = 0,更改为session.auto_start = 1
-----------------------------------------

论坛徽章:
0
2 [报告]
发表于 2005-10-19 12:23 |只看该作者

基于FreeBSD的postfix邮件系统+spamassassin+Clamav Antivirus

二、配置系统
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文件,其中描述了各个表的结构
现在将表结构导入到mysql中:
-------------------------------------------------
# /usr/local/mysql/bin/mysql -u root -p < DATABASE.TXT
-------------------------------------------------

2)、配置postfix
首先需要更改/etc/postfix/main.cf中的一些基本参数,请按照自己的实际情况修改,本例以域名mainone.net为例:
-------------------------------------------------
myhostname = mail.mainone.net
mydomain = mainone.net
myorigin = #mydomain
mydestination = #myhostname, localhost.#mydomain, localhost 
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 = mainone.net
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/local/courier-imap/etc/authmysqlrc,本例中其内容如下:(新建的文件)
-------------------------------------------------
# vi /usr/local/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/local/courier-imap/etc/authdaemonrc.dist /usr/local/courier-imap/etc/authdaemonrc
-------------------------------------------------
因为我们这里只使用了authmysql模块,所以我们可以把其它验证模块去掉,编辑authdaemonrc文件,将其中的:
-------------------------------------------------
authmodulelist="authcustom authcram authuserdb authmysql authpam"
改成:
authmodulelist="authmysql"
最后就是配置pop3d和imapd了,这里我们直接使用其默认设置:
# cp /usr/local/courier-imap/etc/pop3d.dist /usr/local/courier-imap/etc/pop3d
# cp /usr/local/courier-imap/etc/pop3d-ssl.dist /usr/local/courier-imap/etc/pop3d-ssl
# cp /usr/local/courier-imap/etc/imapd.dist /usr/local/courier-imap/etc/imapd
# cp /usr/local/courier-imap/etc/imapd-ssl.dist /usr/local/courier-imap/etc/imapd-ssl
-------------------------------------------------

论坛徽章:
0
3 [报告]
发表于 2005-10-19 12:27 |只看该作者

基于FreeBSD的postfix邮件系统+spamassassin+Clamav Antivirus

三、启动服务
1)、MySQL
-----------------------------------------------
# /usr/local/mysql/share/mysql/mysql.server start
-----------------------------------------------
为了确保postfix以及以后的进程能够正确的搜索到libmysqlclient,在这里将mysql的lib设置到ldconfig的搜索路径中:
-----------------------------------------------
# ldconfig -m /usr/local/mysql/lib/mysql
-----------------------------------------------
2)、Postfix
-----------------------------------------------
# /usr/sbin/postfix start
-----------------------------------------------
3)、Courier-imap
-----------------------------------------------
# /usr/local/courier-imap/libexec/authlib/authdaemond start
# /usr/local/courier-imap/libexec/pop3d.rc start
# /usr/local/courier-imap/libexec/imapd.rc start
-----------------------------------------------
如果你想系统在启动的时候自动运行以上这些服务,可以直接将上面的这些启动服务的命令加入到/etc/rc.local中(这里是以BSD UNIX为例子,如果是非BSD UNIX系统请自行将/etc/rc.local更改为相应系统自启动文件名)。



四、测试邮件系统
在进行下一步前,我们可以先对后台系统进行一下测试,以确保后台系统已经正常工作。
首先建立一个测试用户:
-----------------------------------------------
# /usr/local/mysql/bin/mysql –u postfix -p
mysql>; use postfix;
mysql>; insert into domain(domain,active) values('mainone.net','1');
mysql>; insert into mailbox(username,password,name,maildir,domain,active) values('test@mainone.net','test','kevin','mainone.net/test/Maildir/','mainone.net','1');
mysql>; quit;
测试postfix:
# echo "hello world" | mail test@mainone.net
# ls -al /var/mailbox
-----------------------------------------------
看是否已经建立目录 mainone.net 以及其下面是否有相应的文件夹
测试SMTP认证:
-----------------------------------------------
# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.mainone.net ESMTP Postfix
EHLO mainone.net
250-mainone.net
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@mainone.net密码是test,我们的测试成功了。
测试pop3
-----------------------------------------------
# telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK Hello there.
USER test@mainone.net
+OK Password required.
PASS mainone
+OK logged in.
-----------------------------------------------
上面的提示表示我们的pop3登录也成功了



五、安装配置Postfixadmin-2.0.5和iGENUS_2.0.2
1)、安装postfixadmin-2.0.5
-----------------------------------------------
# tar -zxvf postfixadmin-2.0.5.tgz
# mv postfixadmin-2.0.5 /usr/local/www/postfixadmin
# cd /usr/local/www/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/";

-----------------------------------------------
# vi languages/cn.lang
找到该文件最前面的如下行:
#PALANG['YES'] = '是';
在该行前面加入:
#PALANG['charset'] = 'gb2312';
-----------------------------------------------
修改postfixadmin目录及文件权限
-----------------------------------------------
# cd /usr/local/www/postfixadmin
# chmod 640 *.php *.css
# cd /usr/local/www/postfixadmin/admin/
# chmod 640 *.php .ht*
# cd /usr/local/www/postfixadmin/images/
# chmod 640 *.gif *.png
# cd /usr/local/www/postfixadmin/languages/
# chmod 640 *.lang
# cd /usr/local/www/postfixadmin/templates/
# chmod 640 *.tpl
# cd /usr/local/www/postfixadmin/users/
# chmod 640 *.php
-----------------------------------------------
现在所有的后台服务已经正常工作了,现在我们就开始安装管理界面和用户界面,应注意的是postfixadmin的用户、组、权限的设定。
到此,postfixadmin的修改就已经全部完成,现在可以将postfixadmin这个目录复制或上传到你的web目录中了,然后打开浏览器,进入postfixadmin的管理界面http://www.yourdomain.com/postfixadmin/admin/index.php,这里就可以新建域名和管理员了(注意,通过应该先建域名,再建立管理员)。然后用新建立的管理员登录到http://www.yourdomain.com/postfixadmin/index.php(login.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
# mv igenus /usr/local/www/igenus
# cd /usr/local/www/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中了http:// www.yourdomain.com/igenus/index.php
注意igenus目录以及子目录文件的用户、组、权限的设定,不然无法登陆邮件系统。


3)、安装phpMyAdmin
-----------------------------------------------
# tar –zxvf phpMyAdmin-2.6.7.tar.gz
# mv phpMyAdmin-2.6.7 /usr/local/www/phpMyAdmin
# cd /usr/local/www/phpMyAdmin
修改phpMyAdmin配置文件config.inc.php
$cfg['PmaAbsoluteUri'] = 'http://192.168.0.2/phpMyAdmin/';
$cfg['Servers'][$i]['auth_type']     = 'http';    // Authentication method (config, http or cookie based)?
-----------------------------------------------
指定phpmyadmin的认证方式为http方式
在浏览器输入http://192.168. 0.2/phpMyAdmin/,首次进行登入的用户名为root密码为空,登入后可以修改你的密码。
到这里,我们的Postfix Powered的邮件系统已经完成


六、注意事项
1、        安装Apache和PHP时要检查php是否正确安装。
2、        检查Postfixadmin和iGENUS的目录及文件用户、组、权限的设置,通常在访问postfixadmin时页面没有反应以及iGENUS不能登陆时都是因为因为权限的问题。
3、        我使用的Igenus经过修改,需要增加vpopmail数据库,根据iGENUS中的SQL文件添加数据库表结构,并在phpMyAdmin登录数据库,修改postfixadmin用户对vpopmail的权限。

论坛徽章:
2
丑牛
日期:2013-09-29 09:47:222015七夕节徽章
日期:2015-08-21 11:06:17
4 [报告]
发表于 2005-10-19 14:20 |只看该作者

基于FreeBSD的postfix邮件系统+spamassassin+Clamav Antivirus

不错不错,近期正准备装个邮件系统哪

论坛徽章:
0
5 [报告]
发表于 2005-10-19 14:56 |只看该作者

基于FreeBSD的postfix邮件系统+spamassassin+Clamav Antivirus

师父的作品当然要支持!!!顶!

论坛徽章:
0
6 [报告]
发表于 2005-10-19 15:16 |只看该作者

基于FreeBSD的postfix邮件系统+spamassassin+Clamav Antivirus

不错 支持LZ

论坛徽章:
2
IT运维版块每日发帖之星
日期:2015-10-05 06:20:00操作系统版块每日发帖之星
日期:2015-10-05 06:20:00
7 [报告]
发表于 2005-10-19 15:41 |只看该作者

基于FreeBSD的postfix邮件系统+spamassassin+Clamav Antivirus

看来我很多东西都还不懂,像要建立一个比较好用和安全的MAIL系统,需要了解下它的工作原理吗?

论坛徽章:
0
8 [报告]
发表于 2005-10-19 15:57 |只看该作者

基于FreeBSD的postfix邮件系统+spamassassin+Clamav Antivirus

[quote]原帖由 "zero-B"]看来我很多东西都还不懂,像要建立一个比较好用和安全的MAIL系统,需要了解下它的工作原理吗?[/quote 发表:


当然应该了解下原理了,虽然我也不明白
这个配置是比较简单的,没有防毒,防垃圾邮件,密码认证也是明文
所以不是安全的,只是先架了个环境而以

论坛徽章:
2
丑牛
日期:2013-09-29 09:47:222015七夕节徽章
日期:2015-08-21 11:06:17
9 [报告]
发表于 2005-10-19 16:20 |只看该作者

基于FreeBSD的postfix邮件系统+spamassassin+Clamav Antivirus

强烈要求都加上,呵呵

论坛徽章:
2
IT运维版块每日发帖之星
日期:2015-10-05 06:20:00操作系统版块每日发帖之星
日期:2015-10-05 06:20:00
10 [报告]
发表于 2005-10-19 20:21 |只看该作者

基于FreeBSD的postfix邮件系统+spamassassin+Clamav Antivirus

原帖由 "牙齿晒太阳" 发表:


当然应该了解下原理了,虽然我也不明白
这个配置是比较简单的,没有防毒,防垃圾邮件,密码认证也是明文
所以不是安全的,只是先架了个环境而以


呵呵,就像我以前,架了一个apache+php+mysql,然后什么也不管,什么也没加,就让它空着。

不过想要学到东西,太难了
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP