2013-05-29 59 views
1

我有一台运行在谷歌计算引擎上的虚拟机(CentOS),一切看起来非常简单,已经阅读了所有我能找到的文档,但是这一件事让我感到不安。我知道出站SMTP连接被GCE阻止,但传入的内容应该不会成为我读过的内容。不过,我已经正确配置服务器(我认为),并通过gcutil添加防火墙支持SMTP,但仍然没有骰子:谷歌计算引擎将不允许传入的SMTP连接

gcutil addfirewall smtp --description="Incoming smtp allowed." --allowed="tcp:smtp" 

这增加了该规则,以允许SMTP连接。

gcutil listfirewalls 

    +------------------------+---------------------------------------+---------+------------+-------------+-------------+ 
    |   name   |    description    | network | source-ips | source-tags | target-tags | 
    +------------------------+---------------------------------------+---------+------------+-------------+-------------+ 
    | default-allow-internal | Internal traffic from default allowed | default | 10.0.0.0/8 |    |    | 
    | default-ssh   | SSH allowed from anywhere    | default | 0.0.0.0/0 |    |    | 
    | http2     | Incoming http allowed.    | default | 0.0.0.0/0 |    |    | 
    | pop3     | Incoming pop3 allowed.    | default | 0.0.0.0/0 |    |    | 
    | smtp     | Incoming smtp allowed.    | default | 0.0.0.0/0 |    |    | 
    +------------------------+---------------------------------------+---------+------------+-------------+-------------+ 

列出SMTP规则。其他端口做工精细,我可以进入端口80,22和110,但试图进入端口25时:

telnet nextcore.com 25 
Trying 173.255.112.1... 

,而不会连接。

连接到虚拟机上的本地主机端口25件作品就好了:

telnet localhost 25 
Trying 127.0.0.1... 
Connected to localhost. 
Escape character is '^]'. 
220 nextcore.localdomain ESMTP Postfix 

我缺少什么?

回答

4

我不确定你在端口25上收听什么(例如sendmail,postfix等)。我可以确认,我也无法通过端口25连接到您的VM,但我可以连接到端口80.

您可以检查哪些程序正在侦听哪些端口与sudo netstat -lpn -A inet

$ sudo netstat -lpn -A inet 
Active Internet connections (only servers) 
Proto Recv-Q Send-Q Local Address   Foreign Address   State  PID/Program name 
tcp  0  0 0.0.0.0:22    0.0.0.0:*    LISTEN  2691/sshd 
tcp  0  0 0.0.0.0:25    0.0.0.0:*    LISTEN  15845/nc 
udp  0  0 0.0.0.0:23153   0.0.0.0:*       2291/dhclient 
udp  0  0 0.0.0.0:68    0.0.0.0:*       2291/dhclient 
udp  0  0 10.87.233.49:123  0.0.0.0:*       2566/ntpd 
udp  0  0 127.0.0.1:123   0.0.0.0:*       2566/ntpd 
udp  0  0 0.0.0.0:123    0.0.0.0:*       2566/ntpd 

你可能会发现,你的邮件程序只监听本地主机(127.0.0.1),或者你缺少在/etc/hosts.allow条目或在“的/ etc/hosts.deny`一个条目从外部块的请求您的本地网络。

+3

呸,应该检查默认后缀配置。你可以通过我原来的问题看到它是后缀监听,默认情况下,它在GCE上使用CentOS VM,但是我没有看到它被设置为仅监听本地主机。更改main.cf,重新启动后缀,现在它正在拾取外部连接。谢谢! –