欢迎光临
我们一直在努力

安装postfix+dovecot+spamassassin+clamav

安装完14.04ubuntu 后
(有#表示是命令,假设使用root权限)
(>>>>>>>>>>>>>和<<<<<<<<<<<<<<<<表示文件内容)

设置复制文件保留时间和权限:

~# echo "alias cp='cp -p'"

然后重新登录

设置安装软件日志保留

~# cp /etc/logrotate.d/apt /etc/logrotate.d/apt.rpmorig
~# vi /etc/logrotate.d/apt
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/var/log/apt/history.log {rotate 999monthlydateextcompressmissingoknotifempty}
/var/log/apt/history.log {
rotate 999
monthly
dateext
compress
missingok
notifempty
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

更新

~#apt-get update
~#apt-get dist-upgrade

安装Postfix

~#apt-get install postfix postfix-ldap mailutils

安装Postfix时,会问Postfix的使用模式,我们是”Internet Site”

1. Internet Site 2. mx0.nixonli.com

选择Internet Site是让邮件服务器可以在互联网上收发邮件,2是postfix里显示的域名

增加一个用户,专门管理邮箱存放目录的

~#/usr/sbin/useradd -s /bin/false mx
~#mkdir /home/mx
~#chown mx:mx /home/mx
~#chmod 750 /home/mx

安装dovecot

~# aptitude install dovecot-ldap dovecot-imapd dovecot-pop3d

检验是否安装dovecot成功

~# postconf -a

如果有dovecot就说明成功

~# postconf -m

如果有ldap就说明ldap安装成功

编辑/etc/postfix/main.cf
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#telnet 25进去后显示的欢迎词
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)

#不要在终端提醒有新邮件
biff = no

#取消邮箱地址连接字符串".nixonli.com"
append_dot_mydomain = no

#postfix的说明文档放在哪个目录,
readme_directory = no

#postfix smtp服务器用的RSA private key
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
#postfix smtp服务器用的RSA private key
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
#说明smtp服务器是否支持STARTTLS连接,但是不会要求客户端使用TLS连接
smtpd_use_tls=yes
#Name of the file containing the optional Postfix SMTP server TLS session cache,一般为btree和sdbm2种类型。
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

#本机名字
myhostname = mx0.nixonli.com

#别名数据库,默认是系统用户数据库
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

#从这台出去的邮件的域名,别人的邮件服务器会看到这封邮件是从哪里来的,默认是myhostname
myorigin = /etc/mailname

#机器名字
mydestination = mx0.nixonli.com, localhost.nixonli.com, , localhost

#默认是空的,好像说dns没有mx记录,就要在这里设置
relayhost =

# 在这个地址段的主机比其他的主机拥有更多权利,可以转发邮件
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

#邮箱的容量,如果是0就是无限制,默认是51200000byte,即大概50M
mailbox_size_limit = 0

#用户名和地址表达式的分割符号
recipient_delimiter = +

#刚装postfix的时候选择的连接类型,all表示接受来自所有网络的邮件,在这里可以设置ip地址段
inet_interfaces = all

#接收回来的邮件会放在一个独立的文件夹里,每个用户一个独立的文件夹,要安装mail-utils等包
home_mailbox = Maildir/

#postfix smtp服务器使用的sasl(简单身份验证和安全层)类型,默认是cyrus
smtpd_sasl_type = dovecot

#sasl的路径,要安装dovecot,并且在dovocot.conf里的client设置路径要一样
smtpd_sasl_path = private/auth

#启用smtp身份认证,默认是no
smtpd_sasl_auth_enable = yes
#permit_开头的是允许符合后面条件的ip通过这台postfix发邮件,譬如mynetworks地址段的ip可以发邮件,通过身份认证后的可以发,reject_是拒绝符合后面条件的ip发邮件,譬如没有经过验证的目的地(mail to)
smtpd_recipient_restrictions =
permit_mynetworks, #允许在安全网络下发过来的邮件
permit_sasl_authenticated, #允许通过认证的邮件
reject_unauth_destination, #拒绝不是我是目的地,又没有认证的邮件
check_client_access hash:/etc/postfix/rbl_override, #自己设置手动的黑名单
reject_rbl_client bl.spamcop.net, #拒绝网络黑名单的邮件
reject_rbl_client zen.spamhaus.org #拒绝网络黑名单的邮件

#声明postfix可以使用不规范的认证方法,具体怎么不规范,还没搞清除(outlook发的邮件不规范)
broken_sasl_auth_clients = yes

#虚拟用户的邮件存放的根目录
virtual_mailbox_base = /home/mx

#虚拟用户邮箱的域名,因为我测试的时候只测试这2个域名的邮箱,所以我在这里加,如果多的话,可以搜索出来,符合这些域名的才转发和接收
virtual_mailbox_domains = nixonli.com

#检查用户,并且返回邮箱存放目录
virtual_mailbox_maps = ldap:/etc/postfix/ldap-users.cf

#虚拟邮箱的别名(转发)设置文件定义
virtual_alias_maps = hash:/etc/postfix/aliases/nixonli.com

#虚拟邮箱的大小限制,0是没有限制
virtual_mailbox_limit = 0

#邮件的运输工具,这个名字好像可以随便取,但是要和master.cf里的一致,在这里master.cf要添加dovecot的运输方式
virtual_transport = dovecot

#当有邮件来,内有多个我们的邮箱地址,要分开一个一个地址地交给dovecot处理
dovecot_destination_recipient_limit = 1

#能够把邮件存放到邮件目录的合法用户的uid,即是刚才添加的mx用户的uid,要根据添加用户时的id
virtual_uid_maps = static:1001

#能够把邮件存放到邮件目录的合法用户的uid,即是刚才添加的mx用户组id
virtual_gid_maps = static:1001

#交给杀毒检查内容
content_filter = scan:127.0.0.1:10026

#交给杀毒处理前,要(或不要)做什么事情,这里要求不要更改邮箱地址
recieve_override_options = no_address_mappings

#收发邮件的大小限制,150MB其实是100MB,因为邮件的编码方式会把附件增加50%的容量
message_size_limit = 150000000

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

添加搜索用户的ldap文件,
~# vi /etc/postfix/ldap-users.cf
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

server_host = 127.0.0.1
search_base = dc=nixonli,dc=com
version = 3
query_filter = (mail=%s)
bind = yes
bind_dn = cn=admin,dc=nixonli,dc=com
bind_pw = computer
result_attribute = sn
result_format = %s/Maildir/

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

打开浏览器,登录ldap,譬如我的是http://192.168.31.27/phpldapadmin,然后输入密码进去,譬如,添加一个entry,类型是 Kolab: User Entry,Last name: test,mail:test@nixonli.com,密码:*****
然后在终端查询结果是否正确

~# postmap -q test@nixonli.com ldap:/etc/postfix/ldap-users.cf

如果输出结果 test/Maildir/ 说明查找成功

修改/etc/postfix/master.cf,声明传送方式,这里用的是dovecot,所以要用dovecot的deliver

~# vi /etc/postfix/master.cf

在最后处添加一句:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

dovecot unix - n n - - pipe
flags=DORhu user=mx:mx argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

到这里postfix的配置就结束,接下来是dovecot的

~#vi /etc/dovecot/dovecot.conf

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#监听所有的ip,接受所有ip的imap和pop3请求

listen = *, ::

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

~#vi /etc/dovecot/conf.d/10-auth.conf

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#取消登录命令和其他明文认证,除非用了SSL/TLS连接,
disable_plaintext_auth = no

#跟之前disable_plaintext_auth有关,允许明文登录,但是应该是要有SSL/TLS加密保护
mechanisms = plain login

#启用LDAP认证
#!include auth-system.conf.ext
!include auth-ldap.conf.ext

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

~#vi /etc/dovecot/conf.d/10-logging.conf

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#日志的时间格式
log_timestamp = "%Y-%m-%d %H:%M:%S "

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

~#vi /etc/dovecot/conf.d/10-ssl.conf

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#ssl连接所使用的认证文件
ssl_cert = </etc/ssl/certs/nixonli.com.pem
ssl_key = </etc/ssl/private/nixonli.com.key

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

~#vi /etc/dovecot/conf.d/10-mail.conf

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#邮件存放的地址,这个配置很重要,我的是/home/mx/域名/用户/Maildir
mail_location = maildir:/home/mx/%Ld/%Ln/Maildir

#用什么组能写到/var/mail去
mail_privileged_group = mail
mail_plugins = quota

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

~#vi /etc/dovecot/conf.d/15-lda.conf

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

protocol lda {
mail_plugins = $mail_plugins
#当发送被拒绝的时候,改用postmaster@nixonli.com这个邮件地址发送
postmaster_address = postmaster@nixonli.com

#hostname用在发送邮件所需要的变量,譬如Message-Id,保持默认
hostname = mx0.nixonli.com

#用户认证的主认证路径
auth_socket_path = /var/run/dovecot/auth-userdb
}

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

~#vi /etc/dovecot/conf.d/20-imap.conf

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

protocol imap {
mail_plugins = $mail_plugins imap_quota
mail_max_userip_connections = 20
}

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

~#vi /etc/dovecot/conf.d/20-pop3.conf

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

protocol pop3 {
mail_plugins = $mail_plugins
}

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

~#vi /etc/dovecot/conf.d/90-quota.conf

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

plugin {
#quota_rule = *:storage=1G
#quota_rule2 = Trash:storage=+100M

# LDA/LMTP allows saving the last mail to bring user from under quota to
# over quota, if the quota doesn't grow too high. Default is to allow as
# long as quota will stay under 10% above the limit. Also allowed e.g. 10M.
#quota_grace = 10%%
quota = maildir:User quota
quota_rule = *:storage=3M
}

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

~#vi /etc/dovecot/conf.d/auth-ldap.conf.ext

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

passdb {
args = /etc/dovecot/dovecot-ldap.conf.ext
}

userdb {

args = /etc/dovecot/dovecot-ldap.conf.ext
#设置邮件存放位置
default_fields = home=/home/mx/%Ld/%Ln
}

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

~#vi /etc/dovecot/conf.d/10-master.conf

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

service auth {

# Postfix smtp-auth 后面添加
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
}

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

配置/etc/dovecot/dovecot-ldap.conf.ext
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

# ldap服务器ip
hosts = 127.0.0.1

# ldap管理员用户名,应该是一个只有读权限的用户,不应该是管理员
dn = cn=admin,dc=nixonli,dc=com

#ldap管理员密码
dnpass = computer

#bind验证
auth_bind = yes

# bind验证用户
auth_bind_userdn = cn=%n,dc=nixonli,dc=com

# ldap版本
ldap_version = 3

#ldap查询的根目录
base = dc=nixonli,dc=com

deref = never
#

#搜索范围所有子目录
scope = subtree

#根据你创建的type不同,条件也不同,
user_filter = (&(objectClass=inetOrgPerson)(cn=%Ln)(mail=%Lu))

#搜索出来的属性,cn和密码
pass_attrs = cn=%Ln,userPassword=password

#条件
pass_filter = (&(objectClass=inetOrgPerson)(cn=%Ln))

default_pass_scheme = CRYPT

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

重启postfix和dovecot
~# /etc/init.d/postfix restart
~# /etc/init.d/dovecot restart

因为之前使用的都是系统自动创建的测试证书,所以我们要自己创建自己的证书

~# openssl req -new -x509 -days 3650 -nodes -out /etc/ssl/certs/nixnli.com.pem -keyout /etc/ssl/private/nixonli.com.key

然后根据提示输入内容,”:”右边为我输入的内容,关键是Common Name里要填入在dns里的名字,如mail.nixonli.com
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

-----
Country Name (2 letter code) [AU]:CN
State or Province Name (full name) [Some-State]:GuangDong
Locality Name (eg, city) []:dongguan
Organization Name (eg, company) [Internet Widgits Pty Ltd]:nixonli
Organizational Unit Name (eg, section) []:it
Common Name (eg, YOUR name) []:mail.nixonli.com
Email Address []:nixon@nixonli.com

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

~# /etc/init.d/dovecot restart

使用ClamAV进行病毒过滤
安装ClamAV

~# apt-get install clamav-daemon clamav clamsmtp

正常是会提示以下信息
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>..

* Clamav signatures not found in /var/lib/clamav
* Please retrieve them using freshclam or install the clamav-data package
* Then run '/etc/init.d/clamav-daemon start'

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
以上是提示更新病毒库信息
跟新病毒库信息

~# freshclam
~# /etc/init.d/clamav-daemon start
配置postfix使用clamsmtp
~# vi /etc/postfix/main.cf

在结尾添加以下代码
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.

content_filter = scan:127.0.0.1:10026
receive_override_options = no_address_mappings

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

~#vi /etc/postfix/master.cf

在最后添加以下内容
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>..

# AV scan filter (used by content_filter)
scan unix - - n - 16 smtp
-o smtp_send_xforward_command=yes
# For injecting mail back into postfix from the filter
127.0.0.1:10025 inet n - n - 16 smtpd
-o content_filter=
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks_style=host
-o smtpd_authorized_xforward_hosts=127.0.0.0/8

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
以上是添加扫描服务在10026端口上,执行以上任务的用户和执行clamd的用户要互相访问临时文件(官网是这样讲的)所以要使他们在同一个用户下执行,所以要执行以下命令

# adduser clamsmtp clamav
重启postfix,ClamSMTP,ClamAV
~# /etc/init.d/postfix restart
~# /etc/init.d/clamsmtp restart
~# /etc/init.d/clamav-daemon restart
测试能否扫描病毒,我在没有装clamav的时候,邮件服务器以下这个文件是可以接收的
~# wget http://eicar.org/download/eicar_com.zip

发送一封邮件给test@nixonli.com,附件为刚刚下回来的文件
检查日志

~# tail -f /var/log/mail.log

出现以下日志
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Jun 13 00:06:43 ubuntu postfix/cleanup[4871]: 87114406FA: message-id=
Jun 13 00:06:43 ubuntu postfix/qmgr[4124]: 87114406FA: from=, size=1236, nrcpt=1 (queue active)
Jun 13 00:06:43 ubuntu postfix/smtpd[4864]: disconnect from unknown[192.168.31.93]
Jun 13 00:06:43 ubuntu clamsmtpd: 100000: accepted connection from: 127.0.0.1
Jun 13 00:06:43 ubuntu postfix/smtpd[4874]: connect from localhost[127.0.0.1]
Jun 13 00:06:43 ubuntu postfix/smtpd[4874]: A585C4070D: client=unknown[192.168.31.93]
Jun 13 00:06:43 ubuntu postfix/smtp[4872]: 87114406FA: to=, relay=127.0.0.1[127.0.0.1]:10026, delay=0.19, delays=0.07/0.05/0.07/0.01, dsn=2.0.0, status=sent (250 Virus Detected; Discarded Email)
Jun 13 00:06:43 ubuntu postfix/qmgr[4124]: 87114406FA: removed
Jun 13 00:06:43 ubuntu clamsmtpd: 100000: from=test@nixonli.com, to=test@nixonli.com, status=VIRUS:Eicar-Test-Signature
Jun 13 00:06:43 ubuntu postfix/smtpd[4874]: disconnect from localhost[127.0.0.1]

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
检出出病毒,测试成功

安装和配置spamassassin

~# apt-get install spamassassin spamc

启用spamassasin

~# vi /etc/default/spamassassin

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#启用spamassasin
ENABLED=1

#每天更新spamassassin的数据库
CRON=1

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

设置postfix使用spamassassin检查邮件

~# vi /etc/postfix/master.cf

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

smtp inet n - - - - smtpd
-o content_filter=spamassassin
spamassassin unix - n n - - pipe
user=debian-spamd argv=/usr/bin/spamc -f -e
/usr/sbin/sendmail -oi -f ${sender} ${recipient}

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

设置spamassassin过滤条件

~# vi /etc/spamassassin/local.cf

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#如果怀疑是垃圾邮件,在邮件的标题前添加警告。(中文的警告可能显示有问题,要测试才知道;另外修改配置文件可能写不了中文,要先把文件拿到其他电脑,修改好在上传回去)

rewrite_header Subject *****垃圾邮件警告*****

#不要修改邮件的内容
report_safe 0

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

磁盘配额,使用dovecot自带的quota插件,不用vda补丁

~# vi /etc/dovecot/dovecot.conf

找到imap,pop3,lda三个段落,分别修改其中的plugin设置,见下面
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

protocol imap {
mail_plugins = quota imap_quota
mail_plugin_dir = /usr/lib/dovecot/modules/imap
}

protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
# %u是mail的IMAP的uid,%v是mailbox的IMAP的uid,dovecot v0.99后用的是%08Xu%08Xv
mail_plugins = quota
mail_plugin_dir = /usr/lib/dovecot/modules/pop3
}
protocol lda {

postmaster_address = postmaster@nixonli.com
#当发送被拒绝的时候,改用postmaster@nixonli.com这个邮件地址发送

hostname = mail1.nixonli.com
#hostname用在发送邮件所需要的变量,譬如Message-Id,保持默认

auth_socket_path = /var/run/dovecot/auth-master
#用户认证的主认证路径
mail_plugins = quota
mail_plugin_dir = /usr/lib/dovecot/modules/lda
}

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

配置quota

~# vi /etc/dovecot/conf.d/10-mail.conf

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

mail_plugins = quota

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

因为ldap的schema没有quota字段,所以我用了pager作为quota字段,用phpldapadmin进去添加一个属性pager.

~# vi /etc/dovecot/conf.d/90-quota.conf

然后找到plugin {}这一段,在里面添加一行 quota = maildir

修改/etc/dovecot/dovecot-ldap.conf.ext文件,增加这一句

user_attrs = pager=quota_rule=*:storage=%$,=uid=1001,=gid=1001,=home=/home/mx/%Ld/%Ln
~# vi /etc/dovecot/dovecot-ldap.conf.ext

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

user_attrs = roomNumber=quota_rule=*:storage=%$,=uid=1001,=gid=1001,=home=/home/mx/%Ld/%Ln

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

#重启dovecot
~# /etc/init.d/dovecot restart

打开thunderbird
建立已mail account,在收件箱里右击-属性-Quota,看是否出现quota使用情况,如果出现Usage number of number kb used,并且跟你设置的数值一样,说明成功。

窗外天空
关注公众号『窗外天空』

获取更多建站运营运维新知!
互联网创业、前沿技术......

赞(0) 打赏
文章名称:《安装postfix+dovecot+spamassassin+clamav》
文章链接:https://www.nixonli.com/22909.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏