#include "profiler/profiler.h"
#include "protocols/packet.h"
#include "protocols/ssl.h"
+#include "pub_sub/opportunistic_tls_event.h"
#include "search_engines/search_tool.h"
#include "stream/stream.h"
#include "utils/util_cstring.h"
{ CountType::SUM, "sessions", "total pop sessions" },
{ CountType::NOW, "concurrent_sessions", "total concurrent pop sessions" },
{ CountType::MAX, "max_concurrent_sessions", "maximum concurrent pop sessions" },
+ { CountType::SUM, "start_tls", "total STARTTLS events generated" },
+ { CountType::SUM, "ssl_search_abandoned", "total SSL search abandoned" },
+ { CountType::SUM, "ssl_srch_abandoned_early", "total SSL search abandoned too soon" },
{ CountType::SUM, "b64_attachments", "total base64 attachments decoded" },
{ CountType::SUM, "b64_decoded_bytes", "total base64 decoded bytes" },
{ CountType::SUM, "qp_attachments", "total quoted-printable attachments decoded" },
case RESP_OK:
tmp = SnortStrcasestr((const char*)cmd_start, (eol - cmd_start), "octets");
if (tmp != nullptr)
+ {
+ if (!(pop_ssn->session_flags & POP_FLAG_ABANDON_EVT)
+ and !p->flow->flags.data_decrypted)
+ {
+ pop_ssn->session_flags |= POP_FLAG_ABANDON_EVT;
+ DataBus::publish(SSL_SEARCH_ABANDONED, p);
+ popstats.ssl_search_abandoned++;
+ }
+
pop_ssn->state = STATE_DATA;
+ }
+ else if (pop_ssn->state == STATE_TLS_CLIENT_PEND)
+ {
+ if ((pop_ssn->session_flags & POP_FLAG_ABANDON_EVT)
+ and !p->flow->flags.data_decrypted)
+ {
+ popstats.ssl_srch_abandoned_early++;
+ }
+
+ OpportunisticTlsEvent event(p, p->flow->service);
+ DataBus::publish(OPPORTUNISTIC_TLS_EVENT, event, p->flow);
+ popstats.start_tls++;
+ pop_ssn->state = STATE_DECRYPTION_REQ;
+ }
else
{
pop_ssn->prev_response = RESP_OK;
if (pkt_dir == POP_PKT_FROM_CLIENT)
{
/* This packet should be a tls client hello */
- if (pop_ssn->state == STATE_TLS_CLIENT_PEND)
+ if ((pop_ssn->state == STATE_TLS_CLIENT_PEND)
+ || (pop_ssn->state == STATE_DECRYPTION_REQ))
{
if (IsTlsClientHello(p->data, p->data + p->dsize))
{