Add telemetry event ()

* test sending new event from sshd after kex exchange

* rename telemetry event for clarity

* add comments

* remove else since if block has fatal call

* rename method for additional clarity
This commit is contained in:
Tess Gauthier 2023-12-07 14:35:34 -05:00 committed by GitHub
parent 4ee8dc6498
commit 4cd3519fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 2 deletions

View File

@ -119,6 +119,19 @@ void send_encryption_telemetry(const char* direction,
TraceLoggingUnregister(g_hProvider1);
}
void send_kex_exch_exit_code_telemetry(const int exit_code)
{
TraceLoggingRegister(g_hProvider1);
TraceLoggingWrite(
g_hProvider1,
"KexExchExitCodeSSHD",
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TraceLoggingInt16(exit_code, "KexExchExitCodeSSHD")
);
TraceLoggingUnregister(g_hProvider1);
}
void send_pubkey_telemetry(const char* pubKeyStatus)
{
TraceLoggingRegister(g_hProvider1);
@ -205,4 +218,3 @@ void send_ssh_version_telemetry(const char* ssh_version,
);
TraceLoggingUnregister(g_hProvider1);
}

View File

@ -12,6 +12,9 @@ void send_encryption_telemetry(const char* direction,
const char* comp, const char* host_key,
const char** cproposal, const char** sproposal);
// sends exit code of kex_exchange_identification(), utilized only in sshd
void send_kex_exch_exit_code_telemetry(const int exit_code);
// sends status if using key-based auth
void send_pubkey_telemetry(const char* pubKeyStatus);

10
sshd.c
View File

@ -2723,8 +2723,16 @@ done_loading_hostkeys:
alarm(options.login_grace_time);
if ((r = kex_exchange_identification(ssh, -1,
options.version_addendum)) != 0)
options.version_addendum)) != 0)
#ifdef WINDOWS
{
send_kex_exch_exit_code_telemetry(r);
#endif /* WINDOWS */
sshpkt_fatal(ssh, r, "banner exchange");
#ifdef WINDOWS
}
send_kex_exch_exit_code_telemetry(0);
#endif /* WINDOWS */
idexch_done:
ssh_packet_set_nonblocking(ssh);