当前位置:   article > 正文

检查网站的TLS版本_linux tls版本 查询

linux tls版本 查询

有时候需要知道某个网站支持的TLS的版本。现在SSL 2.0SSL 3.0都已经被淘汰了。其中TLS 1.0TLS 1.1TLS 1.2是目前的的主流,相对也是安全的。主要看加密的算法。TLS 1.3是目前最新的协议版本,也是相对最安全的版本了。

通过网页查看

通过命令行

OpenSSL

  1. openssl s_client -connect www.baidu.com:443 -tls1_2
  2. openssl s_client -connect www.baidu.com:443 -tls1_1
  3. openssl s_client -connect www.baidu.com:443 -tls1

以上分别检查了tls1.2,tls1.1和``tls1`。如果握手失败的话,那么就是不支持了。

NMAP

依赖于nmap

 nmap --script ssl-enum-ciphers -p 443 baidu.com 

结果如下:

  1. Starting Nmap 7.91 ( https://nmap.org ) at 2020-11-29 09:51 CST
  2. Nmap scan report for baidu.com (39.156.69.79)
  3. Host is up (0.0068s latency).
  4. Other addresses for baidu.com (not scanned): 220.181.38.148
  5. PORT STATE SERVICE
  6. 443/tcp open https
  7. | ssl-enum-ciphers:
  8. | SSLv3:
  9. | ciphers:
  10. | TLS_ECDHE_RSA_WITH_RC4_128_SHA (secp256r1) - C
  11. | TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
  12. | TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
  13. | TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
  14. | TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
  15. | TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - C
  16. | compressors:
  17. | NULL
  18. | cipher preference: server
  19. | warnings:
  20. | Broken cipher RC4 is deprecated by RFC 7465
  21. | CBC-mode cipher in SSLv3 (CVE-2014-3566)
  22. | TLSv1.0:
  23. | ciphers:
  24. | TLS_ECDHE_RSA_WITH_RC4_128_SHA (secp256r1) - C
  25. | TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
  26. | TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
  27. | TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
  28. | TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
  29. | TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - C
  30. | compressors:
  31. | NULL
  32. | cipher preference: server
  33. | warnings:
  34. | Broken cipher RC4 is deprecated by RFC 7465
  35. | TLSv1.1:
  36. | ciphers:
  37. | TLS_ECDHE_RSA_WITH_RC4_128_SHA (secp256r1) - C
  38. | TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
  39. | TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
  40. | TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
  41. | TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
  42. | TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - C
  43. | compressors:
  44. | NULL
  45. | cipher preference: server
  46. | warnings:
  47. | Broken cipher RC4 is deprecated by RFC 7465
  48. | TLSv1.2:
  49. | ciphers:
  50. | TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (secp256r1) - A
  51. | TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (secp256r1) - A
  52. | TLS_ECDHE_RSA_WITH_RC4_128_SHA (secp256r1) - C
  53. | TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
  54. | TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
  55. | TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (secp256r1) - A
  56. | TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (secp256r1) - A
  57. | TLS_RSA_WITH_AES_128_GCM_SHA256 (rsa 2048) - A
  58. | TLS_RSA_WITH_AES_256_GCM_SHA384 (rsa 2048) - A
  59. | TLS_RSA_WITH_AES_128_CBC_SHA256 (rsa 2048) - A
  60. | TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
  61. | TLS_RSA_WITH_AES_256_CBC_SHA256 (rsa 2048) - A
  62. | TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
  63. | TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - C
  64. | compressors:
  65. | NULL
  66. | cipher preference: server
  67. | warnings:
  68. | Broken cipher RC4 is deprecated by RFC 7465
  69. |_ least strength: C
  70. Nmap done: 1 IP address (1 host up) scanned in 3.22 seconds

PowerShell

可以用如下的函数,来源:Test web server SSL/TLS protocol support with PowerShell - PKI Extensions

  1. function Test-ServerSSLSupport {
  2. [CmdletBinding()]
  3. param(
  4. [Parameter(Mandatory = $true, ValueFromPipeline = $true)]
  5. [ValidateNotNullOrEmpty()]
  6. [string]$HostName,
  7. [UInt16]$Port = 443
  8. )
  9. process {
  10. $RetValue = New-Object psobject -Property @{
  11. Host = $HostName
  12. Port = $Port
  13. SSLv2 = $false
  14. SSLv3 = $false
  15. TLSv1_0 = $false
  16. TLSv1_1 = $false
  17. TLSv1_2 = $false
  18. KeyExhange = $null
  19. HashAlgorithm = $null
  20. }
  21. "ssl2", "ssl3", "tls", "tls11", "tls12" | %{
  22. $TcpClient = New-Object Net.Sockets.TcpClient
  23. $TcpClient.Connect($RetValue.Host, $RetValue.Port)
  24. $SslStream = New-Object Net.Security.SslStream $TcpClient.GetStream(),
  25. $true,
  26. ([System.Net.Security.RemoteCertificateValidationCallback]{ $true })
  27. $SslStream.ReadTimeout = 15000
  28. $SslStream.WriteTimeout = 15000
  29. try {
  30. $SslStream.AuthenticateAsClient($RetValue.Host,$null,$_,$false)
  31. $RetValue.KeyExhange = $SslStream.KeyExchangeAlgorithm
  32. $RetValue.HashAlgorithm = $SslStream.HashAlgorithm
  33. $status = $true
  34. } catch {
  35. $status = $false
  36. }
  37. switch ($_) {
  38. "ssl2" {$RetValue.SSLv2 = $status}
  39. "ssl3" {$RetValue.SSLv3 = $status}
  40. "tls" {$RetValue.TLSv1_0 = $status}
  41. "tls11" {$RetValue.TLSv1_1 = $status}
  42. "tls12" {$RetValue.TLSv1_2 = $status}
  43. }
  44. # dispose objects to prevent memory leaks
  45. $TcpClient.Dispose()
  46. $SslStream.Dispose()
  47. }
  48. $RetValue
  49. }
  50. }

转载于:检查网站的TLS版本 – wentao's blog

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/624254
推荐阅读
相关标签
  

闽ICP备14008679号