-
Notifications
You must be signed in to change notification settings - Fork 852
ja4_fingerprint: Add an option to disable logging #12938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -78,13 +78,22 @@ Key Differences from JA3 | |||||||||||||
| Plugin Configuration | ||||||||||||||
| ==================== | ||||||||||||||
|
|
||||||||||||||
| The plugin operates as a global plugin and has no configuration options. | ||||||||||||||
| The plugin operates as a global plugin. | ||||||||||||||
|
|
||||||||||||||
| To enable the plugin, add the following line to :file:`plugin.config`:: | ||||||||||||||
|
|
||||||||||||||
| ja4_fingerprint.so | ||||||||||||||
|
|
||||||||||||||
| No additional parameters are required or supported. | ||||||||||||||
|
|
||||||||||||||
| .. option:: --preserve | ||||||||||||||
|
|
||||||||||||||
| This option controls whether the plugin preserves any existing JA4 header. If the option is specified the plugin keep the header | ||||||||||||||
| intact. If the option is not speficied, the plugins appends a generated fingerprint to the existing header value. | ||||||||||||||
|
Comment on lines
+90
to
+91
|
||||||||||||||
| This option controls whether the plugin preserves any existing JA4 header. If the option is specified the plugin keep the header | |
| intact. If the option is not speficied, the plugins appends a generated fingerprint to the existing header value. | |
| This option controls whether the plugin preserves any existing JA4 header. | |
| If the option is specified, the plugin keeps the header intact. If the | |
| option is not specified, the plugin appends a generated fingerprint to the | |
| existing header value. |
Copilot
AI
Mar 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"This option disables log output" is ambiguous now that debug logging (Dbg) still emits fingerprints when debug tags are enabled. Please clarify that --nologging disables writing to ja4_fingerprint.log (text log), and whether debug output is still expected.
| This option disables log output. | |
| This option disables writing fingerprints to the :file:`ja4_fingerprint.log` text log file. It does not affect Traffic Server debug | |
| logging (``Dbg``); if relevant debug tags are enabled, fingerprints may still appear in debug logs. |
Copilot
AI
Mar 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"if the feature is not disabled" is unclear—this appears to refer specifically to --nologging. Consider rephrasing to explicitly mention --nologging, and also update earlier sections (e.g., the "Plugin Behavior" bullet that says it always "Log to File") to reflect the conditional logging behavior.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,15 +81,17 @@ constexpr unsigned int EXT_SUPPORTED_VERSIONS{0x2b}; | |
| DbgCtl dbg_ctl{PLUGIN_NAME}; | ||
|
|
||
| int global_preserve_enabled{0}; | ||
| int global_nologging_enabled{0}; | ||
|
|
||
| } // end anonymous namespace | ||
|
|
||
| static bool | ||
| read_config_option(int argc, char const *argv[], int &preserve) | ||
| read_config_option(int argc, char const *argv[], int &preserve, int &no_logging) | ||
| { | ||
| const struct option longopts[] = { | ||
| {"preserve", no_argument, &preserve, 1}, | ||
| {nullptr, 0, nullptr, 0} | ||
| {"preserve", no_argument, &preserve, 1}, | ||
| {"nologging", no_argument, &no_logging, 1}, | ||
| {nullptr, 0, nullptr, 0} | ||
| }; | ||
|
|
||
| optind = 0; | ||
|
|
@@ -108,6 +110,7 @@ read_config_option(int argc, char const *argv[], int &preserve) | |
| } | ||
|
|
||
| Dbg(dbg_ctl, "JA4 preserve is %s", (preserve == 1) ? "enabled" : "disabled"); | ||
| Dbg(dbg_ctl, "JA4 nologging is %s", (no_logging == 1) ? "enabled" : "disabled"); | ||
| return true; | ||
| } | ||
|
|
||
|
|
@@ -148,16 +151,18 @@ TSPluginInit(int argc, char const **argv) | |
| TSError("[%s] Failed to register.", PLUGIN_NAME); | ||
| return; | ||
| } | ||
| if (!read_config_option(argc, argv, global_preserve_enabled)) { | ||
| if (!read_config_option(argc, argv, global_preserve_enabled, global_nologging_enabled)) { | ||
| TSError("[%s] Failed to parse options.", PLUGIN_NAME); | ||
| return; | ||
| } | ||
| reserve_user_arg(); | ||
| if (!create_log_file()) { | ||
| TSError("[%s] Failed to create log.", PLUGIN_NAME); | ||
| return; | ||
| } else { | ||
| Dbg(dbg_ctl, "Created log file."); | ||
| if (!global_nologging_enabled) { | ||
| if (!create_log_file()) { | ||
| TSError("[%s] Failed to create log.", PLUGIN_NAME); | ||
| return; | ||
| } else { | ||
| Dbg(dbg_ctl, "Created log file."); | ||
| } | ||
| } | ||
|
Comment on lines
+159
to
166
|
||
| register_hooks(); | ||
| } | ||
|
|
@@ -207,8 +212,11 @@ handle_client_hello(TSCont /* cont ATS_UNUSED */, TSEvent event, void *edata) | |
| } else { | ||
| auto data{std::make_unique<JA4_data>()}; | ||
| data->fingerprint = get_fingerprint(ch); | ||
| Dbg(dbg_ctl, "JA4 fingerprint: %s", data->fingerprint.c_str()); | ||
| get_IP(TSNetVConnRemoteAddrGet(ssl_vc), data->IP_addr); | ||
| log_fingerprint(data.get()); | ||
| if (!global_nologging_enabled) { | ||
| log_fingerprint(data.get()); | ||
| } | ||
| // The VCONN_CLOSE handler is now responsible for freeing the resource. | ||
| TSUserArgSet(ssl_vc, *get_user_arg_index(), static_cast<void *>(data.release())); | ||
| } | ||
|
Comment on lines
220
to
222
|
||
|
|
@@ -259,7 +267,6 @@ get_IP(sockaddr const *s_sockaddr, char res[INET6_ADDRSTRLEN]) | |
| void | ||
| log_fingerprint(JA4_data const *data) | ||
| { | ||
| Dbg(dbg_ctl, "JA4 fingerprint: %s", data->fingerprint.c_str()); | ||
| if (TS_ERROR == TSTextLogObjectWrite(*get_log_handle(), "Client IP: %s\tJA4: %s", data->IP_addr, data->fingerprint.c_str())) { | ||
| Dbg(dbg_ctl, "Failed to write to log!"); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in documentation: "speficied" should be "specified".