ThomDietrich / home-assistant-addons

AutoSSH Home Assistant Addon - alternative to cloud or VPN: Permanent port forwarding
MIT License
32 stars 18 forks source link

Localhost.run - not getting the Sub-domain name from the log #1

Closed iosoft closed 2 years ago

iosoft commented 2 years ago

Hello,

I am using the Localhost.run service because its free. Here is my configuration -

hostname: localhost.run
ssh_port: 22
username: autossh
remote_forwarding:
  - localhost.run:80:192.168.79.79:8123
other_ssh_options: '-v'
force_keygen: false

Even though the connection works, but, I can not find the subdomain name from the log details.

==============================================================
Welcome to localhost.run!
Follow your favourite reverse tunnel at [https://twitter.com/localhost_run].
**You need a SSH key to access this service.**
If you get a permission denied follow Gitlab's most excellent howto:
https://docs.gitlab.com/ee/ssh/
*Only rsa and ed25519 keys are supported*
To set up and manage custom domains go to https://admin.localhost.run/
More details on custom domains (and how to enable subdomains of your custom
domain) at https://localhost.run/docs/custom-domains
To explore using localhost.run visit the documentation site:
https://localhost.run/docs/
==============================================================
** your connection id is 4de07fb0-777c-43e0-9ec4-589d360XXXXXX, please mention it if you send me a message about an issue. **
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /data/ssh_keys/autossh_rsa_key RSA SHA256:HL7Z3tI+X/iCe1V5AjLxx0cPthbzTSdJbQX8KCHdt2g explicit
debug1: Server accepts key: /data/ssh_keys/autossh_rsa_key RSA SHA256:HL7Z3tI+X/iCe1V5AjLxx0cPthbzTSdJbQX8KCHdt2g explicit
debug1: Authentication succeeded (publickey).
Authenticated to localhost.run ([54.161.197.247]:22).
debug1: Remote connections from localhost.run:80 forwarded to local address 192.168.79.79:8123
debug1: Entering interactive session.
debug1: pledge: network
debug1: remote forward success for: listen localhost.run:80, connect 192.168.79.79:8123
debug1: All remote forwarding requests processed

As you can see, I can't get the subdomain name! The log ends there.....

ThomDietrich commented 2 years ago

Hey, cool service.

I get your point but how do we best solve this? Where would you normally expect this subdomain name and do you have any clue how to read it?

ThomDietrich commented 2 years ago

So here is the thing. We use autossh to connect the tunnel. Any of the parameters probably hides the line you are missing. My suggestion is you install autossh, copy the command from the script, then try around to understand which command line argument is the culprit. Happy to help fixing the issue if you figure out what it is ;)

Here is the command: https://github.com/ThomDietrich/home-assistant-addons/blob/aeb2187a0cd783c660a23b7e96c769231673b30f/autossh/run.sh#L73-L81

ThomDietrich commented 2 years ago

Anything you wanna add?

iosoft commented 2 years ago

Hello, I am back.

How can I test the command by removing the -N argument?

ThomDietrich commented 2 years ago

You don't have to test this from the Home Assistant host. Just try on your local machine. Alternatively there is a Terminal addon for home assistant, you could try with that. The goal is to play around with autossh

iosoft commented 2 years ago

Hi, I was just going to inform you that - Connection successful if -N argument is removed!

Executing command: /usr/bin/autossh -M 0 -o ServerAliveInterval=30 -o ServerAliveCountMax=3 -o StrictHostKeyChecking=no -o ExitOnForwardFailure=yes -p 22 -t -t -i /data/ssh_keys/autossh_rsa_key autossh@localhost.run -R 80:192.168.79.79:8123 -v

Log:

Welcome to localhost.run!
Follow your favourite reverse tunnel at [https://twitter.com/localhost_run].
**You need a SSH key to access this service.**
If you get a permission denied follow Gitlab's most excellent howto:
https://docs.gitlab.com/ee/ssh/
*Only rsa and ed25519 keys are supported*
To set up and manage custom domains go to https://admin.localhost.run/
More details on custom domains (and how to enable subdomains of your custom
domain) at https://localhost.run/docs/custom-domains
To explore using localhost.run visit the documentation site:
https://localhost.run/docs/
===============================================================================
** your connection id is 3f0645a6-653f-495a-8b64-XXXXXXXXXXXXX, please mention it if you send me a message about an issue. **
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /data/ssh_keys/autossh_rsa_key ED25519 SHA256:XXXXXXXXXXXXXXXXXX explicit
debug1: Server accepts key: /data/ssh_keys/autossh_rsa_key ED25519 SHA256:XXXXXXXXXXXXXXXXXXX explicit
Authenticated to localhost.run ([35.171.254.69]:22) using "publickey".
debug1: Remote connections from LOCALHOST:80 forwarded to local address 192.168.9.9:8123
debug1: ssh_init_forwarding: expecting replies for 1 forwards
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: remote forward success for: listen 80, connect 192.168.9.9:8123
debug1: forwarding_success: all expected forwarding replies received
debug1: ssh_tty_make_modes: no fd or tio
e3606f60fceXXX.lhrtunnel.link tunneled with tls termination, https://e3606f60fceXXX.lhrtunnel.link

I would like to request you to update your awesome and important plugin and move the -N argument as a toggle thing in configuration page or in 'other_ssh_options' text field.

P.S. In you documentation/manual, pls do mention that the 'remote_forwarding' should be like this - 80:HomeAssistantIP:8123

Thanks.

ThomDietrich commented 2 years ago

P.S. In you documentation/manual, pls do mention that the 'remote_forwarding' should be like this - 80:HomeAssistantIP:8123

Not sure about your suggestion, why is this not correct? https://github.com/ThomDietrich/home-assistant-addons/blob/master/autossh/DOCS.md#option-remote_forwarding=

ThomDietrich commented 2 years ago

Done in version 1.0.9 👍

ThomDietrich commented 2 years ago

Ah one more thing: It would be cool if you drafted a small passage for the README how this can be used with localhost.run. Please be subjective and mention potential risks or limitations...

iosoft commented 2 years ago

Sure, I will help you.

iosoft commented 2 years ago

I stopped using localhost.run service as technically its useless. The temporary URL changes after random time interval.