Postfixで外部からのメールが受信できない…587が開いてない?問題を解決(CentOS7、さくらVPS)
さくらVPSで新しいサーバhogehogeを立てて、ここでいくつかのドメインのメールアドレスを、Postfixのバーチャルホストで受信だけ転送する予定で。
が、なぜかメールの受信ができない。自分のサーバ内のサイトにあるフォームからの送信は、ローカル転送なので受け取れるんだけど、外部からのメールが全然届かない。
他のサーバfugafugaからmailコマンドで試してみると、こんなエラーが出ている。
Apr 30 23:08:23 fugafuga postfix/smtp[15437]: connect to mx.hogehoge.net[153.126.209.139]:25: No route to host
「ホストへのルートがないので接続できない。」
ああー、これはあれだな。さくらVPSのヘルプに書いてあったけど、25番ポートが使えなくて、OBP 587(Submission posrt)を使わないといけないっちゅうアレやろ。と合点して、さくらVPSの下記ヘルプページを参照して、master.cfとmain.cfをそれぞれ編集。
5.Submissionポート設定
Submissionポート(587番ポート)を設定します。
設定するには、/etc/postfix/master.cfを編集します。[root@ ~]# vi /etc/postfix/master.cf下記のハイライト部分の行頭にある#を削除します。
# # Postfix master process configuration file. For details on the format # of the file, see the master(5) manual page (command: "man 5 master"). # # Do not forget to execute "postfix reload" after editing this file. # # ========================================================================== # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== smtp inet n - n - - smtpd #smtp inet n - n - 1 postscreen #smtpd pass - - n - - smtpd #dnsblog unix - - n - 0 dnsblog #tlsproxy unix - - n - 0 tlsproxy submission inet n - n - - smtpd # -o syslog_name=postfix/submission # -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes # -o smtpd_reject_unlisted_recipient=no # -o smtpd_client_restrictions=$mua_client_restrictions # -o smtpd_helo_restrictions=$mua_helo_restrictions # -o smtpd_sender_restrictions=$mua_sender_restrictions -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject # -o milter_macro_daemon_name=ORIGINATING #smtps inet n - n - - smtpd # -o syslog_name=postfix/smtps # -o smtpd_tls_wrappermode=yes # -o smtpd_sasl_auth_enable=yes # -o smtpd_reject_unlisted_recipient=no # -o smtpd_client_restrictions=$mua_client_restrictions # -o smtpd_helo_restrictions=$mua_helo_restrictions # -o smtpd_sender_restrictions=$mua_sender_restrictions # -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject # -o milter_macro_daemon_name=ORIGINATING以上で、master.cfの編集完了です。
ところが、これで何度試しても、「25: no route to host」のエラーが解除されず、メールが受け取れない。
fugafugaからtelnetしてみても繋がらない。
[dacelo@fugafuga ~]$ telnet hogehoge.net 587 Trying 123.456.789.000... telnet: connect to address 153.126.209.139: No route to host
2日ほどハマってたんですけど、ハタと気づいた。サーバ内ファイヤウォールだ。それも、iptablesじゃなくて、CentOS7だからfirewalldだったんだ。
firewalldでSMTP用のポートを開放
まずサービスが動いていることを確認。
[dacelo@hogehoge ~]$ systemctl list-unit-files | grep firewalld firewalld.service enabled
現在許可しているサービスを確認。
[dacelo@hogehoge ~]$ sudo firewall-cmd --list-all public (active) target: default icmp-block-inversion: no interfaces: eth0 sources: services: dhcpv6-client http ssh https ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules:
サブミッションポートを許可サービスに追加。
[dacelo@hogehoge ~]$ sudo firewall-cmd --permanent --zone=public --add-service=smtp-submission success
firewalldを再起動して反映。
[dacelo@hogehoge ~]$ sudo systemctl restart firewalld
ところがこの状態でも、外部からメールを送信しようとすると繋がらない。
Apr 30 23:08:23 fugafuga postfix/smtp[15437]: connect to mx.hogehoge.net[123.456.789.000]:25: No route to host
エラーメッセージからは、25番につなごうとしている気配なんだけど、587につないでほしいのよね。うーん。どうやって587に繋いでもらえばいいのか…。あれ?mailコマンドって指定しないとデフォルトでは25番につなぐっていう話なんじゃないか?ひょっとして。そうだよ。メールクライアントの役割だもんな。
広告
でも待てよ。firewalldで25番も開放しちまえばいいんじゃないか?
[dacelo@hogehoge ~]$ sudo firewall-cmd --permanent --zone=public --add-service=smtp success
firewalldを再起動して反映。
[dacelo@hogehoge ~]$ sudo systemctl restart firewalld
そしたらめでたく繋がり、配信・受信できました。
Apr 30 23:42:08 www5254ue postfix/smtp[15941]: 71F13302205: to=, relay=mx.hogehoge.net[123.456.789.000]:25, delay=80220, delays=80220/0.02/0.17/0.1, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as C7AE8E00303D)
25番開けておいていいのかという問題はひとまず置いておいて、今日のところはこれで完了。
初めまして。
私もさくらのVPSで同じ症状でハマって、同様にfirewalldでsmtpを開放してしのいでいます。
私もセキュリティが気になっているのですが、このあと、何か追加の設定をされましたでしょうか?
ご教授いただければ幸いです。
結局25番ポートを開放し続けたまま今に至ります…。
お役に立てず申し訳ないです。
逆にそちらでも何か分かりましたらご教授いただければ、と…
Hi, i think that i saw you visited my web site so i came to
return the desire?.I am trying to to find issues to improve my website!I guess its adequate to make use of some of your ideas!!
Hello my friend! I want to say that this article is awesome, great written and
include approximately all vital infos. I would like to peer more posts like this .
Excellent site you have here but I was wanting to know if
you knew of any community forums that cover the same topics talked about in this article?
I’d really love to be a part of group where I can get responses from other experienced people that share the same interest.
If you have any suggestions, please let me know. Thanks
a lot!
What’s up mates, its wonderful article concerning educationand entirely explained, keep it up all the time.
Do you have a spam problem on this blog; I also am a blogger,
and I was curious about your situation; many of us have developed some nice procedures and we are looking to
exchange techniques with other folks, be sure to shoot me an email
if interested.
Hi! Do you use Twitter? I’d like to follow you if that would be ok.
I’m definitely enjoying your blog and look forward to new posts.
I’m curious to find out what blog system you have been working with?
I’m experiencing some minor security issues with my latest site and I’d like to find something more safeguarded.
Do you have any solutions?
When I originally left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and
now each time a comment is added I receive four emails with the exact same comment.
Perhaps there is an easy method you are able to remove me
from that service? Thanks a lot!
It’s wonderful that you are getting thoughts from this
paragraph as well as from our argument made at this
place.
Hi, always i used to check website posts here early in the dawn,
as i enjoy to find out more and more.
Hi there, i read your blog occasionally and i own a
similar one and i was just wondering if you get a lot of spam
feedback? If so how do you reduce it, any plugin or anything you
can suggest? I get so much lately it’s driving me mad so any assistance is very much appreciated.
Cool blog! Is your theme custom made or did you download it from somewhere?
A design like yours with a few simple tweeks would really make my blog
stand out. Please let me know where you got your theme.
Bless you
I was recommended this web site through my cousin. I’m not certain whether this publish is
written via him as nobody else understand such designated approximately my difficulty.
You’re incredible! Thanks!
I absolutely love your site.. Very nice colors & theme. Did you create this web site yourself?
Please reply back as I’m trying to create my own blog and would love to know where you got this from or
just what the theme is called. Kudos!
magnificent points altogether, you just won a brand new reader.
What may you recommend in regards to your publish that you
simply made some days ago? Any positive?
Hello There. I found your blog using msn. This is an extremely well written article.
I will make sure to bookmark it and return to
read more of your useful info. Thanks for the post. I will definitely
return.
Thankfulness to my father who stated to me regarding
this webpage, this web site is truly amazing.
I do not even know how I ended up here, but I thought this post was great.
I don’t know who you are but certainly you’re going to a famous blogger if you
aren’t already 😉 Cheers!
Thanks for finally writing about > Postfixで外部からのメールが受信できない…587が開いてない?問題を解決(CentOS7、さくらVPS) – DACELO SPACE < Liked it!
Hi to all, it’s actually a good for me to pay a quick visit this site, it includes precious Information.
I’ve been exploring for a bit for any high-quality articles or blog posts on this sort of space .
Exploring in Yahoo I ultimately stumbled upon this website.
Reading this information So i’m happy to exhibit that
I have a very excellent uncanny feeling I found out exactly what I needed.
I so much indisputably will make certain to don?t put
out of your mind this website and provides it a glance regularly.
Currently it looks like Expression Engine is the top
blogging platform available right now. (from what I’ve read) Is that what you are using on your
blog?
Thanks a lot for sharing this with all people you actually recognise what you’re talking
approximately! Bookmarked. Kindly additionally discuss with my website =).
We can have a hyperlink trade contract among us
It’s an remarkable article in favor of all the online viewers; they will obtain benefit from it I
am sure.
Excellent beat ! I wish to apprentice while you amend your website, how
can i subscribe for a blog web site? The account helped me
a acceptable deal. I had been tiny bit acquainted of this your broadcast offered bright clear idea
Hi excellent blog! Does running a blog like this require a great deal of work?
I’ve virtually no understanding of coding
but I was hoping to start my own blog soon. Anyway,
should you have any ideas or techniques for new blog owners please share.
I know this is off subject however I simply wanted to
ask. Thanks a lot!
I was able to find good info from your blog articles.
Hi there, this weekend is pleasant designed for me, because this
occasion i am reading this fantastic educational post here at my home.
bookmarked!!, I like your blog!
These are in fact fantastic ideas in about blogging.
You have touched some good factors here. Any way keep
up wrinting.
Why viewers still make use of to read news papers when in this technological globe the whole thing
is available on net?
You ought to be a part of a contest for one of
the most useful sites on the net. I will highly recommend this blog!
Stunning story there. What happened after?
Thanks!
Have you ever thought about writing an e-book
or guest authoring on other sites? I have a blog centered on the same subjects you discuss and would really
like to have you share some stories/information. I know my subscribers would enjoy your work.
If you’re even remotely interested, feel free to send me an email.
Hello! I just would like to give you a big thumbs up
for the excellent info you’ve got right here on this post.
I am coming back to your blog for more soon.
Good day very cool website!! Man .. Excellent .. Superb ..
I will bookmark your blog and take the feeds additionally?
I’m glad to find a lot of useful info here within the post, we’d like
develop more techniques on this regard, thank you for sharing.
. . . . .
You actually make it appear so easy together with your presentation however I in finding this matter to be actually something that I feel I might never understand.
It kind of feels too complicated and extremely vast
for me. I am taking a look forward to your subsequent submit,
I will attempt to get the hang of it!
Hi friends, nice paragraph and nice arguments commented here, I am truly enjoying by these.
Hi there, You have done an excellent job. I’ll definitely digg
it and personally recommend to my friends. I am confident they’ll be benefited from this web site.
Quality posts is the important to attract the
people to visit the web page, that’s what this web page is providing.
Truly when someone doesn’t understand after that its
up to other users that they will help, so here it happens.
If you are going for most excellent contents like me, just go to see this website daily because it provides quality contents, thanks
May I just say what a relief to discover an individual who actually knows
what they’re discussing on the web. You certainly realize how to
bring a problem to light and make it important.
More and more people have to read this and understand this side of the story.
It’s surprising you aren’t more popular since you certainly possess the gift.
My brother suggested I might like this web site.
He was totally right. This post truly made
my day. You cann’t imagine simply how much time I had spent for this information! Thanks!
Hi, I do think this is an excellent website. I stumbledupon it 😉 I may come back yet again since i have saved as a favorite it.
Money and freedom is the greatest way to change, may
you be rich and continue to guide others.
What’s up, for all time i used to check webpage posts here in the early hours in the dawn, as i enjoy to learn more and more.
Its such as you read my mind! You appear to grasp a lot approximately this, like you wrote the e book in it or something.
I feel that you just can do with some % to power the message home a bit, however instead of that, that
is magnificent blog. A great read. I will certainly be back.
This is very interesting, You’re a very skilled blogger.
I have joined your feed and look forward to seeking more of your great post.
Also, I have shared your site in my social networks!
My brother suggested I may like this blog. He was entirely right.
This post actually made my day. You can not consider simply how a lot
time I had spent for this information! Thanks!
I really love your blog.. Pleasant colors & theme. Did you make this website yourself?
Please reply back as I’m wanting to create my own blog and want to find out where you got this from or just what the theme is named.
Cheers!
I know this if off topic but I’m looking into starting
my own weblog and was curious what all is required to get set up?
I’m assuming having a blog like yours would cost a pretty penny?
I’m not very web savvy so I’m not 100% certain. Any suggestions or advice
would be greatly appreciated. Many thanks
Woah! I’m really loving the template/theme of this website.
It’s simple, yet effective. A lot of times
it’s difficult to get that “perfect balance” between user friendliness and
appearance. I must say that you’ve done a amazing job
with this. Also, the blog loads extremely fast for
me on Safari. Excellent Blog!
It’s genuinely very complex in this full of activity life to listen news on TV, so I only
use web for that reason, and get the newest news.
Hi excellent website! Does running a blog like this take
a massive amount work? I’ve virtually no understanding of coding but I had been hoping to
start my own blog in the near future. Anyways, should you have any recommendations or techniques for new blog owners please share.
I know this is off topic however I simply had to ask.
Thanks a lot!
Heya just wanted to give you a quick heads up and let you
know a few of the images aren’t loading correctly. I’m not sure why but I think its a linking issue.
I’ve tried it in two different internet browsers and both show the same results.
Excellent website. A lot of helpful information here.
I am sending it to some friends ans also sharing in delicious.
And of course, thank you in your effort!