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

Restrict network access of the executed tool #1049

Open
1 of 4 tasks
petertrr opened this issue Aug 16, 2022 · 2 comments · May be fixed by #1247
Open
1 of 4 tasks

Restrict network access of the executed tool #1049

petertrr opened this issue Aug 16, 2022 · 2 comments · May be fixed by #1247
Assignees
Labels
auth Issues related to authentication, authorization and overall service security

Comments

@petertrr
Copy link
Member

petertrr commented Aug 16, 2022

(https://gvisor.dev/docs/architecture_guide/security/)

A sandbox is not a substitute for a secure architecture.

save-cloud services should either be able to authorize against each other (including agent), or the tested tool should have restricted network access (i.e. being able to communicate only with targets outside of cluster IP range)

Plan:

@petertrr petertrr added the auth Issues related to authentication, authorization and overall service security label Aug 16, 2022
@petertrr petertrr self-assigned this Aug 16, 2022
@petertrr
Copy link
Member Author

This also is crucial to keep private tests for contests really private

@petertrr
Copy link
Member Author

petertrr commented Sep 7, 2022

More ideas:

  • Agent is started by container entrypoint
  • Agent requests a token from orchestrator
  • Orchestrator marks this agent as authenticated in the database
  • Agent stores the token in-memory
  • Any new authentication attempts from this container/pod are always 401-ed (ID of the container is always known right after its creation so it should have been stored in the DB by the time processes in the container start network activity). Container IDs are inserted into publicly available data (TestExecutions) only after tests are assigned to an agent, i.e. by that time agent should have started and authenticated.

Service can implement app-to-app authentication using basic auth based on attached secrets. In Kubernetes it can be done using empty ServiceAccounts and TokenReview API


Agent pods can have a NetworkPolicy allowing egress to orchestrator and backend pods only, and also to all IPs outside of cluster range.


Two users in the save-agent pod: save-agent (uid 1100) and save-executor (uid 1200). All resources for execution are chown-ed for save-executor. The user save-agent is also a member of save-executor group to be able to read execution results. save-agent should launch save-cli as a user save-executor.
Then, it seems, save-agent can use Kubernetes secrets (namely ServiceAccount token mounted using volume projection) without executed tool having access to them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Issues related to authentication, authorization and overall service security
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant