我已将 STunnel 配置为将非 SSL POP3 请求代理到端口 111 上的 GMail。当 STunnel 作为桌面应用程序运行时,此功能运行正常,但当我运行 STunnel 服务时,我无法连接到计算机上的端口 111(例如使用 Outlook Express)。
Stunnel 日志文件显示端口绑定成功,但始终看不到连接。当 STunnel 作为服务运行时,是否有东西阻止与该端口的连接?
这是 stunnel.conf
cert = stunnel.pem
; Some performance tunings
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
; Some debugging stuff useful for troubleshooting
debug = 7
output = stunnel.log
; Use it for client mode
client = yes
; Service-level configuration
[gmail]
accept = 127.0.0.1:111
connect = pop.gmail.com:995
来自服务的 stunnel.log
2010.10.07 12:14:22 LOG5[80444:72984]: Reading configuration from file stunnel.conf
2010.10.07 12:14:22 LOG7[80444:72984]: Snagged 64 random bytes from C:/.rnd
2010.10.07 12:14:23 LOG7[80444:72984]: Wrote 1024 new random bytes to C:/.rnd
2010.10.07 12:14:23 LOG7[80444:72984]: PRNG seeded successfully
2010.10.07 12:14:23 LOG7[80444:72984]: Certificate: stunnel.pem
2010.10.07 12:14:23 LOG7[80444:72984]: Certificate loaded
2010.10.07 12:14:23 LOG7[80444:72984]: Key file: stunnel.pem
2010.10.07 12:14:23 LOG7[80444:72984]: Private key loaded
2010.10.07 12:14:23 LOG7[80444:72984]: SSL context initialized for service gmail
2010.10.07 12:14:23 LOG5[80444:72984]: Configuration successful
2010.10.07 12:14:23 LOG5[80444:72984]: No limit detected for the number of clients
2010.10.07 12:14:23 LOG7[80444:72984]: FD=156 in non-blocking mode
2010.10.07 12:14:23 LOG7[80444:72984]: Option SO_REUSEADDR set on accept socket
2010.10.07 12:14:23 LOG7[80444:72984]: Service gmail bound to 0.0.0.0:111
2010.10.07 12:14:23 LOG7[80444:72984]: Service gmail opened FD=156
2010.10.07 12:14:23 LOG5[80444:72984]: stunnel 4.34 on x86-pc-mingw32-gnu with OpenSSL 1.0.0a 1 Jun 2010
2010.10.07 12:14:23 LOG5[80444:72984]: Threading:WIN32 SSL:ENGINE Sockets:SELECT,IPv6
来自桌面(工作)进程的 stunnel.log
2010.10.07 12:10:31 LOG5[80824:81200]: Reading configuration from file stunnel.conf
2010.10.07 12:10:31 LOG7[80824:81200]: Snagged 64 random bytes from C:/.rnd
2010.10.07 12:10:32 LOG7[80824:81200]: Wrote 1024 new random bytes to C:/.rnd
2010.10.07 12:10:32 LOG7[80824:81200]: PRNG seeded successfully
2010.10.07 12:10:32 LOG7[80824:81200]: Certificate: stunnel.pem
2010.10.07 12:10:32 LOG7[80824:81200]: Certificate loaded
2010.10.07 12:10:32 LOG7[80824:81200]: Key file: stunnel.pem
2010.10.07 12:10:32 LOG7[80824:81200]: Private key loaded
2010.10.07 12:10:32 LOG7[80824:81200]: SSL context initialized for service gmail
2010.10.07 12:10:32 LOG5[80824:81200]: Configuration successful
2010.10.07 12:10:32 LOG5[80824:81200]: No limit detected for the number of clients
2010.10.07 12:10:32 LOG7[80824:81200]: FD=156 in non-blocking mode
2010.10.07 12:10:32 LOG7[80824:81200]: Option SO_REUSEADDR set on accept socket
2010.10.07 12:10:32 LOG7[80824:81200]: Service gmail bound to 0.0.0.0:111
2010.10.07 12:10:32 LOG7[80824:81200]: Service gmail opened FD=156
2010.10.07 12:10:33 LOG5[80824:81200]: stunnel 4.34 on x86-pc-mingw32-gnu with OpenSSL 1.0.0a 1 Jun 2010
2010.10.07 12:10:33 LOG5[80824:81200]: Threading:WIN32 SSL:ENGINE Sockets:SELECT,IPv6
2010.10.07 12:10:33 LOG7[80824:81844]: Service gmail accepted FD=188 from 127.0.0.1:24813
2010.10.07 12:10:33 LOG7[80824:81844]: Creating a new thread
2010.10.07 12:10:33 LOG7[80824:81844]: New thread created
2010.10.07 12:10:33 LOG7[80824:25144]: Service gmail started
2010.10.07 12:10:33 LOG7[80824:25144]: FD=188 in non-blocking mode
2010.10.07 12:10:33 LOG7[80824:25144]: Option TCP_NODELAY set on local socket
2010.10.07 12:10:33 LOG5[80824:25144]: Service gmail accepted connection from 127.0.0.1:24813
2010.10.07 12:10:33 LOG7[80824:25144]: FD=212 in non-blocking mode
2010.10.07 12:10:33 LOG6[80824:25144]: connect_blocking: connecting 209.85.227.109:995
2010.10.07 12:10:33 LOG7[80824:25144]: connect_blocking: s_poll_wait 209.85.227.109:995: waiting 10 seconds
2010.10.07 12:10:33 LOG5[80824:25144]: connect_blocking: connected 209.85.227.109:995
2010.10.07 12:10:33 LOG5[80824:25144]: Service gmail connected remote server from 192.168.1.9:24814
2010.10.07 12:10:33 LOG7[80824:25144]: Remote FD=212 initialized
2010.10.07 12:10:33 LOG7[80824:25144]: Option TCP_NODELAY set on remote socket
2010.10.07 12:10:33 LOG7[80824:25144]: SSL state (connect): before/connect initialization
2010.10.07 12:10:33 LOG7[80824:25144]: SSL state (connect): SSLv3 write client hello A
2010.10.07 12:10:33 LOG7[80824:25144]: SSL state (connect): SSLv3 read server hello A
2010.10.07 12:10:33 LOG7[80824:25144]: SSL state (connect): SSLv3 read server certificate A
2010.10.07 12:10:33 LOG7[80824:25144]: SSL state (connect): SSLv3 read server done A
2010.10.07 12:10:33 LOG7[80824:25144]: SSL state (connect): SSLv3 write client key exchange A
2010.10.07 12:10:33 LOG7[80824:25144]: SSL state (connect): SSLv3 write change cipher spec A
2010.10.07 12:10:33 LOG7[80824:25144]: SSL state (connect): SSLv3 write finished A
2010.10.07 12:10:33 LOG7[80824:25144]: SSL state (connect): SSLv3 flush data
2010.10.07 12:10:33 LOG7[80824:25144]: SSL state (connect): SSLv3 read finished A
2010.10.07 12:10:33 LOG7[80824:25144]: 1 items in the session cache
2010.10.07 12:10:33 LOG7[80824:25144]: 1 client connects (SSL_connect())
2010.10.07 12:10:33 LOG7[80824:25144]: 1 client connects that finished
2010.10.07 12:10:33 LOG7[80824:25144]: 0 client renegotiations requested
2010.10.07 12:10:33 LOG7[80824:25144]: 0 server connects (SSL_accept())
2010.10.07 12:10:33 LOG7[80824:25144]: 0 server connects that finished
2010.10.07 12:10:33 LOG7[80824:25144]: 0 server renegotiations requested
2010.10.07 12:10:33 LOG7[80824:25144]: 0 session cache hits
2010.10.07 12:10:33 LOG7[80824:25144]: 0 external session cache hits
2010.10.07 12:10:33 LOG7[80824:25144]: 0 session cache misses
2010.10.07 12:10:33 LOG7[80824:25144]: 0 session cache timeouts
2010.10.07 12:10:33 LOG6[80824:25144]: SSL connected: new session negotiated
2010.10.07 12:10:33 LOG6[80824:25144]: Negotiated ciphers: RC4-MD5 SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5
2010.10.07 12:10:34 LOG7[80824:25144]: SSL socket closed on SSL_read
2010.10.07 12:10:34 LOG7[80824:25144]: Sending socket write shutdown
2010.10.07 12:10:34 LOG5[80824:25144]: Connection closed: 53 bytes sent to SSL, 118 bytes sent to socket
2010.10.07 12:10:34 LOG7[80824:25144]: Service gmail finished (0 left)
答案1
我在 W2003 x64 数据中心服务器(虚拟服务器)上遇到了同样的问题。关闭 Windows Firefall 并没有解决问题。有一件事让我感到疑惑:该服务没有出现在 services.msc - 列表中。
在将 service=stunnel 添加到 conf 文件后,它似乎可以工作了。
然后我重启了服务器,它又不工作了。我登录后,通过 services.msc 重启了服务,它又工作了。真是奇怪的事情。
答案2
尝试输入:
foreground = yes
在那里。
“stunnel.log” 包含任何您可以发布的内容吗?