Closed Wolvverine closed 1 year ago
@Wolvverine just to confirm... do you have any sort of proxy in play within your environment?
I am not aware of any reported problems in this area.
Could you additionally confirm what the output from the following command is on your system:
choco source list
Chocolatey v2.0.0 chocolatey - https://chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
Do you have any sort of proxy in play within your environment? No.
choco config
Chocolatey v2.0.0
cacheLocation = c:\Windows\Temp | Cache location if not TEMP folder. Replaces $env:TEMP
value for choco.exe process. It is highly recommended this be set to make Chocolatey more deterministic in cleanup.
commandExecutionTimeoutSeconds = 2700 | Default timeout for command execution. '0' for infinite (starting in 0.10.4).
containsLegacyPackageInstalls = true | Install has packages installed prior to 0.9.9 series.
defaultPushSource = | Default source to push packages to when running 'choco push' command.
defaultTemplateName = | Default template name used when running 'choco new' command.
proxy = | Explicit proxy location.
proxyBypassList = | Optional proxy bypass list. Comma separated.
proxyBypassOnLocal = true | Bypass proxy for local connections.
proxyPassword = | Optional proxy password. Encrypted.
proxyUser = | Optional proxy user.
upgradeAllExceptions = | A comma-separated list of package names that should not be upgraded when running `choco upgrade all'. Defaults to empty.
webRequestTimeoutSeconds = 30 | Default timeout for web requests.
@Wolvverine this shouldn't make any difference, but what happens if you attempt to use https://community.chocolatey.org/api/v2/
, rather than https://chocolatey.org/api/v2/
?
The same.
@Wolvverine are you familiar with how to use Fiddler? https://www.telerik.com/fiddler. It would be very useful to see the outgoing requests and responses when this happens, in order to try to track down exactly what is going on.
Is this something you would be able to help provide?
It seems that chocolatey servers do not support strong cipher sets for TLS/SSL.
The Windows 10/11 hardened system uses: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA TLS_RSA_WITH_AES_256_GCM_SHA384 TLS_RSA_WITH_AES_128_GCM_SHA256 TLS_RSA_WITH_AES_256_CBC_SHA256 TLS_RSA_WITH_AES_128_CBC_SHA256 TLS_RSA_WITH_AES_256_CBC_SHA TLS_RSA_WITH_AES_128_CBC_SHA
Chocolatey servers use: RSASSA-PSS with SHA-256 RSASSA-PSS with SHA-384 RSASSA-PSS with SHA-512 RSASSA-PKCS1-v1_5 with SHA-256 RSASSA-PKCS1-v1_5 with SHA-384 RSASSA-PKCS1-v1_5 with SHA-1 ECDSA with SHA-256 ECDSA with SHA-384 ECDSA with SHA-1 DSA with SHA-1 RSASSA-PKCS1-v1_5 with SHA-512 ECDSA with SHA-512
https://learn.microsoft.com/en-us/windows/win32/secauthn/tls-cipher-suites-in-windows-10-v1903
https://learn.microsoft.com/en-us/windows/win32/secauthn/cipher-suites-in-schannel
@Wolvverine where is that screenshot taken from? Also, can you confirm the same against community.chocolatey.org?
Charles (Fiddler simmilar app)
@Wolvverine thank you for confirming!
In an earlier comment, you mentioned:
The Windows 10/11 hardened system uses:
Can you confirm which operating system you are actually using? Is it Windows 10, or is it Windows 11? Also, what process have you followed to harden the operating system?
Can you also confirm that if you revert back to the previous version of Chocolatey CLI, i.e. 1.4.0, that things start working again?
Further, looking at the report from ssllabs for community.chocolatey.org, I get the following results:
Which includes a number of the cipher suites that you say your system requires.
@Wolvverine I have put together a short video of how to look at the request/responses that are being used by the Chocolatey CLI in this short video:
It would be great if you could have a watch of that video, and then grab the session archive at the time you are seeing the problem in Chocolatey CLI.
Let me know here if you run into any problems with grabbing the required information. Thanks!
Windows 10 Enterprise
###### Enable TLS 1.2
$SChannelRegPath = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols"
New-Item $SChannelRegPath"\TLS 1.2\Server" -Force
New-Item $SChannelRegPath"\TLS 1.2\Client" -Force
New-ItemProperty -Path $SChannelRegPath"\TLS 1.2\Server" -Name Enabled -Value 1 -PropertyType DWORD
Set-ItemProperty -Path $SChannelRegPath"\TLS 1.2\Server" -Name Enabled -Value 1
New-ItemProperty -Path $SChannelRegPath"\TLS 1.2\Server" -Name DisabledByDefault -Value 0 -PropertyType DWORD
Set-ItemProperty -Path $SChannelRegPath"\TLS 1.2\Server" -Name DisabledByDefault -Value 0
New-ItemProperty -Path $SChannelRegPath"\TLS 1.2\Client" -Name Enabled -Value 1 -PropertyType DWORD
Set-ItemProperty -Path $SChannelRegPath"\TLS 1.2\Client" -Name Enabled -Value 1
New-ItemProperty -Path $SChannelRegPath"\TLS 1.2\Client" -Name DisabledByDefault -Value 0 -PropertyType DWORD
Set-ItemProperty -Path $SChannelRegPath"\TLS 1.2\Client" -Name DisabledByDefault -Value 0
###### Enable TLS 1.3
New-Item $SChannelRegPath"\TLS 1.3\Server" -Force
New-Item $SChannelRegPath"\TLS 1.3\Client" -Force
New-ItemProperty -Path $SChannelRegPath"\TLS 1.3\Server" -Name Enabled -Value 1 -PropertyType DWORD
Set-ItemProperty -Path $SChannelRegPath"\TLS 1.3\Server" -Name Enabled -Value 1
New-ItemProperty -Path $SChannelRegPath"\TLS 1.3\Server" -Name DisabledByDefault -Value 0 -PropertyType DWORD
Set-ItemProperty -Path $SChannelRegPath"\TLS 1.3\Server" -Name DisabledByDefault -Value 0
New-ItemProperty -Path $SChannelRegPath"\TLS 1.3\Client" -Name Enabled -Value 1 -PropertyType DWORD
Set-ItemProperty -Path $SChannelRegPath"\TLS 1.3\Client" -Name Enabled -Value 1
New-ItemProperty -Path $SChannelRegPath"\TLS 1.3\Client" -Name DisabledByDefault -Value 0 -PropertyType DWORD
Set-ItemProperty -Path $SChannelRegPath"\TLS 1.3\Client" -Name DisabledByDefault -Value 0
###### Enable TLS 1.2 and 1.3 only for WinHTTP
##### https://learn.microsoft.com/en-us/answers/questions/348388/windows-10-tls-1-3-enablement-registry-keys
$WinhttpRegPath1="HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp"
New-ItemProperty -Path $WinhttpRegPath1 -Name DefaultSecureProtocols -Value 10240 -PropertyType DWORD
Set-ItemProperty -Path $WinhttpRegPath1 -Name DefaultSecureProtocols -Value 10240
$WinhttpRegPath2="HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"
New-ItemProperty -Path $WinhttpRegPath2"\WinHttp" -Name DefaultSecureProtocols -Value 10240 -PropertyType DWORD
Set-ItemProperty -Path $WinhttpRegPath2"\WinHttp" -Name DefaultSecureProtocols -Value 10240
New-ItemProperty -Path $WinhttpRegPath2"\WinHttp" -Name SecureProtocols -Value 10240 -PropertyType DWORD
Set-ItemProperty -Path $WinhttpRegPath2"\WinHttp" -Name SecureProtocols -Value 10240
###### Configuring .Net applications to use TLS 1.2
$RegPath1 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319"
New-ItemProperty -path $RegPath1 -name SystemDefaultTlsVersions -value 1 -PropertyType DWORD
Set-ItemProperty -path $RegPath1 -name SystemDefaultTlsVersions -value 1
New-ItemProperty -path $RegPath1 -name SchUseStrongCrypto -value 1 -PropertyType DWORD
Set-ItemProperty -path $RegPath1 -name SchUseStrongCrypto -value 1
$RegPath3 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.5.23026"
New-ItemProperty -path $RegPath3 -name SystemDefaultTlsVersions -value 1 -PropertyType DWORD
Set-ItemProperty -path $RegPath3 -name SystemDefaultTlsVersions -value 1
New-ItemProperty -path $RegPath3 -name SchUseStrongCrypto -value 1 -PropertyType DWORD
Set-ItemProperty -path $RegPath3 -name SchUseStrongCrypto -value 1
$RegPath2 = "HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319"
New-ItemProperty -path $RegPath2 -name SystemDefaultTlsVersions -value 1 -PropertyType DWORD
Set-ItemProperty -path $RegPath2 -name SystemDefaultTlsVersions -value 1
New-ItemProperty -path $RegPath2 -name SchUseStrongCrypto -value 1 -PropertyType DWORD
Set-ItemProperty -path $RegPath2 -name SchUseStrongCrypto -value 1
[Enum]::GetNames([Net.SecurityProtocolType]) -contains 'Tls12'
[System.Net.ServicePointManager]::SecurityProtocol.HasFlag([Net.SecurityProtocolType]::Tls12)
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
[Net.SecurityProtocolType]
[enum]::GetNames([Net.SecurityProtocolType])
#### Disable TLS 1.0 and TLS 1.1
New-Item $SChannelRegPath -Name "TLS 1.0"
New-Item $SChannelRegPath"\TLS 1.0" -Name SERVER
New-ItemProperty -Path $SChannelRegPath"\TLS 1.0\SERVER" -Name Enabled -Value 0 -PropertyType DWORD
Set-ItemProperty -Path $SChannelRegPath"\TLS 1.0\SERVER" -Name Enabled -Value 0
New-Item $SChannelRegPath"\TLS 1.1\Server" –force
New-Item $SChannelRegPath"\TLS 1.1\Client" –force
New-ItemProperty -Path $SChannelRegPath"\TLS 1.1\Server" -Name Enabled -Value 0 -PropertyType DWORD
Set-ItemProperty -Path $SChannelRegPath"\TLS 1.1\Server" -Name Enabled -Value 0
New-ItemProperty -Path $SChannelRegPath"\TLS 1.1\Server" -Name DisabledByDefault -Value 0 -PropertyType DWORD
Set-ItemProperty -Path $SChannelRegPath"\TLS 1.1\Server" -Name DisabledByDefault -Value 0
New-ItemProperty -Path $SChannelRegPath"\TLS 1.1\Client" -Name Enabled -Value 0 -PropertyType DWORD
Set-ItemProperty -Path $SChannelRegPath"\TLS 1.1\Client" -Name Enabled -Value 0
New-ItemProperty -Path $SChannelRegPath"\TLS 1.1\Client" -Name DisabledByDefault -Value 0 -PropertyType DWORD
Set-ItemProperty -Path $SChannelRegPath"\TLS 1.1\Client" -Name DisabledByDefault -Value 0
##### Disable weak ciphers and algorithms
Disable-TlsCipherSuite -Name "TLS_DHE_RSA_WITH_AES_256_CBC_SHA"
Disable-TlsCipherSuite -Name "TLS_DHE_RSA_WITH_AES_128_CBC_SHA"
Disable-TlsCipherSuite -Name "TLS_RSA_WITH_AES_256_GCM_SHA384"
Disable-TlsCipherSuite -Name "TLS_RSA_WITH_AES_128_GCM_SHA256"
Disable-TlsCipherSuite -Name "TLS_RSA_WITH_AES_256_CBC_SHA256"
Disable-TlsCipherSuite -Name "TLS_RSA_WITH_AES_128_CBC_SHA256"
Disable-TlsCipherSuite -Name "TLS_RSA_WITH_AES_256_CBC_SHA"
Disable-TlsCipherSuite -Name "TLS_RSA_WITH_AES_128_CBC_SHA"
Disable-TlsCipherSuite -Name "TLS_RSA_WITH_3DES_EDE_CBC_SHA"
Disable-TlsCipherSuite -Name "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256"
Disable-TlsCipherSuite -Name "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256"
Disable-TlsCipherSuite -Name "TLS_DHE_DSS_WITH_AES_256_CBC_SHA"
Disable-TlsCipherSuite -Name "TLS_DHE_DSS_WITH_AES_128_CBC_SHA"
Disable-TlsCipherSuite -Name "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA"
Disable-TlsCipherSuite -Name "TLS_RSA_WITH_RC4_128_SHA"
Disable-TlsCipherSuite -Name "TLS_RSA_WITH_RC4_128_MD5"
Disable-TlsCipherSuite -Name "TLS_RSA_WITH_NULL_SHA256"
Disable-TlsCipherSuite -Name "TLS_RSA_WITH_NULL_SHA"
Disable-TlsCipherSuite -Name "TLS_PSK_WITH_AES_256_GCM_SHA384"
Disable-TlsCipherSuite -Name "TLS_PSK_WITH_AES_128_GCM_SHA256"
Disable-TlsCipherSuite -Name "TLS_PSK_WITH_AES_256_CBC_SHA384"
Disable-TlsCipherSuite -Name "TLS_PSK_WITH_AES_128_CBC_SHA256"
Disable-TlsCipherSuite -Name "TLS_PSK_WITH_NULL_SHA384"
Disable-TlsCipherSuite -Name "TLS_PSK_WITH_NULL_SHA256"
$HTTPRegPath = "HKLM:\SYSTEM\CurrentControlSet\services\HTTP\Parameters"
### Enable TLS order Http2
New-ItemProperty -Path $HTTPRegPath -PropertyType 'DWORD' -Name 'EnableHttp2Tls' -Value '1'
Set-ItemProperty -Path $HTTPRegPath -Name 'EnableHttp2Tls' -Value '1'
### TLS 1.3
New-ItemProperty -Path $HTTPRegPath -PropertyType 'DWORD' -Name 'EnableHttp3' -Value '1'
Set-ItemProperty -Path $HTTPRegPath -Name 'EnableHttp3' -Value '1'
Enable-TlsCipherSuite -Name "TLS_AES_256_GCM_SHA384"
Enable-TlsCipherSuite -Name "TLS_AES_128_GCM_SHA256"
TLS_AES_256_GCM_SHA384
Get-TlsCipherSuite | Format-Table Name
Get-TlsEccCurve | Format-Table Name
I passed TLS/SSL communication through Charles proxy for selected chocolatey addresses - it works.
For that for connections/adresese that do not go through SSL proxy but are from choco is: "TLSv1.2 [Failed: handshake_failure (40) - Unable to negotiate an acceptable set of security parameters, this probably means there are no cipher suites in common]"
The same situation in Fiddler. "Decrypt HTTPS traffic" and all is ok with choco.
@Wolvverine I can confirm that after running the hardening script that you provided above, I can replicate the issue, namely:
Unable to load the service index for source https://community.chocolatey.org/api/v2/.
Unable to connect to source 'https://community.chocolatey.org/api/v2/':
Object reference not set to an instance of an object.
Can I ask where this hardening script came from? Is this something that you have created yourself? Or something that you have taken from another place?
It would be good to understand exactly which of the commands causes this problem though, and then further to understand why the decision was made to enable/disable the one that is causing the problem.
@Wolvverine I've had a look at the script and run it on Windows 10. The problematic line on my test system (Windows 10 Pro 22H2) is:
New-ItemProperty -Path $SChannelRegPath"\TLS 1.3\Client" -Name DisabledByDefault -Value 0 -PropertyType DWORD
If you run the script without that line, Chocolatey CLI can run choco upgrade all -y
. But running this line of code produces the same error you are experiencing. The same code, in its entirety, causes no such issues in Windows 11 Pro 22H2.
I'm unsure why this doesn't work, but did find this suggestion that it may be a bug. It seems unlikely this is the issue, and I'm likely putting 2 and 2 together there and probably coming up with 5. But it was all I could find.
As the script / hardening is what is causing the issue, there isn't anything for us to do here, so I'm going to go ahead and close this. We can always re-open it later if needed.
Windows hardening enforces the use of the proper security settings while disabling potentially vulnerable ones. While removing those keys fixes your issue in the short term. The more valid and accurate answer would to have Chocolatey support the more secure algorithms.
https://github.com/simeononsecurity/Windows-Optimize-Harden-Debloat/issues/67
👍 Thank you @pauby ! This discovery of the "problematic line" saved my laptop. I removed that setting in my registry and, voilà, chocolatey is back in business!
Checklist
What You Are Seeing?
After last upgrade chocolatey: Unable to load the service index for source https://chocolatey.org/api/v2/.
Name
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
TLS_RSA_WITH_AES_256_GCM_SHA384
TLS_RSA_WITH_AES_128_GCM_SHA256
TLS_RSA_WITH_AES_256_CBC_SHA256
TLS_RSA_WITH_AES_128_CBC_SHA256
TLS_RSA_WITH_AES_256_CBC_SHA
TLS_RSA_WITH_AES_128_CBC_SHA
TLS 1.2 and 1.3 are set on system.
What is Expected?
upgrade/install packages
How Did You Get This To Happen?
choco upgrade all -y choco upgrade all -y -debug -trace
System Details
Name Value
PSVersion 7.3.4 PSEdition Core GitCommitId 7.3.4 OS Microsoft Windows 10.0.19045 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0
choco --version
2.0.0
choco list chocolatey.extension --exact
Chocolatey v2.0.0 0 packages installed.
Installed Packages
Output Log
Additional Context
No response