首页 > 代码库 > SMTP(2)

SMTP(2)

POSTFIX

##1.服务器配置:(限制规则是按照查询的顺序进行的,第一条符合条件的规则被执行)

 

    客户端主机名/地址限制 :

    smtpd_client_restrictions =

    check_client_access hash:/etc/postfix/access,

    permit_mynetworks,reject_maps_rbl (permit_mynetworks:如果客户端的ip地址符合$mynetworks参数定义的范围则接受该客户端的连接请求;reject_maps_rbl:如果客户端的网络地址符合$maps_rbl_domains参数的值则拒绝

    该客户端的连接请求)

    vim access:

        192.168.0.4REJECT

        192.168.0REJECT

    postmap access

    /etc/init.d/postfix restart

 

实例:

westos.westos.com端:

    vim access:

        172.25.254.113  REJECT

    postmapaccess

    postconf -d |grep client

    postconf -e "smtpd_client_restrictions = check_client_access hash:/etc/postfix/access"

    systemctl restart postfix.service


linux.linux.com端:

    telnet 172.25.254.213 25

技术分享

 

 

 

通过发件人地址进行限制 :

smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/

sender

vim /etc/postfix/sender:

    user@exmaple.com REJECT(OK、RELAY)

postmap sender

 


实例:

westos.westos.com端:

vim sender

    student@westos.com REJECT

postmap sender

postconf -d | grep sender

 postconf -e "smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender"

systemctl restart postfix.service


linux.linux.com端:

    telnet 172.25.254.213 25

技术分享

 

通过收件人地址进行过滤 :

smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recipient, permit_mynetworks,

reject_unauth_destination(reject_unauth_destination:不管客户端的主机名,只

要符合以下的条件, 就拒绝该客户端SMTP连接请求:

* 解析后的目标地址符合$relay_domains及其子域

* 解析后的目标地址符合$inet_interfaces、$mydestination或$virtual_maps )

vi /etc/postfix/recipient:

user@example.com

DISCARDED

postmap recipient

 

实例:

westos.westos.com端:

vim recip

    student@westos.comREJECT

 postmap recip

postconf -d | grep recip

postconf -e "smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recip"

systemctl restart postfix.service


 

linux.linux.com端:

telnet 172.25.254.213 25

技术分享

 


 

 

 

 

豆腐块(dovecot)

##1.mutt的创建与使用

westos.westos.com端:

    yum install dovecot -y

    cd /etc/dovecot/

    vim dovecot.conf

         24 protocols = imap pop3 lmtp

        49 disable_plaintext_auth = no

    

[root@westos conf.d]# vim 10-mail.conf

    30 mail_location =  mbox:~/mail:INBOX=/var/mail/%u

 

技术分享

 

[root@westos skel]# mkdir mail/.imap/ -p

[root@westos skel]# touch mail/.imap/INBOX

[root@westos dovecot]# useradd lee

[root@westos dovecot]# passwd lee

##先创建目录后建立的新用户会自动生成该文件,不必切换到该用户再自行创建

 


linux.linux.com端:

yum install mutt -y

技术分享

技术分享


 

 

 

##2.雷鸟的创建与使用

 

 

westos.westos.com端;

    [root@westos dovecot]# vim /etc/dovecot/dovecot.conf

        49 login_trusted_networks = 0.0.0.0/0

    [root@westos dovecot]# systemctl restart dovecot.service

     

 

linux.linux.com端:

    [root@linux postfix]# cd /mnt/

    [root@linux mnt]# ls

    thunderbird-45.5.1.tar.bz2

    [root@linux mnt]# tar jxf thunderbird-45.5.1.tar.bz2

    [root@linux mnt]# cd thunderbird/

    [root@linux thunderbird]# ./thunderbird

技术分享


本文出自 “12110289” 博客,谢绝转载!

SMTP(2)