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

Only use loopback interface for nginx, mongo, rabbitmq #780

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

unoduetre
Copy link
Contributor

@unoduetre unoduetre commented Sep 2, 2024

What

Currently docker allows any host on the network to connect to the nginx proxy, mongo and rabbitmq and consequently allows anyone on the network to access the apps while in development. This is because nginx proxy, mongo and rabbitmq are currently configured to bind on all interfaces.

This PR changes that so they only bind to 127.0.0.1 (the loopback interface).

Why

https://gds.slack.com/archives/CAB4Q3QBW/p1725265458430239

@unoduetre unoduetre force-pushed the only-use-localhost-interface-for-nginx branch from 973b61d to ae6d8ab Compare September 2, 2024 09:44
@unoduetre unoduetre changed the title Only use loopback interface for nginx Only use loopback interface for nginx, mongo, rabbitmq Sep 2, 2024
@unoduetre unoduetre marked this pull request as ready for review September 2, 2024 10:03
Copy link
Member

@kevindew kevindew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. It does feel like we should be able to set this with a global option in the network bit, I'd want us to rule that out before committing this.

I also get an error for the nginx part - this could be my local machine of course:

Error response from daemon: Ports are not available: exposing port TCP 192.168.1.208:80 -> 0.0.0.0:0: failed to connect to /var/run/com.docker.vmnetd.sock: is vmnetd running?: dial unix /var/run/com.docker.vmnetd.sock: connect: no such file or directory

As mentioned on Slack, we're not under pressure to resolve this instantly and can wait for further comms from @jameskirk36 before proceeding.

@unoduetre
Copy link
Contributor Author

unoduetre commented Sep 2, 2024

Thanks for this. It does feel like we should be able to set this with a global option in the network bit, I'd want us to rule that out before committing this.

I also get an error for the nginx part - this could be my local machine of course:

Error response from daemon: Ports are not available: exposing port TCP 192.168.1.208:80 -> 0.0.0.0:0: failed to connect to /var/run/com.docker.vmnetd.sock: is vmnetd running?: dial unix /var/run/com.docker.vmnetd.sock: connect: no such file or directory

As mentioned on Slack, we're not under pressure to resolve this instantly and can wait for further comms from @jameskirk36 before proceeding.

Thanks. If someone could provide a more general solution that would automatically apply to all ports, I also think that'd be better and this PR could be closed.

I checked and it works for me e.g. for frontend-app-live: govuk-docker up frontend-app-live starts the app and I can access it through frontend.dev.gov.uk. Similarly for publisher. Maybe restarting docker and/or removing the container nginx-proxy could help? What app did you check?

@kevindew
Copy link
Member

kevindew commented Sep 2, 2024

That was government-frontend, after first checking on govuk-chat. Yeah I tried restarting docker.

I imagine I just need to look into the error more, I imagine it might be something on my host machine perhaps if it's localised to just me.

@hannako
Copy link
Contributor

hannako commented Sep 2, 2024

I got the same error as @kevindew
no container to killError response from daemon: Ports are not available: exposing port TCP 127.0.0.1:80 -> 0.0.0.0:0: failed to connect to /var/run/com.docker.vmnetd.sock: is vmnetd running?: dial unix /var/run/com.docker.vmnetd.sock: connect: no such file or directory

I stopped and killed all the containers (and images and volumes!) before running make government-frontend and then govuk-docker-up app-live from the government frontend repo.

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.

3 participants