Bug 426987 - Android app increments port numbers for SFTP plugin, result is many extra known_hosts keys on desktop.
Summary: Android app increments port numbers for SFTP plugin, result is many extra kno...
Status: REPORTED
Alias: None
Product: kdeconnect
Classification: Applications
Component: android-application (other bugs)
Version First Reported In: unspecified
Platform: Android Android 10.x
: NOR normal
Target Milestone: ---
Assignee: Albert Vaca Cintora
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-26 10:37 UTC by Tom Brossman
Modified: 2020-09-26 10:37 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Brossman 2020-09-26 10:37:52 UTC
SUMMARY

If I restart my router, or toggle WiFi off/on on my mobile phone, and the SFTP auto-connect option is enabled, the Android app increments the port number it chooses by one, which causes unwanted extra entries in the ~/.ssh/known_hosts file of the paired desktop Linux machine. If the Android app reused the same port when reconnecting, this would not happen.

STEPS TO REPRODUCE

1. Pair Android app with desktop Linux machine
2. Enable SFTP (and auto-connect) option
3. After pairing is established, observe one new host key for mobile phone in desktop machine's known_hosts file
4. Toggle WiFi off/on and wait a moment for app to reconnect SFTP.
5. (optional) Set HashKnownHosts to 'yes' in desktop SSH config file, to confirm source IP of the redundant lines originates from mobile phone's LAN IP.

OBSERVED RESULT

A new host key appears in the desktop machine's known_hosts file every single time WiFi + SFTP disconnects and reconnects.

EXPECTED RESULT

The same port should be reused so that only one host key ever appears in the desktop machine's known_hosts file after WiFi + SFTP disconnects and reconnects.

SOFTWARE/OS VERSIONS

Android 10
Google Pixel 4
KDE Connect 1.14.2 (From F-Droid)

Ubuntu 20.04.01
GSConnect GNOME Shell extension 

ADDITIONAL INFORMATION

Example sequential host key/port combinations from known_hosts:

[192.168.1.102]:1740 ssh-rsa AAAAB3NzaC1yc...<redacted>
[192.168.1.102]:1741 ssh-rsa AAAAB3NzaC1yc...<redacted>
[192.168.1.102]:1742 ssh-rsa AAAAB3NzaC1yc...<redacted>
[192.168.1.102]:1743 ssh-rsa AAAAB3NzaC1yc...<redacted>