我正在尝试stunnel
在 CentOS 7 服务器上安装,但我收到了未知 TCP 服务错误。 我该如何解决此错误以完成stunnel
安装?
我安装并测试stunnel
如下:
# yum install stunnel
# yum install telnet
# vi /etc/stunnel/stunnel.conf (creates new file)
添加以下内容:
client=yes
[rev-smtps]
accept=127.0.0.1:2525
connect=the.mail.server.url
Esc :wq
然后回到命令行:
# stunnel &
# telnet 127.0.0.1 2525
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Connection closed by foreign host.
[1]+ Done stunnel
我将此解释为 stunnel 未连接到远程邮件服务器,因为本教程说我应该期待类似于以下内容的结果:
[root@dev xinetd.d]# telnet localhost 2525
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 smtp104.sbc.mail.re3.yahoo.com ESMTP
EHLO
250-smtp104.sbc.mail.re3.yahoo.com
250-AUTH LOGIN PLAIN XYMCOOKIE
250-PIPELINING
250 8BITMIME
quit
Connection closed by foreign host.
请注意,在上面的配置中,the.mail.server.url
是适用于我的 MS Outlook 连接到同一邮件服务器以检索 smtps 和 imap 邮件的确切 URL。
此外,在进行这些测试时,该开发服务器上的临时防火墙规则是:
[root@localhost stunnel]# firewall-cmd --list-all
public (default, active)
interfaces: ens7 eth0
sources:
services: dhcpv6-client http imaps smtp ssh
ports: 8080/tcp
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
请注意,smtp.xml
filewalld 配置文件指定port 465
为smtp
.好像没有smtps.xml
文件。
journalctl
运行后立即键入telnet localhost 2525
会在日志末尾附加以下内容:
Oct 19 15:56:40 localhost.localdomain stunnel[6657]: LOG5[6657:140496905537280]: Service [rev-smtps] accepted connection from 127.0.0.1:43872
Oct 19 15:56:40 localhost.localdomain stunnel[6657]: LOG3[6657:140496905537280]: Unknown TCP service 'the.mail.server.url'
Oct 19 15:56:40 localhost.localdomain stunnel[6657]: LOG3[6657:140496905537280]: No host resolved
Oct 19 15:56:40 localhost.localdomain stunnel[6657]: LOG5[6657:140496905537280]: Connection reset: 0 byte(s) sent to SSL, 0 byte(s) sent to socket
那么我如何确认它stunnel
正在工作呢?
答案1
client=yes [rev-smtps] accept=127.0.0.1:2525 connect=the.mail.server.url
您是否可能忘记告诉stunnel
它应该连接到哪个端口?
connect=mail.server.url:port
应该是正确的语法。