You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow specifying remote expected web UI port which would generate a href somewhere #4824
enhancementNew features or improvements of some kind, as opposed to a problem (bug)frozen-due-to-ageIssues closed and untouched for a long time, together with being locked for discussiongood first issueGood starting points for new contributors
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.
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.
It would be fairly trivial to do this; we already have the IP visible in the GUI, all we need to do is guess the port and print the link.
The more useful thing to do would be to (optionally) allow API/GUI access proxied over the sync connection we already have. This would work over relays and through proxies etc. I don’t necessarily think we should implement that either.
(For *Arigi* specifically I’d like to be able to tell Syncthing to push events and logs to a management station HTTPS address and accept API commands in the returned response, turning the request/response cycle on its head. We should probably not implement that either.)
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.
Yeah I just said guess because at the moment it’s not communicated. It certainly could be, but that also means we ought to try upnp to get an external port mapping for it, for example. We certainly shouldn’t do that without the user’s permission.
The simplest possible solution I can think of, which would work with statically configured ports or forwards, would be to let you configure the api port on a remote device. When it’s connected via a non-relay method we could then show a GUI link in the device section.
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.
So I agree that adding GUI stuff to the protocol is out of scope. The protocol has always been about more than just the Syncthing implementation, and even we stray from that ideal now and then adding a specific GUI address field to it is going too far.
If you do remote administration of devices I think it’s reasonable to expect you to know what port you have the GUI on, while the IP might plausibly change now and then. Being able to add a port to the config and have the GUI generate a link feels roughly on par with being able to give the device a name of your choosing - a local decision for convenience. And it’s not super intrusive. So I think we could do that.
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.
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).
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>.
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.
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.)
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).
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?
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.
enhancementNew features or improvements of some kind, as opposed to a problem (bug)frozen-due-to-ageIssues closed and untouched for a long time, together with being locked for discussiongood first issueGood starting points for new contributors
Activity
AudriusButkevicius commentedon Mar 18, 2018
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.
acolomb commentedon Mar 18, 2018
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.
calmh commentedon Mar 18, 2018
acolomb commentedon Mar 18, 2018
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.
calmh commentedon Mar 18, 2018
acolomb commentedon Mar 18, 2018
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?
AudriusButkevicius commentedon Mar 18, 2018
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.
calmh commentedon Mar 18, 2018
AudriusButkevicius commentedon Mar 18, 2018
Right, I get it, so this is done on my own device.
I think that's ok.
acolomb commentedon Mar 18, 2018
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.
AudriusButkevicius commentedon Mar 18, 2018
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).
AudriusButkevicius commentedon Mar 18, 2018
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>.6 remaining items
AudriusButkevicius commentedon Aug 20, 2020
We don't assign tickets per-se. First PR to close it wins :)
rjpruitt16 commentedon Aug 23, 2020
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.
calmh commentedon Aug 23, 2020
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.)
rjpruitt16 commentedon Aug 23, 2020
Would I have to write the javascript to probe for the port? Is there already something written in the backend to probe?
calmh commentedon Aug 23, 2020
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).
rjpruitt16 commentedon Sep 22, 2020
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?
acolomb commentedon Sep 23, 2020
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.
Merge branch 'main' into cdc
Merge tag 'v1.12.1' into try_release