Openssl TLS 扩展支持配置(服务器名称指示)
我想配置 openssl 客户端服务器以支持 TLS 扩展,特别是服务器名称指示 (SNI)。
我已经在 ubuntu linux 上构建了最新的 openssl 1.0.0e,没有提供任何额外的配置参数。
./config make make install
不确定在构建此版本时是否需要提供任何其他配置参数。
现在我已经设置了服务器并使用 openssl 提供的标准命令行工具(即 s_client 和 s_server)通过 openssl 客户端连接到它。
我的问题是:如何在 s_client 中指定要作为扩展名发送的主机名? openssl 是否可以在命令行中使用某些参数指定服务器名称?
谢谢!
I want to configure openssl client-server to support TLS extensions specifically server name indication (SNI).
I have build the latest openssl 1.0.0e on ubuntu linux without giving any additional config parameter.
./config make make install
Not sure if I need to give any additional config parameters while building for this version.
Now I have set up server and connecting to it through openssl client using the standard command line tool provided by openssl, viz s_client and s_server.
My question is: how do I specify the host name to be sent as extension in s_client? Does openssl have the provision to specify server name using some parameter in commandline?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这已经休眠了一段时间了。因为我很久以前就想到了这一点,所以写下答案并结束它是合乎逻辑的。
命令行选项
servername
可用于指定SNI。上述命令将使用客户端 hello 的 SNI 扩展中存在的给定服务器名称触发 TLS 客户端。
This has been lying dormant for some time. Since I figured this out long back, it would be logical to write the answer and put a closure to this.
The command-line option
servername
is available to specify SNI.The above command will trigger TLS client with the given server name present in SNI extension of client hello.
要使用 s_server,您可以使用以下命令:
openssl s_server -accept 443 -cert normal_cert.pem -key normal_key.ky -servername xyz.com -cert2 sni_cert.pem -key2 sni_key.ky
每当客户端请求不带服务器名扩展的服务器时服务器将回复normal_cert,如果服务器名称扩展是client hello,则服务器将回复sni_cert。
要将 s_client 与 SNI 一起使用,您可以使用以下命令:
openssl s_client -servername xyz.com -connect ip:port
For using s_server you can use the command:
openssl s_server -accept 443 -cert normal_cert.pem -key normal_key.ky -servername xyz.com -cert2 sni_cert.pem -key2 sni_key.ky
Here whenever the client will request the server without servername extension the server will reply with normal_cert and if there is servername extension is client hello then server will reply with the sni_cert.
For using s_client with SNI you can use the command:
openssl s_client -servername xyz.com -connect ip:port
相关的命令行选项有:
starttls prot
:在为支持它的协议启动 TLS 之前使用 STARTTLS 命令,其中“prot”定义采用哪一个协议。目前仅支持“smtp”、“pop3”、“imap”、“ftp”和“xmpp”。servername host
:设置 TLS 扩展服务器名The relevant commandline options are:
starttls prot
: use the STARTTLS command before starting TLS for those protocols that support it, where 'prot' defines which one to assume. Currently only "smtp", "pop3", "imap", "ftp" and "xmpp" are supported.servername host
: Set TLS extension servername