Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting via SSH

SOLVED
Go to solution
Valentin Likoum
Frequent Advisor

Scripting via SSH

Hello,
We'd like to manage our network gear (D-link' DFL) from the VMS host. The only acceptable way we see is the interactive SSH session (issue a bunch of commands and analyze the results). But how can it be accoplished from the VMS? Plain SSH command (HP TCPIP 5.4) takes only one command to run, so unusefull. C-Kermit would be the ideal candidate for the job, but it doesn't support SSH in VMS version. What else?
"-S" switch of the SSH command looks promising but the documentation is too brief about it.
"Does not request a session channel. This type of session does not disconnect automatically.". But how can it be used?
6 REPLIES
Valentin Likoum
Frequent Advisor

Re: Scripting via SSH

Sorry, I re-read my own question and found it not clear enough. We'd like to manage the device automatically from the script, not manually of cause. So the task is:
- make an SSH-connection to the device
- issue a bunch of commands in the same connection
- get the results
Hoff
Honored Contributor

Re: Scripting via SSH

D-Link offers various DFL-class boxes. And they vary. Which D-Link DFL is involved here?

Brute-force alternative: cURL?

The ssh manual points to the potential need for:

$ SSH -o "batchmode yes"

There are also open source versions of OpenSSH around that could be used for reference or for an alternative implementation.

And if you have an HP support contract, consider using it.

And if the OpenVMS box doesn't work sufficiently here for your needs, consider an alternate host operating system and box to serve as the network administration and management gateway. The minicom bits on an embedded box might be interesting and useful here and as a console server.
Jean-François Piéronne
Trusted Contributor
Solution

Re: Scripting via SSH

This can be easily scripted using paramiko Python module, a small example accessing a linux box from a VMS one:

import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('rhost', username='usr', password='pwd')
stdin, stdout, stderr = ssh.exec_command("uptime")
print stdout.readlines()
ssh.close()

give
[' 17:23:24 up 32 min, 1 user, load average: 0.14, 0.33, 0.35\n']

You can find more examples on
http://jessenoller.com/2009/02/05/ssh-programming-with-paramiko-completely-different/


Jean-Francois
Valentin Likoum
Frequent Advisor

Re: Scripting via SSH

> D-Link offers various DFL-class boxes. And they vary. Which D-Link DFL is involved here?

DFL-1600

> Brute-force alternative: cURL?

cURL to DFL' web management interface? It's the way I'm trying to bypass as it looks too complicated (java-script reverse engineering) and potentially unstable due to firmware updates.

> The ssh manual points to the potential need for:
> SSH -o "batchmode yes"

yes, I tried it. It works correctly from the DCL command file but executes exactly one command in one connection. I need to issue bunch of commands in one connection, otherwise DFL rollback the change[s].

> There are also open source versions of OpenSSH around that could be used for reference or for an alternative implementation.
> And if the OpenVMS box doesn't work sufficiently here for your needs, consider an alternate host operating system

Yes, I consider these ways as a last chance. I'm still trying to keep things tight as far as possible.
Valentin Likoum
Frequent Advisor

Re: Scripting via SSH

> This can be easily scripted using paramiko Python module

Jean-François, thank you for reminder. I thought about Perl Net:SSH2 module (unfotunately it requires libssh2 library which should be found or ported myself) but definitly forgot about Python. It's worth a try. Does it require some other external libraries?
Jean-François Piéronne
Trusted Contributor

Re: Scripting via SSH

Valentin,

Installation of Python required 2 LD images.
Installation documentation:
http://www.vmspython.org/DownloadAndInstallationPython

Jean-Francois