Hello,
I am trying to automate some things that cannot be done with the REST API like creating password map aliases. I decided to try using Python's Paramiko library for the SSH capability. It works perfectly when connecting to a regular Linux server, however when I use it with Datapower I get this error:
Traceback (most recent call last):
File "setupDatapowerAppliance.py", line 211, in <module>
main()
File "setupDatapowerAppliance.py", line 198, in main
createSSHConnection(dpHost)
File "setupDatapowerAppliance.py", line 136, in createSSHConnection
stdin,stdout,stderr=ssh_client.exec_command('config')
File "/usr/local/lib/python3.6/site-packages/paramiko/client.py", line 514, in exec_command
chan.exec_command(command)
File "/usr/local/lib/python3.6/site-packages/paramiko/channel.py", line 72, in _check
return func(self, *args, **kwds)
File "/usr/local/lib/python3.6/site-packages/paramiko/channel.py", line 257, in exec_command
self._wait_for_event()
File "/usr/local/lib/python3.6/site-packages/paramiko/channel.py", line 1226, in _wait_for_event
raise e
I have tried multiple command syntax but am stuck and before I use up any more time I'm curious if it's possible this might not work with Datapower's SSH implementation?
This is my code:
logging.debug("entered createSSHConnection")
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
ssh_client.connect(hostname=dpAppliance,username=dpUser,password=dpPassword)
except Exception as e:
logging.error("Error:" + str(e))
sys.exit(1)
stdin,stdout,stderr=ssh_client.exec_command('config')
Note that I took the username/password out of the ssl_client.connect string and it still seemed to connect, whereas on a regular Linux server it fails to connect without a user/pass. On Datapower it only fails when I try to execute a command, so I assume I'm not really logged in at all.
Thanks for any insight!
#DataPower#Support#SupportMigration