Skip to content

Commit 88ad1b4

Browse files
ADD-SPbungle
authored andcommitted
fix(mtls) use OpenResty's API for mtls (#99)
1 parent 9ce5f6d commit 88ad1b4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/resty/healthcheck.lua

+9-9
Original file line numberDiff line numberDiff line change
@@ -1018,16 +1018,16 @@ function checker:run_single_check(ip, port, hostname, hostheader)
10181018
local https_sni, session, err
10191019
https_sni = self.checks.active.https_sni or hostheader or hostname
10201020
if self.ssl_cert and self.ssl_key then
1021-
session, err = sock:tlshandshake({
1022-
verify = self.checks.active.https_verify_certificate,
1023-
client_cert = self.ssl_cert,
1024-
client_priv_key = self.ssl_key,
1025-
server_name = https_sni
1026-
})
1027-
else
1028-
session, err = sock:sslhandshake(nil, https_sni,
1029-
self.checks.active.https_verify_certificate)
1021+
ok, err = sock:setclientcert(self.ssl_cert, self.ssl_key)
1022+
1023+
if not ok then
1024+
self:log(ERR, "failed to set client certificate: ", err)
1025+
end
10301026
end
1027+
1028+
session, err = sock:sslhandshake(nil, https_sni,
1029+
self.checks.active.https_verify_certificate)
1030+
10311031
if not session then
10321032
sock:close()
10331033
self:log(ERR, "failed SSL handshake with '", hostname or "", " (", ip, ":", port, ")', using server name (sni) '", https_sni, "': ", err)

0 commit comments

Comments
 (0)