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

Containers only see IP of docker gateway when using nextcloud in docker rootless due to rootless "builtin" default port driver #4621

Open
ccaccb opened this issue May 5, 2024 · 1 comment · May be fixed by #4671
Labels
2. developing Work in progress documentation Improvements or additions to documentation good first issue Small tasks with clear documentation about how and in which place you need to fix things in. help wanted Extra attention is needed

Comments

@ccaccb
Copy link

ccaccb commented May 5, 2024

Steps to reproduce

  1. Setup nextcloud aio with docker rootless as documented in docker-rootless.md. Don't use an external reverse proxy.
  2. Try logging in with an invalid password.
  3. The IP logged in the admin logs is the IP of the docker network gateway, not the actual remote IP of the client.

Expected behavior

Correct IP logged.

Actual behavior

IP of the docker network gateway logged.

Host OS

linux

Nextcloud AIO version

Nextcloud AIO v8.2.1

Current channel

latest

Root cause

When using rootless docker defaults to using the "builtin" port driver.
See https://docs.docker.com/engine/security/rootless/#networking-errors.
But that port driver doesn't allow forwarding of the remote IP, instead containers see connections as coming from the IP of the docker network gateway (e.g. 172.19.0.1).
This means that nextclouds IP-based security measures don't work correctly and it is e.g. possible to do a denial of service attack against the nextcloud instance by spamming invalid logins and getting the IP of the gateway throtteled or even blocked.

Fix

In order to fix this one can also use slirp4netns as a port driver.

Note that this will likely decrease performance.
See also: Following https://rootlesscontaine.rs/getting-started/docker/#changing-the-port-forwarder

Update docs

I propose to updating the documentation for nextcloud in docker rootless.
Mention that if not using a non-dockerized reverse proxy the logged remote IPs will be that of the docker gateway and how to fix that.

@ccaccb ccaccb added 0. Needs triage Pending approval or rejection. This issue is pending approval. bug Something isn't working labels May 5, 2024
@szaimen szaimen added documentation Improvements or additions to documentation and removed bug Something isn't working labels May 13, 2024
@szaimen
Copy link
Collaborator

szaimen commented May 13, 2024

Hi, would you mind opening a PR that improves the documentation? :)

@szaimen szaimen added good first issue Small tasks with clear documentation about how and in which place you need to fix things in. help wanted Extra attention is needed labels May 13, 2024
@szaimen szaimen added 2. developing Work in progress and removed 0. Needs triage Pending approval or rejection. This issue is pending approval. labels May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress documentation Improvements or additions to documentation good first issue Small tasks with clear documentation about how and in which place you need to fix things in. help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants