Skip to content

Commit a057d5b

Browse files
authored
Merge pull request #306 from raphaelm/patch-1
Fail silently if there is no OCSP server
2 parents 7125960 + 077a68f commit a057d5b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/resty/auto-ssl/ssl_certificate.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ end
159159
local function get_ocsp_response(fullchain_der, auto_ssl_instance)
160160
-- Pull the OCSP URL to hit out of the certificate chain.
161161
local ocsp_url, ocsp_responder_err = ocsp.get_ocsp_responder_from_der_chain(fullchain_der)
162-
if not ocsp_url then
162+
if not ocsp_url and not ocsp_responder_err then
163+
-- There is no OCSP responder, stop silently
164+
return "", nil
165+
elseif not ocsp_url then
163166
return nil, "failed to get OCSP responder: " .. (ocsp_responder_err or "")
164167
end
165168

@@ -236,9 +239,11 @@ local function set_ocsp_stapling(domain, cert_der, auto_ssl_instance)
236239
end
237240

238241
-- Set the OCSP stapling response.
239-
local ok, ocsp_status_err = ocsp.set_ocsp_status_resp(ocsp_resp)
240-
if not ok then
241-
return false, "failed to set ocsp status resp: " .. (ocsp_status_err or "")
242+
if ocsp_resp ~= "" then
243+
local ok, ocsp_status_err = ocsp.set_ocsp_status_resp(ocsp_resp)
244+
if not ok then
245+
return false, "failed to set ocsp status resp: " .. (ocsp_status_err or "")
246+
end
242247
end
243248

244249
return true

0 commit comments

Comments
 (0)