-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
CHE-14398: Copy SSH keys with proper permissions #15167
Conversation
✅ E2E Happy path tests succeed 🎉 See Details
Tested with Eclipse Che Single User on K8S (minikube v1.1.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, didn't test it, though
E2E tests of Eclipse Che Multiuser on OCP has failed:
|
ci-test |
E2E tests of Eclipse Che Multiuser on OCP has failed:
|
❌ E2E Happy path tests failed ❗ See Details
Tested with Eclipse Che Single User on K8S (minikube v1.1.1) ℹ️ |
crw-ci-test |
❌ E2E Happy path tests failed ❗ See Details
Tested with Eclipse Che Single User on K8S (minikube v1.1.1) ℹ️ |
E2E tests of Eclipse Che Multiuser on OCP has been successful:
|
crw-ci-test |
❌ E2E Happy path tests failed ❗ See Details
Tested with Eclipse Che Single User on K8S (minikube v1.1.1) ℹ️ |
crw-ci-test |
❌ E2E Happy path tests failed ❗ See Details
Tested with Eclipse Che Single User on K8S (minikube v1.1.1) ℹ️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning towards -1 on this PR, do we really need to add yet another init container to pods? If we do have to, it should at least be handled in the same way as all other containers in workspaces and be provisioned using the existing flow. The current PR looks like a hack.
Also, has this been tested on a (non-minishift) OpenShift deployment? From what I understand, the arbitrary user ID default will mean that the key is not readable by anyone.
Container initContainer = | ||
new ContainerBuilder() | ||
.withName("ssh-private-keys-modifier") | ||
.withImage("centos:centos7") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is bad practice and will be a nightmare for airgap users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used a property
Please don't abandon this, it is the only way we can use Che on Kubernetes/Rancher because at the moment there are many issues preventing running Che as a non-root user in this environment. |
crw-ci-test |
We cannot override command in a common container, so I used init container.
no
Do you mean the case when the workspace is shared? |
❌ E2E Happy path tests failed ❗ See Details
Tested with Eclipse Che Single User on K8S (minikube v1.1.1) ℹ️ |
❌ E2E Happy path tests failed ❗ See Details
Tested with Eclipse Che Single User on K8S (minikube v1.1.1) ℹ️ |
E2E tests of Eclipse Che Multiuser on OCP has been successful:
|
Using an init container is fine, but hard-coding it in this way is not, IMO. To be clear, this will break offline/airgap.
I haven't looked into this deeply and checked whether it causes issues, but containers running on OpenShift a) do not have root privileges, and b) start with a semi-randomly assigned user ID. Will the init container copy the ssh keys in with the correct owner? |
I have reworked it to use a property
Basically this workaround is designed to work only when the che assembly is set up to have a root user @davidwindell Am I correct? |
@vinokurig @vparfonov I am in agreement with @amisevsk here. This look like a hack whereas we had a solution for @davidwindell problem and potentially for any permission related problem: Add a wsmaster property to specify workspaces default security context · Issue #15138 · eclipse/che. |
@vparfonov I think that it makes more sense to work on #15138 yes! I made it P1 |
If you do abandon, this please note that it means we won't be able to use Che at all until #14330 is fixed also. |
@davidwindell but #15138 would fix this as well right? You will be able to run containers as root user or any user id you would like and that should fix the permissions problem. |
It doesn't look like we will need the copy, mounting should be enough kubernetes/kubernetes#81089 (comment) |
I don't understand why mounting should be enough. I have setup my minikube with:
and it worked as usual (the mounted key still has
|
I hadn't seen this commit and it hadn't been mentioned when I made my second comment -- apologies. While that removes the hard blocker for merging, IMO this PR is still a hack. Either way, I won't block merging if it's a hard requirement for some. |
Is not actual any more |
What does this PR do?
The OpenSSH daemon requires 600 file mode access permissions for private keys.
Mounted keys have 640 permissions despite setting
DefaultMode
to 600.As a workaround add an init container and set a command that copies the SSH keys to mounted to all workspace pod containers and manually set them needed permissions.
What issues does this PR fix or reference?
#14398
Release Notes
Docs PR