mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12:38:20 +00:00
fix expression errors in x509 policy scrips when unparseable data is in certificate chain.
This commit is contained in:
parent
96f71c24d8
commit
b16322aefb
3 changed files with 8 additions and 4 deletions
|
@ -29,7 +29,7 @@ global extracted_certs: set[string] = set() &read_expire=1hr &redef;
|
|||
|
||||
event ssl_established(c: connection) &priority=5
|
||||
{
|
||||
if ( ! c$ssl?$cert_chain || |c$ssl$cert_chain| == 0 )
|
||||
if ( ! c$ssl?$cert_chain || |c$ssl$cert_chain| == 0 || !c$ssl$cert_chain[0]?$x509 )
|
||||
return;
|
||||
|
||||
if ( ! addr_matches_host(c$id$resp_h, extract_certs_pem) )
|
||||
|
|
|
@ -36,7 +36,8 @@ event ssl_established(c: connection) &priority=3
|
|||
local chain: vector of opaque of x509 = vector();
|
||||
for ( i in c$ssl$cert_chain )
|
||||
{
|
||||
chain[i] = c$ssl$cert_chain[i]$x509$handle;
|
||||
if ( c$ssl$cert_chain[i]?$x509 )
|
||||
chain[i] = c$ssl$cert_chain[i]$x509$handle;
|
||||
}
|
||||
|
||||
if ( chain_id in recently_validated_certs )
|
||||
|
@ -49,7 +50,7 @@ event ssl_established(c: connection) &priority=3
|
|||
c$ssl$validation_status = result$result_string;
|
||||
recently_validated_certs[chain_id] = result$result_string;
|
||||
}
|
||||
|
||||
|
||||
if ( c$ssl$validation_status != "ok" )
|
||||
{
|
||||
local message = fmt("SSL certificate validation failed with (%s)", c$ssl$validation_status);
|
||||
|
|
|
@ -39,7 +39,10 @@ event ssl_established(c: connection) &priority=3
|
|||
|
||||
local chain: vector of opaque of x509 = vector();
|
||||
for ( i in c$ssl$cert_chain )
|
||||
chain[i] = c$ssl$cert_chain[i]$x509$handle;
|
||||
{
|
||||
if ( c$ssl$cert_chain[i]?$x509 )
|
||||
chain[i] = c$ssl$cert_chain[i]$x509$handle;
|
||||
}
|
||||
|
||||
local reply_id = cat(md5_hash(c$ssl$ocsp_response), join_string_vec(c$ssl$cert_chain_fuids, "."));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue