Welcome to the new Schneider Electric Community

It's your place to connect with experts and peers, get continuous support, and share knowledge.

  • Explore the new navigation for even easier access to your community.
  • Bookmark and use our new, easy-to-remember address (community.se.com).
  • Get ready for more content and an improved experience.

Contact SchneiderCommunity.Support@se.com if you have any questions.

Close
Invite a Co-worker
Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
Send Invite Cancel
84422members
353606posts

key based ssh authentication

APC UPS Data Center & Enterprise Solutions Forum

Schneider Electric support forum for our Data Center and Business Power UPS, UPS Accessories, Software, Services, and associated commercial products designed to share knowledge, installation, and configuration.

Solved
bobjunga_apc
Ensign
Ensign
0 Likes
3
454

key based ssh authentication

This was originally posted on APC forums on 11/13/2015


I have a number of 8xxx series PDUs. I want to write bash scripts to collect information from them. Is it possible to authorize an ssh key for a management card user so that it can connect without a password. Ideally I want to create a readonly type user on each device and authorize that user to authenticate with an ssh key instead of a password.

I can use either a local user account or I could configure radius. A ssh key solution for either type would work for me.  (either uploading the ssh key to the device or having RADIUS provide the ssh key)

Also, it seems that when I it does not accept scripted command via ssh. for example, "ssh @ system"  reports "Connection to closed by remote host." after I type the password.  I wonder if I have to invoke the command differently than when typing it in an interactive shell. something like "... 'run system'" for example.

Most devices are currently running 5.1.6 and I am in the process of upgrading them to 633 (I think that is 6.0.33 -- the current release)

In the 6.x documentation I saw references to scripting via the command line interface. What is the typical way to do that?

--BobG


Accepted Solutions
bobjunga_apc
Ensign
Ensign
0 Likes
0
454

Re: key based ssh authentication

This was originally posted on APC forums on 11/14/2015


FYI, I have written a BASH library that manipulates ssh to communicate with the APC gen 2 management cards that are in the 8xxx series pdus.  If anyone is interested in getting it, PM me.

Here is an example script that would run a command passed to it and display the results. The library has the default passwords hard coded for the known usernames. If you specify a different username, it prompts you to enter the password. It would make sense to leave the readonly password to the default and change the others so that the script could be used without any password for readonly access but for users you add, it would prompt for a  passowrd. Of course you could choose to hard code your admin password in your scripts too. 

I will also add methods to the APCPDU class to manipulate outlets, etc...

        cat pduRun

        #!/bin/bash
        #usage: pduRun
        source bg_APCPDU.sh

        device="${1:-$myPDU.example.com}"; [ $# -gt 0 ] && shift
        username="${1:-readonly}"; [ $# -gt 0 ] && shift

        declare -A pdu=()
        ConstructObject APCPDU pdu "$device"
        $pdu.connect "$username" "$promptForPass"
        $pdu.execCommand "$*"
        echo "$($pdu.get buf)"
        $pdu.disconnect

See Answer In Context

3 Replies 3
BillP
Administrator Administrator
Administrator
0 Likes
0
454

Re: key based ssh authentication

This reply was originally posted by Angela on APC forums on 11/13/2015


Hi Bob,

We don't support key based authentication at this time unfortunately. And so that second question doesn't work either as you have to be logged in to issue commands. I will inquire more about key based authentication but I don't think we plan to implement it in the immediate future.

The scripting help we have is just a guide to the command line interface (and also mentions SNMP as an option) -> http://www.apc.com/support/index?page=content&country=ITB〈=en&locale=en_US&id=FA156163

And yes, for the AP8XXX series/models of PDU, AOS (APC OS) 6.3.2 /rpdu2g APP 6.3.3 is the latest. We'll be coming out with a new rev shortly (AOS 6.3.3 I think) with some security changes but the answers to your questions won't change with that release. We are removing RC4 ciphers, providing TLS 1.2, SHA-2 hash signatures, etc.

bobjunga_apc
Ensign
Ensign
0 Likes
0
454

Re: key based ssh authentication

This was originally posted on APC forums on 11/13/2015


Thank you for your quick response. Disappointing, but at least I know.

I hope to see a more complete sshd implementation on these devices in the future.

--BobG

bobjunga_apc
Ensign
Ensign
0 Likes
0
455

Re: key based ssh authentication

This was originally posted on APC forums on 11/14/2015


FYI, I have written a BASH library that manipulates ssh to communicate with the APC gen 2 management cards that are in the 8xxx series pdus.  If anyone is interested in getting it, PM me.

Here is an example script that would run a command passed to it and display the results. The library has the default passwords hard coded for the known usernames. If you specify a different username, it prompts you to enter the password. It would make sense to leave the readonly password to the default and change the others so that the script could be used without any password for readonly access but for users you add, it would prompt for a  passowrd. Of course you could choose to hard code your admin password in your scripts too. 

I will also add methods to the APCPDU class to manipulate outlets, etc...

        cat pduRun

        #!/bin/bash
        #usage: pduRun
        source bg_APCPDU.sh

        device="${1:-$myPDU.example.com}"; [ $# -gt 0 ] && shift
        username="${1:-readonly}"; [ $# -gt 0 ] && shift

        declare -A pdu=()
        ConstructObject APCPDU pdu "$device"
        $pdu.connect "$username" "$promptForPass"
        $pdu.execCommand "$*"
        echo "$($pdu.get buf)"
        $pdu.disconnect