欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

马哥 25_04 _邮件服务系列之Postfix常用配置 有大用

mynetworks  邮件中继

127.0.0.0/8

SASL认证



测试认证没有问题

[root@mail ~]# testsaslauthd -u hadoop -p 111111111

0: OK "Success."

[root@mail ~]#



看看 新的(修改的) postfix的配置

[root@mail ~]# postconf -n

broken_sasl_auth_clients = yes

command_directory = /usr/sbin

config_directory = /etc/postfix

daemon_directory = /usr/libexec/postfix

data_directory = /var/lib/postfix

debug_peer_level = 2

debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5

html_directory = no

inet_protocols = ipv4

mail_owner = postfix

mailq_path = /usr/bin/mailq

manpage_directory = /usr/local/man

mydestination = $myhostname, $mydomain, localhost, $mydomain,

mydomain = magedu.com

myhostname = mail.magedu.com

mynetworks = 127.0.0.0/8

myorigin = $mydomain

newaliases_path = /usr/bin/newaliases

queue_directory = /var/spool/postfix

readme_directory = no

sample_directory = /etc/postfix

sendmail_path = /usr/sbin/sendmail

setgid_group = postdrop

smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Version not Available!

smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_non_fqdn_hostname,reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient,reject_unknown_recipient_domain,reject_unauth_pipelining,reject_unauth_destination

smtpd_sasl_auth_enable = yes

smtpd_sasl_local_domain = $myhostname

smtpd_sasl_security_options = noanonymous

smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/access

unknown_local_recipient_reject_code = 550

postconf: warning: /etc/postfix/main.cf: unused parameter: smtpd_sasl_application_name=smtpd

You have new mail in /var/spool/mail/root

[root@mail ~]#


postfix 2.3以后  

把 smtpd_sasl_application_name = smtpd

改为 smtpd_sasl_path = smtpd



[root@mail ~]# vim /etc/postfix/main.cf

 ............................................................

#smtpd_sasl_application_name = smtpd

smtpd_sasl_path = smtpd

 ............................................................


重启  postfix

[root@mail ~]# service postfix restart

关闭 postfix:                                             [确定]

启动 postfix:                                             [确定]

[root@mail ~]#


这个文件没动

[root@mail ~]# vim /usr/lib/sasl2/smtpd.conf

pwcheck_method: saslauthd

mech_list: LOGIN PLAIN

~

我们还要重启 saslauthd 服务


[root@mail ~]# service saslauthd restart

停止 saslauthd:                                           [确定]

启动 saslauthd:                                           [确定]

[root@mail ~]#


(马哥) 仍然不能发送邮件

image.png

image.png


马哥这么依然不行

image.png


我这边依然可以

[root@mail ~]# telnet 192.168.1.45 25

Trying 192.168.1.45...

Connected to www.a.org (192.168.1.45).

Escape character is '^]'.

220 Welcome to our mail.magedu.com ESMTP,Warning: Version not Available!

helo mail.magedu.com

250 mail.magedu.com

auth login

334 VXNlcm5hbWU6

b3BlbnN0YWNr

334 UGFzc3dvcmQ6

emhvbmcxOTI2

235 2.7.0 Authentication successful

mail from:openstack@magedu.com

250 2.1.0 Ok

rcpt to:hello@aol.com

250 2.1.5 Ok

quit

221 2.0.0 Bye

Connection closed by foreign host.

[root@mail ~]#


在  192.168.1.85 上试试依然可以

[root@www ~]# telnet 192.168.1.45  25

Trying 192.168.1.45...

Connected to www.b.net (192.168.1.45).

Escape character is '^]'.

220 Welcome to our mail.magedu.com ESMTP,Warning: Version not Available!

helo mail.magedu.com

250 mail.magedu.com

auth login

334 VXNlcm5hbWU6

b3BlbnN0YWNr

334 UGFzc3dvcmQ6

emhvbmcxOTI2

235 2.7.0 Authentication successful

mail from:openstack@magedu.com

250 2.1.0 Ok

rcpt to:openstack@magedu.com

250 2.1.5 Ok

quit

221 2.0.0 Bye

Connection closed by foreign host.

[root@www ~]#


马哥 安装 postfix-2.9.6   (马哥本来是2.10.0的版本)

停掉服务

image.png


删除原来的配置

image.png

马哥删除他本来已经做好的东西, 准备重新编译

image.png

编译选项

image.png


进行编译和安装

image.pngimage.pngimage.png   一路回车



image.png

image.png

image.png

监听的ip地址

image.png


image.png


image.png


image.png

image.png


马哥的此时行了

image.png



image.png


马哥的行了 (outlook 里面 已配置了登录验证)


image.png

发件箱空了,说明发出去了

image.png

为什么我的不行 (outlook 里面 已配置了登录验证)

image.png


我下面这样设置就行了

1)

image.png

2)

image.png

3)

image.png


发送给的是 openstack@magedu.com (或者任何收件人都可以 比如 obama@col.com ,也能够发送出去)

image.png

普通分类: