diff --git a/readme.md b/readme.md index f058894..ab45aa3 100644 --- a/readme.md +++ b/readme.md @@ -108,3 +108,6 @@ To contribute, please pick off an item from the project or issue page. We'd love * [Extension Docs](https://docs.microsoft.com/en-us/visualstudio/extensibility/creating-a-settings-category?view=vs-2022) * [Extension Sample](https://github.com/microsoft/VSSDK-Extensibility-Samples/tree/master/Options) * [Offroad Debugging](https://github.com/Microsoft/MIEngine/wiki/Offroad-Debugging-of-.NET-Core-on-Linux---OSX-from-Visual-Studio) + + +_Copyright 2024 Xeno Innovations, Inc._ diff --git a/release-notes.md b/release-notes.md index f654dae..dca1dd5 100644 --- a/release-notes.md +++ b/release-notes.md @@ -4,6 +4,20 @@ This document contains the release information for the project. +### 2.2.0 + +* Fixed: Support VS v17.9 (#79) +* Update: SSH.NET to v2023.0.1 + +### 2.1.1 + +* Update: Version 2.1 and Code Housekeeping by @DamianSuess in #65 +* Update: GUI .NET 6 Sample NuGet packages by @DamianSuess in #68 +* Update: PR Template by @DamianSuess in #69 +* Update: Release build generator script by @DamianSuess in #70 +* Update: Quality control by @DamianSuess in #74 +* Update: Upgrade github actions by @DamianSuess in #75 + ### 2.1 * Update: Code cleanup diff --git a/src/VsLinuxDebugger/Core/Security/RsaSha256DigitalSignature.cs b/src/VsLinuxDebugger/Core/Security/RsaSha256DigitalSignature.cs deleted file mode 100644 index c0096ad..0000000 --- a/src/VsLinuxDebugger/Core/Security/RsaSha256DigitalSignature.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Security.Cryptography; -using Renci.SshNet.Common; -using Renci.SshNet.Security.Cryptography; -using Renci.SshNet.Security.Cryptography.Ciphers; - -namespace VsLinuxDebugger.Core.Security -{ - /// - /// Based on https://github.com/sshnet/SSH.NET/blob/1d5d58e17c68a2f319c51e7f938ce6e964498bcc/src/Renci.SshNet/Security/Cryptography/RsaDigitalSignature.cs#L12 - /// - /// With following changes: - /// - OID changed to sha2-256 - /// - hash changed from sha1 to sha2-256 - /// - public class RsaSha256DigitalSignature : CipherDigitalSignature, IDisposable - { - private HashAlgorithm _hash; - - private bool _isDisposed; - - /// Construct with a custom Object Identifier. - /// RSA Key. - public RsaSha256DigitalSignature(RsaWithSha256SignatureKey rsaKey) - : base(new ObjectIdentifier(2, 16, 840, 1, 101, 3, 4, 2, 1), new RsaCipher(rsaKey)) - { - // custom - _hash = SHA256.Create(); - } - - ~RsaSha256DigitalSignature() - { - Dispose(false); - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (_isDisposed) - return; - - if (disposing) - { - var hash = _hash; - if (hash != null) - { - hash.Dispose(); - _hash = null; - } - - _isDisposed = true; - } - } - - protected override byte[] Hash(byte[] input) - { - return _hash.ComputeHash(input); - } - } -} diff --git a/src/VsLinuxDebugger/Core/Security/RsaSha256Util.cs b/src/VsLinuxDebugger/Core/Security/RsaSha256Util.cs deleted file mode 100644 index 435f3d4..0000000 --- a/src/VsLinuxDebugger/Core/Security/RsaSha256Util.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Reflection; -using System.Security.Cryptography; -using Renci.SshNet; -using Renci.SshNet.Common; -using Renci.SshNet.Security; -using Renci.SshNet.Security.Cryptography; -using Renci.SshNet.Security.Cryptography.Ciphers; - -namespace VsLinuxDebugger.Core.Security -{ - /// - /// Utility class which allows ssh.net to connect to servers using ras-sha2-256. - /// - public static class RsaSha256Util - { - /// RSA SHA2 256. - public const string RSA_SHA2_256 = "rsa-sha2-256"; - - /// - /// Converts key file to rsa key with sha2-256 signature - /// Due to lack of constructor: https://github.com/sshnet/SSH.NET/blob/bc99ada7da3f05f50d9379f2644941d91d5bf05a/src/Renci.SshNet/PrivateKeyFile.cs#L86 - /// We do that in place - /// - /// Private key file. - /// Argument Null Exception. - public static void ConvertToKeyWithSha256Signature(PrivateKeyFile keyFile) - { - var oldKeyHostAlgorithm = keyFile.HostKey as KeyHostAlgorithm; - if (oldKeyHostAlgorithm == null) - { - throw new ArgumentNullException(nameof(oldKeyHostAlgorithm)); - } - - var oldRsaKey = oldKeyHostAlgorithm.Key as RsaKey; - if (oldRsaKey == null) - { - throw new ArgumentNullException(nameof(oldRsaKey)); - } - - var newRsaKey = new RsaWithSha256SignatureKey(oldRsaKey.Modulus, oldRsaKey.Exponent, oldRsaKey.D, oldRsaKey.P, oldRsaKey.Q, - oldRsaKey.InverseQ); - - UpdatePrivateKeyFile(keyFile, newRsaKey); - } - - public static void SetupConnection(ConnectionInfo connection) - { - connection.HostKeyAlgorithms[RSA_SHA2_256] = data => new KeyHostAlgorithm(RSA_SHA2_256, new RsaKey(), data); - } - - private static void UpdatePrivateKeyFile(PrivateKeyFile keyFile, RsaWithSha256SignatureKey key) - { - var keyHostAlgorithm = new KeyHostAlgorithm(key.ToString(), key); - - var hostKeyProperty = typeof(PrivateKeyFile).GetProperty(nameof(PrivateKeyFile.HostKey)); - hostKeyProperty.SetValue(keyFile, keyHostAlgorithm); - - var keyField = typeof(PrivateKeyFile).GetField("_key", BindingFlags.NonPublic | BindingFlags.Instance); - keyField.SetValue(keyFile, key); - } - } -} diff --git a/src/VsLinuxDebugger/Core/Security/RsaWithSha256SignatureKey.cs b/src/VsLinuxDebugger/Core/Security/RsaWithSha256SignatureKey.cs deleted file mode 100644 index d94942f..0000000 --- a/src/VsLinuxDebugger/Core/Security/RsaWithSha256SignatureKey.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Renci.SshNet.Common; -using Renci.SshNet.Security; -using Renci.SshNet.Security.Cryptography; - -namespace VsLinuxDebugger.Core.Security -{ - /// RSA With SHA256 Signature Key. - public class RsaWithSha256SignatureKey : RsaKey - { - private RsaSha256DigitalSignature _digitalSignature; - - public RsaWithSha256SignatureKey(BigInteger modulus, BigInteger exponent, BigInteger d, BigInteger p, BigInteger q, BigInteger inverseQ) - : base(modulus, exponent, d, p, q, inverseQ) - { - } - - protected override DigitalSignature DigitalSignature - { - get - { - _digitalSignature ??= new RsaSha256DigitalSignature(this); - return _digitalSignature; - } - } - - public override string ToString() - { - return RsaSha256Util.RSA_SHA2_256; - } - } -} diff --git a/src/VsLinuxDebugger/Core/SshTool.cs b/src/VsLinuxDebugger/Core/SshTool.cs index 4b52d88..ae0e9fa 100644 --- a/src/VsLinuxDebugger/Core/SshTool.cs +++ b/src/VsLinuxDebugger/Core/SshTool.cs @@ -8,7 +8,6 @@ using Renci.SshNet.Common; using SharpCompress.Common; using SharpCompress.Writers; -using VsLinuxDebugger.Core.Security; namespace VsLinuxDebugger.Core { @@ -16,8 +15,8 @@ public class SshTool : IDisposable { private readonly string _tarGzFileName = "vsldBuildContents.tar.gz"; - private bool _isConnected = false; private SshConnectionInfo _info; + private bool _isConnected = false; private ScpClient _scp; private SftpClient _sftp; private SshClient _ssh; @@ -157,22 +156,25 @@ public async Task CleanFolderAsync(string path) public async Task ConnectAsync() { PrivateKeyFile keyFile = null; - ConnectionInfo conn = null; + ConnectionInfo connInfo = null; try { if (_info.PrivateKeyEnabled) { + Logger.Output($"SSH configuring private key connection..."); + if (string.IsNullOrEmpty(_info.PrivateKeyPassword)) keyFile = new PrivateKeyFile(_info.PrivateKeyPath); else keyFile = new PrivateKeyFile(_info.PrivateKeyPath, _info.PrivateKeyPassword); + /** // adds rsa-sha2-256 RsaSha256Util.ConvertToKeyWithSha256Signature(keyFile); var authenticationMethodRsa = new PrivateKeyAuthenticationMethod(_info.UserName, keyFile); - conn = new ConnectionInfo(_info.Host, _info.Port, _info.UserName, authenticationMethodRsa); - RsaSha256Util.SetupConnection(conn); - + connInfo = new ConnectionInfo(_info.Host, _info.Port, _info.UserName, authenticationMethodRsa); + RsaSha256Util.SetupConnection(connInfo); + */ } } catch (Exception ex) @@ -184,10 +186,10 @@ public async Task ConnectAsync() try { - if (_info.PrivateKeyEnabled && File.Exists(_info.PrivateKeyPath)) - _ssh = new SshClient(conn); - else - _ssh = new SshClient(_info.Host, _info.Port, _info.UserName, _info.UserPass); + Logger.Output($"SSH connecting..."); + _ssh = (_info.PrivateKeyEnabled && File.Exists(_info.PrivateKeyPath)) + ? new SshClient(_info.Host, _info.Port, _info.UserName, keyFile) + : new SshClient(_info.Host, _info.Port, _info.UserName, _info.UserPass); await Task.Run(() => _ssh.Connect()); } @@ -199,20 +201,17 @@ public async Task ConnectAsync() try { - if (_info.PrivateKeyEnabled && File.Exists(_info.PrivateKeyPath)) - _sftp = new SftpClient(conn); - else - _sftp = new SftpClient(_info.Host, _info.Port, _info.UserName, _info.UserPass); + _sftp = (_info.PrivateKeyEnabled && File.Exists(_info.PrivateKeyPath)) + ? new SftpClient(connInfo) + : new SftpClient(_info.Host, _info.Port, _info.UserName, _info.UserPass); _sftp.Connect(); - } catch (Exception) { - if (_info.PrivateKeyEnabled && File.Exists(_info.PrivateKeyPath)) - _scp = new ScpClient(conn); - else - _scp = new ScpClient(_info.Host, _info.Port, _info.UserName, _info.UserPass); + _scp = (_info.PrivateKeyEnabled && File.Exists(_info.PrivateKeyPath)) + ? new ScpClient(connInfo) + : new ScpClient(_info.Host, _info.Port, _info.UserName, _info.UserPass); _scp.Connect(); } diff --git a/src/VsLinuxDebugger/Properties/AssemblyInfo.cs b/src/VsLinuxDebugger/Properties/AssemblyInfo.cs index 132fadc..0b7c19c 100644 --- a/src/VsLinuxDebugger/Properties/AssemblyInfo.cs +++ b/src/VsLinuxDebugger/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -10,7 +9,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xeno Innovations, Inc.")] [assembly: AssemblyProduct("VS Linux Debugger")] -[assembly: AssemblyCopyright("Copyright 2022-2023 Xeno Innovations, Inc.")] +[assembly: AssemblyCopyright("Copyright 2022-2024 Xeno Innovations, Inc.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -29,5 +28,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.1.3")] -[assembly: AssemblyFileVersion("2.1.1.3")] +[assembly: AssemblyVersion("2.2.0.0")] +[assembly: AssemblyFileVersion("2.2.0.0")] diff --git a/src/VsLinuxDebugger/VsLinuxDebugger.csproj b/src/VsLinuxDebugger/VsLinuxDebugger.csproj index 1308f72..b1330c8 100644 --- a/src/VsLinuxDebugger/VsLinuxDebugger.csproj +++ b/src/VsLinuxDebugger/VsLinuxDebugger.csproj @@ -53,9 +53,6 @@ - - - @@ -104,7 +101,7 @@ 0.30.1 - 2020.0.2 + 2023.0.1 6.0.2 diff --git a/src/VsLinuxDebugger/source.extension.vsixmanifest b/src/VsLinuxDebugger/source.extension.vsixmanifest index 5b45ac0..8fbf5cd 100644 --- a/src/VsLinuxDebugger/source.extension.vsixmanifest +++ b/src/VsLinuxDebugger/source.extension.vsixmanifest @@ -4,7 +4,7 @@ xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011"> VS Linux Debugger @@ -14,7 +14,7 @@ ..\..\readme.md ..\..\release-notes.md Resources\TuxDebug.png - debug; build; remote debug; vsdbg; linux; xamarin; rpi; rpi4; remotedebug; remote; debugger; linux debug; net6; dotnet; raspberry pi; ubuntu; + debug; build; remote debug; vsdbg; linux; xamarin; rpi; rpi4; remotedebug; remote; debugger; linux debug; net6; dotnet; raspberry pi; ubuntu; suess; suess-labs; xeno-innovations