华为全闪存阵列 IBM云计算 Acronis 安克诺斯 安腾普 腾保数据
首页 > 技术园地 > Postfix > 正文

Ubuntu 10.04 TLS系统中安装配置postfix邮件服务器

2014-08-18 10:18来源:中国存储网
导读:采用Ubuntu 10.04 TLS i386 系统,安装时选择中文并安装 openssh-server(便于远程操作),设置好机器名以及网络环境,确保可以连接 internet 。

一、系统安装

采用Ubuntu 10.04 TLS i386 系统,安装时选择中文并安装 openssh-server(便于远程操作)

设置好机器名以及网络环境,确保可以连接 internet 。

二、基本软件安装 (出现提示,按默认配置)

sudo aptitude install  mysql-server phpmyadmin postfix-mysql lrzsz courier-authlib-mysql courier-pop libsasl2-modules-sql maildrop apache2-suexec-custom libunix-syslog-perl 

rsync mailgraph ntpdate

三、配置 Extmail(用户webmail系统) + Extman(管理员后台系统)

#------------------------------------------------------------------------------------

1、使用 rz 命令上传已经下载好的最新的 Extmail 和 Extman 软件包

extmail-1.2.tar.gz 

extman-1.1.tar.gz

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

2、解压缩至当前目录

sudo tar -zxvf extman-1.1.tar.gz

sudo tar -zxvf extmail-1.2.tar.gz

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

3、将解压文件复制到 /var/www/ 目录下

sudo cp -R extmail-1.2 /var/www/extmail

sudo cp -R extman-1.1 /var/www/extman

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

4、添加相关目录和用户,并配置权限

sudo groupadd -g 1001 vgroup

sudo useradd -g 1001 -u 1001 -s /bin/false -d /home/domains vuser

sudo mkdir /home/domains/

sudo chown -R 1001:1001 /home/domains

sudo chown -R 1001:1001 /var/www/extmail/cgi/

sudo chown -R 1001:1001 /var/www/extman/cgi/

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

5、设置 Extmail & Extman 配置文件

#----------------------------------------------------------------------------------

修改Extman配置文件如下

sudo vim /var/www/extman/webman.cf

# sys_config, the config file and webman programe root

SYS_CONFIG = /var/www/extman/

# sys_langdir, the i18n dir

SYS_LANGDIR = /var/www/extman/lang

# sys_templdir, the template dir

SYS_TEMPLDIR = /var/www/extman/html

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

# if not set.

SYS_MAILDIR_BASE = /home/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/

# 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_purge_data - to completely destroy user's mailbox or not?

SYS_PURGE_DATA = 0

# sys_sess_timeout, session timeout in seccond, default 6 hours

# SYS_SESS_TIMEOUT = 21600

# sys_user_psize, user default page_size

SYS_PSIZE = 20

# sys_user_lang, user default language

# SYS_LANG = en_US

# sys_app_type, the app type: WebMail or ExtMan? It must be the same

# as prefix part of language package name, eg: WebMail::en_US

SYS_APP_TYPE = ExtMan

# 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: 2x1 => length =2, depth =1

# depend on sys_isp_mode = yes

SYS_DOMAIN_HASHDIR_DEPTH = 2x2

# 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 = 2x2

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

# sys_default_gid, if not set, webman will ignore it

SYS_DEFAULT_GID = 1001

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

SYS_DEFAULT_MAXALIAS = 100

SYS_DEFAULT_MAXUSERS = 100

SYS_DEFAULT_MAXNDQUOTA = 500

# 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 = /var/run/mysqld/mysqld.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

# sys_cmdserver_sock

SYS_CMDSERVER_SOCK = /tmp/cmdserver.sock

# sys_cmdserver_maxconn

SYS_CMDSERVER_MAXCONN = 5

# sys_cmdserver_pid

SYS_CMDSERVER_PID = /var/run/cmdserver.pid

# sys_cmdserver_log

SYS_CMDSERVER_LOG = /var/log/cmdserver.log

# sys_cmdserver_authcode

SYS_CMDSERVER_AUTHCODE = your_auth_code_here

# sys_disable_server_list

SYS_IGNORE_SERVER_LIST = web

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

修改Extmail配置文件如下

sudo vim /var/www/extmail/webmail.cf

# sys_config, the config file and webmail programe root

SYS_CONFIG = /var/www/extmail/

# sys_langdir, the i18n dir

SYS_LANGDIR = /var/www/extmail/lang

# sys_templdir, the template dir

SYS_TEMPLDIR = /var/www/extmail/html

# sys_http_cache, a switch to enable or disable http cache via http header

SYS_HTTP_CACHE = 0

# sys_smtp_host

SYS_SMTP_HOST = 127.0.0.1

# sys_smtp_port

SYS_SMTP_PORT = 25

# sys_smtp_timeout

SYS_SMTP_TIMEOUT = 5

# sys_spam_report_on = 1 | 0 - enable spam reporting or not

SYS_SPAM_REPORT_ON = 0

# sys_spam_report_type = dspam | spamassassin - spam reporting type

SYS_SPAM_REPORT_TYPE = dspam

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

SYS_SHOW_WARN = 0

# sys_ip_security_on = 1 | 0 - enable login ip security or not

SYS_IP_SECURITY_ON = 1

# sys_permit_noquota, permit an account without qouta?

SYS_PERMIT_NOQUOTA = 1

# sys_sess_dir, the session dir

SYS_SESS_DIR = /tmp

# sys_upload_tmpdir, the temp directory for file uploading

SYS_UPLOAD_TMPDIR = /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

"/var/www/extmail/webmail.cf" 214L, 6783C

# 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_app_type, the app type: WebMail or ExtMan? It must be the same

# as prefix part of language package name, eg: WebMail::en_US

SYS_APP_TYPE = WebMail

# 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, 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 = /home/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 = /var/run/mysqld/mysqld.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

# password retrieve attributes

# comment them out if you don't want such function

SYS_MYSQL_ATTR_PWD_QUESTION = question

SYS_MYSQL_ATTR_PWD_ANSWER = answer

SYS_MYSQL_ATTR_PWD_ANSWER = answer

# 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

# password retrieve attributes

# comment them out if you don't want such function

SYS_LDAP_ATTR_PWD_QUESTION = question

SYS_LDAP_ATTR_PWD_ANSWER = answer

# 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

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

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

修改extmail.sql 文件

sudo vim /var/www/extman/docs/extmail.sql

将1000给为1001,如下

uidnumber int(6) NOT NULL default '1001',

gidnumber int(6) NOT NULL default '1001',

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

导入Extmail数据库 (*******为mysql数据root密码)

sudo mysql -uroot -p******* < /var/www/extman/docs/extmail.sql

sudo mysql -uroot -p******* < /var/www/extman/docs/init.sql

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

配置apache 

cd /etc/apache2/mods-enabled/

sudo ln -s ../mods-available/suexec.load ./suexec.load

cd /etc/apache2/sites-enabled/

sudo rm -rf /etc/apache2/sites-enabled/000-default 

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

创建extmail虚拟服务器文件,内容如下

sudo vim /etc/apache2/sites-enabled/extmail

<VirtualHost *:80>

ServerName mail.goldenempire.asia

DocumentRoot /var/www/extmail/html/

ScriptAlias /extmail/cgi/       /var/www/extmail/cgi/

Alias /extmail                  /var/www/extmail/html/

ScriptAlias /extman/cgi/        /var/www/extman/cgi/

Alias /extman                   /var/www/extman/html/

# Suexec config

SuexecUserGroup vuser vgroup

</VirtualHost>

#----------------------------------------------------------------------------------

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

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

四、配置postfix & courier 与 extmail & mysql 连接

#----------------------------------------------------------------------------------

使用mysql作为postfix的后台数据库

cd /var/www/extman/docs/

sudo cp mysql_virtual_*.cf /etc/postfix/

sysudo chmod o= /etc/postfix/mysql_virtual_*.cf 

sudo chgrp postfix /etc/postfix/mysql_virtual_*.cf

cd /etc/postfix/

sudo find ./ -name 'mysql_virtual_*' -exec sed --in-place 's/localhost/127.0.0.1/g' {} \;

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

修改 main.cf 文件

sudo cp /etc/postfix/main.cf /etc/postfix/main.cf.bak

sudo vim /etc/postfix/main.cf 

# See /usr/share/postfix/main.cf.dist for a commented, more complete version

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)

biff = no

# appending .domain is the MUA's job.

append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings

#delay_warning_time = 4h

#本机机器名

myhostname = mail.goldenempire.asia

#本机域名

mydomain = goldenempire.asia

myorigin = $mydomain

alias_maps = hash:/etc/aliases

alias_database = hash:/etc/aliases

#收信域名,一定要有$mydomain不然不能使用user@example.com收信

mydestination =

relayhost =

#信任的,无须SMTP认证的地址范围

mynetworks = 127.0.0.0/8

mailbox_size_limit = 0

recipient_delimiter = +

inet_interfaces = all

#邮件的存储方式,一定要有此设置

home_mailbox = Maildir

append_dot_mydomain = no

append_at_myorigin = no

smtpd_helo_required = yes

ignore_mx_lookup_error = yes

message_size_limit = 31457280

#本地邮件的投递方式,也可以使用maildrop

local_transport = maildrop

#虚拟用户的投递方式,也可以使用maildrop

virtual_transport = maildrop

maildrop_destination_recipient_limit = 1

virtual_alias_domains =

virtual_alias_maps =

    proxy:mysql:/etc/postfix/mysql_virtual_sender_maps.cf,

    proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf

virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql_virtual_domains_maps.cf

virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf

#邮件存储的根目录

virtual_mailbox_base = /home/domains

#虚拟用户的ID,(数值参考实际系统的postfix用户的ID值)

virtual_uid_maps = static:105

virtual_gid_maps = static:114

proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps 

$relay_domains $canonical_maps $sender_canonical_maps $smtpd_sender_login_maps $recipient_canonical_maps $relocated_maps transport_maps $mynetworks

#smtpd auth config

smtpd_sasl_security_options = noanonymous

smtpd_sasl_auth_enable = yes

broken_sasl_auth_clients = yes

#不投递本地系统帐号邮件

local_recipient_maps = $alias_maps $virtual_mailbox_maps

smtpd_sender_login_maps =

    proxy:mysql:/etc/postfix/mysql_virtual_sender_maps.cf,

    proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf

smtpd_reject_unlisted_sender = yes

smtpd_recipient_restrictions =

    permit_mynetworks,

    reject_sender_login_mismatch,

    permit_sasl_authenticated,

    reject_unknown_sender_domain,

    reject_non_fqdn_hostname,

    reject_non_fqdn_sender,

    reject_non_fqdn_recipient,

    reject_unknown_recipient_domain,

    reject_unauth_destination,

    reject_unauth_pipelining,

    reject_invalid_hostname,

    check_recipient_maps

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

修改master.cf 文件

sudo vim /etc/postfix/master.cf

smtp      inet  n       -       -       -       -       smtpd

改为

smtp      inet  n       -       n       -       -       smtpd

.和

maildrop  unix  -       n       n       -       -       pipe

  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}

改为

maildrop  unix  -       n       n       -       -       pipe

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

#----------------------------------------------------------------------------------

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

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

#----------------------------------------------------------------------------------

配置courier

sudo cp /etc/courier/authdaemonrc /etc/courier/authdaemonrc.bak

sudo vim /etc/courier/authdaemonrc

authmodulelist="authpam"

改为

authmodulelist="authmysql"

sudo cp /etc/courier/authmysqlrc /etc/courier/authmysqlrc.bak

sudo vim /etc/courier/authmysqlrc

MYSQL_SERVER            127.0.0.1

MYSQL_USERNAME          extmail

MYSQL_PASSWORD          extmail

MYSQL_PORT              3306

MYSQL_OPT               0

MYSQL_DATABASE          extmail

MYSQL_USER_TABLE        mailbox

MYSQL_CRYPT_PWFIELD     password

DEFAULT_DOMAIN          domain

MYSQL_UID_FIELD         uidnumber

MYSQL_GID_FIELD         gidnumber

MYSQL_LOGIN_FIELD       username

MYSQL_HOME_FIELD        homedir

MYSQL_NAME_FIELD        name

MYSQL_MAILDIR_FIELD     maildir

MYSQL_QUOTA_FIELD       quota

MYSQL_SELECT_CLAUSE     SELECT username,password,domain,                \

                        uidnumber,gidnumber,          \

                        CONCAT('/home/domains/',homedir),          \

                        CONCAT('/home/domains/',maildir),          \

                        quota,                        \

                        name                          \

                        FROM mailbox                  \

                        WHERE username = '$(local_part)@$(domain)'      \

                        AND active = 1

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

创建/etc/postfix/sasl/smtpd.conf 加入下面的内容 

sudo vim /etc/postfix/sasl/smtpd.conf

pwcheck_method:authdaemond

log_level:0

mech_list:PLAIN LOGIN

allow_plaintext: true

authdaemond_path:/var/run/courier/authdaemon/socket

#----------------------------------------------------------------------------------

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

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

#----------------------------------------------------------------------------------

图形日志配置

sudo cp -R /var/www/extman/addon/mailgraph_ext /usr/local/mailgraph_ext

修改mailgraph-init

sudo vim /usr/local/mailgraph_ext/mailgraph-init

MAIL_LOG=/var/log/maillog

改成

MAIL_LOG=/var/log/mail.log

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

重启相关服务

sudo /etc/init.d/postfix restart

sudo /etc/init.d/courier-authdaemon restart

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

添加自动执行计划

sudo crontab -e

30 4 * * * /var/www/extman/tools/reportusage.pl -all /home/domains postmaster@goldenempire.asia

35 1 * * * ntpdate-debian

#----------------------------------------------------------------------------------

#----------------------------------------------------------------------------------

添加开机自启动项

sudo vim /etc/rc.local

/usr/local/mailgraph_ext/mailgraph-init start

/var/www/extman/daemon/cmdserver -v -d

/usr/bin/rsync --daemon

chmod -R +x /var/run/courier/authdaemon

/etc/init.d/courier-authdaemon restart

#----------------------------------------------------------------------------------

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

继续阅读
相关阅读
  • SUSE 11 sp1 安装Postfix后配置

    该篇介绍SUSE 11 sp1 安装Postfix后配置,SUSE11sp1安装好Postfix后,可以参考如下配置文件(去掉注释内容):

  • CentOS Postfix extmail avamisd slock clamv完整服务器安装说明

    Centos postfix extmail avamisd slock clamv全套安装说明目录:一、 postfix安装二、 配置courier-authlib三、 安装maildrop四、 安装apache mysql php五、 配置webmail-

  • Postfix的安装配置

    postfix对使用资源的控制通过特定的postfix配置参数,我们可以实现postfix...由于这段代码使用了mysql客户端库,所以我们必须安装mysql的开包。一、postfix 安装配置Postfi

  • Postfix邮件服务器安装配置全解

    对配置者的要求:1. 对Llinux有基本的认识2. 会一些基本的操作3. 如vi。4. 对mail的一些基本原理要有个基本认识5. 如知道什么是MTA6. 知道 DNS和mail的关系。7. 对MYSQL有

产品推荐
头条阅读
栏目热点

Copyright @ 2006-2018 ChinaStor.COM 版权所有 京ICP备14047533号

中国存储网

存储第一站,存储门户,存储在线交流平台