深入解析:openssl s_client 命令——测试、调试和诊断 SSL/TLS 连接
目录
openssl s_client 命令详解
openssl s_client 是一个功能强大的 SSL/TLS 客户端工具,用于测试、调试和诊断 SSL/TLS 连接。
基本语法
openssl s_client [options] [host:port]
常用参数详解
连接参数
-connect <目标主机:目标端口>- 指定要连接的远程服务器
# 基本用法
openssl s_client -connect example.com:443
# 连接本地服务
openssl s_client -connect localhost:8443
# 使用 IP 地址
openssl s_client -connect 192.168.1.100:443
-bind <本地IP:本地端口>- 指定客户端使用的哪个本地源地址和端口
# 绑定到特定本地 IP
openssl s_client -connect example.com:443 -bind 192.168.1.50:0
# 绑定到特定本地端口
openssl s_client -connect example.com:443 -bind 0.0.0.0:12345
# 绑定到具体 IP 和端口
openssl s_client -connect example.com:443 -bind 192.168.1.50:54321
注意事项:
- :0 表示让系统自动选择可用端口
- 0.0.0.0 表示绑定到所有本地接口
- 必须确保绑定的 IP 地址在本地系统上已配置且可用
-proxy <目标代理:本地端口>- 通过 HTTP 代理连接
# 通过代理连接
openssl s_client -connect example.com:443 -prox

浙公网安备 33010602011771号