nobonobo / ssh-p2p

ssh p2p tunneling server and client
MIT License
243 stars 40 forks source link

Simplify connection process with auto-generate key and starting ssh on client #17

Open MurzNN opened 5 years ago

MurzNN commented 5 years ago

Will be good to simplify connection process via one command on client and server.

So auto-generate new key and store it in somewhere like .config/ssh-p2p and show short instruction for user. Something like this:

myuser@remotehost$ ssh-p2p server
No stored key found, generated new key: 34d90493-5f6f-4e2b-8932-a8e0b1c8aa27
Key stored in file .config/ssh-p2p/server-key.txt
Use this command on client for connect to this host:
ssh-p2p connect 34d90493-5f6f-4e2b-8932-a8e0b1c8aa27 -u myuser
Waiting for connections. Press Ctrl+C for exit.

And on client side - auto start ssh process after connecting:

myuser2@clienthost$ ssh-p2p connect 34d90493-5f6f-4e2b-8932-a8e0b1c8aa27 -u myuser
2019/06/04 06:54:40 main.go:269: pc ice state change:Checking
2019/06/04 06:54:42 main.go:269: pc ice state change:Connected
2019/06/04 06:54:42 Starting ssh process: ssh -p 2222 127.0.0.1 -u myuser
myuser@127.0.0.1's password:
myuser@remotehost$ # we are connected!