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

Add a new RPC ConnectWithCreds to allow gofer to connect to a unix domain socket with application's credentials #11340

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

copybara-service[bot]
Copy link

Add a new RPC ConnectWithCreds to allow gofer to connect to a unix domain socket with application's credentials

Dear gvisor developers,

Thank you very much for maintaining / developing gvisor!

Motivation

We had a use case (which I believe is a wide use case) that the sandboxes send requests over a unix domain socket on host, which is mapped to the container's file system and listened to by a server on the local host.

The sandboxed application is started with a prescribed uid. To authenticate the request, the server verifies the request's uid.

However, as the gofer process (which usually runs as root) executes connect(unix_domain_socket) call on behalf of the sandbox, the server always sees a uid 0. Hence the server cannot authenticate the UDS requests coming from the sandbox.

Proposal

I propose to Add a new RPC ConnectWithCreds to allow gofer to connect to a unix domain socket with application's credentials. On that gofer server thread, the euid/egid are temporarily changed to application's uid/gid and restored after the connect(2) call.

Questions

What do you think of this change? Is there any security/ functionality concern? Thank you so much for your feedback!

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11291 from xianzhe-databricks:fix-uds-auth c4f686f

@copybara-service copybara-service bot added the exported Issue was exported automatically label Jan 6, 2025
@copybara-service copybara-service bot merged commit 7aa4c49 into master Jan 7, 2025
@copybara-service copybara-service bot deleted the test/cl712489714 branch January 7, 2025 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exported Issue was exported automatically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants