Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable monitor port #46

Open
dmikushin opened this issue Mar 29, 2023 · 0 comments
Open

Enable monitor port #46

dmikushin opened this issue Mar 29, 2023 · 0 comments

Comments

@dmikushin
Copy link
Contributor

dmikushin commented Mar 29, 2023

I've seen situations, when remote host went offline, but autossh containers remained with dangling ssh connection, which is neither online nor offline. Eventually, autossh restarts them, perhaps when some port lease expires within the kernel. But it takes time, about 30 minutes.

Monitor port is disabled by -M 0, but is actually useful for resuming connection that is stalled due to an issue described above.

Enabling monitor port isn't easy, because it is hardcoded in autossh:

char    *mhost = "127.0.0.1";   /* host in port forwards */
...
     /* 
      * Only if we're doing the network monitor thing.
      * Socket once opened stays open for listening for 
      * the duration of the program.
      */
     if (writep) {
         if (!echop) {
             sock = conn_listen(mhost, readp);
             /* set close-on-exec */
             (void)fcntl(sock, F_SETFD, FD_CLOEXEC);
         } else
             sock = NO_RD_SOCK;
     }

As we know, assumption of 127.0.0.1 being a loopback address is wrong in Docker. Should we [ask for a] patch autossh source code, or do you see some other workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant