Merge in SNORT/snort3 from ~BSACHDEV/snort3:alpn_service to master
Squashed commit of the following:
commit
707eb376b25536ef398532d0466aa0c9ade171af
Author: bsachdev <bsachdev@cisco.com>
Date: Thu Nov 10 10:40:12 2022 -0500
appid: Added config for logging alpn service mappings
// after certificate-exchange). Such manual detection is disabled by default (0).
uint32_t first_decrypted_packet_debug = 0;
bool log_eve_process_client_mappings = false;
+ bool log_alpn_service_mappings = false;
#endif
bool log_stats = false;
uint32_t app_stats_period = 300;
"the first packet of an already decrypted SSL flow (debug single session only)" },
{ "log_eve_process_client_mappings", Parameter::PT_BOOL, nullptr, "false",
"enable logging of encrypted visibility engine process to client mappings" },
+ { "log_alpn_service_mappings", Parameter::PT_BOOL, nullptr, "false",
+ "enable logging of alpn service mappings" },
#endif
{ "memcap", Parameter::PT_INT, "1024:maxSZ", "1048576",
"max size of the service cache before we start pruning the cache" },
config->first_decrypted_packet_debug = v.get_uint32();
else if ( v.is("log_eve_process_client_mappings") )
config->log_eve_process_client_mappings = v.get_bool();
+ else if (v.is("log_alpn_service_mappings") )
+ config->log_alpn_service_mappings = v.get_bool();
else
#endif
if ( v.is("memcap") )
#include <algorithm>
#include "log/messages.h"
+#include "managers/inspector_manager.h"
#include "utils/util.h"
#include "appid_debug.h"
+#include "appid_inspector.h"
using namespace snort;
using namespace std;
alpn_pattern_matcher.add(p->pattern.data(), p->pattern.size(), p, true);
#ifdef REG_TEST
+ AppIdInspector* inspector =
+ (AppIdInspector*) InspectorManager::get_inspector(MOD_NAME, true);
+ if (inspector and inspector->get_ctxt().config.log_alpn_service_mappings)
LogMessage("Adding ALPN service App pattern %d %s\n",
p->app_id, p->pattern.c_str());
#endif
#include "config.h"
#endif
+#include "appid_inspector.h"
#include "service_plugins/alpn_patterns.cc"
#include "service_alpn_patterns_mock.h"
}
}
+Inspector* InspectorManager::get_inspector(char const*, bool, const snort::SnortConfig*)
+{
+ return nullptr;
+}
+
+AppIdContext* ctxt;
+AppIdContext& AppIdInspector::get_ctxt() const { return *ctxt; }
+
TEST_GROUP(alpn_patterns_tests)
{
void setup() override