owenthereal / upterm

Instant Terminal Sharing
https://upterm.dev
Apache License 2.0
829 stars 54 forks source link

"Server refuse our key" if upterm client lost time sync #151

Open slapsh opened 1 year ago

slapsh commented 1 year ago

If I try to start upterm client on a host with wrong time on it, I will have "Server refuse our key" message when I try to connect to it by ssh client.

How to repeat: 1) Let's break time setting on target server:

$ timedatectl set-ntp false
$ timedatectl set-time 10:00
$ timedatectl
               Local time: Mon 2023-01-16 10:00:03 UTC
               Universal time: Mon 2023-01-16 10:00:03 UTC
               RTC time: Mon 2023-01-16 10:00:03
               Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: no
              NTP service: inactive
              RTC in local TZ: no

2) Run "upterm host" command:

./upterm host
=== CYCTSSRPMHSQZIRTANAP
Command:                /bin/bash
Force Command:          n/a
Host:                   ssh://uptermd.upterm.dev:22
SSH Session:            ssh CyCTSsrPMHsqzirTanap:YzAxZDU4ZTIudm0udXB0ZXJtLmludGVybmFsOjIyMjI=@uptermd.upterm.dev

Run 'upterm session current' to display this screen again

Press <q> or <ctrl-c> to accept connections...

3) Try to connect on some host to "target server" by upterm:

$ ssh CyCTSsrPMHsqzirTanap:YzAxZDU4ZTIudm0udXB0ZXJtLmludGVybmFsOjIyMjI=@uptermd.upterm.dev
CyCTSsrPMHsqzirTanap:YzAxZDU4ZTIudm0udXB0ZXJtLmludGVybmFsOjIyMjI=@uptermd.upterm.dev: Permission denied (publickey).

As soon as we sync time on target server everything works fine