-
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
Unable to clone with SSH: unprotected private key file #14398
Comments
@vinokurig @azatsarynnyy could you please take a look |
Can not reproduce it in the latest che-theia version. |
@davidwindell Could you please specify the che version, it is viewed in the bottom left corner of the dashboard. Latest is |
@vinokurig it's |
Could the fact I have to use:
As per #14330, cause this? |
I can replicate this bug using a |
@davidwindell @fe-o2 Could you please test my fix for this issue? I've pushed the patched |
@vinokurig I can't test as with your server image I get a console error:
This doesn't happen with the 7.2.0 image. Looks like the same error here #14767 (comment) |
It's been suggested on Mattermost that I need to use the nightly plugin registry, will try tomorrow |
Unfortunately, I can't test this either because there is a bug in the nightly plugin registry #14704 |
Should be fixed by #14791. @davidwindell @fe-o2 Please reopen the issue if you will be able to reproduce the bug again. |
@vinokurig I managed to get this running but the issue still remains, can you re-open? I am using |
@vinokurig I think this might hold some clues:
It looks like the symbolic link is not 600 which is causing the problem? Some hints here? runatlantis/atlantis#775 I don't know if |
@davidwindell Have you reproduced the bug with 640 permissions? |
@vinokurig yes, it's still warning that |
Looks like this depends on upstream issue: kubernetes/kubernetes#81089 |
@vinokurig 644 is the default file permission but we can specify different file permissions: volumes:
- name: foo
secret:
secretName: mysecret
defaultMode: 416 The upstream issue is about ownership rather then file permissions mode. |
blocked with kubernetes/kubernetes#81089 |
The fix from K8's could be a long time coming. In the meantime, can you implement the workaround of copying the files but only when the pod is running as |
@davidwindell AFAIK Che and Che workspaces pods are running under non-root user. |
@vinokurig this can be changed by setting securityContext.runAsUser to '0' which is already necessary because of the bugs in #14330 |
I have created #15138 |
I have some ideas with init container, playing with it now. |
@davidwindell I've prepared an image |
Dont forget to set
|
Awesome, yes I'll test today! 👍 |
@vinokurig it worked!! Great job, I am now able to clone via SSH. |
@vinokurig I have been testing this and managed to get file permission I suppose that in Che we are forced to specify the Anyway here are the steps I have followed (on minikube):
$ kubectl create secret generic ssh-key-secret --from-file=id_rsa.pub=/Users/mloriedo/.ssh/id_rsa.pub --from-file=id_rsa=/Users/mloriedo/.ssh/id_rsa
secret/my-ssh-key created
cat <<EOF | kubectl apply -f -
kind: Pod
apiVersion: v1
metadata:
name: secret-test-pod
labels:
name: secret-test
spec:
securityContext:
runAsUser: 0
runAsGroup: 0
containers:
- name: ssh-test-container
image: busybox
volumeMounts:
- name: secret-volume
readOnly: true
mountPath: "/etc/secret-volume"
command: ["tail"]
args: ["-f", "/dev/null"]
volumes:
- name: secret-volume
secret:
secretName: ssh-key-secret
defaultMode: 384
EOF
$ kubectl exec -ti secret-test-pod -- ls -laR /etc/secret-volume/
/etc/secret-volume/:
total 4
drwxrwxrwt 3 root root 120 Nov 16 10:47 .
drwxr-xr-x 1 root root 4096 Nov 16 10:47 ..
drwxr-xr-x 2 root root 80 Nov 16 10:47 ..2019_11_16_10_47_47.045033508
lrwxrwxrwx 1 root root 31 Nov 16 10:47 ..data -> ..2019_11_16_10_47_47.045033508
lrwxrwxrwx 1 root root 13 Nov 16 10:47 id_rsa -> ..data/id_rsa
lrwxrwxrwx 1 root root 17 Nov 16 10:47 id_rsa.pub -> ..data/id_rsa.pub
/etc/secret-volume/..2019_11_16_10_47_47.045033508:
total 8
drwxr-xr-x 2 root root 80 Nov 16 10:47 .
drwxrwxrwt 3 root root 120 Nov 16 10:47 ..
-rw------- 1 root root 1675 Nov 16 10:47 id_rsa
-rw------- 1 root root 417 Nov 16 10:47 id_rsa.pub |
@lord Do you mean that we need to have an ability not to specify |
@vinokurig I think that in general we should not apply |
@l0rd
and the key files will have real |
@vinokurig thank you very much, I can confirm that setting FS__GROUP to |
Describe the bug
When attempting to clone a git repository via the terminal, I get the error:
I can't change the permissions as Che is injecting this as readonly.
Che version
Steps to reproduce
SSH: generate key pair...
commandgit clone {some git@ URL}
Expected behavior
SSH key should be mounted with appropriate permissions (i.e.
400
or600
).Runtime
kubectl version
)oc version
)minikube version
andkubectl version
)minishift version
andoc version
)docker version
andkubectl version
)Installation method
Helm charts via Rancher
Environment
The text was updated successfully, but these errors were encountered: