Skip to content

Allow specifying remote expected web UI port which would generate a href somewhere #4824

Closed

Description

@acolomb

For devices that have a remotely accessible GUI listen address with authentication, it would be nice to advertise that to other nodes for remote administration. Those could then display a link in their GUI's respective device box.

I think this would make remote administration much less painful, but of course requires a protocol extension and some logic to find the right address. Basically:

  • If the GUI listen address is set to localhost, do not advertise it.
  • If set to a specific address, advertise that and bind() to it.
    • TBD: Should an address be allowed where bind() fails? It would be useful for Dynamic DNS, tunnels, or NAT routing, but risks linking to totally unrelated hosts.
  • Send a flag to indicate whether the connection requires HTTPS.

On the receiving end:

  • Display the advertised address as a link. If 0.0.0.0 was advertised, use the last IP address where a successful direct connection was made.
  • If HTTPS is required, the receiving end could try connecting to the port and see if the certificate matches the device.

Does that sound like a reasonable proposal? I'm not familiar with Syncthing's code or Go at all, so I cannot immediately offer taking a stab at implementing any of this.

Activity

  1. AudriusButkevicius commented on Mar 18, 2018

    @AudriusButkevicius
    Member

    I think it's unreasonable to assume that everyone connects with devices that are their own.

    If you want centralized cluster management, you might want to look at Arigi.

  2. acolomb commented on Mar 18, 2018

    @acolomb
    MemberAuthor

    What in my proposal assumes that the devices are owned by the same user?

    To prevent unwanted remote config changes, the user should enable authentication. Displaying a link to the admin GUI only simplifies the process for those cases where remote access is even possible because the remote user already has the credentials. The most common default case would not even allow remote GUI access, so it only affects users who already consciously opened it up.

    My only assumption is that this share of users will likely want to connect to their remote GUI from another syncthing node within the cluster, instead of some random computer.

  3. calmh commented on Mar 18, 2018

    @calmh
    Member
  4. acolomb commented on Mar 18, 2018

    @acolomb
    MemberAuthor

    What do you mean by "guess the port"? It's not really standardized, but could be announced by the remote device, as I am suggesting.

    Of course, sharing the sync connection would be great, but sounds like a lot of code complexity.

    As for Arigi, it seems to be a commercial service. One more level on top which needs configuration. Opening firewalls for remote GUI access can already be quite complex, so I am trying to make things easier once the remote access is configured.

  5. calmh commented on Mar 18, 2018

    @calmh
    Member
  6. acolomb commented on Mar 18, 2018

    @acolomb
    MemberAuthor

    Well it's better than nothing, but an unnecessary extra step if the GUI port could be advertised on connection.

    What about my proposal, show the link after trying to open an HTTPS connection to it and match the certificate?

  7. AudriusButkevicius commented on Mar 18, 2018

    @AudriusButkevicius
    Member

    So I am very much against this as it's a can of worms.

    It doesn't deal with authentication, doesn't deal with manual port mappings (how the hell am I supposed to know what port did someone map on the router), doesn't deal with reverse proxies or anything else.
    Supporting any of this would be pure madness, as we would have to start caring about these things and start wedging in settings to adjust them.

    If this requires protocol changes, then I am even more against this, as all this does is tries to put a hyperlink in the page...

    If you need to manage remote syncthing instances, please do the address setup/forwarding/dyndns /bookmarking the address or what not yourself.

    The certificate we use the HTTPS has nothing to do with device ID's and it's a completely different certificate, so there is no way we can reasonably know what the self signed cert will look like...

    Also, how are we going to "verify" it? Browsers do verification of certificates, and we have no say in that.

  8. calmh commented on Mar 18, 2018

    @calmh
    Member
  9. AudriusButkevicius commented on Mar 18, 2018

    @AudriusButkevicius
    Member

    Right, I get it, so this is done on my own device.
    I think that's ok.

  10. acolomb commented on Mar 18, 2018

    @acolomb
    MemberAuthor

    Okay @AudriusButkevicius, I'm convinced. It would be a very incomplete feature screaming for all those bells and whistles you described. I understand why the BEP should not be bloated with stuff that is not sync-specific.

    So @calmh your plan is basically a bookmark system within Syncthing's GUI instead of some browser instance, but reusing the discovery mechanism for Dynamic DNS ;-) I could live with that.

    @AudriusButkevicius about the certificate, sorry I thought the HTTPS connection used the same certificate as the sync connection because I see no sense in separating them. To me, the sync protocol and the GUI are just two different endpoints on the same server, so could be identified by the same certificates. Which would also simplify the trust decision when doing remote GUI access.

  11. AudriusButkevicius commented on Mar 18, 2018

    @AudriusButkevicius
    Member

    Regarding the certificate, your device might be behind a genuine syncthing.mycompany.com domain, that is trusted by the browsers, and you might not want to click through a warning every time.
    On the other hand, web certs are usually valid for 1-2 years (or even less with LetsEncrypt et al).
    Device ID is a hash of the device certificate, which includes expiry date et al.

    So your suggestion either forces everyone to click through the security warning in the browsers (as your device ID cert is self signed with "infinite" expiry and never accepted by the browsers), or forces you to rewire your cluster every 1-2 years, as your certificate expires and forces you to gain a new device ID. (because web certs never have "infinite" expiry).

  12. AudriusButkevicius commented on Mar 18, 2018

    @AudriusButkevicius
    Member

    Anyways, I'll reopen this as I guess there is consensus on the potential feature, which is add an advanced config option for each device called webUI port, which when non-zero, which converts something (device name) to an href pointing to <address connected to if connected via TCP>:<port specified in the config>.

  13. added
    enhancement
    on Mar 18, 2018
  14. 6 remaining items

  15. AudriusButkevicius commented on Aug 20, 2020

    @AudriusButkevicius
    Member

    We don't assign tickets per-se. First PR to close it wins :)

  16. rjpruitt16 commented on Aug 23, 2020

    @rjpruitt16
    Contributor

    Can someone help me decided how to write a test for this? It seems the functionality is mostly going to change in the frontend. Is it okay if I the commit does not include a backend test.

  17. calmh commented on Aug 23, 2020

    @calmh
    Member

    Yeah, I wouldn't expect one. (Though I guess a bonus point could be if the GUI probes for the port actually being open on the other side before displaying the link, perhaps.)

  18. rjpruitt16 commented on Aug 23, 2020

    @rjpruitt16
    Contributor

    Would I have to write the javascript to probe for the port? Is there already something written in the backend to probe?

  19. calmh commented on Aug 23, 2020

    @calmh
    Member

    There's nothing in the backend, and the interesting test is anyway whether the browser can connect, not really the syncthing process (which might well be on the other side of the planet).

  20. rjpruitt16 commented on Sep 22, 2020

    @rjpruitt16
    Contributor

    I thought the address would be given by the address field in deviceconfiguration json, but on the machines I setup, for address it says "dynamic." Does this mean the address is being determine dynamically from the relay? It seems the listening address could have different forms which will factor into how which address might eventually be transform .

    Also, when I was looking in the documentation, it seems the listening address includes the port number. It seems @calmh said one challenge could be finding the port number. I am looking in the wrong place for the address?

  21. acolomb commented on Sep 23, 2020

    @acolomb
    MemberAuthor

    The idea here was to store an additional config field for the expected remote GUI port in the deviceconfiguration structure. The address should be taken from the currently active BEP connection when status is Syncing or Connected. You'll have to look where the GUI caches this current connection info, or retrieve it again from the respective API endpoint. Then combine with the configured port number and probe whether it is open as described above.

  22. modified the milestone: v1.12.0 on Nov 10, 2020
  23. added a commit that references this issue on Nov 11, 2020
    fcd80c1
  24. added this to the v1.12.1 milestone on Nov 18, 2020
  25. added
    frozen-due-to-age
    on Nov 11, 2021
  26. locked and limited conversation to collaborators on Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfrozen-due-to-agegood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions