-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The .NET Framework supports TLS v1.2 as of version 4.5 - http://msdn.microsoft.com/en-us/library/system.security.authentication.sslprotocols(v=vs.110).aspx but the security protocol is not set to use it out of the box. Set the SecurityProtocol to start with the highest encryption available and move down from there. If someone compiles choco with .NET 4.0, post a warning about the encryption not being good enough.
- Loading branch information
1 parent
fd09a01
commit 91e492c
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/chocolatey/infrastructure/registration/SecurityProtocol.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright © 2011 - Present RealDimensions Software, LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace chocolatey.infrastructure.registration | ||
{ | ||
using System.Net; | ||
using logging; | ||
|
||
public sealed class SecurityProtocol | ||
{ | ||
public static void set_protocol() | ||
{ | ||
#if NETFX_45 | ||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3; | ||
#else | ||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Ssl3; | ||
"chocolatey".Log().Warn(ChocolateyLoggers.Important, | ||
@" !!WARNING!! | ||
Choco prefers to use TLS v1.2 if it is available, but this client is | ||
built on .NET 4.0, which uses an older SSL. It's using TLS 1.0 or | ||
earlier, which makes it susceptible to BEAST and also doesn't | ||
implement the 1/n-1 record splitting mitigation for Cipher-Block | ||
Chaining. | ||
For more information you should visit https://www.howsmyssl.com/"); | ||
#endif | ||
} | ||
} | ||
} |