isontheline / pro.webssh.net

iOS / iPadOS / macOS SSH Client
https://apps.apple.com/us/app/id497714887
MIT License
316 stars 46 forks source link

Reboot and (R) restart sometimes results in "Bad Credentials" #879

Closed sbrooke closed 1 year ago

sbrooke commented 1 year ago

Bug description

Recent change. Occasionally when I reboot and am logged out of the system, I wait for the restart, hit R to reconnect and get "Bad Credentials" or something like that. Close the tab, open a new tab, and the login works fine.

Screenshots

I'll try to capture this next time.

isontheline commented 1 year ago

Strange behavior as I'm rebooting lot of server each week.

Are you using password or private key? If last one, does the pkey requires a passphrase?

sbrooke commented 1 year ago

Password only. Same MacOS system as the other issue.

isontheline commented 1 year ago

Could you enable verbose logging in order to find the root cause?

In order to enable verbose logging you can follow the steps :

  1. Launch WebSSH
  2. WebSSH menu (top bar)
  3. Settings
  4. Log Level > Verbose
  5. Restart WebSSH
  6. Reproduce your action
  7. Launch mashREPL (inside WebSSH)
  8. Type pwd
  9. Go to the folder printed
  10. Find WebSSH logs there
sbrooke commented 1 year ago

Happened again, here's the reconnect attempt. I've modified the IP address:

2023/05/04 12:11:17:988 [DEBUG] Fetching from iCloud with a change token
2023/05/04 12:11:18:171 [DEBUG] iCloud data fetched with success.
2023/05/04 12:11:32:231 [VERBOSE] Closing the connection...
2023/05/04 12:11:32:231 [VERBOSE] Session was not connected.
2023/05/04 12:11:32:231 [VERBOSE] Connection is now closed.
2023/05/04 12:11:32:231 [VERBOSE] Reconnecting...
2023/05/04 12:11:32:231 [VERBOSE] Launching connection with block...
2023/05/04 12:11:32:231 [VERBOSE] Won't dismiss prompt because no one is displayed.
2023/05/04 12:11:32:249 [DEBUG] No SOCKS Tunnel launched. SSH connection will be established without any SOCKS hostname.
2023/05/04 12:11:32:311 [DEBUG] Connected to : x.x.x.x
2023/05/04 12:11:32:312 [DEBUG] Authentication using login/password
2023/05/04 12:11:32:407 [VERBOSE] <SSHLog>
  <AuthenticatePw>
    <SSHVersion>9.5.0.91</SSHVersion>
    <authenticatePw>
      <sshAuthenticatePw>
        <requestUserAuthService>
          <sendServiceRequest>
            <svcName>ssh-userauth</svcName>
            <SentServiceReq>ssh-userauth</SentServiceReq>
          </sendServiceRequest>
        </requestUserAuthService>
        <AuthMethods>publickey,password</AuthMethods>
        <passwordAuth>
          <sshRawPacket>Socket connection closed.</sshRawPacket>
          <sshReadMessage>Socket connection closed.</sshReadMessage>
          <error>Error reading password userauth response.</error>
          <userauth_response>Socket connection closed.</userauth_response>
        </passwordAuth>
      </sshAuthenticatePw>
      <error>Socket connection lost.</error>
    </authenticatePw>
    <error>Failed.</error>
  </AuthenticatePw>
</SSHLog>
2023/05/04 12:11:32:591 [DEBUG] Dismissing prompt...
2023/05/04 12:11:32:989 [DEBUG] Fetching from iCloud with a change token
2023/05/04 12:11:33:184 [DEBUG] iCloud data fetched with success.
2023/05/04 12:11:47:990 [DEBUG] Fetching from iCloud with a change token
2023/05/04 12:11:48:176 [DEBUG] iCloud data fetched with success.
2023/05/04 12:11:54:441 [VERBOSE] Closing the connection...
2023/05/04 12:11:54:441 [VERBOSE] Session was not connected.
2023/05/04 12:11:54:442 [VERBOSE] Connection is now closed.

Here's what happens when I hit Q and then launch the same session new:


2023/05/04 12:17:33:073 [VERBOSE] Closing connection...
2023/05/04 12:17:33:073 [VERBOSE] Session was not connected.
2023/05/04 12:17:33:073 [VERBOSE] Connection closed.
2023/05/04 12:17:33:183 [DEBUG] iCloud data fetched with success.
2023/05/04 12:17:33:596 [VERBOSE] Saving (pushAllowed == 1) object blahDeBlahHexCodeWasHere to local database
2023/05/04 12:17:33:606 [DEBUG] Launch_SSH_Count_21.8 : 21
2023/05/04 12:17:33:607 [DEBUG] Launch_SSH_Count : 318
2023/05/04 12:17:33:608 [VERBOSE] IAP already purchased (iCloud) : com.webssh.pro.unlimited
2023/05/04 12:17:33:609 [DEBUG] Will end edit on scene DifferentIDWasHere
2023/05/04 12:17:34:119 [INFO] Success iCloud save object : blahDeBlahHexCodeWasHere
2023/05/04 12:17:35:283 [DEBUG] No custom SSH Config File will overwrite this connection settings
2023/05/04 12:17:35:283 [VERBOSE] Launching connection (SSH)...
2023/05/04 12:17:35:283 [VERBOSE] Connecting to SSH...
2023/05/04 12:17:35:283 [VERBOSE] Launching connection with block...
2023/05/04 12:17:35:283 [VERBOSE] Won't dismiss prompt because no one is displayed.
2023/05/04 12:17:35:293 [DEBUG] No SOCKS Tunnel launched. SSH connection will be established without any SOCKS hostname.
2023/05/04 12:17:35:323 [DEBUG] Connected to : x.x.x.x
2023/05/04 12:17:35:325 [DEBUG] Authentication using login/password
2023/05/04 12:17:36:095 [VERBOSE] Connecting with terminal type 'xterm-256color' and size : 80x24
2023/05/04 12:17:36:098 [VERBOSE] Launching check data notifier
2023/05/04 12:17:36:200 [DEBUG] Dismissing prompt...
2023/05/04 12:17:38:591 [VERBOSE] Is now connected to SSH, displaying terminal
2023/05/04 12:17:38:604 [DEBUG] Loading Xterm.js terminal...
2023/05/04 12:17:38:780 [DEBUG] Xterm.js terminal WKWebView has been successfully loaded```
isontheline commented 1 year ago

That's strange.

I will check if I vacuum the connection properly before trying to reconnect.

I hope to come back to you with a fix in a couple of days.

isontheline commented 1 year ago

I'm not able to reproduce the "Bad Credentials" :

Image

Perhaps server has not finished to start on your side?

sbrooke commented 1 year ago

No, it's finished starting. Different behavior when I'm too fast. I've waited a while before hitting the restart and I'm having this behavior.

isontheline commented 1 year ago

I've tested again without any success to reproduce.

When you (R)etry multiple times without exiting the terminal it doesn't work? You need to exit in order to gain success access again?

isontheline commented 1 year ago

Hello @sbrooke 👋

Does any updates since May should have fixed this issue?

sbrooke commented 1 year ago

I haven’t noticed it recently. I’ve been doing SSH a little less recently, just because other things are getting in the way. I have some planned work in the next week or two, so I’ll let you know if it happens again.

I’m ok with closing this ticket and I can open it back up if I experience it again. Thanks!

isontheline commented 1 year ago

Thank you so much for your feedback @sbrooke 🙏

Yes feel free to reopen it at any time

Thank you again!