postfix 只允许指定的用户给特定的别名发送邮件 推荐
2010-10-12 17:31
357 查看
公司需求:只有公司高层才可以向全体员工发送邮件,除此之外,均无权向全体员工发送邮件。
公司高层邮箱:
wanglujing@ourgame.com
renlina@ourgame.com
caiyanyan@ourgame.com
qinwen@ourgame.com
shiwanting@ourgame.com
全体员工邮箱:qtyg@ourgame.com
postfix相关概念如下,具体的请参考《postfix权威指南》,在第十一章 反垃圾邮件 中讲的很清楚,下面引用了其部分参数:
Smtmpd_restriction_classes
自定义规范等级的名称,列出管理员自定义的所有规范等级,每一组规范等级,都是由一系列UBE限制条件组成。
Check_client_access 客户端
Check_sender_access 发件人
Check_recipient_access 收件人
Check_recipient_access maptype:mapname
Check_recipient_access 指向一个含有邮件地址、网域名称、人名的访问表,用于对比客户端在RCPT TO命令中提供的收件地址,如果发现相符的索引键,则postfix执行相对应的值所提定的动作。
Check_sender_access maptype:mapname
Check_sender_access 指向一个含有邮件地址,网域名称,人名的访问表,用于对比客户端在MAIL FROM命令中提供的寄件人邮件地址,如果发现相符的索引键,则postfix执行相对应的值所指定的动作。
SMTP对话过程以各阶段对应的限制条件:
动作如下:
解决方法如下:
1,定义规范等级,名称分别为local_only与local_only1,修改main.cf(注:红色的代表新增加的)
[root@mail postfix]# vi main.cf
#youshengtao 2010-10-12
smtpd_restriction_classes = local_only, local_only1
local_only = check_recipient_access hash:/etc/postfix/plugin/plugin.list,reject
local_only1 = check_sender_access hash:/etc/postfix/plugin/plugin.users,reject
smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_non_fqdn_sender, reject_non_fqd
n_recipient, reject_unlisted_recipient, check_sender_access hash:/etc/postfix/plugin/plugin.users, check_sender_access hash:/etc/postfix/plugin/local_senders, check_recipient_access hash:/etc/postfix/plugin/local_recipients, permit_mynetworks, permit_sasl_authenticated, rejec
t_unauth_destination, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, check_policy_service inet:127.0.0.1:10031
2,建立相关的目录,也可以不建目录,直接放在postifx目录下面,不过,为了以后维护方便,我还是建了一个目录。
[root@mail ~]# mkdir -p /etc/postfix/plugin
[root@mail ~]# cd /etc/postfix/plugin/
[root@mail plugin]# vi local_recipients
qtyg@ourgame.com local_only1
[root@mail plugin]# vi local_senders
wanglujing@ourgame.com local_only
renlina@ourgame.com local_only
caiyanyan@ourgame.com local_only
qinwen@ourgame.com local_only
shiwanting@ourgame.com local_only
[root@mail plugin]# vi plugin.list
qtyg@ourgame.com OK
[root@mail npc]# vi plugin.users
wanglujing@ourgame.com OK
renlina@ourgame.com OK
caiyanyan@ourgame.com OK
qinwen@ourgame.com OK
shiwanting@ourgame.com OK
3,使用postmap将下列的文件转换成postfix可直接查询的格式。
postmap hash:/etc/postfix/plugin/plugin.list
postmap hash:/etc/postfix/plugin/plugin.users
postmap hash:/etc/postfix/plugin/local_senders
postmap hash:/etc/postfix/plugin/local_recipients
4,重载postfix后,邮件服务器正常工作,实现了我们需要的功能。
[root@mail npc]# service postfix reload
重新载入postfix:[确定]
备注:不要忘记第3步,否则服务器会不能收发任何邮件,日志中会有如下提示:
Oct 12 13:55:15 mail postfix/smtpd[875]: fatal: open database /etc/postfix/plugin/recipient_list.db: No such file or directory
Oct 12 13:55:16 mail postfix/master[2266]: warning: process /usr/libexec/postfix/smtpd pid 875 exit status 1
Oct 12 13:55:16 mail postfix/master[2266]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling
公司高层邮箱:
wanglujing@ourgame.com
renlina@ourgame.com
caiyanyan@ourgame.com
qinwen@ourgame.com
shiwanting@ourgame.com
全体员工邮箱:qtyg@ourgame.com
postfix相关概念如下,具体的请参考《postfix权威指南》,在第十一章 反垃圾邮件 中讲的很清楚,下面引用了其部分参数:
Smtmpd_restriction_classes
自定义规范等级的名称,列出管理员自定义的所有规范等级,每一组规范等级,都是由一系列UBE限制条件组成。
Check_client_access 客户端
Check_sender_access 发件人
Check_recipient_access 收件人
Check_recipient_access maptype:mapname
Check_recipient_access 指向一个含有邮件地址、网域名称、人名的访问表,用于对比客户端在RCPT TO命令中提供的收件地址,如果发现相符的索引键,则postfix执行相对应的值所提定的动作。
Check_sender_access maptype:mapname
Check_sender_access 指向一个含有邮件地址,网域名称,人名的访问表,用于对比客户端在MAIL FROM命令中提供的寄件人邮件地址,如果发现相符的索引键,则postfix执行相对应的值所指定的动作。
SMTP对话过程以各阶段对应的限制条件:
动作如下:
OK | 通过当前过滤规则的检查,postfix继续检查下一组过滤规则。 |
REJECT | 拒绝邮件.后面可以加上一段简短信息,说明拒绝的理由,这段信息会连同拒绝码一起返回给客户端,并且被记录在postfix日志文件中。 |
1,定义规范等级,名称分别为local_only与local_only1,修改main.cf(注:红色的代表新增加的)
[root@mail postfix]# vi main.cf
#youshengtao 2010-10-12
smtpd_restriction_classes = local_only, local_only1
local_only = check_recipient_access hash:/etc/postfix/plugin/plugin.list,reject
local_only1 = check_sender_access hash:/etc/postfix/plugin/plugin.users,reject
smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_non_fqdn_sender, reject_non_fqd
n_recipient, reject_unlisted_recipient, check_sender_access hash:/etc/postfix/plugin/plugin.users, check_sender_access hash:/etc/postfix/plugin/local_senders, check_recipient_access hash:/etc/postfix/plugin/local_recipients, permit_mynetworks, permit_sasl_authenticated, rejec
t_unauth_destination, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, check_policy_service inet:127.0.0.1:10031
2,建立相关的目录,也可以不建目录,直接放在postifx目录下面,不过,为了以后维护方便,我还是建了一个目录。
[root@mail ~]# mkdir -p /etc/postfix/plugin
[root@mail ~]# cd /etc/postfix/plugin/
[root@mail plugin]# vi local_recipients
qtyg@ourgame.com local_only1
[root@mail plugin]# vi local_senders
wanglujing@ourgame.com local_only
renlina@ourgame.com local_only
caiyanyan@ourgame.com local_only
qinwen@ourgame.com local_only
shiwanting@ourgame.com local_only
[root@mail plugin]# vi plugin.list
qtyg@ourgame.com OK
[root@mail npc]# vi plugin.users
wanglujing@ourgame.com OK
renlina@ourgame.com OK
caiyanyan@ourgame.com OK
qinwen@ourgame.com OK
shiwanting@ourgame.com OK
3,使用postmap将下列的文件转换成postfix可直接查询的格式。
postmap hash:/etc/postfix/plugin/plugin.list
postmap hash:/etc/postfix/plugin/plugin.users
postmap hash:/etc/postfix/plugin/local_senders
postmap hash:/etc/postfix/plugin/local_recipients
4,重载postfix后,邮件服务器正常工作,实现了我们需要的功能。
[root@mail npc]# service postfix reload
重新载入postfix:[确定]
备注:不要忘记第3步,否则服务器会不能收发任何邮件,日志中会有如下提示:
Oct 12 13:55:15 mail postfix/smtpd[875]: fatal: open database /etc/postfix/plugin/recipient_list.db: No such file or directory
Oct 12 13:55:16 mail postfix/master[2266]: warning: process /usr/libexec/postfix/smtpd pid 875 exit status 1
Oct 12 13:55:16 mail postfix/master[2266]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling
相关文章推荐
- postfix限定特定用户才能发送到别名的解决方法
- Python通过smtp服务发送电子邮件给指定用户(适用于Zabbix邮件报警)
- python获取天气信息,给指定用户发送邮件
- Postfix-2.11+Dovecot-2.0.9+MySQL+Cyrus-sasl+Extmail-1.2实现基于虚拟用户的邮件系统架构 推荐
- 在RHEL5下构建基于系统用户的Postfix邮件系统 推荐
- 备份指定文件到用户主目录,使用tar命令压缩并发送邮件
- 想统计指定用户每天通过EXCHANGE发送了多少封邮件么?
- Postfix限制部分用户发送和接收外部邮件
- GitLab Server 发送邮件给新增用户使其通过邮箱中的链接去指定地址修改登录密码
- postfix只允许部分账户给一个特定别名发邮件
- postfix限制特定用户收发邮件的高级访问控制方法
- 演示账号激活的过程:注册——>向指定邮箱发送邮件——>用户登录邮箱,激活账号
- 允许postfix发送带exe附件的邮件
- kettle从mysql中查询出特定的数据然后发送邮件附件到指定的邮箱。
- Exchange 2003允许部分用户发送邮件到部分外网服务器
- domino 代理发送邮件,并且邮件发件人是指定用户的实现方法
- RedHat 5.4+ Postfix +Extmail实现基于虚拟用户的邮件系统(一) 推荐
- Event Handler的开发与部署--扩展练习:上传文档后,指定用户,添加发送邮件通知操作
- Linux自动向指定用户发送邮件
- 禁止冒名顶替Exchange用户发送邮件