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

Implement runInContainer #37

Open
miekg opened this issue Dec 24, 2020 · 5 comments
Open

Implement runInContainer #37

miekg opened this issue Dec 24, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@miekg
Copy link
Collaborator

miekg commented Dec 24, 2020

I thinking of implementing run-in-container, but I'm wondering about auth. I don't fully understand it yet from the k8s side, but I do think it makes sense to have a defense in depth and also check the local user on the system.

So I'm thinking of utilizing ssh and using the user ID from the kubectl call (how to get that though?) and then performing a ssh USER@localhost and dropping you in the /var/run/systemk/UID directory; which you can escape as you are free to roam the system; just like normal ssh. And commands given are dropped for the time being, but we may just want to go with garbage in; garbage out.

@miekg miekg added the enhancement New feature or request label Dec 24, 2020
@miekg
Copy link
Collaborator Author

miekg commented Dec 24, 2020

I would be nice if VK would give the user in the context, right now there isn't a lot there...

@miekg
Copy link
Collaborator Author

miekg commented Dec 24, 2020

doing an exec /bin/bash as the current user is a Bad Idea (tm) because we run as root currently.

@miekg
Copy link
Collaborator Author

miekg commented Dec 24, 2020

this might be problematic:

% ./kubectl exec --stdin --tty uptimed -- /bin/bash
Defaulting container name to uptimed.
Use 'kubectl describe pod/uptimed -n default' to see all of the containers in this pod.
Error from server: error dialing backend: x509: cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs

@miekg
Copy link
Collaborator Author

miekg commented Dec 24, 2020

this will also impact #5

@pires
Copy link
Member

pires commented Dec 27, 2020

In Kubernetes the only way to define UID/GID is in a Pod spec. Kubernetes is not opinionated when it comes to validate that: some security firms sell container runtime integrations that validate/enforce during container startup; and/or admission plug-ins for doing it while the request to create a Pod is in-flight.

The Kubernetes API also doesn't mandate for user information other than an identity proof that can be validated by the authorization layer, and even that is not expected to carry UID/GID.

For starters, I'd run containers either as specified UID/GID or, if unspecified, use a default one, eg nobody.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants