Slithin icon indicating copy to clipboard operation
Slithin copied to clipboard

[Bug] Hard crash when using key based authentication with SSH version 8.8p1

Open ghost opened this issue 3 years ago • 3 comments

Hard crash when connecting to a remarkable tablet profile that uses SSH key authentication (not password authentication which works just fine).

I assume that's due to my version of SSH being >= 8.8. See https://remarkablewiki.com/tech/ssh at the bottom of the page for confirmation and a workaround.

Reproduce on any GNU/Linux distribution (I'm using the latest Fedora) by:

  • adding a profile that uses an SSH key
  • running a version of SSH greater than or equal to 8.8 on that machine

To get a shell from the command line I had to change some settings in my $HOME/.ssh/config file which let me connect just fine. For reference here's what I had to add to my config:

Host *
        PubkeyAcceptedKeyTypes +ssh-rsa
        HostKeyAlgorithms +ssh-rsa

And here's the logs:

Unhandled exception. Renci.SshNet.Common.SshException: openssh key type: ssh-rsa is not supported
   at Renci.SshNet.PrivateKeyFile.ParseOpenSshV1Key(Byte[] keyFileData, String passPhrase)
   at Renci.SshNet.PrivateKeyFile.Open(Stream privateKey, String passPhrase)
   at Renci.SshNet.PrivateKeyFile..ctor(Stream privateKey)
   at Slithin.Models.LoginInfo.GetKey() in /home/runner/work/Slithin/Slithin/Source/Slithin/Models/LoginInfo.cs:line 28
   at Slithin.ViewModels.ConnectionWindowViewModel.Connect(Object obj) in /home/runner/work/Slithin/Slithin/Source/Slithin/ViewModels/ConnectWindowViewModel.cs:line 138
   at Slithin.Core.MVVM.DelegateCommand.Execute(Object parameter) in /home/runner/work/Slithin/Slithin/Source/Libraries/Slithin.Core/MVVM/DelegateCommand.cs:line 32
   at Avalonia.Controls.Button.OnClick() in /_/src/Avalonia.Controls/Button.cs:line 321
   at Avalonia.Controls.Button.OnPointerReleased(PointerReleasedEventArgs e) in /_/src/Avalonia.Controls/Button.cs:line 364
   at Avalonia.Input.InputElement.<>c.<.cctor>b__32_9(InputElement x, PointerReleasedEventArgs e) in /_/src/Avalonia.Input/InputElement.cs:line 223
   at Avalonia.Interactivity.RoutedEvent.<>c__DisplayClass23_0.<AddClassHandler>b__0(ValueTuple`2 args) in /_/src/Avalonia.Interactivity/RoutedEvent.cs:line 94
   at System.Reactive.AnonymousObserver`1.OnNextCore(T value) in /_/Rx.NET/Source/src/System.Reactive/AnonymousObserver.cs:line 67
   at System.Reactive.ObserverBase`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/ObserverBase.cs:line 36
   at System.Reactive.Subjects.Subject`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs:line 145
   at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 118
   at Avalonia.Interactivity.EventRoute.RaiseEvent(IInteractive source, RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 79
   at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/Interactive.cs:line 123
   at Avalonia.Input.MouseDevice.MouseUp(IMouseDevice device, UInt64 timestamp, IInputRoot root, Point p, PointerPointProperties props, KeyModifiers inputModifiers) in /_/src/Avalonia.Input/MouseDevice.cs:line 313
   at Avalonia.Input.MouseDevice.ProcessRawEvent(RawPointerEventArgs e) in /_/src/Avalonia.Input/MouseDevice.cs:line 144
   at Avalonia.Input.InputManager.ProcessInput(RawInputEventArgs e) in /_/src/Avalonia.Input/InputManager.cs:line 37
   at Avalonia.RawEventGrouper.DispatchFromQueue() in /_/src/Shared/RawEventGrouping.cs:line 56
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 37
   at Avalonia.X11.X11PlatformThreading.HandleX11(CancellationToken cancellationToken) in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 169
   at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken) in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 245
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 65
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 120
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 209
   at Slithin.Program.Main(String[] args) in /home/runner/work/Slithin/Slithin/Source/Slithin/Program.cs:line 21
Aborted (core dumped)

I would have submitted a fix as a pull request since it seems like all we'd need to do is pass some configuration options to SSH.NET to allow for that key format but I'm unfamiliar with cross platform C# development and won't have time to attempt a fix until the weekend.

ghost avatar Jul 06 '22 21:07 ghost

Do you know if the problem only exists on linux or also on windows?

furesoft avatar Jul 07 '22 12:07 furesoft

I could not reproduce the error on windows 10 or on debian buster (oldstable not current) however the output of ssh -V on windows returned:

OpenSSH_for_Windows_7.7p1

so I believe that once they integrate version 8 where that key type was deprecated the bug will surface again unless rsa keys of the type Remarkable tablets support are manually enabled in Slithin's codebase.

ghost avatar Jul 15 '22 19:07 ghost

Could be this. Some additional params need to passed to OpenSSH

OpenSSH 8.8 ssh-rsa problem https://github.com/simonschllng/rm-sync/issues/10

PhilT avatar Aug 12 '22 22:08 PhilT