Breedly
Breedly

Reputation: 14336

Datapower SSH login ignores username

When I ssh to my Datapower node like so: ssh [email protected] I receive this response:

ssh [email protected]
(unknown)
Unauthorized access prohibited.
login:

I then enter in the same username, and am also prompted for a password. I type in my credentials and it works! Why didn't it just read my username the first time?

This is hampering my ability to automate a few basic tasks with shell scripts such as fetching logs for processing.

Upvotes: 1

Views: 2007

Answers (4)

user26321131
user26321131

Reputation: 1

Set in your Datapower - default - RBM - ssh policy auth with password

Upvotes: 0

Renato
Renato

Reputation: 181

I agree with @Ken and @Stefan that a XML Management is a more appropriate tool for long term automations, howerver, sometimes we need something quick or temporary (or both) ... and for that a CLI automation is easier and faster to develop.

An easy way to push commands to CLI from a shell script is directing the input and output, like this quick sample:

#!/bin/ksh
DPHOST=datapower.device.company.com
DP_USER_ID="myuser"
DP_PASSWORD="mypasword"
TMPFILE=/tmp/tempfile.dp
OUTFILE=/tmp/outfile.dp
TS=`date +%Y%m%d%H%M%S`

cat << EOF > $TMPFILE
DP_USER_ID
DP_PASSWORD
default
echo show cpu
show cpu
echo show memory
show memory
EOF

ssh -T $DPHOST < $TMPFILE  > $OUTFILE.$TS
rm $TMPFILE

Note that if you do not have any application domains defined, you may suppress the "default" after the password

And of course, for security reasons you may request the user and password at run time, rather then have it saved on a plain text file, but that is up to you ... the relevant piece here is that you can redirect the file with the commands to an regular ssh session

If you prefer, something like cat $TMPFILE | ssh -T $DPHOST > $OUTFILE.$TS would also works.

Upvotes: 2

Anders
Anders

Reputation: 3412

That is because DataPower really isn't a SSH server only using the protocol. What I do in my scripts is that I do the connection, wait for the response and then send the username as the second command and password as third:

ssh [datapower ip]

(unknown)

Unauthorized access prohibited.

login:

your-username

password:

your-password

'#xi52:

Upvotes: 1

Ken
Ken

Reputation: 1

DataPower ignores the passed-in username.

Will using the XML Management interface meet your needs? I probably have some scripts laying around.

Ken

Upvotes: 0

Related Questions