Skip to content
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

SSH support #7

Open
cmccluskey opened this issue Feb 12, 2018 · 3 comments
Open

SSH support #7

cmccluskey opened this issue Feb 12, 2018 · 3 comments

Comments

@cmccluskey
Copy link

In our application for controlling our APC units we need to use SSH instead of Telnet. I think Paramiko or similar can be easily replace the Telnet in your current implementation, but does mean including of some heavy modules to support this. Any interest in including this?

@scls19fr
Copy link
Owner

Ideally it should be an optional dependency

Maybe https://github.com/fgimian/paramiko-expect should be considered

For interacting with telnet, pexpect is used

What is important (too me) is to have code that works with telnet and (if optional depencies are necessary and installed) works with ssh

I haven't test it mysef, but did you tried to pass cli parameter

parser.add_argument('--cli', action='store', default='',
                    help="command line to execute 'ssh {user}@{host}' or 'telnet {host}")

See also class APCFactory

Contributions are welcome

@cmccluskey
Copy link
Author

I will give the cli argument a try. I think the only hangup then would be that the keys would then have to be published in the known_hosts file beforehand (something that paramiko handles very nicely for new/unknown entries).

The paramiko-exspect would be a nice way to glue the SSH side to use the same code as the telnet side since the send/expect calls appear to be the same at first glance.

I'll post what I discover.

@smallfish01
Copy link

Hello Cmccluskey,

I used the script and also would like to change telnet to ssh, but when I changed utility.py line 72 from "commandline = 'telnet %s' % host" to " commandline = 'ssh %s' % host" and tried running but got error:

apc --status

Acquiring lock /tmp/apc.lock
Connecting to APC @ 192.168.21.87
ERROR: Timeout connecting to APC

I think maybe the commandline is error, do you know how to change the commandline to ssh?

Thank you so much.

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

No branches or pull requests

3 participants