gujjwal00 / avnc

VNC Client for Android
GNU General Public License v3.0
600 stars 57 forks source link

SSH Tunnel - Wrong VNC Password will leave SSH Tunnel open until app is closed #245

Closed userw2891 closed 1 month ago

userw2891 commented 1 month ago

A Wrong VNC Password will leave established SSH Tunnel open for a VNC un-established Remote Desktop Connection. Typing wrong VNC Password several times will open new SSH Tunnels, for each wrong VNC Password, that will remain open.

Those "orphan" SSH Tunnels will be closed only when AVNC is closed.

On Linux this can be easily seen with: $ sudo lsof -i:ssh

gujjwal00 commented 1 month ago

Normally, all connections are cleaned up as soon as you go back from Viewer.

Typing wrong VNC Password several times will open new SSH Tunnels, for each wrong VNC Password, that will remain open.

This should not happen, and I am unable to reproduce this. When you tap 'Retry' button, old SSH connection should be closed, and a new one should be established. Can you please grab AVNC logs from Settings => Tools => Logs, and paste here.

userw2891 commented 1 month ago

I paste it here... I am not sure about it (if I update yesterday to latest from F-droid, or if this log is relevant, or if I use this phone when I discover and test the Issue, or a cobination of those)

I signed in through ssh with authenticatin key, not password, if it might be a difference in software behavior.... the ssh established but I type wrong the vnc password witch just return typing the vnc password not ssh key password (passphrase), but open for it another ssh session... (I think the moment I push retry - for vnc password input)

the last ssh sesion close after ending the vnc session... but previos failed vnc authentication close only when I close te app.

Logs

```python --------- beginning of main 08-14 21:05:00.910 16493 16493 I com.gaurav.avn: Reinit property: dalvik.vm.checkjni= false 08-14 21:05:00.910 16493 16493 I com.gaurav.avn: ReInitProperties: persist.vm.debug.dumpapi= false 08-14 21:05:00.913 16493 16493 E com.gaurav.avn: Not starting debugger since process cannot load the jdwp agent. 08-14 21:05:00.960 16493 16511 I HwFrameworkSecurityPartsFactory: add HwFrameworkSecurityPartsFactory to memory. 08-14 21:05:00.961 16493 16511 E BehaviorCollectManager: Fail to acquire dataAnalyzerService... 08-14 21:05:01.006 16493 16493 I com.gaurav.avn: QarthPatchMonintor::Init 08-14 21:05:01.006 16493 16493 I com.gaurav.avn: 08-14 21:05:01.006 16493 16493 I com.gaurav.avn: QarthPatchMonintor::StartWatch 08-14 21:05:01.006 16493 16493 I com.gaurav.avn: 08-14 21:05:01.007 16493 16511 I HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=com.gaurav.avnc#10187#256 08-14 21:05:01.007 16493 16511 I HwApiCacheMangerEx: apicache path=/storage/21A7-7226 state=mounted key=com.gaurav.avnc#10187#256 08-14 21:05:01.007 16493 16511 I HwApiCacheMangerEx: need clear apicache,because volumes changed,oldCnt=0 newCnt=2 08-14 21:05:01.007 16493 16493 I com.gaurav.avn: QarthPatchMonintor::WatchPackage: /data/hotpatch/fwkhotpatch/ 08-14 21:05:01.008 16493 16493 I com.gaurav.avn: 08-14 21:05:01.008 16493 16493 I com.gaurav.avn: QarthPatchMonintor::CheckAndWatchPatch: /data/hotpatch/fwkhotpatch/com.gaurav.avnc 08-14 21:05:01.008 16493 16493 I com.gaurav.avn: 08-14 21:05:01.008 16493 16493 I com.gaurav.avn: QarthPatchMonintor::CheckAndWatchPatch: /data/hotpatch/fwkhotpatch/all 08-14 21:05:01.008 16493 16493 I com.gaurav.avn: 08-14 21:05:01.008 16493 16493 I com.gaurav.avn: QarthPatchMonintor::Run 08-14 21:05:01.008 16493 16493 I com.gaurav.avn: 08-14 21:05:01.009 16493 16514 I com.gaurav.avn: QarthPatchMonintor::Reading 08-14 21:05:01.009 16493 16514 I com.gaurav.avn: 08-14 21:05:01.009 16493 16514 I com.gaurav.avn: QarthPatchMonintor::CheckNotifyEvent 08-14 21:05:01.009 16493 16514 I com.gaurav.avn: 08-14 21:05:01.009 16493 16514 I com.gaurav.avn: QarthPatchMonintor::CheckNotifyEvent before read 08-14 21:05:01.009 16493 16514 I com.gaurav.avn: 08-14 21:05:01.010 16493 16511 I HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=com.gaurav.avnc#10187#0 08-14 21:05:01.010 16493 16511 I HwApiCacheMangerEx: apicache path=/storage/21A7-7226 state=mounted key=com.gaurav.avnc#10187#0 08-14 21:05:01.010 16493 16511 I HwApiCacheMangerEx: need clear apicache,because volumes changed,oldCnt=2 newCnt=2 08-14 21:05:01.017 16493 16511 I AwareBitmapCacher: init processName:com.gaurav.avnc pid=16493 uid=10187 08-14 21:05:01.022 16493 16516 E AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile@404fba8 08-14 21:05:01.050 16493 16518 I iGraphics: [0020080c] pn: com.gaurav.avnc, p: 16493 08-14 21:05:01.051 16493 16518 I iGraphics: [0030050c] PV 10 08-14 21:05:01.051 16493 16518 I iGraphics: [0030050c] no element 'igfx' 08-14 21:05:01.052 16493 16518 I iGraphics: [0030050c] LoadCloudParams lib file success. 08-14 21:05:01.053 16493 16518 E Parcel : Reading a NULL string not supported here. 08-14 21:05:01.061 16493 16518 E GED : Failed to get GED Log Buf, err(0) 08-14 21:05:01.119 16493 16493 I DecorView[]: old windowMode:0 new windoMode:1 08-14 21:05:01.147 16493 16493 I OverScrollerOptimization: start init SmartSlideOverScroller and get the overscroller config 08-14 21:05:01.147 16493 16493 I OverScrollerOptimization: get the overscroller config 08-14 21:05:01.279 16493 16493 I DecorView[]: old windowMode:1 new windoMode:1 08-14 21:05:01.296 16493 16529 W HiTouch_HiTouchSensor: depended package hiTouch does n't exist! 08-14 21:05:01.296 16493 16529 I HiTouch_HiTouchSensor: HiTouch restricted: system app HiTouch don't exist. 08-14 21:05:01.428 16493 16518 W Gralloc3: mapper 3.x is not supported 08-14 21:05:01.431 16493 16518 E ion : ioctl c0044901 failed with code -1: Invalid argument 08-14 21:05:01.481 16493 16493 I HwViewRootImpl: removeInvalidNode jank list is null 08-14 21:05:01.553 16493 16493 W InputMethodManager: startInputReason = 1 08-14 21:05:01.593 16493 16493 W InputMethodManager: startInputReason = 5 08-14 21:05:03.421 16493 16493 I Hwaps : APS: EventAnalyzed: initAPS: version is 10.1.0.18 08-14 21:05:03.422 16493 16493 I hwaps : HwAps: JNI_OnLoad --------- beginning of system 08-14 21:05:03.519 16493 16493 W HwApsManager: HwApsManagerService, registerCallback, start ! 08-14 21:05:03.571 16493 16493 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@a679be2 08-14 21:05:03.594 16493 16493 I DecorView[]: old windowMode:0 new windoMode:1 08-14 21:05:03.653 16493 16493 I DecorView[]: old windowMode:1 new windoMode:1 08-14 21:05:03.661 16493 16539 W HiTouch_HiTouchSensor: depended package hiTouch does n't exist! 08-14 21:05:03.661 16493 16539 I HiTouch_HiTouchSensor: HiTouch restricted: system app HiTouch don't exist. 08-14 21:05:03.804 16493 16493 W InputMethodManager: startInputReason = 1 ```

gujjwal00 commented 1 month ago

Does this happen every time you enter an incorrect VNC password and then tap on the retry button, or only sometimes? Because the later would indicate a race condition somewhere in cleanup code.

And I also tried the private key without much success in reproducing the bug.

userw2891 commented 1 month ago

Ok I have done more testing On one of my phones (not the one with the log) I have an older version 2.5.1 where this reproduce easily Updating on that phone to latest F-droid Version 2.5.3 no problem here ... regarding mentioned issue

But I observe another issue (on version 2.5.3), after I type password wrong and push retry, I have to push several times retry, as it does not bring the password enter dialog again (just after pushing several times retry). I don't know if it works after leaving it couple of seconds or not, or what exactly in the end it trigger the dialog to show.

userw2891 commented 1 month ago

so I think this issue can be closed, regarding the other one new ...

userw2891 commented 1 month ago

just extra mention retry password is for same VNC wrong password, (after I open the connection over ssh with the Key password)

gujjwal00 commented 1 month ago

Oh, I think you are hitting a known bug introduced in v2.5.0, where connections were not cleaned up properly. It was fixed in v2.5.2: https://github.com/gujjwal00/avnc/commit/04ad0d38a75713b9dcbf168bdb64a8129cf18354

But I observe another issue (on version 2.5.3), after I type password wrong and push retry, I have to push several times retry, as it does not bring the password enter dialog again (just after pushing several times retry). I don't know if it works after leaving it couple of seconds or not, or what exactly in the end it trigger the dialog to show.

This is probably just the VNC server temporarily refusing connections after a few incorrect password attempts.