mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Add very basic ocsp stapling support.
This only allows access to the ocsp stapling response data. No verification or anything else at the moment.
This commit is contained in:
parent
9b7eb293f1
commit
c24629abf4
7 changed files with 41 additions and 2 deletions
|
@ -81,5 +81,6 @@
|
||||||
# Detect SHA1 sums in Team Cymru's Malware Hash Registry.
|
# Detect SHA1 sums in Team Cymru's Malware Hash Registry.
|
||||||
@load frameworks/files/detect-MHR
|
@load frameworks/files/detect-MHR
|
||||||
|
|
||||||
# Load heartbleed detection. Only superficially tested, might contain bugs.
|
# Uncomment the following line to enable detection of the heartbleed attack. Enabling
|
||||||
@load policy/protocols/ssl/heartbleed
|
# this might impact performance a bit.
|
||||||
|
# @load policy/protocols/ssl/heartbleed
|
||||||
|
|
|
@ -214,6 +214,8 @@ event ssl_session_ticket_handshake%(c: connection, ticket_lifetime_hint: count,
|
||||||
##
|
##
|
||||||
## c: The connection.
|
## c: The connection.
|
||||||
##
|
##
|
||||||
|
## is_orig: True if event is raised for originator side of the connection.
|
||||||
|
##
|
||||||
## length: length of the entire heartbeat message.
|
## length: length of the entire heartbeat message.
|
||||||
##
|
##
|
||||||
## heartbeat_type: type of the heartbeat message. Per RFC, 1 = request, 2 = response
|
## heartbeat_type: type of the heartbeat message. Per RFC, 1 = request, 2 = response
|
||||||
|
@ -236,9 +238,21 @@ event ssl_heartbeat%(c: connection, is_orig: bool, length: count, heartbeat_type
|
||||||
##
|
##
|
||||||
## c: The connection.
|
## c: The connection.
|
||||||
##
|
##
|
||||||
|
## is_orig: True if event is raised for originator side of the connection.
|
||||||
|
##
|
||||||
## length: length of the entire heartbeat message.
|
## length: length of the entire heartbeat message.
|
||||||
##
|
##
|
||||||
## .. bro:see:: ssl_client_hello ssl_established ssl_extension ssl_server_hello
|
## .. bro:see:: ssl_client_hello ssl_established ssl_extension ssl_server_hello
|
||||||
## ssl_alert ssl_heartbeat
|
## ssl_alert ssl_heartbeat
|
||||||
event ssl_encrypted_heartbeat%(c: connection, is_orig: bool, length: count%);
|
event ssl_encrypted_heartbeat%(c: connection, is_orig: bool, length: count%);
|
||||||
|
|
||||||
|
## This event contains the OCSP response contained in a Certificate Status Request
|
||||||
|
## message, when the client requested OCSP stapling and the server supports it. See
|
||||||
|
## description in :rfc:`6066`
|
||||||
|
##
|
||||||
|
## c: The connection.
|
||||||
|
##
|
||||||
|
## is_orig: True if event is raised for originator side of the connection.
|
||||||
|
##
|
||||||
|
## response: OCSP data.
|
||||||
|
event ssl_stapled_ocsp%(c: connection, is_orig: bool, response: string%);
|
||||||
|
|
|
@ -389,6 +389,17 @@ refine connection SSL_Conn += {
|
||||||
return true;
|
return true;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
function proc_certificate_status(rec : SSLRecord, status_type: uint8, response: bytestring) : bool
|
||||||
|
%{
|
||||||
|
if ( status_type == 1 ) // ocsp
|
||||||
|
{
|
||||||
|
BifEvent::generate_ssl_stapled_ocsp(bro_analyzer(),
|
||||||
|
bro_analyzer()->Conn(), ${rec.is_orig},
|
||||||
|
new StringVal(response.length(), (const char*) response.data()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
%}
|
||||||
};
|
};
|
||||||
|
|
||||||
refine typeattr Alert += &let {
|
refine typeattr Alert += &let {
|
||||||
|
@ -473,3 +484,7 @@ refine typeattr ApplicationLayerProtocolNegotiationExtension += &let {
|
||||||
refine typeattr ServerNameExt += &let {
|
refine typeattr ServerNameExt += &let {
|
||||||
proc : bool = $context.connection.proc_server_name(rec, server_names);
|
proc : bool = $context.connection.proc_server_name(rec, server_names);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
refine typeattr CertificateStatus += &let {
|
||||||
|
proc : bool = $context.connection.proc_certificate_status(rec, status_type, response);
|
||||||
|
};
|
||||||
|
|
|
@ -341,6 +341,7 @@ type Certificate(rec: SSLRecord) = record {
|
||||||
|
|
||||||
type CertificateStatus(rec: SSLRecord) = record {
|
type CertificateStatus(rec: SSLRecord) = record {
|
||||||
status_type: uint8; # 1 = ocsp, everything else is undefined
|
status_type: uint8; # 1 = ocsp, everything else is undefined
|
||||||
|
length : uint24;
|
||||||
response: bytestring &restofdata;
|
response: bytestring &restofdata;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
F, 1995
|
BIN
testing/btest/Traces/tls/ocsp-stapling.trace
Normal file
BIN
testing/btest/Traces/tls/ocsp-stapling.trace
Normal file
Binary file not shown.
|
@ -0,0 +1,7 @@
|
||||||
|
# @TEST-EXEC: bro -C -r $TRACES/tls/ocsp-stapling.trace %INPUT
|
||||||
|
# @TEST-EXEC: btest-diff .stdout
|
||||||
|
|
||||||
|
event ssl_stapled_ocsp(c: connection, is_orig: bool, response: string)
|
||||||
|
{
|
||||||
|
print is_orig, |response|;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue