Skip to content

Telemetry #529

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

Merged
merged 42 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
94142ee
add stubbed telemetry files for win 10 sdk compatability only
tgauth Aug 11, 2021
f538052
remove privacy header from telemetry as tag is already defined in oth…
tgauth Aug 11, 2021
4c9a924
cleanup telemetry call
tgauth Aug 24, 2021
4bba47f
add telemetry functions
tgauth Sep 15, 2021
5c6ca68
rename provider group
tgauth Sep 15, 2021
1dc4516
update paths.target with win10 sdk version
tgauth Sep 21, 2021
7ec8e95
revert to using sdk var from paths.target
tgauth Sep 21, 2021
4b99f99
use var in paths.target to specify sdk version
tgauth Sep 21, 2021
dd3e61e
Merge branch 'stubbed-header-fix' into telemetry-stubbed-header
tgauth Sep 21, 2021
f3e549d
update to use sdk var defined in paths.target
tgauth Sep 21, 2021
7408471
fix spacing in unittest vcxproj
tgauth Sep 21, 2021
1cbc4ae
point to win10 sdk for all builds
tgauth Sep 21, 2021
4db523a
test appveyor
tgauth Sep 22, 2021
d726807
test appveyor again
tgauth Sep 22, 2021
1732a33
add null check in sdk version
tgauth Sep 22, 2021
c0e0cd6
add logging to null sdk check
tgauth Sep 22, 2021
8f1361e
modify logic in get-win10sdk function
tgauth Sep 22, 2021
841ddd8
add more logging to build helper
tgauth Sep 22, 2021
f653eb6
change check for sdk in build helper
tgauth Sep 22, 2021
f8596da
fix extra parentheses
tgauth Sep 22, 2021
b4f484e
update win10 sdk version
tgauth Sep 23, 2021
91e4868
debug appveyor
tgauth Sep 23, 2021
c5aba35
check vctargets path in build script
tgauth Sep 23, 2021
0ff658c
debug appveyor
tgauth Sep 23, 2021
93a1203
break out sdk and path checks
tgauth Sep 23, 2021
bd6a1eb
fix win 10 sdk version for now
tgauth Sep 23, 2021
b56b372
remove preprocessor flag since it is redundant with stubbed header
tgauth Sep 27, 2021
3b5d5c8
remove remote debug from appveyor
tgauth Sep 27, 2021
dd67c4c
cleanup build script and use specific win 10 sdk version
tgauth Oct 1, 2021
f96d760
rename telemetry functions and add windows if def
tgauth Oct 1, 2021
791708c
add comment for provider registering and unregistering
tgauth Oct 4, 2021
63e995b
fix ifdef windows for if statements
tgauth Oct 5, 2021
8e989c1
rename tracelogging event to single word
tgauth Oct 5, 2021
4f96457
make some formatting fixes
tgauth Oct 7, 2021
09c0e31
send port number from ssh instead of configured ports from sshd
tgauth Oct 7, 2021
5562de9
fix indentation on if statement
tgauth Oct 7, 2021
2680760
fix indentation
tgauth Oct 7, 2021
ec73f1d
actually fix indentation
tgauth Oct 7, 2021
150605e
fix spacing
tgauth Oct 7, 2021
fa64976
fix spacing
tgauth Oct 7, 2021
07870a1
send boolean for port info
tgauth Oct 7, 2021
baccc08
remove spaces from telemetry descriptions
tgauth Oct 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions contrib/win32/openssh/MicrosoftTelemetry.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/* ++

Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See LICENSE in the project root for license information.

Module Name:

TraceLoggingConfig.h

Abstract:

Macro definitions used by this project's TraceLogging ETW providers:

- Configuration macros that select the ETW Provider Groups to be used by
this project.
- Constants for tags that are commonly used in Microsoft's
TraceLogging-based ETW.

Different versions of this file use different definitions for the
TraceLoggingOption configuration macros. The definitions in this file are
empty. As a result, providers using this configuration file will not join
any ETW Provider Groups and will not be given any special treatment by
group-sensitive ETW listeners.

Environment:

User mode or kernel mode.

--*/

#pragma once

// Configuration macro for use in TRACELOGGING_DEFINE_PROVIDER. The definition
// in this file configures the provider as a normal (non-telemetry) provider.
#define TraceLoggingOptionMicrosoftTelemetry() \
// Empty definition for TraceLoggingOptionMicrosoftTelemetry

// Configuration macro for use in TRACELOGGING_DEFINE_PROVIDER. The definition
// in this file configures the provider as a normal (non-telemetry) provider.
#define TraceLoggingOptionWindowsCoreTelemetry() \
// Empty definition for TraceLoggingOptionWindowsCoreTelemetry

// Event privacy tags. Use the PDT macro values for the tag parameter, e.g.:
// TraceLoggingWrite(...,
// TelemetryPrivacyDataTag(PDT_BrowsingHistory | PDT_ProductAndServiceUsage),
// ...);
#define TelemetryPrivacyDataTag(tag) TraceLoggingUInt64((tag), "PartA_PrivTags")
#define PDT_BrowsingHistory 0x0000000000000002u
#define PDT_DeviceConnectivityAndConfiguration 0x0000000000000800u
#define PDT_InkingTypingAndSpeechUtterance 0x0000000000020000u
#define PDT_ProductAndServicePerformance 0x0000000001000000u
#define PDT_ProductAndServiceUsage 0x0000000002000000u
#define PDT_SoftwareSetupAndInventory 0x0000000080000000u

// Event categories specified via keywords, e.g.:
// TraceLoggingWrite(...,
// TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
// ...);
#define MICROSOFT_KEYWORD_CRITICAL_DATA 0x0000800000000000 // Bit 47
#define MICROSOFT_KEYWORD_MEASURES 0x0000400000000000 // Bit 46
#define MICROSOFT_KEYWORD_TELEMETRY 0x0000200000000000 // Bit 45
#define MICROSOFT_KEYWORD_RESERVED_44 0x0000100000000000 // Bit 44 (reserved for future assignment)

// Event categories specified via event tags, e.g.:
// TraceLoggingWrite(...,
// TraceLoggingEventTag(MICROSOFT_EVENTTAG_REALTIME_LATENCY),
// ...);
#define MICROSOFT_EVENTTAG_DROP_USER_IDS 0x00008000
#define MICROSOFT_EVENTTAG_AGGREGATE 0x00010000
#define MICROSOFT_EVENTTAG_DROP_PII_EXCEPT_IP 0x00020000
#define MICROSOFT_EVENTTAG_COSTDEFERRED_LATENCY 0x00040000
#define MICROSOFT_EVENTTAG_CORE_DATA 0x00080000
#define MICROSOFT_EVENTTAG_INJECT_XTOKEN 0x00100000
#define MICROSOFT_EVENTTAG_REALTIME_LATENCY 0x00200000
#define MICROSOFT_EVENTTAG_NORMAL_LATENCY 0x00400000
#define MICROSOFT_EVENTTAG_CRITICAL_PERSISTENCE 0x00800000
#define MICROSOFT_EVENTTAG_NORMAL_PERSISTENCE 0x01000000
#define MICROSOFT_EVENTTAG_DROP_PII 0x02000000
#define MICROSOFT_EVENTTAG_HASH_PII 0x04000000
#define MICROSOFT_EVENTTAG_MARK_PII 0x08000000

// Field categories specified via field tags, e.g.:
// TraceLoggingWrite(...,
// TraceLoggingString(szUser, "UserName", "User's name", MICROSOFT_FIELDTAG_HASH_PII),
// ...);
#define MICROSOFT_FIELDTAG_DROP_PII 0x04000000
#define MICROSOFT_FIELDTAG_HASH_PII 0x08000000
55 changes: 32 additions & 23 deletions contrib/win32/openssh/OpenSSHBuildHelper.psm1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Set-StrictMode -Version 2.0
Set-StrictMode -Version 2.0
If ($PSVersiontable.PSVersion.Major -le 2) {$PSScriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path}
Import-Module $PSScriptRoot\OpenSSHCommonUtils.psm1 -Force

Expand Down Expand Up @@ -150,6 +150,7 @@ function Start-OpenSSHBootstrap
[bool] $silent = -not $script:Verbose
Write-BuildMsg -AsInfo -Message "Checking tools and dependencies" -Silent:$silent

$Win10SDKVerChoco = "10.1.17763.1"
$machinePath = [Environment]::GetEnvironmentVariable('Path', 'MACHINE')
$newMachineEnvironmentPath = $machinePath

Expand Down Expand Up @@ -205,26 +206,36 @@ function Start-OpenSSHBootstrap
}

$vcVars = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 14.0\Common7\Tools\vsvars32.bat"
$sdkPath = "${env:ProgramFiles(x86)}\Windows Kits\8.1\bin\x86\register_app.vbs"
$sdkVersion = Get-Windows10SDKVersion
$env:vctargetspath = "${env:ProgramFiles(x86)}\MSBuild\Microsoft.Cpp\v4.0\v140"

if ($sdkVersion -eq $null)
{
$packageName = "windows-sdk-10.1"
Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName ..."
choco install $packageName --version=$Win10SDKVerChoco -y --force --limitoutput --execution-timeout 120 2>&1 >> $script:BuildLogFile
}

if (-not (Test-Path $env:vctargetspath))
{
Write-BuildMsg -AsInfo -Message "installing visualcpp-build-tools"
choco install visualcpp-build-tools --version 14.0.25420.1 -y --force --limitoutput --execution-timeout 120 2>&1 >> $script:BuildLogFile
}

#use vs2017 build tool if exists
if($VS2017Path -ne $null)
{
If (-not (Test-Path $sdkPath))
{
$packageName = "windows-sdk-8.1"
Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName ..."
choco install $packageName -y --force --limitoutput --execution-timeout 10000 2>&1 >> $script:BuildLogFile
}


if(-not (Test-Path $VcVars))
{
Write-BuildMsg -AsError -ErrorAction Stop -Message "VC++ 2015.3 v140 toolset are not installed."
}
}
elseIf (($VS2015Path -eq $null) -or (-not (Test-Path $VcVars)) -or (-not (Test-Path $sdkPath))) {
elseIf (($VS2015Path -eq $null) -or (-not (Test-Path $VcVars))) {
$packageName = "vcbuildtools"
Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName ..."
choco install $packageName -ia "/InstallSelectableItems VisualCppBuildTools_ATLMFC_SDK;VisualCppBuildTools_NETFX_SDK;Win81SDK_CppBuildSKUV1" -y --force --limitoutput --execution-timeout 10000 2>&1 >> $script:BuildLogFile
choco install $packageName -ia "/InstallSelectableItems VisualCppBuildTools_ATLMFC_SDK;VisualCppBuildTools_NETFX_SDK" -y --force --limitoutput --execution-timeout 120 2>&1 >> $script:BuildLogFile
$errorCode = $LASTEXITCODE
if ($errorCode -eq 3010)
{
Expand Down Expand Up @@ -272,7 +283,7 @@ function Start-OpenSSHBootstrap
{
$packageName = "windows-sdk-10.1"
Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName ..."
choco install $packageName --force --limitoutput --execution-timeout 10000 2>&1 >> $script:BuildLogFile
choco install $packageName --version=$Win10SDKVerChoco --force --limitoutput --execution-timeout 120 2>&1 >> $script:BuildLogFile
}
}

Expand Down Expand Up @@ -577,6 +588,7 @@ function Start-OpenSSHBuild
}

Write-BuildMsg -AsInfo -Message "Starting Open SSH build; Build Log: $($script:BuildLogFile)."
Write-BuildMsg -AsInfo -Message "$msbuildCmd $cmdMsg"

& "$msbuildCmd" $cmdMsg
$errorCode = $LASTEXITCODE
Expand Down Expand Up @@ -622,20 +634,17 @@ function Get-VS2015BuildToolPath
}

function Get-Windows10SDKVersion
{
{
#Temporary fix - Onecore builds are failing with latest windows 10 SDK (10.0.18362.0)
$requiredSDKVersion = [version]"10.0.17763.0"
## Search for latest windows sdk available on the machine
$windowsSDKPath = Join-Path ${env:ProgramFiles(x86)} "Windows Kits\10\Lib"
$minSDKVersion = [version]"10.0.14393.0"
$versionsAvailable = @()
#Temporary fix - Onecore builds are failing with latest widows 10 SDK (10.0.18362.0)
$maxSDKVersion = [version]"10.0.17763.0"
$versionsAvailable = Get-ChildItem $windowsSDKPath | ? {$_.Name.StartsWith("10.")} | % {$version = [version]$_.Name; if(($version.CompareTo($minSDKVersion) -ge 0) -and ($version.CompareTo($maxSDKVersion) -le 0)) {$version}}
if(0 -eq $versionsAvailable.count)
{
return $null
$windowsSDKPath = Join-Path ${env:ProgramFiles(x86)} "Windows Kits\10\bin\$requiredSDKVersion\x86\register_app.vbs"
if (test-path $windowsSDKPath) {
return $requiredSDKVersion
}
else {
return $null
}
$versionsAvailable = $versionsAvailable | Sort-Object -Descending
return $versionsAvailable[0]
}

function Get-BuildLogFile
Expand Down
2 changes: 1 addition & 1 deletion contrib/win32/openssh/paths.targets
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<ZLib-arm-Path>$(SolutionDir)\ZLib\bin\arm\</ZLib-arm-Path>
<UseOpenSSL>true</UseOpenSSL>
<SSLLib>libcrypto.lib;</SSLLib>
<WindowsSDKVersion>8.1</WindowsSDKVersion>
<WindowsSDKVersion>10.0.17763.0</WindowsSDKVersion>
<AdditionalDependentLibs>bcrypt.lib;Userenv.lib;Crypt32.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;Netapi32.lib;Rpcrt4.lib;ntdll.lib</AdditionalDependentLibs>
<MinimalCoreWin>false</MinimalCoreWin>
</PropertyGroup>
Expand Down
Loading