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

I'd need finer-grained restrictions #15

Open
funkyfuture opened this issue May 10, 2019 · 8 comments
Open

I'd need finer-grained restrictions #15

funkyfuture opened this issue May 10, 2019 · 8 comments

Comments

@funkyfuture
Copy link

ciao, thanks for this simple solution. i'd have a use-case though where only access to the endpoints containers/json and …/{id}/json (inspection), but not …/create or …/{id}/stop etc., would be needed.

it'd be therefore desirable to use environment variables like CONTAINER_LIST and CONTAINER_INSPECT to override the CONTAINER value.

@yajo
Copy link
Contributor

yajo commented May 13, 2019

Thanks for your time on opening this issue. 😊

Usually CONTAINERS=1 POST=0 should be enough for your case, where you allow access to containers/*, but only allow GET and HEAD operations.

Please reopen if I missed something.

@yajo yajo closed this as completed May 13, 2019
@funkyfuture
Copy link
Author

well, my examples weren't the best. but there are other endpoints for GET requests, like export that are desirable to forbid.

@yajo yajo reopened this May 13, 2019
@yajo
Copy link
Contributor

yajo commented May 13, 2019

OK, let me reopen. 😉

TBH most likely I'm not gonna work to fix this, since it doesn't affect the usage I do for this image. However if anybody wants to open a PR, feel free to do so! 😊

@funkyfuture
Copy link
Author

#14 seems like a step in the right direction for that, but a standalone binary that generates the config as entrypoint would be preferable.

@HazardousBackup
Copy link

I think this issue should be looked at more closely because as it stands if you have something like Diun that should only really need containers/json, you'd give it CONTAINERS=1 but that will also give it access to containers/{id}/archive which would let it grab arbitrary files from any other container and containers/{id}/json which would give it the environmental variables for any running container which might include private information.

Neither one of those Diun would need to do (not that it uses them) and so it shouldn't have access to them. However, there is no way to deny access via this proxy.

@andrebrait
Copy link

Have you looked into https://github.com/wollomatic/socket-proxy? It seems to be able to essentially do the same as this project, but for any UNIX socket and it has quite fine-grained controls. The author has a sample Traefik setup using it here: https://github.com/wollomatic/traefik-hardened

This may give ideas on how to use that for a similar use-case.

@HazardousBackup
Copy link

If this is in reply to me, since I revived this topic, then my concern isn't really for myself.
I can get away without it or do modifications myself. I'm working on a modification for linuxserver/docker-socket-proxy for at least myself at the moment.

The reason I think this is important is that this project has over 10 Million pulls on Docker Hub and not everyone is going to catch these details about the API.

@andrebrait
Copy link

andrebrait commented Jul 28, 2024

@HazardousBackup yes, it was for you. I believe the project I linked would be somewhat close to what your goal is. I understand linuxserver/docker-socket-proxy is a drop-in replacement to this, but in order to accomplish the finer grained permissions, it'll probably have to stop being that. If that's the case, then perhaps it's worth taking a look at the one I linked. It's probably easier to customize that to have a set of "templates" for popular services than it is to modify this to achieve the same level of customization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants