如何使用OpenSSL s_client检查和验证HTTPS Web服务器的SSL / TLS?

OpenSSL provides different features and tools for SSL/TLS related operations. s_lient is a tool used to connect, check, list HTTPS, TLS/SSL related information. Simply we can check remote TLS/SSL connection with s_client . In these tutorials, we will look at different use cases of s_client .

OpenSSL为SSL / TLS相关操作提供了不同的功能和工具。 s_lient是用于连接,检查,列出HTTPS,TLS / SSL相关信息的工具。 只需我们可以使用s_client检查远程TLS / SSL连接。 在这些教程中,我们将研究s_client不同用例。

检查网站的TLS / SSL (Check TLS/SSL Of Website)

The basic and most popular use case for s_client is just connecting remote TLS/SSL website. We will provide the web site with the HTTPS port number. In this example we will connect to the poftut.com .

s_client的基本且最受欢迎的用例是仅连接远程TLS / SSL网站。 我们将为网站提供HTTPS端口号。 在此示例中,我们将连接到poftut.com

$ openssl s_client -connect poftut.com:443
Check TLS/SSL Of Website
Check TLS/SSL Of Website
检查网站的TLS / SSL

使用指定的证书颁发机构检查网站的TLS / SSL (Check TLS/SSL Of Website with Specifying Certificate Authority)

If the web site certificates are created in house or the web browsers or Global Certificate Authorities do not sign the certificate of the remote site we can provide the signing certificate or Certificate authority. We will use -CAfile by providing the Certificate Authority File.

如果网站证书是在内部创建的,或者Web浏览器或全局证书颁发机构不对远程站点的证书进行签名,我们可以提供签名证书或证书颁发机构。 我们将通过提供证书颁发机构文件来使用-CAfile

$ openssl s_client -connect poftut.com:443 -CAfile /etc/ssl/CA.crt

连接Smtp并升级到TLS (Connect Smtp and Upgrade To TLS)

We can use s_client to test SMTP protocol and port and then upgrade to TLS connection. We will use -starttls smtp command. We will use the following command.

我们可以使用s_client测试SMTP协议和端口,然后升级到TLS连接。 我们将使用-starttls smtp命令。 我们将使用以下命令。

$ openssl s_client -connect smtp.poftut.com:25 -starttls smtp

连接HTTPS站点禁用SSL2 (Connect HTTPS Site Disabling SSL2)

HTTPS or SSL/TLS have different subversions. We can enable or disable the usage of some of them. In this example, we will disable SSLv2 connection with the following command.

HTTPS或SSL / TLS具有不同的子版本。 我们可以启用或禁用其中一些功能。 在此示例中,我们将使用以下命令禁用SSLv2连接。

$ openssl s_client -connect poftut.com:443 -no_ssl2

仅连接HTTPS TLS1或TLS2 (Connect HTTPS Only TLS1 or TLS2)

Like the previous example, we can specify the encryption version. In this example, we will only enable TLS1 or TLS2 with the -tls1_2 .

像前面的示例一样,我们可以指定加密版本。 在此示例中,我们仅使用-tls1_2启用TLS1或-tls1_2

$ openssl s_client -connect poftut.com:443 -tls1_2

指定密码或加密类型 (Specify Cipher or Encryption Type)

We can specify the cipher with the -cipher option like below.

我们可以使用-cipher选项指定密码,如下所示。

$ openssl s_client -connect poftut.com:443 -cipher RC4-SHA

仅连接HTTPS RC4-SHA (Connect HTTPS Only RC4-SHA)

We can also specify the hash algorithm of the encryption protocol. In this example, we will only enable RC4-SHA hash algorithm for SSL/TLS connection. We will use -cipher RC4-SHA . All other encryption and Cipher types will be denied and the connection will be closed.

我们还可以指定加密协议的哈希算法。 在此示例中,我们将仅为SSL / TLS连接启用RC4-SHA哈希算法。 我们将使用-cipher RC4-SHA 。 所有其他加密和密码类型将被拒绝,连接将被关闭。

$ openssl s_client -connect poftut.com:443 -cipher RC4-SHA

将SSL / TLS调试为HTTPS (Debug SSL/TLS To The HTTPS)

While a SSL/TLS connection is made there is a lot of operation under the hood. If we have some problems or we need detailed information about the SSL/TLS initialization we can use -tlsextdebug option like below.

虽然建立了SSL / TLS连接,但在后台进行了大量操作。 如果我们有一些问题,或者需要有关SSL / TLS初始化的详细信息,我们可以使用-tlsextdebug选项,如下所示。

$ openssl s_client -connect poftut.com:443 -tlsextdebug
Debug SSL/TLS To The HTTPS
Debug SSL/TLS To The HTTPS
将SSL / TLS调试为HTTPS
LEARN MORE  Linux curl Command Tutorial With Examples
了解更多Linux curl命令示例教程

翻译自: https://www.poftut.com/use-openssl-s_client-check-verify-ssltls-https-webserver/

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值