我正在使用 stunnel 处理多个域证书。我有两个域 test.int 和 test1.int,并为每个域提供了多个证书和一个默认证书。我使用 stunnel 的 sni 选项来提供多个域证书。我尝试使用 javascript websocket 连接到安全服务器,但日志文件输出显示
SNI: extension not received from the client
所以我不确定 sni 选项是否受支持。有人能帮我解释一下它是否有效吗?“SNI:未从客户端收到扩展”语句的含义是什么。
提前感谢您的宝贵答案。
我的 stunnel.config 文件
output=/var/log/stunnel.log
pid=
debug = 7
fips = no
compression = rle
options = NO_SSLv2
syslog = no
[websockets]
cert = /usr/local/etc/stunnel/default.crt
key = /usr/local/etc/stunnel/default.key
accept = 0.0.0.0:9443
connect = 127.0.0.1:9000
[sni1]
sni = websockets:mailxf.test.int
cert = /usr/local/etc/stunnel/test.int.crt
key = /usr/local/etc/stunnel/test.int.key
connect = 127.0.0.1:9000
[sni2]
sni = websockets:mailxf.test1.int
cert = /usr/local/etc/stunnel/test1.int.crt
key = /usr/local/etc/stunnel/test1.int.key
connect = 127.0.0.1:9000
日志文件输出
Service [websockets] accepted (FD=9) from 192.168.0.132:38257
2014.04.14 18:30:32 LOG7[7085:139648669734672]: Service [websockets] started
2014.04.14 18:30:32 LOG5[7085:139648669734672]: Service [websockets] accepted connection from 192.168.0.132:38257
2014.04.14 18:30:32 LOG7[7085:139648669734672]: SSL state (accept): before/accept initialization
**2014.04.14 18:30:32 LOG5[7085:139648669734672]: SNI: extension not received from the client**
2014.04.14 18:30:32 LOG7[7085:139648669734672]: SSL state (accept): SSLv3 read client hello A
2014.04.14 18:30:32 LOG7[7085:139648669734672]: SSL state (accept): SSLv3 write server hello A
2014.04.14 18:30:32 LOG7[7085:139648669734672]: SSL state (accept): SSLv3 write change cipher spec A
2014.04.14 18:30:32 LOG7[7085:139648669734672]: SSL state (accept): SSLv3 write finished A
2014.04.14 18:30:32 LOG7[7085:139648669734672]: SSL state (accept): SSLv3 flush data
2014.04.14 18:30:32 LOG7[7085:139648669734672]: SSL state (accept): SSLv3 read finished A
2014.04.14 18:30:32 LOG7[7085:139648669734672]: 2 items in the session cache
2014.04.14 18:30:32 LOG7[7085:139648669734672]: 0 client connects (SSL_connect())
2014.04.14 18:30:32 LOG7[7085:139648669734672]: 0 client connects that finished
2014.04.14 18:30:32 LOG7[7085:139648669734672]: 0 client renegotiations requested
2014.04.14 18:30:32 LOG7[7085:139648669734672]: 19 server connects (SSL_accept())
2014.04.14 18:30:32 LOG7[7085:139648669734672]: 19 server connects that finished
2014.04.14 18:30:32 LOG7[7085:139648669734672]: 0 server renegotiations requested
2014.04.14 18:30:32 LOG7[7085:139648669734672]: 14 session cache hits
2014.04.14 18:30:32 LOG7[7085:139648669734672]: 0 external session cache hits
2014.04.14 18:30:32 LOG7[7085:139648669734672]: 0 session cache misses
2014.04.14 18:30:32 LOG7[7085:139648669734672]: 2 session cache timeouts
2014.04.14 18:30:32 LOG6[7085:139648669734672]: SSL accepted: previous session reused
2014.04.14 18:30:32 LOG6[7085:139648669734672]: connect_blocking: connecting 127.0.0.1:9000
2014.04.14 18:30:32 LOG7[7085:139648669734672]: connect_blocking: s_poll_wait 127.0.0.1:9000: waiting 10 seconds
2014.04.14 18:30:32 LOG5[7085:139648669734672]: connect_blocking: connected 127.0.0.1:9000
2014.04.14 18:30:32 LOG5[7085:139648669734672]: Service [websockets] connected remote server from 127.0.0.1:44325
2014.04.14 18:30:32 LOG7[7085:139648669734672]: Remote socket (FD=10) initialized
用于连接安全服务器的 Javascript 代码,
wss://mailxf.test.int:9443/bo/socket.bo.php
我使用的网络浏览器版本是 Chrome 26 和 Firefox 24,操作系统版本是 centos 6。
答案1
您尝试直接连接到 IP 地址,而不是主机名。因此,SNI 没有任何意义,因为您没有提供名称。您应该使用主机名。
例如:
wss://example.com:9443/bo/socket.bo.php