I am trying to install stunnel on a CentOS 7 server, but I am getting an Unknown TCP Service error. How can I resolve this error to complete the stunnel installation?
I installed and tested stunnel as follows:
# yum install stunnel
# yum install telnet
# vi /etc/stunnel/stunnel.conf (creates new file)
Add the following contents:
client=yes
[rev-smtps]
accept=127.0.0.1:2525
connect=the.mail.server.url
Esc :wq
Then back to command line:
# 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
I am interpreting this to say that stunnel is not connecting to the remote mail server, because this tutorial says that I should expect results similar to the following:
[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.
Note that, in the above config, the.mail.server.url is the exact url that works for my MS Outlook to connect to the same mail server to retrieve mail for BOTH smtps and imaps.
Also, the temporary firewall rules on this development server at the moment of these tests are:
[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:
And note that the smtp.xml filewalld config file specifies port 465 as the port for smtp. There does not seem to be an smtps.xml file.
Typing journalctl immediately after running telnet localhost 2525 resulted in the following appended at the end of the logs:
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
So how can I confirm that stunnel is working?