Webmail安装配置

可供postfix选择的webmail不是很丰富,通过比较,我选择extmail作为postfix的webmail客户端工具,本来extmail也包括像postfixadmin这样的web管理工具extman),因为前面我们已经用了postfixadmin, 这里我只用extmail。

下载ExtMail-Solution-Linux-0.1.tar.gz后解压,然后把它移动到目录/var/www/extsuite/extmail。在apache的配置文件httpd.conf末尾追加下面的内容以便用户可以通过web方式访问extmail:

DirectoryIndex  index.html index.php  index.cgi

ScriptAlias /extmail/cgi/   /mail/www/extsuite/extmail/cgi/

    AllowOverride None

    Options None

    Order allow,deny

    Allow from all

 

Alias /extmail /mail/www/extsuite/extmail/html

     Options Indexes FollowSymLinks

     AllowOverride None

     Order allow,deny

     Allow from all

保存文件,重启apache服务即可在浏览器输入邮件服务器的url访问了。

图 8

如果少了相应的perl模块,web页面会给出提示,按照提示把perl模块安装上去就正常了。到这里,extmail的配置还没有完呢,至少还有2个文件需要修改,这2个文件是webmail.cf和/var/www/extsuite/extmail/html/default/index.html.前一个是extmail的配置文件,后一个是页面文件显示方式。

webmail.cf的内容:更改过的内容用斜体红色字体显示

[root@mailserv2 extmail]# more webmail.cf

# sys_config, the config file and webmail programe root

SYS_CONFIG = /var/www/extsuite/extmail/

 

# sys_langdir, the i18n dir

SYS_LANGDIR = /var/www/extsuite/extmail/lang

 

# sys_templdir, the template dir

SYS_TEMPLDIR = /var/www/extsuite/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 = /tmp/

 

# 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_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 => 800x600

# screen2 => 1024x768

# screen3 => 1280x1024

SYS_USER_SCREEN = auto

 

# sys_user_lang, user default language

SYS_USER_LANG = en_US

 

# 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 = 0

SYS_USER_SHOW_HTML = 1

SYS_USER_COMPOSE_HTML = 1

SYS_USER_CONV_LINK =1

SYS_USER_ADDR2ABOOK = 1

 

# 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 = 0

 

# sys_debug_on, default is off

SYS_DEBUG_ON = 0

 

# 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 = /var/mailbox

 

# 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 = postfix

SYS_MYSQL_PASS = postfix

SYS_MYSQL_DB = postfix

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_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_ACTIVE = active

 

# if authlib, all relate parameters should prefix as AUTHLIB

SYS_AUTHLIB_SOCKET = /usr/local/authlib/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 = /mail/www/extsuite/extmail/globabook.cf

SYS_G_ABOOK_FILE_LOCK = 1

SYS_G_ABOOK_FILE_CONVERT = 0

SYS_G_ABOOK_FILE_CHARSET = utf-8

在文件/var/www/extsuite/extmail/html/default/index.html 加入下面的标识,可以得到不

 

<%domain%>

邮件域的下拉列表,从而方便用户的使用。

图 9

到这里,postfix的安装配置算是完成了。我们来逐个检查这些服务的正确性,简单的方法就是启动每一个服务,根据服务的运行来掌握各个服务是否正常。为了方便所有服务随开机自动启动,我把它们都加在了文件/etc/rc.local里,这些内容包括:

################ normal services ############################

/usr/local/apache/bin/apachectl start

/usr/local/mysql/bin/mysqld_safe --user=mysql&

/usr/local/authlib/sbin/authdaemond start

 

############## postfix relatively ###########################

postfix start

/usr/local/imap/sbin/imapd start

 

################ antivirus and antispam #####################

/usr/bin/spamd --daemonize --pidfile /var/run/spamd.pid

/usr/local/sbin/amavisd start

/usr/local/clamav/sbin/clamd

病毒库和垃圾邮件的列表则放在crontab里:

[root@mailserv2 extmail]# crontab -l

0 0 1 * * root wget -N -P /usr/share/spamassassin www.ccert.edu.cn/spam/sa/Chinese_rules.cf;kill -HUP `cat /var/run/spamd.pid`

00 00 * * * /usr/local/clamav/bin/freshclam

待所有的服务都正常后,用postfixadmin创建邮件域和用户。创建完毕,通过查看postfix日志/var/log/maillog了解操作是否成功;同时通过查看目录/var/mailbox里是否生成与创建的邮件帐户同名的目录。


相关内容