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

Feature Request: Bind Web GUI / SSH to specific interfaces or IPs #1347

Closed
willjones opened this issue Jan 24, 2017 · 20 comments
Closed

Feature Request: Bind Web GUI / SSH to specific interfaces or IPs #1347

willjones opened this issue Jan 24, 2017 · 20 comments
Assignees
Labels
feature Adding new functionality

Comments

@willjones
Copy link
Member

It would be really nice to have an option to easily configure what interfaces the web GUI and SSH processes listen on.

By default they are active on all IPs on the firewall, this potentially exposes management access to networks that people would maybe not want to, whilst we can obviously solve this with a firewall rule it strikes me as maybe being better to allow folks to specify an interface or IP that these services bind to.

Potentially this saves a lot of firewall rules too in situations with a large number of internal networks where exposing access to the GUI or SSH would not be desirable at all.

@fichtner fichtner self-assigned this Apr 25, 2017
@fichtner
Copy link
Member

(definitely maybe)

@fichtner fichtner added this to the Future milestone Apr 25, 2017
@fichtner fichtner added the feature Adding new functionality label Apr 25, 2017
@rptxcosmo
Copy link

+1
Same need.

@fichtner fichtner modified the milestones: 18.1, Future Jul 13, 2017
@fichtner
Copy link
Member

will be done on our way to 18.1, the code preparations have been done for 17.7.

@fraenki
Copy link
Member

fraenki commented Nov 24, 2017

@fichtner Is this still on the roadmap for 18.1?

@fichtner
Copy link
Member

It's not on the roadmap per se, but I still have this in my priority list for 18.1.

@fichtner
Copy link
Member

Alright, so we're going to do this:

  • Interface selection for SSH and web GUI separately
  • Selected interfaces will be expanded in primary IP addresses and all alias / carp configurations automatically, so no manual IP stuff...
  • The default will be none, which is nicely backwards-compatible and the least worse in terms of operational impact ;)
  • Dynamic reload for DHCP-configured interfaces will be supported
  • There will not be a lot of sanity checking. To stress this point, if all manually configured interfaces do not have a single IP listening address, the service will refuse to start as opposed to falling back to listen on all interfaces...
  • Use at your own risk. It's hard to recover without other precautions like console access, auto-console login, etc.

Thoughts? :)

@fraenki
Copy link
Member

fraenki commented Nov 29, 2017

@fichtner All I've ever wanted! :D I'm absolutely OK with having no sanity checking and defaulting to a backwards-compatible config.

@fichtner
Copy link
Member

Thanks, full speed ahead then. :) For recovery, I'm planning this as people will run into issues for sure. #1966

@fraenki
Copy link
Member

fraenki commented Nov 29, 2017

Dynamic reload for DHCP-configured interfaces will be supported

After thinking about this a little longer I have to ask: A reload will only be triggered for DHCP, right? It would be cumbersome if the reload would happen if a VPN tunnel (IPsec, OpenVPN) is reconfigured/reconnected. (A worst-case scenario would be flapping VPN tunnels that would cause constant reloads of the WebGUI and make configuration changes impossible.)

@fichtner
Copy link
Member

During "newwanip" reload of a selected interface the service will be restarted. Since we use session CSRF and graceful SSH kill (active sessions are not touched) this should be low impact.

if (!empty($interface) && !in_array($interface, $interfaces)) {
return;
}

@fichtner
Copy link
Member

fichtner commented Dec 15, 2017

Hi all,

The general code is in place for the web GUI now after a bit of struggle with lighttpd with regard to link local IPv6 being outright rejected, ssl settings block inheritance and other idiosyncrasies.

For safe use, I have been pondering how to make this robust and prevent a "lockout" scenario as discussed with @AdSchellevis. A sensible way forward would be:

If the web GUI configuration is changed to include or exclude interfaces (minus the case of deleting all interfaces), a timeout of 60 seconds (feel free to say if this is enough or not or too much) will run that will reset the interface configuration if it was not confirmed in an "apply-like" fashion through the GUI.

There are a few challenges here, but the system would be safe from lockouts and we could extend this approach to other critical changes like port changes, HTTP(S) toggle, certificate and cipher changes.

Thoughts? :)

Cheers,
Franco

@fichtner
Copy link
Member

fichtner commented Dec 15, 2017

Note to self:

  • [17.1.5] allows for selecting client cert as webgui certificate #1580 is a similar recovery scenario. We will store the old webgui config under webgui-backup and restore this if it is not applied in time or possibly if the box is rebooted (don't panic!).
  • Lighttpd is allergic to link-local IPv6 and IPv6 Gif Tunnels, all the more reason for recovery/revert
  • Move the joined SSH / GUI anti-lockout to firewall advanced settings (it belongs to the firewall subsystem as it is enforced there)

@fichtner
Copy link
Member

grr github

@fichtner fichtner reopened this Dec 16, 2017
fichtner added a commit that referenced this issue Dec 16, 2017
Anti-lockout really has both SSH and web GUI as its targets,
which is a bit weird here.  Maybe we ought to split the options,
but for now move it a bit close to SSH.  A separate option makes
no sense at this point.  Maybe this is more of an advanced firewall
option?
fichtner added a commit that referenced this issue Dec 18, 2017
(cherry picked from commit 4ba98f8)
fichtner added a commit that referenced this issue Dec 18, 2017
(cherry picked from commit 6ab6267)
(cherry picked from commit 086b91c)
fichtner added a commit that referenced this issue Dec 20, 2017
fichtner added a commit that referenced this issue Dec 20, 2017
Reload the client side.  If we can't connect back, the second
part of this rework will make sure that the system reverts to
its former state and this reload will be able to pick it up.

While here kill the questionable login autocomplete toggle.
@fraenki
Copy link
Member

fraenki commented Dec 22, 2017

  • Interface selection for SSH and web GUI separately
  • Selected interfaces will be expanded in primary IP addresses and all alias / carp configurations automatically, so no manual IP stuff...

Tested this for SSH on 17.7.11, works perfectly! 👍

WITH SSH interface selection:

root     sshd       55579 3  tcp4   LAN_CARPIP1:22          *:*
root     sshd       55579 4  tcp4   LAN_CARPIP2:22          *:*
root     sshd       55579 5  tcp4   LAN_CARPIP3:22          *:*
root     sshd       55579 6  tcp4   LAN_IP:22               *:*
root     sshd       55579 7  tcp4   WAN_CARPIP1:22          *:*
root     sshd       55579 8  tcp4   WAN_CARPIP2:22          *:*
root     sshd       55579 9  tcp4   WAN_IP:22               *:*

WITHOUT SSH interface selection:

root     sshd       65280 4  tcp4   *:22                  *:*

@fichtner
Copy link
Member

@fraenki cool! web gui code is in place on -devel as well, only thing missing is the recovery-revert / confirm-after-save to avoid a lockout.

@fraenki
Copy link
Member

fraenki commented Dec 22, 2017

If the web GUI configuration is changed to include or exclude interfaces (minus the case of deleting all interfaces), a timeout of 60 seconds (feel free to say if this is enough or not or too much) will run that will reset the interface configuration if it was not confirmed in an "apply-like" fashion through the GUI.

I think that a timeout of 60 seconds would be too low. I have several boxes where the GUI/PHP parts are a bit sluggish. I'm pretty sure I won't be able to confirm the configuration within 60 seconds :)

@fichtner
Copy link
Member

Ok, 3 minutes or 5? The new system polls and redirects when it’s back, will also later alternate between old and new link to kick back in after the global revert timeout so we catch most cases.

@fraenki
Copy link
Member

fraenki commented Dec 25, 2017

Ok, 3 minutes or 5?

I'd choose 5 minutes. Long enough to be able to issue a confirmation, short enough to not be considered a serious downtime in case of a misconfiguration.

fichtner added a commit that referenced this issue Dec 27, 2017
The initial timeout of 20 seconds is long, but it's safer to wait so
that we're not bouncing back to the old web GUI before it goes down.

PR: #1347
fichtner added a commit that referenced this issue Dec 27, 2017
@fichtner fichtner modified the milestones: 18.1, 18.7 Jan 19, 2018
@fichtner
Copy link
Member

The recovery has not been implemented for the initial 18.1 as time for testing is nonexistent at this point (today is the code freeze). Instead, a warning has been put into place with 795dd8b following the suggestion of @AdSchellevis when people try to set this value.

fichtner added a commit that referenced this issue Jan 19, 2018
(cherry picked from commit 795dd8b)
(cherry picked from commit 73527b8)
@fichtner fichtner removed this from the 18.7 milestone Feb 28, 2018
@fichtner
Copy link
Member

Seems to work.... deferring recovery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding new functionality
Development

No branches or pull requests

4 participants