Difference between revisions of "Satori/SSHModuleProposal"
< Satori
m |
m |
||
Line 19: | Line 19: | ||
* Manage connecting and disconnecting when <code>remote_execute()</code> is called. (Lazy load the auth object) | * Manage connecting and disconnecting when <code>remote_execute()</code> is called. (Lazy load the auth object) | ||
* Attempt to handle password prompts for non-passwordless sudoers | * Attempt to handle password prompts for non-passwordless sudoers | ||
− | * Attempt to handle hiccups with pty/tty rules by retrying with a pty channel<ref name="get_pty"/> if the system responds with "sudo requires a tty" or similar | + | * Attempt to handle hiccups with pty/tty rules by retrying the command with a pty channel<ref name="get_pty"/> if the system responds with "sudo requires a tty" or similar |
* Support ssh proxy connections<ref name="sshproxy_connections"/>, and create an implementation that provides the same behavior whether connecting through a proxy or connecting to the remote host directly. | * Support ssh proxy connections<ref name="sshproxy_connections"/>, and create an implementation that provides the same behavior whether connecting through a proxy or connecting to the remote host directly. | ||
* Implement an instance property, <code>platform_info</code>, that will return the remote host's platform info using (python >=2.4)'s [http://docs.python.org/2/library/platform.html platform module] | * Implement an instance property, <code>platform_info</code>, that will return the remote host's platform info using (python >=2.4)'s [http://docs.python.org/2/library/platform.html platform module] |
Revision as of 17:58, 7 March 2014
SSH Module Proposal
As an initial platform to enable data plane discovery, implement an SSH module using paramiko by extending its SSHClient class.
Desired Interface
>>> from satori.common.ssh import SSH >>> client = SSH(host="123.456.789.11", host_password="pa$$word", host_username="Tobias") >>> output = client.remote_execute("sudo echo hello", with_exit_code=True) >>> print output {'stdout': 'hello', 'stderr': '', 'exit_code': 0}
Requirements
- Accept a password string, private key string, or path to private key file for auth. Paramiko will automatically check in the standard places for ssh keys if nothing else is provided.
- Manage authentication mechanisms, retry authenticating, and prefer SSH keys.
- Implement/override a
connect()
method to do this.
- Implement/override a
- Provide a method,
test_connection()
, for doing just that. - Manage connecting and disconnecting when
remote_execute()
is called. (Lazy load the auth object) - Attempt to handle password prompts for non-passwordless sudoers
- Attempt to handle hiccups with pty/tty rules by retrying the command with a pty channel[1] if the system responds with "sudo requires a tty" or similar
- Support ssh proxy connections[2], and create an implementation that provides the same behavior whether connecting through a proxy or connecting to the remote host directly.
- Implement an instance property,
platform_info
, that will return the remote host's platform info using (python >=2.4)'s platform module- Remote system requires python>=2.4
- architecture, distro, version
- e.g. Ubuntu 12.04 x86_64 would return
-
{'arch': 'x86_64', 'dist': 'ubuntu', 'version': '12.04'}
-
- ↑ 1.0 1.1 paramiko.channel.Channel.get_pty See get_pty().
- ↑ 2.0 2.1 paramiko.client.SSHClient.connect See sock keyword argument.