astefanutti / kubebox

⎈❏ Terminal and Web console for Kubernetes
http://astefanutti.github.io/kubebox
MIT License
2.15k stars 142 forks source link

/bin/sh: 1: Syntax error: Missing when web-ssh into any pods #25

Closed fangli closed 5 years ago

fangli commented 5 years ago

If I run kubebox in kubernetes as a service, when web-ssh into a pod, it gives an error:

/bin/sh: 1: Syntax error: Missing '))'
command terminated with non-zero exit code: Error executing in Docker Container: 2
Disconnected
Type Ctrl-C to close

I'm not pretty sure if it's caused by this commit: https://github.com/astefanutti/kubebox/commit/b795966f51cbf503f2c371ea6fa1579136fbe32b

astefanutti commented 5 years ago

Can you confirm you've deployed Kubebox with the kubernetes.yaml template? If yes, could you try changing the container image to astefanutti/kubebox:0.3.1-server so that we can confirm it's caused by b795966f51cbf503f2c371ea6fa1579136fbe32b?

fangli commented 5 years ago

Issue confirmed. if I use kubebox:0.3.1-server or just revert that file, everything works like a charm. Please note that the issue only exists in web-ssh deployment. if I run kubebox as a native console, it works without problem.

Maybe there are something incompatible in webpage deployment, like incorrect char escaping? or malformed exec command?

I haven't figure out what exactly caused this issue, coz if I ran something like

echo $((type getent > /dev/null 2>&1 && getent passwd root | cut -d: -f7 2>/dev/null) || echo /bin/sh)

in pods manually, it just works.

astefanutti commented 5 years ago

Thanks a lot. I suspect char escaping issue too, with '&' messing up the request. What browser do you use? Would you be able to inspect the request being sent in the dev console?

astefanutti commented 5 years ago

I've been able to reproduce, both in Web and terminal versions. It should be fixed with 58a35b35617b382480ac264a75fa30e090a70ccb. Thanks for your help!

fangli commented 5 years ago

Oh you r the genius! it took me several hours to figure out why that happens. I tried many shell with your getent commands but nothing found. That's the kubebox version of "rm -rf / tmp/files" lol :)