File tree Expand file tree Collapse file tree 3 files changed +36
-3
lines changed
src/BenchmarksApps/TLS/HttpSys Expand file tree Collapse file tree 3 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 22
22
# debug purpose settings
23
23
certValidationConsoleEnabled : false
24
24
httpSysLogs : false
25
+ tlsRegistryLogs : false
25
26
statsEnabled : false
26
27
logRequestInfo : false
27
- arguments : " --urls https://{{serverAddress}}:{{serverPort}} --mTLS {{mTLS}} --certValidationConsoleEnabled {{certValidationConsoleEnabled}} --statsEnabled {{statsEnabled}} --tlsRenegotiation {{tlsRenegotiation}} --httpSysLogs {{httpSysLogs}} --tlsProtocols {{tlsProtocols}} --logRequestInfo {{logRequestInfo}}"
28
+ arguments : " --urls https://{{serverAddress}}:{{serverPort}} --mTLS {{mTLS}} --certValidationConsoleEnabled {{certValidationConsoleEnabled}} --statsEnabled {{statsEnabled}} --tlsRenegotiation {{tlsRenegotiation}} --httpSysLogs {{httpSysLogs}} --tlsProtocols {{tlsProtocols}} --logRequestInfo {{logRequestInfo}} --tlsRegistryLogs {{tlsRegistryLogs}} "
28
29
29
30
kestrelServer :
30
31
source :
Original file line number Diff line number Diff line change 7
7
builder . Logging . ClearProviders ( ) ;
8
8
9
9
var writeCertValidationEventsToConsole = bool . TryParse ( builder . Configuration [ "certValidationConsoleEnabled" ] , out var certValidationConsoleEnabled ) && certValidationConsoleEnabled ;
10
- var httpSysLoggingEnabled = bool . TryParse ( builder . Configuration [ "httpSysLogs" ] , out var httpSysLogsEnabled ) && httpSysLogsEnabled ;
10
+ var httpSysLogsEnabled = bool . TryParse ( builder . Configuration [ "httpSysLogs" ] , out var httpSysLogsConfig ) && httpSysLogsConfig ;
11
+ var tlsRegistryLogsEnabled = bool . TryParse ( builder . Configuration [ "tlsRegistryLogs" ] , out var tlsRegistryLogsConfig ) && tlsRegistryLogsConfig ;
11
12
var logRequestInfo = bool . TryParse ( builder . Configuration [ "logRequestInfo" ] , out var logRequestInfoConfig ) && logRequestInfoConfig ;
12
13
var statsEnabled = bool . TryParse ( builder . Configuration [ "statsEnabled" ] , out var connectionStatsEnabledConfig ) && connectionStatsEnabledConfig ;
13
14
@@ -90,7 +91,9 @@ void OnShutdown()
90
91
if ( ! logged )
91
92
{
92
93
logged = true ;
94
+ Console . WriteLine ( "[RequestInfo]" ) ;
93
95
Console . WriteLine ( "TLS Protocol: " + context . Features . Get < ITlsHandshakeFeature > ( ) ? . Protocol ) ;
96
+ Console . WriteLine ( "---" ) ;
94
97
}
95
98
96
99
await next ( ) ;
@@ -131,7 +134,11 @@ void OnShutdown()
131
134
132
135
await app . StartAsync ( ) ;
133
136
134
- if ( httpSysLoggingEnabled )
137
+ if ( tlsRegistryLogsEnabled )
138
+ {
139
+ RegistryController . ShowRegistryKeys ( ) ;
140
+ }
141
+ if ( httpSysLogsEnabled )
135
142
{
136
143
NetShWrapper . Show ( ) ;
137
144
}
Original file line number Diff line number Diff line change
1
+ using System . Text ;
2
+ using Microsoft . Win32 ;
3
+
4
+ namespace HttpSys
5
+ {
6
+ public static class RegistryController
7
+ {
8
+ private const string TLS12Key = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" ;
9
+ private const string TLS13Key = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters" ;
10
+
11
+ [ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Interoperability" , "CA1416:Validate platform compatibility" , Justification = "benchmark only runs on windows" ) ]
12
+ public static void ShowRegistryKeys ( )
13
+ {
14
+ var strBuilder = new StringBuilder ( "Registry TLS settings: \n " ) ;
15
+
16
+ var tls12Enabled = Registry . GetValue ( TLS12Key , "Enabled" , "not defined" ) ;
17
+ strBuilder . AppendLine ( "\t TLS 1.2: " + tls12Enabled ? . ToString ( ) ) ;
18
+
19
+ var tls13Enabled = Registry . GetValue ( TLS13Key , "EnableHTTP3" , "not defined" ) ;
20
+ strBuilder . AppendLine ( "\t TLS 1.3: " + tls12Enabled ? . ToString ( ) ) ;
21
+
22
+ Console . WriteLine ( strBuilder . ToString ( ) ) ;
23
+ }
24
+ }
25
+ }
You can’t perform that action at this time.
0 commit comments