Skip to content
This repository has been archived by the owner on Sep 20, 2018. It is now read-only.

Customizing the ssh command #49

Open
igor-sfiligoi opened this issue Nov 22, 2013 · 7 comments
Open

Customizing the ssh command #49

igor-sfiligoi opened this issue Nov 22, 2013 · 7 comments

Comments

@igor-sfiligoi
Copy link

We are currently using ssh through a set of custom wrappers, and are considering moving to pushy.

However, we also want to be able to customize the ssh command that is being used.
Both in terms of arguments being passed and the actual binary name (we use gsissh).

I currently cannot find any way to customize this is pushy.
Is there a way? Would you be willing to consider adding the option, else?

Thanks,
Igor

@axw
Copy link
Member

axw commented Nov 23, 2013

There is an option for setting the binary used, though it's slightly hackish: set the PUSHY_NATIVE_SSH environment variable to "gsissh". As long as you do this before importing pushy, you're set. See: https://github.com/pushyrpc/pushy/blob/master/pushy/transport/ssh.py#L139

There's not currently a way of passing arbitrary arguments through. What do you need to pass? Is it static? If so, then you could create a wrapper for gsissh that passes those arguments. Otherwise, I'd be okay with a pull request to support passing through non-standard arguments.

I should inform you that I am not actively working on the project, and I do not have much time for it. Please bear this in mind as you consider migrating your existing tools.

@igor-sfiligoi
Copy link
Author

Ah... the PUSHY_NATIVE_SSH is almost what I want.

The only problem is that you require it to be a single file;
what i would like to do is instead set it to the path plus a set of arguments.

E.g., something along the lines of
gsissh -S /tmp/mycache

Any chance you could allow this?
I know I could create a wrapper for that, but it is annoying (and not very flexible).

Thanks,
Igor

PS: Having an explicit setting for this would be even better.
e.g. pushy.native_ssh = "gsissh -S %s" % mycache_fname

@axw
Copy link
Member

axw commented Nov 25, 2013

PS: Having an explicit setting for this would be even better.
e.g. pushy.native_ssh = "gsissh -S %s" % mycache_fname

That sounds reasonable. I'm thinking something like this:

pushy.transport.ssh.set_native(["gsissh", "-S", mycache_fname])

which will raise an exception if "gsissh" doesn't exist, and otherwise tell the SSH transport to use the arguments provided.

@igor-sfiligoi
Copy link
Author

Yep, that would be great.

BTW: Please do the same for scp.

Thanks,
Igor

PS: I assume you will post on this thread once it is done.

@igor-sfiligoi
Copy link
Author

One further comment:
Please search the path for the binary as well...

Looks like now it expects the abspath:
[0902] sfiligoi@engage-submit-1 ~$ export PUSHY_NATIVE_SSH=gsissh
[0904] sfiligoi@engage-submit-1 ~$ gsissh cmssubmit-r1.t2.ucsd.edu
Last login: Fri Nov 22 16:04:08 2013 from uaf-3.t2.ucsd.edu
[uscms1369@cmssubmit-r1 ~]$ exit
logout
Connection to cmssubmit-r1.t2.ucsd.edu closed.
[0904] sfiligoi@engage-submit-1 ~$ python
Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import pushy
con=pushy.connect('ssh:cmssubmit-r1.t2.ucsd.edu')
/home/sfiligoi/.local/lib/python2.6/site-packages/pushy/transport/ssh.py:144: UserWarning: Ignoring non-existant PUSHY_NATIVE_SSH ('gsissh')
"Ignoring non-existant PUSHY_NATIVE_SSH (%r)" % native_ssh)
Traceback (most recent call last):
File "", line 1, in
File "/home/sfiligoi/.local/lib/python2.6/site-packages/pushy/client.py", line 580, in connect
return PushyClient(target, **kwargs)
File "/home/sfiligoi/.local/lib/python2.6/site-packages/pushy/client.py", line 364, in init
self.server.stdin.write(marshal.dumps(packages, 1))
pushy.client.ClientInitException:
[remote] Unable to negotiate a key exchange method

[0905] sfiligoi@engage-submit-1 ~$ which gsissh
/usr/bin/gsissh

@axw
Copy link
Member

axw commented Nov 26, 2013

PS: I assume you will post on this thread once it is done.

Sure, however, as I mentioned earlier, I do not have much time for Pushy. I don't know when I'll get to this. If you would like it soon(er), I suggest you make the changes and send a pull request (or just maintain a fork).

@igor-sfiligoi
Copy link
Author

OK, will do the changes and let you know.

Spending time coding is not a problem, but do not want to maintain a fork.
But since you seem to be OK with the idea, will do the code and hopefully you can accept it.

Thanks,
Igor

On 11/25/2013 04:54 PM, Andrew Wilkins wrote:

PS: I assume you will post on this thread once it is done.

Sure, however, as I mentioned earlier, I do not have much time for Pushy. I don't know when I'll get to this. If you would like it soon(er), I suggest you make the changes and send a pull request (or just maintain a fork).


Reply to this email directly or view it on GitHub #49 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants