mail=freebsd+postfix

Postfix, Amavisd-new, ClamAV, ExtMail ExtMan Courier系列软件。是一个功能相对比较齐全的免费电子邮件系统。以下是其主要的特性列表:

  • 支持SMTP/POP3/IMAP/HTTP协议
  • 支持SMTP认证及ESMTP
  • 可支持大容量邮箱(大于1GB
  • 高速Web界面访问邮箱
  • 完整的Web管理后台
  • 在线服务端病毒过滤
  • 内建内容过滤
  • SMTP行为识别垃圾邮件
  • 支持大量反垃圾邮件技术
  • 图形化邮件日志分析
  • 支持别名/多域/域管理员等
  • 支持网络磁盘/POP3邮件
  • 支持读/HTML格式邮件
  • 支持定制模板及多语言
  • 支持邮件列表管理,基于WEB

功能模块

内容 备注
操作系统(OS FreeBSD 6.2 FreeBSD是一个优秀的unix操作系统,基于宽松的BSD协议
邮件传输代理(MTA Postfix 2.3 使用2.3ports中的postfix已经是最新的2.3
数据库/目录服务 Mysql 5.1 可选MySQL5.1
邮件投递代理(MDA Maildrop 2.0.x 支持过滤和强大功能
Web帐户管理后台 ExtMan-0.2beta3 支持无限域名、无限用户
POP3 服务器 Courier-IMAP 支持pop3/pop3s/imap/imaps,功能强大,可根据需要选择
WebMail 系统 ExtMail-1.0beta3 支持多语言、全部模板化,功能基本齐全
防病毒软件(Anti-Virus ClamAV 0.88 最热门的开源杀毒软件
SMTP阶段反垃圾邮件工具 Spam Locker 0.083 基于SMTP行为识别的Antispam软件,大量可选插件
内容过滤器 Amavisd-new 2.4.x Content-Filter软件,支持与clamav/sa的挂接
内容级别的反垃圾邮件工具 SpamAssassin 著名的SA,可以支持大量规则,但速度较慢
SMTP认证库 Cyrus SASL 2.1x 标准的SASL实现库,可以支持Courier authlib
其他数据认证库 Courier Authlib 0.58 authlibmaildrop, courier-imap等服务的关键部件
日志分析及显示 mailgraph_ext ExtMan中已经包含了
Web 服务器 Apache 2.2.x 最新版的apache服务器,默认支持ssl模块

 

二、安装MYSQL

 

 

   [root@dns-master easy-rsa]# cd /usr/ports/databases/mysql51-server/

[root@dns-master mysql51-server]# make install clean

安装完毕后在/etc/rc.conf 文件添加如下一行

Mysql_enable=”YES”

 启动mysql数据库

[root@dns-master rc.d]# /usr/local/etc/rc.d/mysql-server start

 

可以用ps 或者netstat 检查mysql服务是否启动

[root@dns-master rc.d]# ps -axu |grep mysql

root    42195  0.0  0.1  5908  1304  p0  S+    3:40PM   0:00.00 grep mysql

mysql   15336  0.0  0.1  5160  1520  p2- I    Mon03PM   0:00.01 /bin/sh /usr/local/bin/mysqld_safe –defaults-ext

mysql   15398  0.0  3.9 62956 40284  p2- S    Mon03PM   1:47.44 [mysqld]

  更改mysql root用户密码,因为安装后是空的,为了安全一定要修改

   #mysqladmin -u root flush-privileges password “newpassword”

  

三、安装apache服务器

   

[root@dns-master rc.d]# cd /usr/ports/www/apache22/

   [root@dns-master rc.d]# make install clean

   安装完后,修改httpd.conf

   [root@dns-master apache22]# vi /usr/local/etc/apache22/httpd.conf

   根据自己的情况修改配置文件,其中一些常见的项需要设置

Servername  mail.redpoo.com

DocumentRoot /usr/local/www

修改/etc/rc.conf文件,添加如下一行保存退出

 Apache22_enable=”YES”

启动apapche

[root@dns-master apache22]# /usr/local/etc/rc.d/apache22 start

  

四、安装PHP

  

 [root@dns-master php5-session]# cd /usr/ports/www/php5-session/

[root@dns-master php5-session]#make install clean

选择一些你需要的模块

 

安装完毕后,修改httpd.conf

加入如下一行

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

修改目录索引,添加index.php

DirectoryIndex index.html index.php

保存退出

重新启动apache

/usr/local/etc/rc.d/apache22 restart

 

安装php的扩展

 [root@dns-master php5-session]# cd /usr/ports/lang/php5-extensions/

[root@dns-master php5-extensions]#make install clean

选择BZ2 CTYPE GD GETTEXT ICONV IMAP MBSTRING MCRYPT MYSQL OPENSSL OVERLOAD PCRE POSIX SESSION TOKENIZER XML ZLIB ZIP

    

五、安装webmail数据库

 

extman extmail用户后台管理系统,官方网站为www.extmail.org 下载解压

 

%tar zxvf extman-13-20060102.tar.gz

%cd extman-0.13-20060102/docs

%mysql -u root -p <extmail.sql

Enter password:

%mysql -u root -p <init.sql

Enter password:

extman添加了两个MySQL用户

 

1、只读用户:extmail 密码:extmail

 

2、读/写用户:webman 密码:webman

 

init.sql 里,对extmail数据库添加了下面的记录

 

a、添加了一个别名记录 support@extmail.org ->test@extmail.org

 

b、增加了 extmail.org

 

c、增加了test@extmail.org的邮箱密码为test

 

d、增加了extman 的管理员root@extmail.org 密码为extmail

test用户创建路径

需要一个测试帐号test@extmail.org,需要准备该账号的路径。

mkdir -p /data/domains/redpoo.com/test/Maildir/new

mkdir -p /data/domains/redpoo.com/test/Maildir/cur

mkdir -p /data/domains/redpoo.com/test/Maildir/tmp

chown -R vuser:vgroup /data/domains/

chmod -R 700 /data/domains/

 

这些以后都是可以修改。

    

、安装Courier-IMAP

  

 %cd /usr/ports/mail/courier-imap/

%make install clean选择opensslMySQL

 

/etc/rc.conf 加入

 

courier_authdaemond_enable=”YES”

courier_imap_pop3d_enable=”YES”

courier_imap_imapd_enable=”YES”修改authdaemond的权限

 

%/usr/local/etc/rc.d/courier-authdaemond.sh start

%chmod -R  +x /var/run/authdaemond/ authdaemond 启动完成后,检查/var/run/authdaemond 下面是否产生socket 文件,因为认证时是通过这个文件读取密码的。

 

设置/usr/local/etc/authlib/authdaemonrc

 

%mv authdaemonrc authdaemonrc.bak

修改authdaemonrc为如下面的内容

 

authmodulelist=”authmysql”

authmodulelistorig=”authmysql”

version=”authdaemond.mysql”

daemons=5                            

authdaemover=/var/run/authdaemond    

subsystem=mail                       

DEBUG_LOGIN=0                       

DEFAULTOPTIONS=”wbnodsn=1″

LOGGEROPTS=”"

上面DEBUG_LOGIN=2 是为了调试方便,等系统完全测试完成,可改为 0,即不显示调试信息。

 

修改/usr/local/etc/authlib/authmysqlrc 为如下内容

%mv authmysqlrc authmysqlrc.bak

Vi  authmysqlrc

 

MYSQL_SERVER            localhost

MYSQL_USERNAME          extmail

MYSQL_PASSWORD          extmail

MYSQL_SOCKET            /tmp/mysql.sock

MYSQL_DATABASE          extmail

MYSQL_USER_TABLE        mailbox

MYSQL_CRYPT_PWFIELD     password

MYSQL_UID_FIELD         vuser

MYSQL_GID_FIELD         vgroup

MYSQL_HOME_FIELD        homedir

MYSQL_MAILDIR_FIELD     maildir

MYSQL_SELECT_CLAUSE     SELECT username,password,”",uidnumber,gidnumber,\

                        CONCAT(’/data/domains/’,homedir),               \

                        CONCAT(’/data/domains/’,maildir),               \

                        quota,                                          \

                        name                                            \

                        FROM mailbox                                    \

                        WHERE username = ‘$(local_part)@$(domain)’

DEFAULT_DOMAIN  mail.redpoo.com

 

创建pop3/imap 的配置文件

 

%cp pop3d.cnf.dist pop3d.cnf

%cp imapd.cnf.dist imapd.cnf

修改/usr/local/etc/courier-imap/pop3d.cnf 为如下内容,

[root@dns-master courier-imap]# more pop3d.cnf

 

RANDFILE = /usr/local/share/courier-imap/pop3d.rand

 

[ req ]

default_bits = 1024

encrypt_key = yes

distinguished_name = req_dn

x509_extensions = cert_type

prompt = no

 

[ req_dn ]

C=CN

ST=BJ

L=Bei Jing

O=Redpoo

OU=Redpoo

CN=redpoo.com

emailAddress=bosonmaster@gmail.com

  

#[ cert_type ]

#nsCertType = server

POP3AUTH=”LOGIN CRAM-MD5 CRAM-SHA1″

 

POP3AUTH=”LOGIN CRAM-MD5 CRAM-SHA1″

修改/usr/local/etc/courier-imap/imapd.cnf 为如下内容

prompt = no

 

[ req_dn ]

C=CN

ST=BJ

L=Bei Jing

O=Redpoo

OU=Redpoo

CN=redpoo.com

emailAddress=bosonmaster@gmail.com

 

#[ cert_type ]

#nsCertType = server

IMAP_CAPABILITY=”IMAP4rev1 CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA”

   

七、安装Cyrus-SASL2

  

%cd /usr/ports/security/cyrus-sasl2

%make install WITH_AUTHDAEMON=yes

创建 /usr/local/lib/sasl2/smtpd.conf 加入下面的内容

pwcheck_method:authdaemond

log_level:3

mech_list:PLAIN LOGIN

authdaemond_path:/var/run/authdaemond/socket

  

八、安装POSTFIX

  

%cd /usr/ports/mail/postfix

%make install clean选择SASL2 TLSMySQLVDA ,安装过程中有两个提问,直接按回车,使用系统默认的回答。

 

%echo postfix: root >> /etc/aliases

%/usr/local/bin/newaliases

%ln -s /usr/local/sbin/sendmail /usr/sbin/sendmail

如果出现ln: /usr/sbin/sendmail: File exists 提示,把/usr/sbin/sendmail改名再链接。

 

设置postfix 随系统启动,编辑/etc/rc.conf,加入以下选项

 

postfix_enable=”YES”                 

sendmail_enable=”NO”                 

sendmail_submit_enable=”NO”          

sendmail_outbound_enable=”NO”

sendmail_msp_queue_enable=”NO”

 

创建编辑/etc/periodic.conf 加入下面的内容

 

daily_clean_hoststat_enable=”NO”

daily_status_mail_rejects_enable=”NO”

daily_status_include_submit_mailq=”NO”

daily_submit_queuerun=”NO”

 

配置/usr/local/etc/postfix/main.cf,为如下内容

more /usr/local/etc/postfix/main.cf

###################BASE##################

mydomain = mail.redpoo.com

myhostname=mail.redpoo.com

mydestination = $mydomain $myhostname localhost localhost.localdomain

local_recipient_maps =

command_directory = /usr/local/sbin

#local_transport = virtual

smtpd_banner = redpoo.com ESMTP Mail System

message_size_limit = 14680064          

#mailbox_size_limit = 512000000

mynetworks = 127.0.0.0/8

#################MySQL################

virtual_alias_maps =mysql:/usr/local/etc/postfix/mysql_virtual_alias_maps.cf

#virtual_gid_maps = static:1000

#virtual_gid_maps = static:1000

virtual_mailbox_base = /data/domains

virtual_mailbox_domains = mysql:/usr/local/etc/postfix/mysql_virtual_domains_maps.cf

#virtual_mailbox_limit = 512000000

virtual_mailbox_maps = mysql:/usr/local/etc/postfix/mysql_virtual_mailbox_maps.cf

#virtual_minimum_uid = 1000

#virtual_minimum_uid = 1000

#virtual_transport = virtual

virtual_transport = maildrop:

maildrop_destination_recipient_limit = 1

 

#virtual_uid_maps = static:125

#virtual_uid_maps = static:1000

################Quota################

virtual_create_maildirsize = yes

virtual_mailbox_extended = yes

virtual_mailbox_limit_maps = mysql:/usr/local/etc/postfix/mysql_virtual_mailbox_limit_maps.cf

virtual_mailbox_limit_override = yes

virtual_maildir_limit_message = Sorry,the user’s Maildir has overdrawn his diskspace quota ,please tray again late

r.

virtual_overquota_bounce = yes

 

##############SASL####################

smtpd_sasl_auth_enable = yes

smtpd_sasl2_auth_enable = yes

smtpd_sasl_security_options = noanonymous

broken_sasl_auth_clients = yes

 

smtpd_recipient_restrictions =

 permit_mynetworks,

 permit_sasl_authenticated,

 reject_unauth_destination,

 reject_unauth_pipelining,

 reject_invalid_hostname,

 reject_rbl_client cbl.anti-spam.org.c

readme_directory = no

sample_directory = /usr/local/etc/postfix

sendmail_path = /usr/local/sbin/sendmail

html_directory = no

setgid_group = maildrop

manpage_directory = /usr/local/man

daemon_directory = /usr/local/libexec/postfix

newaliases_path = /usr/local/bin/newaliases

mailq_path = /usr/local/bin/mailq

queue_directory = /var/spool/postfix

mail_owner = postfix

content_filter = smtp-amavis:[127.0.0.1]:10024

  

以下四个文件在extman 软件包Docs 目录里,使用时,直接复制到/usr/local/etc/postfix 目录即可。

mysql_virtual_limit_maps.cf

 

more mysql_virtual_limit_maps.cf

user = extmail

password = extmail

hosts = localhost

dbname = extmail

table = mailbox

select_field = quota

where_field = username

additional_conditions = AND active = ‘1′

  

mysql_virtual_mailbox_limit_maps.cf

                       

[root@dns-master postfix]# more mysql_virtual_mailbox_limit_maps.cf

user = extmail

password = extmail

hosts = localhost

dbname = extmail

table = mailbox

select_field = quota

where_field = username

additional_conditions = AND active = ‘1′

 

mysql_virtual_mailbox_maps.cf

 

[root@dns-master postfix]# more mysql_virtual_mailbox_maps.cf

user = extmail

password = extmail

hosts = localhost

dbname = extmail

table = mailbox

select_field = maildir

where_field = username

additional_conditions = AND active = ‘1′

  

mysql_virtual_sender_maps.cf

 

[root@dns-master postfix]# more mysql_virtual_sender_maps.cf

user = extmail

password = extmail

hosts = localhost

dbname = extmail

table = mailbox

select_field = username

where_field = username

additional_conditions = AND active = ‘1′

 

mysql_virtual_alias_maps.cf

 

[root@dns-master postfix]# more mysql_virtual_alias_maps.cf

user = extmail

password = extmail

hosts = localhost

dbname = extmail

table = alias

select_field = goto

where_field = address

additional_conditions = AND active = ‘1′

  

九、安装maildrop

  

我们在设置邮件服务器时MTA 部分还是使用posfix 本身的帐户进行处理邮件,由于maildrop 不能和postfix 与同一用户身份处理邮件,所以我们新开一个用户用户maildrop 处理。

 

添加vgroup

 

pw groupadd vgroup -g 1000添加vuser

 

%pw useradd vuser -g 1000 -u 1000 -s /sbin/nologin -d /sbin/nologin -c “virtual mail user”安装maildrop,记得要把WITH_AUTHLIB=yes 加上

 

%cd /usr/ports/mail/maildrop

%make install WITH_AUTHLIB=yes选择AUTH_MYSQL

修改/usr/local/etc/postfix/master.cf

maildrop unix -     n     n     -     -     pipe

  flags=DRhu user=vuser argv=/usr/local/bin/maildrop -d ${user}@${nexthop} ${recipient} ${user} ${extension} ${nexthop}

 

设置邮件存储目录

 

%mkdir -p domains/extmail.org/test

%/usr/local/bin/maildirmake /home/data/domains/extmail.org/test/Maildir

%chown -R 1000:1000 domains/

  

十、安装amavisd-new

   

 内容过滤我们采用了amavisd-new ,主要考滤到amavsid-new 配置方便,

%cd /usr/ports/security/amavisd-new/

%make install clean只选择MYSQL

在安装Amavisd-new 时,系统会自动把Spamassassin 装上去,还要选择AS_ROOT SSL MYSQL TOOLS

 

/etc/rc.conf 加入下面的内容

 

amavisd_enable=”YES”

spamd_enable=”YES”修改 /usr/local/etc/amavisd.conf

 

$mydomain = ‘extmail.org’; 垃圾邮件病毒通知

 

$virus_admin               = “postmaster\@$mydomain”;  # notifications recip.

$mailfrom_notify_admin     = “postmaster\@$mydomain”;  # notifications sender

$mailfrom_notify_recip     = “postmaster\@$mydomain”;  # notifications sender

$mailfrom_notify_spamadmin = “postmaster\@$mydomain”; # notifications sender

$mailfrom_to_quarantine = ”; # null return path; uses original sender if undef去除对附件的转换

 

$banned_filename_re = new_RE(

#把中间的内容全部加上#

);加入对Clamav 的支持

 

# ### http://www.clamav.net/

 ['ClamAV-clamd',

   \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd"],

   qr/\bOK$/, qr/\bFOUND$/,

   qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],

 

/usr/local/etc/postfix/master.cf 加入

 

smtp-amavis unix -   -   n     -       2  smtp

        -o smtp_data_done_timeout=1200

        -o disable_dns_lookups=yes

                                                                                

127.0.0.1:10025 inet n -       n       -       -  smtpd

        -o content_filter=

        -o local_recipient_maps=

        -o relay_recipient_maps=

        -o smtpd_restriction_classes=

        -o smtpd_client_restrictions=

        -o smtpd_helo_restrictions=

        -o smtpd_sender_restrictions=

        -o smtpd_recipient_restrictions=permit_mynetworks,reject

        -o mynetworks=127.0.0.0/8

  

重启postfix

 

%/usr/local/etc/rc.d/postfix.sh restart

postfix/postfix-script: stopping the Postfix mail system

postfix/postfix-script: starting the Postfix mail system

对于Spamassassin 配置文件/usr/local/etc/mail/spamassassin/local.cf

# SpamAssassin config file for version 3.x

# NOTE: NOT COMPATIBLE WITH VERSIONS 2.5 or 2.6

# See http://www.yrex.com/spam/spamconfig25.php for earlier versions

# Generated by http://www.yrex.com/spam/spamconfig.php (version 1.50)

 

# How many hits before a message is considered spam.

required_score           5.0

 

# Encapsulate spam in an attachment (0=no, 1=yes, 2=safe)

report_safe             1

 

# Enable the Bayes system

use_bayes               1

 

# Enable Bayes auto-learning

bayes_auto_learn              1

 

# Enable or disable network checks

skip_rbl_checks         0

use_razor2              1

use_dcc                 1

use_pyzor               1

 

# Mail using languages used in these country codes will not be marked

# as being possibly spam in a foreign language.

# - chinese english japanese

ok_languages            zh en ja

 

# Mail using locales used in these country codes will not be marked

# as being possibly spam in a foreign language.

ok_locales              en ja zh

 

调试amavisd-new

 

%su vscan

$ /etc/sbin/amavisd debug如果没有出现任何错误,证明你的amavisd-new 正常。

十一、安装Clamav

   

clamav 用于邮件杀毒

 

%cd /usr/ports/security/clamav

%make install clean可以什么都不选,直接回车

 

clamav_clamd_enable=”YES”

clamav_freshclam_enable=”YES”修改/usr/local/etc/clamd.conf 让其以vscan 身份运行(145)

 

#User clamav

User vscan修改/usr/local/etc/freshclam.conf

 

#DatabaseOwner clamav

DatabaseOwner vscan修目录权限

 

%chown -R vscan:vscan /var/log/clamav

%chown -R vscan:vscan /var/run/clamav

%chown -R vscan:vscan /var/db/clamav启动clamav 自动更新

 

%/usr/local/etc/rc.d/clamav-clamd.sh start

%/usr/local/etc/rc.d/clamav-freshclam.sh start

   

十二、安装EXTMAIL

  

1、设置apache 的运行身份

修改/usr/local/etc/apache22/httpd.conf

 

#User www

#Group www

User vuser

Group vgroup

修改webtman.cf 内容如下;

more /usr/local/etc/mail/spamassassin/local.cf

# SpamAssassin config file for version 3.x

# NOTE: NOT COMPATIBLE WITH VERSIONS 2.5 or 2.6

# See http://www.yrex.com/spam/spamconfig25.php for earlier versions

# Generated by http://www.yrex.com/spam/spamconfig.php (version 1.50)

 

# How many hits before a message is considered spam.

required_score           5.0

 

# Encapsulate spam in an attachment (0=no, 1=yes, 2=safe)

report_safe             1

 

# Enable the Bayes system

use_bayes               1

 

# Enable Bayes auto-learning

bayes_auto_learn              1

 

# Enable or disable network checks

skip_rbl_checks         0

use_razor2              1

use_dcc                 1

use_pyzor               1

 

# Mail using languages used in these country codes will not be marked

# as being possibly spam in a foreign language.

# - chinese english japanese

ok_languages            zh en ja

 

# Mail using locales used in these country codes will not be marked

# as being possibly spam in a foreign language.

ok_locales              en ja zh

 

[root@dns-master postfix]# vi /usr/local/etc/apache22/httpd.conf

    # If you prefer a logfile with access, agent, and referer information

    # (Combined Logfile Format) you can use the following directive.

    #

    CustomLog /var/log/httpd-access.log combined

</IfModule>

<IfModule alias_module>

    #

    # Redirect: Allows you to tell clients about documents that used to

    # exist in your server’s namespace, but do not anymore. The client

    # will make a new request for the document at its new location.

    # Example:

    # Redirect permanent /foo http://www.example.com/bar

 

    #

    # Alias: Maps web paths into filesystem paths and is used to

    # access content that does not live under the DocumentRoot.

    # Example:

    # Alias /webpath /full/filesystem/path

    # If you prefer a logfile with access, agent, and referer information

    # (Combined Logfile Format) you can use the following directive.

    #

    CustomLog /var/log/httpd-access.log combined

</IfModule>

<IfModule alias_module>

    #

    # Redirect: Allows you to tell clients about documents that used to

    # exist in your server’s namespace, but do not anymore. The client

    # will make a new request for the document at its new location.

    # Example:

    # Redirect permanent /foo http://www.example.com/bar

   

    #

    # Alias: Maps web paths into filesystem paths and is used to

    # access content that does not live under the DocumentRoot.

    # Example:

    # Alias /webpath /full/filesystem/path

    # If you prefer a logfile with access, agent, and referer information

    # (Combined Logfile Format) you can use the following directive.

    #

    CustomLog /var/log/httpd-access.log combined

</IfModule>

<IfModule alias_module>

    #

    # Redirect: Allows you to tell clients about documents that used to

    # exist in your server’s namespace, but do not anymore. The client

    # will make a new request for the document at its new location.

    # Example:

    # Redirect permanent /foo http://www.example.com/bar

   

    #

    # Alias: Maps web paths into filesystem paths and is used to

    # access content that does not live under the DocumentRoot.

    # Example:

    # Alias /webpath /full/filesystem/path

    #

    # If you include a trailing / on /webpath then the server will

    # require it to be present in the URL.  You will also likely

    # need to provide a <Directory> section to allow access to

    # the filesystem path.

   

    #     

    # ScriptAlias: This controls which directories contain server scripts.

    # ScriptAliases are essentially the same as Aliases, except that   

    # documents in the target directory are treated as applications and

    # run by the server when requested rather than as documents sent to the

    # client.  The same rules about trailing “/” apply to ScriptAlias

    # directives as to Alias.

    #

    ScriptAlias /cgi-bin/ “/usr/local/www/apache22/cgi-bin/”

:q

[root@dns-master postfix]# cd /usr/local/www/extman/webman.cf

-bash: cd: /usr/local/www/extman/webman.cf: Not a directory

[root@dns-master postfix]# more /usr/local/www/extman/webman.cf

# sys_config, the config file and webman programe root

SYS_CONFIG = /usr/local/www/extman/

 

# sys_langdir, the i18n dir

SYS_LANGDIR = /usr/local/www/extman/lang

 

# sys_templdir, the template dir

SYS_TEMPLDIR = /usr/local/www/extman/html

 

# maildir_base, the base dir of user maildir, use absolute path

# if not set.

SYS_MAILDIR_BASE = /data/domains

 

# sys_warn, show system warning or not, default to yes

SYS_SHOW_WARN = 0

 

# sys_sess_dir, the session dir

SYS_SESS_DIR = /tmp/extman/

 

# sys_captcha_on 1|0 - to enable captcha feature or not

SYS_CAPTCHA_ON = 0

 

# sys_captcha_key

SYS_CAPTCHA_KEY = r3s9b6a7

 

# sys_captcha_len

SYS_CAPTCHA_LEN = 6

 

# sys_sess_timeout, session timeout in seccond, default 6 hours

# SYS_SESS_TIMEOUT = 21600

 

# sys_user_psize, user default page_size

SYS_PSIZE = 50

 

# sys_user_lang, user default language

# SYS_LANG = zh_CN

 

# sys_template_name, the template name

SYS_TEMPLATE_NAME = default

 

# web management related restritions

# sys_default_expire, valid value: ?y ?m ?d

SYS_DEFAULT_EXPIRE = 1y

 

# sys_groupmail_sender - sender for groupmail, this account must

# exist or postfix or other mta will complain error

SYS_GROUPMAIL_SENDER = postmaster@extmail.org

 

# sys_default_services, valid value: smtpd, smtp, webmail, netdisk,

# imap and pop3, concatenate with “,” as multiple values, eg: webmail,smtpauth

SYS_DEFAULT_SERVICES = webmail,smtpd,smtp,pop3,netdisk

 

# sys_isp_mode, yes|no - if yes, use our HashDir to spread

# storage to multiple directories

SYS_ISP_MODE = no

 

# sys_domain_hashdir = yes|no, if yes we will enable domain hashdir

# depend on sys_isp_mode = yes

SYS_DOMAIN_HASHDIR = yes

 

# sys_domain_hashdir_depth, the hash length and depth, format:

# length x depth, eg: 2×1 => length =2, depth =1

# depend on sys_isp_mode = yes

SYS_DOMAIN_HASHDIR_DEPTH = 2×2

 

# sys_user_hashdir = yes|no, if yes we will enable user hashdir

# depend on sys_isp_mode = yes

SYS_USER_HASHDIR = yes

 

# sys_user_hashdir_depth, similar to sys_hashdir_domain_depth

SYS_USER_HASHDIR_DEPTH = 2×2

# XXX FIXME

# experimental feature, per domain tranport/routing capability

# same config style as SYS_USER_ROUTING_LIST

# SYS_DOMAIN_ROUTING_LIST = lmtp:mx1.extmail.org,lmtp:mx2.extmail.org

 

# XXX FIXME

# experimental feature, per user routing capability

# please specify routing info, concatenate with “,” as multiple list

# members, eg: smtp:mx1.abc.com,smtp:mx2.abc.com

# SYS_USER_ROUTING_LIST = smtp:[192.168.2.130],smtp:[192.168.2.128]

 

# sys_min_uid, the minimal uid

SYS_MIN_UID = 500

 

# sys_min_gid, the minimal gid

SYS_MIN_GID = 100

 

# sys_default_uid, if not set, webman will ignore it

SYS_DEFAULT_UID = 1000

 

# sys_default_gid, if not set, webman will ignore it

SYS_DEFAULT_GID = 1000

 

# sys_quota_multiplier, in bytes, default to 1 MB

SYS_QUOTA_MULTIPLIER = 1048576

 

# sys_quota_type, valid type: vda|courier

SYS_QUOTA_TYPE = courier

 

# maxquota, alias, users and netdisk quota for domain

SYS_DEFAULT_MAXQUOTA =10000

SYS_DEFAULT_MAXALIAS = 10000

SYS_DEFAULT_MAXUSERS = 1000

SYS_DEFAULT_MAXNDQUOTA = 100

 

# per user default quota, netdisk quota and expire

SYS_USER_DEFAULT_QUOTA = 5

SYS_USER_DEFAULT_NDQUOTA = 5

SYS_USER_DEFAULT_EXPIRE = 1y

 

# sys_backend_type mysql|ldap

SYS_BACKEND_TYPE = mysql

 

# sys_crypt_type: crypt|cleartext|plain|md5|md5crypt|plain-md5|ldap-md5|sha|sha1

SYS_CRYPT_TYPE = md5crypt

 

# if mysql, all relate paramters should prefix as SYS_MYSQL

SYS_MYSQL_USER = webman

SYS_MYSQL_PASS = webman

SYS_MYSQL_DB = extmail

SYS_MYSQL_HOST = localhost

SYS_MYSQL_SOCKET = /tmp/mysql.sock

# table name

SYS_MYSQL_TABLE = manager

SYS_MYSQL_ATTR_USERNAME = username

SYS_MYSQL_ATTR_PASSWD = password

# comment it if you only want to save crypted password

# we highly recommend that you disable the following line :)

# SYS_MYSQL_ATTR_CLEARPW = clearpwd

 

# if ldap, all relate paramters should prefix as SYS_LDAP

SYS_LDAP_BASE = dc=extmail.org

SYS_LDAP_RDN = cn=Manager,dc=extmail.org

SYS_LDAP_PASS = secret

SYS_LDAP_HOST = localhost

# ldif attributes

SYS_LDAP_ATTR_USERNAME = mail

SYS_LDAP_ATTR_PASSWD = userPassword

# comment it if you only want to save crypted password

# we highly recommend that you disable the following line :)

# SYS_LDAP_ATTR_CLEARPW = clearPassword

 

# sys_rrd_datadir, the full path of rrd data

SYS_RRD_DATADIR = /var/lib

 

# sys_rrd_tmpdir, the temp dir for graph

SYS_RRD_TMPDIR = /tmp/viewlog

 

# sys_rrd_queue_on, yes|no, show queue or not

SYS_RRD_QUEUE_ON = yes

2、安装extmail

extmail官方网站:www.extmail.org 下载最新版式

 

tar zxvf extmail-23-20060219.tar.gz

%cp -r  extmail-0.23-20060219/ /usr/local/www/apache22/cgi-bin/extmail

创建配置文件

 

%cd /usr/local/www/apache22/cgi-bin/extmail/

%cp webmail.cf.default webmail.cf

修改配置文件,我只把需要修改的地方贴出来

 

# sys_config, the config file and webmail programe root

SYS_CONFIG = /usr/local/www/apache22/cgi-bin/extmail/

 

# sys_langdir, the i18n dir

SYS_LANGDIR = /usr/local/www/apache22/cgi-bin/extmail/lang

 

# sys_templdir, the template dir

SYS_TEMPLDIR = /usr/local/www/apache22/cgi-bin/extmail/html

# sys_netdisk_on, default is off

SYS_NETDISK_ON = 1

# maildir_base, the base dir of user maildir, use absolute path

# if not set.

SYS_MAILDIR_BASE = /home/data/domains

# if mysql, all relate paramters should prefix as SYS_MYSQL

SYS_MYSQL_USER = extmail  

SYS_MYSQL_PASS = extmail  

SYS_MYSQL_DB = extmail    

SYS_MYSQL_HOST = localhost

SYS_MYSQL_SOCKET = /tmp/mysql.sock 

打开你的浏览器,输入http://ip/extmail 即可看到登陆窗口

   

十三、安装EXTMAN

   

extmail 官方网站下载软件包,解压复制到/usr/local/www/apache22/cgi-bin目录。

 

%cd /usr/local/www/apache22/cgi-bin/extman/编辑 webman.cf

 

  more webmail.cf

# sys_config, the config file and webmail programe root

SYS_CONFIG = /usr/local/www/extmail/

 

# sys_langdir, the i18n dir

SYS_LANGDIR = /usr/local/www/extmail/lang

 

# sys_templdir, the template dir

SYS_TEMPLDIR = /usr/local/www/extmail/html

 

# sys_warn, show system warning or not, default to yes

SYS_SHOW_WARN = 0

 

# sys_permit_noquota, permit an account without qouta?

SYS_PERMIT_NOQUOTA = 1

 

# sys_sess_dir, the session dir

SYS_SESS_DIR = /var/tmp/extmail

 

# sys_log_on = 1 | 0 - enable logging or not

SYS_LOG_ON = 1

 

# sys_log_type = file|syslog|nsyslog, syslog will save login

# or error info into mail.*, nsyslog is a replacement to syslog

# that will send log message to network syslogd

SYS_LOG_TYPE = syslog

 

# sys_log_file - path to log file, if sys_log_type = file

SYS_LOG_FILE = /var/log/extmail.log

 

# sys_captcha_on 1|0 - to enable captcha feature or not

SYS_CAPTCHA_ON = 1

 

# sys_captcha_key

SYS_CAPTCHA_KEY = r3s9b6a7

 

# sys_captcha_len

SYS_CAPTCHA_LEN = 6

 

# sys_sess_timeout, session timeout, default 3 hours (3h) format:

# number+(s|m|h|d|M|y); or only number, the 0 means that the

# session will last for 0 seconds, but if you specify the

# sys_sess_cookie_only = 1 then it means the session will expire

# after you close your browser :)

SYS_SESS_TIMEOUT = 0

 

# sys_sess_cookie_only = 0|1 use cookie only or include cgi “sid”

# parameter ? if set to true(1), the session will be expired after

# sys_sess_timeout if there is no any active request from browser

SYS_SESS_COOKIE_ONLY = 1

 

# sys_user_psize, user default page_size

SYS_USER_PSIZE = 10

 

# sys_user_tsize, user mail subject truncate size, valid type:

# auto    => full text

# screen1 => 800×600

# screen2 => 1024×768

# screen3 => 1280×1024

SYS_USER_SCREEN = auto

 

# sys_user_lang, user default language

SYS_USER_LANG = zh_CN

 

# sys_user_template, user default template

SYS_USER_TEMPLATE = default

 

# sys_user_charset, user default charset

SYS_USER_CHARSET = utf-8

 

# sys_user_trylocal, user default outgoing encoding mechanism

SYS_USER_TRYLOCAL = 1

 

# sys_user_timezone, user default timezone

SYS_USER_TIMEZONE = +0800

 

# sys_user_* default parameters

SYS_USER_CCSENT = 1

SYS_USER_SHOW_HTML = 1

SYS_USER_COMPOSE_HTML = 1

SYS_USER_CONV_LINK =1

SYS_USER_ADDR2ABOOK = 1

 

# sys_message_size_limit, default message size limit per user

# count as byte(s), eg: 5242880 means 5MB

SYS_MESSAGE_SIZE_LIMIT = 5242880

 

# sys_min_pass_len, minimal password length, default 2

SYS_MIN_PASS_LEN = 2

 

# sys_mfilter_on, default is off

SYS_MFILTER_ON = 1

 

# sys_netdisk_on, default is off

SYS_NETDISK_ON = 1

 

# sys_show_signup, default is on, this feature need extman

# 0.2.2 or higher version, built with signup serivce

SYS_SHOW_SIGNUP = 1

 

# sys_debug_on, default is off

SYS_DEBUG_ON = 1

 

# sys auth type, mysql/ldap/authlib

SYS_AUTH_TYPE = mysql

 

# maildir_base, the base dir of user maildir, use absolute path

# if not set.

SYS_MAILDIR_BASE = /data/domains/

 

# sys_auth_schema, vpopmail1/vpopmail2/virtual

# vpopmail1 => all user accounts in one table

# vpopmail2 => accounts in per domain table

SYS_AUTH_SCHEMA = virtual

 

# crypt_type, the default encrypt type of password, possible type

# currently is crypt|cleartext|plain|md5|md5crypt|plain-md5|ldap-md5|sha|sha1

SYS_CRYPT_TYPE = md5crypt

 

# if mysql, all relate parameters should prefix as SYS_MYSQL

SYS_MYSQL_USER = extmail

SYS_MYSQL_PASS = extmail

SYS_MYSQL_DB = extmail

SYS_MYSQL_HOST = localhost

SYS_MYSQL_SOCKET = /tmp/mysql.sock

# table name

SYS_MYSQL_TABLE = mailbox

SYS_MYSQL_ATTR_USERNAME = username

SYS_MYSQL_ATTR_DOMAIN = domain

SYS_MYSQL_ATTR_PASSWD = password

# sys_mysql_attr_clearpw - attribute to save clear password, useful for

# postmaster withdraw the original passwd if the end user forgot, but

# we highly recommend that you don’t enable it for security reason

SYS_MYSQL_ATTR_CLEARPW = clearpwd

SYS_MYSQL_ATTR_QUOTA = quota

SYS_MYSQL_ATTR_NDQUOTA = netdiskquota

SYS_MYSQL_ATTR_HOME = homedir

SYS_MYSQL_ATTR_MAILDIR = maildir

# service enable/disable attributes

# comment them out if you don’t want their function

SYS_MYSQL_ATTR_DISABLEWEBMAIL = disablewebmail

SYS_MYSQL_ATTR_DISABLENETDISK = disablenetdisk

SYS_MYSQL_ATTR_DISABLEPWDCHANGE = disablepwdchange

SYS_MYSQL_ATTR_ACTIVE = active

 

# if ldap, all relate parameters should prefix as SYS_LDAP

SYS_LDAP_BASE = o=extmailAccount,dc=example.com

SYS_LDAP_RDN = cn=Manager,dc=example.com

SYS_LDAP_PASS = secret

SYS_LDAP_HOST = localhost

# ldif attributes

SYS_LDAP_ATTR_USERNAME = mail

SYS_LDAP_ATTR_DOMAIN = virtualDomain

SYS_LDAP_ATTR_PASSWD = userPassword

# sys_ldap_attr_clearpw - attribute to save clear password, useful for

# postmaster withdraw the original passwd if the end user forgot, but

# we highly recommend that you don’t enable it for security reason

SYS_LDAP_ATTR_CLEARPW = clearPassword

SYS_LDAP_ATTR_QUOTA = mailQuota

SYS_LDAP_ATTR_NDQUOTA = netdiskQuota

SYS_LDAP_ATTR_HOME = homeDirectory

SYS_LDAP_ATTR_MAILDIR = mailMessageStore

# service enable/disable attributes

# comment them out if you don’t want their function

SYS_LDAP_ATTR_DISABLEWEBMAIL = disablewebmail

SYS_LDAP_ATTR_DISABLENETDISK = disablenetdisk

SYS_LDAP_ATTR_DISABLEPWDCHANGE = disablePasswdChange

SYS_LDAP_ATTR_ACTIVE = active

 

# if authlib, all relate parameters should prefix as AUTHLIB

SYS_AUTHLIB_SOCKET = /var/spool/authdaemon/socket

 

# Global Abook support

# sys_g_abook_type, global abook type, valid is ldap|file, currently

# only support ldap, file module is under development :-)

SYS_G_ABOOK_TYPE = file

 

# if ldap, all relate parameters should prefix as SYS_G_ABOOK_LDAP

SYS_G_ABOOK_LDAP_HOST = localhost

SYS_G_ABOOK_LDAP_BASE = ou=AddressBook,dc=example.com

SYS_G_ABOOK_LDAP_ROOTDN = cn=Manager,dc=example.com

SYS_G_ABOOK_LDAP_ROOTPW = secret

SYS_G_ABOOK_LDAP_FILTER = objectClass=OfficePerson

 

# if file, all relate parameters should prefix as SYS_G_ABOOK_FILE

SYS_G_ABOOK_FILE_PATH = /var/www/extsuite/extmail/globabook.cf

SYS_G_ABOOK_FILE_LOCK = 1

SYS_G_ABOOK_FILE_CONVERT = 0

SYS_G_ABOOK_FILE_CHARSET = utf-8

创建/tmp/extman

 

%mkdir /tmp/extman

%chmod 777 /tmp/extman/

 

至此一个完整的邮件系统就安装完成了。

 



1 条评论

(Required)
(Required, will not be published)