edf-hpc / clara

Cluster Administration tools
Other
18 stars 12 forks source link

IPMI: Add ability to execute "random" IPMI commands via SSH #59

Closed mehdid closed 8 years ago

mehdid commented 8 years ago

Sometimes, manufacturers implement special (and not standard) commands in their baseboard management controllers. Obviously, ipmitool or freeipmi will not be aware of their existence. The idea is to be able to execute such commands through the SSH interface of the BMC. So, for a command "foo bar 1", make clara do "ssh immcn001 'foo bar 1'" and handle the password request for the SSH part.

mehdid commented 8 years ago

For the cli part, one could imagine : clara ipmi ssh "hostlist" "cmd"

rezib commented 8 years ago

For the password stuff, we should add an option to upload SSH public key with:

task.set_info('ssh_path', "/usr/bin/sshpass -f /tmp/random_tmp_file /usr/bib/ssh")

Then, use the publickey authentication mecanism for other commands.

mehdid commented 8 years ago

or use something like pexpect? It looks enough for what we are looking for. The SSH session is even part of the base modules (see pxssh [1]). What is the advantage of sshpass?

[1] http://pexpect.readthedocs.org/en/stable/api/pxssh.html

rezib commented 8 years ago

Can you also tell what's wrong with sshpass?

sshpass is a lean, simple, clean C program w/o dep except libc and ssh. It just does what we want, nothing more or less.

Catching ssh password prompt using expect is not an easy job since it is not printed on stdout nor stderr. Using expect means more code, and more complexity to handle the tty stuff. Do we really want to do this?

And thus, I can't see any way to use clustershell and parallel/fanout connections with pexpect.

mehdid commented 8 years ago

Take it easy Rémi ;-) Pick whatever solution you like, as long as it does the job.

About pexpect, I wouldn't say it is a complex solution. It is a quite old thing that exists and just does the job and allows (easily) to have different passwords. All the complexity is hidden behind the pxssh module. It is true that we don't need the multiple passwords feature yet though.

If we want to avoid adding many dependencies to Clara, then, yes, pexpect might not be the ideal solution.

rezib commented 8 years ago

We should probably consider a dep on clustershell >= 1.7 for this issue: https://github.com/cea-hpc/clustershell/issues/283 ...