Skip to content

Conversation

@matthijskooijman
Copy link

Using host network reduces separation and potentially exposes more ports publicly than needed or intended. In some cases (such as opening up many dynamic ports) this is needed, but for haproxy and nginx this is not the case. Haproxy only needs port 80 and 443 externally, and nginx normally does not need to expose anything external (only to another reverse proxy such as haproxy).

With some care, these containers can be changed to use regular networking instead (which is what this PR does).

See the commit messages for details.

Issue #138 also talks about a change like this and suggests that it would not be possible. If I read that issue correctly (but it is vague and only implies the issue), it might suggest that it would not work because freeswitch would need ipv6 connections to be forwarded over ipv6, which is what the nginx example in https://github.com/bigbluebutton/docker/blob/develop/docs/existing-web-server.md does. However:

  • The apache example on that page forwards everything over ipv4, as does the default haproxy production forwarder
  • I've tested the resulting build with a client that connects to the server (haproxy) over ipv6, which then connects to the underlying nginx over ipv4, and that works fine (audio and video connection to another host that might have used ipv4, did not check).
  • If really needed, the docker internal network could also be configured for ipv6.

There is also a bit of development config (here and here. I've updated this as far as I understand how it works, but I'm not 100% sure (and have not been able to test this, since I was running on a remote server, not locally).

This still listed old (now removed) containers and missed newly added
ones, which are now fixed.

This also makes the network_mode: host listings consistent, and removes
the "extra_hosts" listed for nginx (this does not really seem to have
much advantage in docs, unlike a list of allocated IP addresses which
*is* useful).

The list is slightly reordered to match the order in
docker-compose.tmpl.yml.
This is not really needed, nginx is always intended to be behind a
reverse proxy, so it can just expose its ports on the internal network.
This prevents having the 4808x ports exposed externally (though a user
can still expose them explicitly with a ports directive if needed).

This removes the "nginx" extra-hosts definition from the
bbb-graphql-middleware host container, since the "nginx" name now
resolves to the nginx internal IP normally.

In the haproxy config, this updates the IP address instead of using the
"nginx" name, as it seems that the haproxy resolv.conf does not list the
docker resolver but somehow uses the (host system) external DNS
directly.

Nginx also listens on port 8185. Previously this bound to 127.0.0.1 and
10.7.7.1 (the host-side IP of the internal network) explicitly,
presumably to prevent this port being available publically, but this is
no longer needed, so now it can just bind to the port directly.
This is not really needed, haproxy only needs to expose two ports
externally, so better to make that explicit using a ports directive,
which also gives the user more control.
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

Successfully merging this pull request may close these issues.

1 participant