threefoldtecharchive / jumpscale9_lib

Apache License 2.0
0 stars 1 forks source link

re-introduce sshclient/executor support for paramiko #58

Closed rkhamis closed 6 years ago

rkhamis commented 6 years ago

Issue migrated from [https://api.github.com/repos/Jumpscale/lib9/issues/205](), opened by @despiegk

on OS keep on having issues with the ssh2 lib, we need to keep on supporting paramiko

in other words need to support both

rkhamis commented 6 years ago

commented by @rkhamis I'll check with @maxux if we can build a wheel for mac with his fix there. If not, we'll have to re-add paramiko

rkhamis commented 6 years ago

*commented by @despiegk we already tried everything, also the ssh forward does not seem to work for keys a wheel will not resolve this I think

its less work to leave Paramiko in as option

On Sun, Mar 25, 2018 at 11:42 AM, Reem Khamis notifications@github.com wrote:

I'll check with @maxux https://github.com/maxux if we can build a wheel for mac with his fix there. If not, we'll have to re-add paramiko

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Jumpscale/lib9/issues/205#issuecomment-375957660, or mute the thread https://github.com/notifications/unsubscribe-auth/AFvi1Jg-FsOgKDvRFwgaFn77Tg1etirWks5th2aTgaJpZM4S6Br3 .

--

Kristof De Spiegeleer +971525609014 (my telegram account registered on this nr, best way to reach me) +201206927877 +32 475405474 skype: despiegk *

rkhamis commented 6 years ago

*commented by @maxux What about ssh2-python version 0.11 released 4 days ago with our patch inside ?

On Sun, 25 Mar 2018 at 18:56, kristof de spiegeleer < notifications@github.com> wrote:

we already tried everything, also the ssh forward does not seem to work for keys a wheel will not resolve this I think

its less work to leave Paramiko in as option

On Sun, Mar 25, 2018 at 11:42 AM, Reem Khamis notifications@github.com wrote:

I'll check with @maxux https://github.com/maxux if we can build a wheel for mac with his fix there. If not, we'll have to re-add paramiko

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Jumpscale/lib9/issues/205#issuecomment-375957660, or mute the thread < https://github.com/notifications/unsubscribe-auth/AFvi1Jg-FsOgKDvRFwgaFn77Tg1etirWks5th2aTgaJpZM4S6Br3

.

--

Kristof De Spiegeleer +971525609014 (my telegram account registered on this nr, best way to reach me) +201206927877 +32 475405474 skype: despiegk

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Jumpscale/lib9/issues/205#issuecomment-375985372, or mute the thread https://github.com/notifications/unsubscribe-auth/AD8yEJ9W_ntiewdSX00Soduf88GhVrCGks5th8wggaJpZM4S6Br3 .

*

rkhamis commented 6 years ago

*commented by @despiegk On Sun, Mar 25, 2018 at 6:57 PM, Maxime Daniel notifications@github.com wrote:

What about ssh2-python version 0.11 released 4 days ago with our patch inside ?

On Sun, 25 Mar 2018 at 18:56, kristof de spiegeleer < notifications@github.com> wrote:

we already tried everything, also the ssh forward does not seem to work for keys a wheel will not resolve this I think

its less work to leave Paramiko in as option

On Sun, Mar 25, 2018 at 11:42 AM, Reem Khamis notifications@github.com wrote:

I'll check with @maxux https://github.com/maxux if we can build a wheel for mac with his fix there. If not, we'll have to re-add paramiko

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Jumpscale/lib9/issues/205#issuecomment-375957660, or mute the thread < https://github.com/notifications/unsubscribe-auth/AFvi1Jg- FsOgKDvRFwgaFn77Tg1etirWks5th2aTgaJpZM4S6Br3

.

--

Kristof De Spiegeleer +971525609014 <+971%2052%20560%209014> (my telegram account registered on this nr, best way to reach me) +201206927877 <+20%20120%20692%207877> +32 475405474 <0475%2040%2054%2074> skype: despiegk

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Jumpscale/lib9/issues/205#issuecomment-375985372, or mute the thread https://github.com/notifications/unsubscribe-auth/AD8yEJ9W_ ntiewdSX00Soduf88GhVrCGks5th8wggaJpZM4S6Br3 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Jumpscale/lib9/issues/205#issuecomment-375985476, or mute the thread https://github.com/notifications/unsubscribe-auth/AFvi1AXGk2oX46qWwRmvW60fy7JFAI9Mks5th8x7gaJpZM4S6Br3 .

--

Kristof De Spiegeleer +971525609014 (my telegram account registered on this nr, best way to reach me) +201206927877 +32 475405474 skype: despiegk *

rkhamis commented 6 years ago

commented by @despiegk even if the patch resolves the stability issue, ssh key forwarding does not seem to be in? and this also we need please put paramiko back as an option, its also more stable

rkhamis commented 6 years ago

*commented by @maxux From what I know, it's not ssh2-python which needs to be used directly, but parallel-ssh which use ssh2-python or paramiko under the hood (selectable).

parallel-ssh supports ssh-agent-forward (https://github.com/ParallelSSH/parallel-ssh/blob/master/doc/advanced.rst)*

rkhamis commented 6 years ago

*commented by @ahussein as @maxux mentioned, parallel-ssh supports both ssh2-python and paramiko, a simple change in our sshclient should allow use to support both on development branch you can now create an sshclient using the following: sshclient = j.clients.ssh.get(instance='testparamiko', data={'addr': ipaddr, 'login': 'root', 'sshkey': sshkey}, use_paramiko=True)

The use_paramiko flag is new and will default to False if not specified*

rkhamis commented 6 years ago

commented by @despiegk I will do differently when OSX i will use paramiko by default,

rkhamis commented 6 years ago

*commented by @despiegk image

not sure this is right behaviour?

pssh.ssh_client

doesnt that mean its just old ssh1 client, which is less secure?*

rkhamis commented 6 years ago

*commented by @despiegk not working on my machine lets fix first please image

test using ssh://docs.grid.tf:7022/despiegk/itenv_test.git and

python3 python_build.py

*

rkhamis commented 6 years ago

commented by @rkhamis @xmonader Please add a new executor to use the old paramiko code here

rkhamis commented 6 years ago

commented by @ahussein our test case also fails here: https://travis-ci.org/Jumpscale/core9/builds/360850611 its probably something related the version of pssh that was being used. Maybe we need to pip freeze the working version of pssh.

rkhamis commented 6 years ago

*commented by @ahussein works on development. Also on test script build_python.py works beyond the error mentioned before. Currently the errors I get when running the python_build.py script is:

[Sun01 20:39] - SSHClient.py      :68  :.134.212.32:2207(root) - ERROR    - bash: js9: command not found
Traceback (most recent call last):
  File "python_build.py", line 13, in <module>
    builder_prefab.core.run("js9 'j.tools.sandboxer.python.do()'")
  File "/opt/code/github/jumpscale/prefab9/JumpScale9Prefab/PrefabCore.py", line 1134, in run
    cmd, checkok=checkok, die=die, showout=showout, env=env, timeout=timeout, sudo=sudo)
  File "/opt/code/github/jumpscale/core9/JumpScale9/tools/executor/ExecutorSSH.py", line 68, in execute
    cmds2, die=die, showout=showout)
  File "/opt/code/github/jumpscale/core9/JumpScale9/clients/ssh/SSHClient.py", line 85, in execute
    raise j.exceptions.RuntimeError("Cannot execute (ssh):\n%s\noutput:\n%serrors:\n%s" % (cmd, output, error))
JumpScale9.errorhandling.JSExceptions.RuntimeError: ERROR: Cannot execute (ssh):
[ ! -e '/root/.bash_profile' ] && touch '/root/.bash_profile' ;source /root/.bash_profile;js9 'j.tools.sandboxer.python.do()'
output:
errors:
bash: js9: command not found
 ((type:runtime.error)
[Sun01 20:39] - ErrorHandler.py   :257 :j.core.errorhandler  - ERROR    - Cannot execute (ssh):
[ ! -e '/root/.bash_profile' ] && touch '/root/.bash_profile' ;source /root/.bash_profile;js9 'j.tools.sandboxer.python.do()'
output:
errors:
bash: js9: command not found

which is a problem with the script itself. *

rkhamis commented 6 years ago

commented by @xmonader Re-introducing Paramiko client on latest development