pcarrier / srv.us

ssh to expose local HTTP services online, CLI pastebin, etc.
https://docs.srv.us
BSD Zero Clause License
87 stars 8 forks source link

Non-HTTP protocols #20

Closed musahi0128 closed 1 year ago

musahi0128 commented 1 year ago

Hi, I am trying to expose my ssh port through your service. I use this command on my server

~/Downloads# ssh srv.us -R 1:localhost:22
The authenticity of host 'srv.us (5.161.108.112)' can't be established.
ED25519 key fingerprint is SHA256:oG4TmU4TFvLkEOWN80+x+ITOMfFRyusJ1IC7ZBYAKTM.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'srv.us' (ED25519) to the list of known hosts.
1: https://uvlkreaxmsbbc6gcwnkeknk6eu.srv.us/

I then tried ssh to the provided https address

C:\Users\User1>ssh -i .ssh\id_rsa uvlkreaxmsbbc6gcwnkeknk6eu.srv.us -p 22
Usage: ssh srv.us -R 1:localhost:3000 -R 2:192.168.0.1:80 …
Connection to uvlkreaxmsbbc6gcwnkeknk6eu.srv.us closed.

it goes straight to exit as shown above. Can you please give example for the usage I tried? akin to SSH jump server I guess. Thanks!

pcarrier commented 1 year ago

We still wrap all services in TLS (SSL), so for protocols that do not support it, you'll need to use something like stunnel.

For example:

$ cat config.stunnel
foreground = yes
[ssh]
client = yes
accept = 22222
connect = pcarrier.gh.srv.us:443
$ stunnel config.stunnel
2023.08.24 22:22:41 LOG5[ui]: stunnel 5.70 on aarch64-apple-darwin22.4.0 platform
2023.08.24 22:22:41 LOG5[ui]: Compiled with OpenSSL 3.1.1 30 May 2023
2023.08.24 22:22:41 LOG5[ui]: Running  with OpenSSL 3.1.2 1 Aug 2023
2023.08.24 22:22:41 LOG5[ui]: Threading:PTHREAD Sockets:POLL,IPv6 TLS:ENGINE,OCSP,PSK,SNI
2023.08.24 22:22:41 LOG5[ui]: Reading configuration from file /Users/pcarrier/config.stunnel
2023.08.24 22:22:41 LOG5[ui]: UTF-8 byte order mark not detected
2023.08.24 22:22:41 LOG5[ui]: FIPS mode disabled
2023.08.24 22:22:41 LOG4[ui]: Service [ssh] needs authentication to prevent MITM attacks
2023.08.24 22:22:41 LOG5[ui]: Configuration successful
[…]

then while stunnel is running,

$ ssh localhost -p 22222
musahi0128 commented 1 year ago

It works, thanks!