Skip to content

Commit 3b5134d

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into net7
# Conflicts: # src/Renci.SshNet/Renci.SshNet.csproj # test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj
2 parents d2f6322 + ee054f4 commit 3b5134d

File tree

109 files changed

+4807
-1267
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+4807
-1267
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ dotnet_diagnostic.S2971.severity = none
195195
# This is rather harmless.
196196
dotnet_diagnostic.S3218.severity = none
197197

198+
# S3236: Remove this argument from the method call; it hides the caller information.
199+
dotnet_diagnostic.S3236.severity = none
200+
198201
# S3267: Loops should be simplified with "LINQ" expressions
199202
# https://rules.sonarsource.com/csharp/RSPEC-3267
200203
#
@@ -701,6 +704,9 @@ dotnet_code_quality.CA1828.api_surface = all
701704
# Similar to MA0053, but does not support public types and types that define (new) virtual members.
702705
dotnet_diagnostic.CA1852.severity = none
703706

707+
# CA1848: don't enforce LoggerMessage pattern
708+
dotnet_diagnostic.CA1848.severity = suggestion
709+
704710
# CA1859: Change return type for improved performance
705711
#
706712
# By default, this diagnostic is only reported for private members.

.github/workflows/build.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: Build
2+
3+
on:
4+
- push
5+
- pull_request
6+
- workflow_dispatch
7+
8+
jobs:
9+
Linux:
10+
runs-on: ubuntu-24.04
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0 # needed for Nerdbank.GitVersioning
16+
17+
- name: Setup .NET
18+
uses: actions/setup-dotnet@v4
19+
with:
20+
dotnet-version: 9.0.x
21+
22+
- name: Build Unit Tests .NET
23+
run: dotnet build -f net9.0 test/Renci.SshNet.Tests/
24+
25+
- name: Build IntegrationTests .NET
26+
run: dotnet build -f net9.0 test/Renci.SshNet.IntegrationTests/
27+
28+
- name: Build IntegrationTests .NET Framework
29+
run: dotnet build -f net48 test/Renci.SshNet.IntegrationTests/
30+
31+
- name: Run Unit Tests .NET
32+
run: |
33+
dotnet test \
34+
-f net9.0 \
35+
--no-build \
36+
--logger "console;verbosity=normal" \
37+
--logger GitHubActions \
38+
-p:CollectCoverage=true \
39+
-p:CoverletOutputFormat=cobertura \
40+
-p:CoverletOutput=../../coverlet/linux_unit_test_net_9_coverage.xml \
41+
test/Renci.SshNet.Tests/
42+
43+
- name: Run Integration Tests .NET
44+
run: |
45+
dotnet test \
46+
-f net9.0 \
47+
--no-build \
48+
--logger "console;verbosity=normal" \
49+
--logger GitHubActions \
50+
-p:CollectCoverage=true \
51+
-p:CoverletOutputFormat=cobertura \
52+
-p:CoverletOutput=../../coverlet/linux_integration_test_net_9_coverage.xml \
53+
test/Renci.SshNet.IntegrationTests/
54+
55+
# Also run a subset of the integration tests targeting netfx using mono. This is a temporary measure to get
56+
# some coverage until a proper solution for running the .NET Framework integration tests in CI is found.
57+
# Running all the tests causes problems which are not worth solving in this rare configuration.
58+
# See https://github.com/sshnet/SSH.NET/pull/1462 and related links
59+
- name: Run Integration Tests Mono
60+
run: |
61+
sudo apt-get install ca-certificates gnupg
62+
sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
63+
echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
64+
sudo apt-get update
65+
sudo apt-get install mono-devel
66+
dotnet test \
67+
-f net48 \
68+
--no-build \
69+
--logger "console;verbosity=normal" \
70+
--logger GitHubActions \
71+
-p:CollectCoverage=true \
72+
-p:CoverletOutputFormat=cobertura \
73+
-p:CoverletOutput=../../coverlet/linux_integration_test_net_48_coverage.xml \
74+
--filter "Name~Ecdh|Name~ECDsa|Name~Zlib|Name~Gcm" \
75+
test/Renci.SshNet.IntegrationTests/
76+
77+
- name: Archive Coverlet Results
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: Coverlet Results Linux
81+
path: coverlet
82+
83+
Windows:
84+
runs-on: windows-2022
85+
steps:
86+
- name: Checkout
87+
uses: actions/checkout@v4
88+
with:
89+
fetch-depth: 0 # needed for Nerdbank.GitVersioning
90+
91+
- name: Setup .NET
92+
uses: actions/setup-dotnet@v4
93+
with:
94+
dotnet-version: 9.0.x
95+
96+
- name: Build Solution
97+
run: dotnet build Renci.SshNet.sln
98+
99+
- name: Publish AOT Compatibility Test App
100+
run: dotnet publish -r win-x64 /warnaserror test/Renci.SshNet.AotCompatibilityTestApp/
101+
102+
- name: Create NuGet Package
103+
run: dotnet pack
104+
105+
- name: Archive NuGet Package
106+
uses: actions/upload-artifact@v4
107+
with:
108+
name: NuGet Package
109+
path: src/Renci.SshNet/bin/Release/*.*nupkg
110+
111+
- name: Run Unit Tests .NET
112+
run: |
113+
dotnet test `
114+
-f net9.0 `
115+
--no-build `
116+
--logger "console;verbosity=normal" `
117+
--logger GitHubActions `
118+
-p:CollectCoverage=true `
119+
-p:CoverletOutputFormat=cobertura `
120+
-p:CoverletOutput=../../coverlet/windows_unit_test_net_9_coverage.xml `
121+
test/Renci.SshNet.Tests/
122+
123+
- name: Run Unit Tests .NET Framework
124+
run: |
125+
dotnet test `
126+
-f net462 `
127+
--no-build `
128+
--logger "console;verbosity=normal" `
129+
--logger GitHubActions `
130+
-p:CollectCoverage=true `
131+
-p:CoverletOutputFormat=cobertura `
132+
-p:CoverletOutput=../../coverlet/windows_unit_test_net_4_6_2_coverage.xml `
133+
test/Renci.SshNet.Tests/
134+
135+
- name: Archive Coverlet Results
136+
uses: actions/upload-artifact@v4
137+
with:
138+
name: Coverlet Results Windows
139+
path: coverlet
140+
141+
Publish:
142+
runs-on: ubuntu-24.04
143+
if: github.ref == 'refs/heads/develop'
144+
permissions:
145+
packages: write
146+
needs:
147+
- Windows
148+
- Linux
149+
steps:
150+
- name: Download NuGet Package
151+
uses: actions/download-artifact@v4
152+
with:
153+
name: NuGet Package
154+
155+
- name: Publish to GitHub NuGet Registry
156+
run: |
157+
dotnet nuget add source \
158+
--username $GITHUB_ACTOR \
159+
--password ${{ secrets.GITHUB_TOKEN }} \
160+
--store-password-in-clear-text \
161+
--name github \
162+
"https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json"
163+
dotnet nuget push "*.nupkg" \
164+
--source github \
165+
--api-key ${{ secrets.GITHUB_TOKEN }}

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ Before subsequent coverage collections, delete the previous collections with `gi
3030

3131
## CI
3232

33-
The repository makes use of continuous integration (CI) on [AppVeyor](https://ci.appveyor.com/project/drieseng/ssh-net/history) to validate builds and tests on PR branches and non-PR branches. At the time of writing, some tests can occasionally fail in CI due to a dependency on timing or a dependency on networking/socket code. If you see an existing test which is unrelated to your changes occasionally failing in CI but passing locally, you probably don't need to worry about it. If you see one of your newly-added tests failing, it is probably worth investigating why and whether it can be made more stable.
33+
The repository makes use of continuous integration (CI) with GitHub Actions to validate builds and tests on PR branches and non-PR branches. At the time of writing, some tests can occasionally fail in CI due to a dependency on timing or a dependency on networking/socket code. If you see an existing test which is unrelated to your changes occasionally failing in CI but passing locally, you probably don't need to worry about it. If you see one of your newly-added tests failing, it is probably worth investigating why and whether it can be made more stable.
3434

3535
## Good to know
3636

37-
### TraceSource logging
37+
### Logging
3838

39-
The Debug build of SSH.NET contains rudimentary logging functionality via `System.Diagnostics.TraceSource`. See `Renci.SshNet.Abstractions.DiagnosticAbstraction` for usage examples.
39+
The tests always log to the console. See the [Logging documentation](https://sshnet.github.io/SSH.NET/logging.html) on how to set a custom `ILoggerFactory`.
4040

4141
### Wireshark
4242

Directory.Packages.props

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,29 @@
44
<CentralPackageVersionOverrideEnabled>false</CentralPackageVersionOverrideEnabled>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageVersion Include="Appveyor.TestLogger" Version="2.0.0" />
87
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
9-
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.4.0" />
8+
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.5.0" />
109
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
1110
<PackageVersion Include="coverlet.msbuild" Version="6.0.2" />
12-
<PackageVersion Include="LiquidTestReports.Markdown" Version="1.0.9" />
11+
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1">
12+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
13+
<PrivateAssets>all</PrivateAssets>
14+
</PackageVersion>
1315
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.163" />
1416
<!-- Must be kept at version 1.0.0 or higher, see https://github.com/sshnet/SSH.NET/pull/1288 for details. -->
1517
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0" />
18+
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
19+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
20+
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
1621
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
17-
<PackageVersion Include="MSTest.TestAdapter" Version="3.6.0" />
18-
<PackageVersion Include="MSTest.TestFramework" Version="3.6.0" />
22+
<PackageVersion Include="MSTest.TestAdapter" Version="3.6.2" />
23+
<PackageVersion Include="MSTest.TestFramework" Version="3.6.2" />
1924
<PackageVersion Include="Moq" Version="4.20.72" />
20-
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.7.70-alpha" />
25+
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.7.77-alpha" /> <!-- can use stable once 3.7 is released -->
2126
<PackageVersion Include="PolySharp" Version="1.14.1" />
2227
<PackageVersion Include="SonarAnalyzer.CSharp" Version="9.32.0.97167" />
2328
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
2429
<PackageVersion Include="System.Formats.Asn1" Version="8.0.1" />
25-
<PackageVersion Include="Testcontainers" Version="3.10.0" />
30+
<PackageVersion Include="Testcontainers" Version="4.0.0" />
2631
</ItemGroup>
2732
</Project>

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SSH.NET is a Secure Shell (SSH-2) library for .NET, optimized for parallelism.
44

55
[![Version](https://img.shields.io/nuget/vpre/SSH.NET.svg)](https://www.nuget.org/packages/SSH.NET)
66
[![NuGet download count](https://img.shields.io/nuget/dt/SSH.NET.svg)](https://www.nuget.org/packages/SSH.NET)
7-
[![Build status](https://ci.appveyor.com/api/projects/status/ih77qu6tap3o92gu/branch/develop?svg=true)](https://ci.appveyor.com/api/projects/status/ih77qu6tap3o92gu/branch/develop)
7+
![Build status](https://github.com/sshnet/SSH.NET/actions/workflows/build.yml/badge.svg)
88

99
## Key Features
1010

@@ -62,6 +62,7 @@ The main types provided by this library are:
6262
## Additional Documentation
6363

6464
* [Further examples](https://sshnet.github.io/SSH.NET/examples.html)
65+
* [Logging](https://sshnet.github.io/SSH.NET/logging.html)
6566
* [API browser](https://sshnet.github.io/SSH.NET/api/Renci.SshNet.html)
6667

6768
## Encryption Methods
@@ -101,17 +102,21 @@ The main types provided by this library are:
101102
* OpenSSL PKCS#8 PEM format ("BEGIN PRIVATE KEY", "BEGIN ENCRYPTED PRIVATE KEY")
102103
* ssh.com format ("BEGIN SSH2 ENCRYPTED PRIVATE KEY")
103104
* OpenSSH key format ("BEGIN OPENSSH PRIVATE KEY")
105+
* PuTTY private key format ("PuTTY-User-Key-File-2", "PuTTY-User-Key-File-3")
104106
* DSA in
105107
* OpenSSL traditional PEM format ("BEGIN DSA PRIVATE KEY")
106108
* OpenSSL PKCS#8 PEM format ("BEGIN PRIVATE KEY", "BEGIN ENCRYPTED PRIVATE KEY")
107109
* ssh.com format ("BEGIN SSH2 ENCRYPTED PRIVATE KEY")
110+
* PuTTY private key format ("PuTTY-User-Key-File-2", "PuTTY-User-Key-File-3")
108111
* ECDSA 256/384/521 in
109112
* OpenSSL traditional PEM format ("BEGIN EC PRIVATE KEY")
110113
* OpenSSL PKCS#8 PEM format ("BEGIN PRIVATE KEY", "BEGIN ENCRYPTED PRIVATE KEY")
111114
* OpenSSH key format ("BEGIN OPENSSH PRIVATE KEY")
115+
* PuTTY private key format ("PuTTY-User-Key-File-2", "PuTTY-User-Key-File-3")
112116
* ED25519 in
113117
* OpenSSL PKCS#8 PEM format ("BEGIN PRIVATE KEY", "BEGIN ENCRYPTED PRIVATE KEY")
114118
* OpenSSH key format ("BEGIN OPENSSH PRIVATE KEY")
119+
* PuTTY private key format ("PuTTY-User-Key-File-2", "PuTTY-User-Key-File-3")
115120

116121
Private keys in OpenSSL traditional PEM format can be encrypted using one of the following cipher methods:
117122
* DES-EDE3-CBC
@@ -123,7 +128,7 @@ Private keys in OpenSSL traditional PEM format can be encrypted using one of the
123128

124129
Private keys in OpenSSL PKCS#8 PEM format can be encrypted using any cipher method BouncyCastle supports.
125130

126-
Private keys in ssh.com format can be encrypted using one of the following cipher methods:
131+
Private keys in ssh.com format can be encrypted using the following cipher method:
127132
* 3des-cbc
128133

129134
Private keys in OpenSSH key format can be encrypted using one of the following cipher methods:
@@ -138,6 +143,9 @@ Private keys in OpenSSH key format can be encrypted using one of the following c
138143
* aes256-gcm<span></span>@openssh.com
139144
* chacha20-poly1305<span></span>@openssh.com
140145

146+
Private keys in PuTTY private key format can be encrypted using the following cipher method:
147+
* aes256-cbc
148+
141149
## Host Key Algorithms
142150

143151
**SSH.NET** supports the following host key algorithms:
@@ -177,6 +185,19 @@ Private keys in OpenSSH key format can be encrypted using one of the following c
177185

178186
The library has no special requirements to build, other than an up-to-date .NET SDK. See also [CONTRIBUTING.md](https://github.com/sshnet/SSH.NET/blob/develop/CONTRIBUTING.md).
179187

188+
## Using Pre-Release NuGet Package
189+
190+
If you need an unreleased bugfix or feature, you can use the Pre-Release NuGet packages from the `develop` branch which are published to the [GitHub NuGet Registry](https://github.com/sshnet/SSH.NET/pkgs/nuget/SSH.NET).
191+
In order to pull packages from the registry you first have to create a Personal Access Token with the `read:packages` permissions. Then add a NuGet Source for SSH.NET:
192+
193+
Note: you may have to add `--store-password-in-clear-text` on non-Windows platforms.
194+
195+
```
196+
dotnet nuget add source --name SSH.NET --username <username> --password <personalaccesstoken> https://nuget.pkg.github.com/sshnet/index.json
197+
```
198+
199+
Then you can add the the package as described [here](https://github.com/sshnet/SSH.NET/pkgs/nuget/SSH.NET).
200+
180201
## Supporting SSH.NET
181202

182203
Do you or your company rely on **SSH.NET** in your projects? If you want to encourage us to keep on going and show us that you appreciate our work, please consider becoming a [sponsor](https://github.com/sponsors/sshnet) through GitHub Sponsors.

Renci.SshNet.sln

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1010
.editorconfig = .editorconfig
1111
.gitattributes = .gitattributes
1212
.gitignore = .gitignore
13-
appveyor.yml = appveyor.yml
1413
CODEOWNERS = CODEOWNERS
1514
CONTRIBUTING.md = CONTRIBUTING.md
1615
Directory.Build.props = Directory.Build.props
@@ -83,6 +82,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Renci.SshNet.IntegrationBen
8382
EndProject
8483
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Renci.SshNet.AotCompatibilityTestApp", "test\Renci.SshNet.AotCompatibilityTestApp\Renci.SshNet.AotCompatibilityTestApp.csproj", "{F2E3FC50-4EF4-488C-B3D2-C45E99898D8B}"
8584
EndProject
85+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{05229079-6738-42CE-8F73-F4E182929B03}"
86+
EndProject
87+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{95F25B1A-2B14-4745-9087-43C00CD90EE0}"
88+
ProjectSection(SolutionItems) = preProject
89+
.github\workflows\build.yml = .github\workflows\build.yml
90+
.github\workflows\docs.yml = .github\workflows\docs.yml
91+
EndProjectSection
92+
EndProject
8693
Global
8794
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8895
Debug|Any CPU = Debug|Any CPU
@@ -244,6 +251,8 @@ Global
244251
{19895BAF-F946-470D-8497-7034F9F2A8A7} = {1E46D4B6-EE87-4D29-8641-0AE8CD8ED0F0}
245252
{3572019A-3A57-4578-B5A2-6280576EB508} = {1E46D4B6-EE87-4D29-8641-0AE8CD8ED0F0}
246253
{92E7B1B8-4C70-4138-9970-433B2FC2E3EB} = {1E46D4B6-EE87-4D29-8641-0AE8CD8ED0F0}
254+
{05229079-6738-42CE-8F73-F4E182929B03} = {04E8CC26-116E-4116-9558-7ED542548E70}
255+
{95F25B1A-2B14-4745-9087-43C00CD90EE0} = {05229079-6738-42CE-8F73-F4E182929B03}
247256
EndGlobalSection
248257
GlobalSection(ExtensibilityGlobals) = postSolution
249258
SolutionGuid = {BAD6019D-4AF7-4E15-99A0-8036E16FC0E5}

0 commit comments

Comments
 (0)