【问题标题】:I want to use JMeter to simulate the TLS handshake process我想用JMeter来模拟TLS握手过程
【发布时间】:2019-12-09 05:02:48
【问题描述】:

我想修改 TLS 握手过程中的每一步,以测试我的 tls 服务器是否符合规范。 比如我想用JMeter来模拟TLS的第一个“client_hello”请求,我可以在JMeter中自定义TLS协议中的参数内容。例如,我可以将“version”值设置为“aaabbb”,故意让协商失败。 有什么好主意吗? handshake process

【问题讨论】:

标签: ssl jmeter tls1.2


【解决方案1】:

根据 JMeter 用户手册的SSL Encryption 章节

JMeter HTTP 采样器配置为接受所有证书,无论是否受信任,无论有效期等。这是为了在测试服务器时提供最大的灵活性。

因此,如果您需要验证TLS handshake,则需要手动编写连接逻辑脚本,包括使用Apache HttpComponents 使用JSR223 Sampler and Groovy language 的低级传输设置

示例代码:

def sslContext = org.apache.http.conn.ssl.SSLContexts.custom().useTLS().build()

String [] protocols = ['aaabbb']

def f = new org.apache.http.conn.ssl.SSLConnectionSocketFactory(sslContext, protocols, null, org.apache.http.conn.ssl.SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER)

def client = org.apache.http.impl.client.HttpClients.custom().setSSLSocketFactory(f).build();

def get = new org.apache.http.client.methods.HttpGet('https://example.com')

client.execute(get)

演示:

【讨论】:

    猜你喜欢
    • 2012-04-15
    • 2012-06-11
    • 2016-03-21
    • 1970-01-01
    • 1970-01-01
    • 2012-04-18
    • 2020-01-07
    • 1970-01-01
    • 2014-12-09
    相关资源
    最近更新 更多