How to connect CircleCI to Jboss server without giving the password?

I have written automated deployment script with out giving password to connect circleci server to jboss server but it is recognized sshkey i have given sshkey in my repo and environment variable can you please help.

Looks like a duplicate of your other question.

Moreover, I’ve responded to a number of your other questions on this forum, and have not received a response. This question, and its duplicate, is too broad and difficult to answer. More details, such as code and configuration are required to make this answerable.

If I don’t receive a response to this, I’ll assume the account is a bot, and will ask moderators to consider disabling it.

in my previous question i didn’t see any suggestions can you please help me

See above! Please help me.

“This my config.yml file”

< deploy:

machine:
   enabled: true

working_directory: ~/CIDependency

environment:
    HOST_NAME=$HOSTNAME
    APP_SERVER=$Appserver
    DEPLOY_USER=$USERNAME
    PASSWORD=$PASSWORD
    ID_RSA=$ID_RSA
    Deploy_Location=$Deploypath
    DEPLOY_FILENAME=$Deployname
    DEPLOY_FILE=$Deployfile
    BUILD_NUM_PARM=$5
steps:
  - checkout
  - add_ssh_keys:
       fingerprints:
          - "29:af:41:62:3c:f7:43:cc:15:cb:1d:53:f2:0a:da:9d"
 
  - run: chmod 700 .circleci/JBoss_Deploy.sh           
  - run:
      name: Dev Deployment 
      command: bash .circleci/JBoss_Deploy.sh

/>

"Here i attached log "

Hi Sravankumar,

Thank you for providing your configuration. However, the second file is not formatted in this discussion forum, and it is rather hard to read. Would you carefully reformat the second file, so that it is readable and so that indentation is preserved?

I recall I sent you a private message some while back, to show how to correctly format code/config in Markdown. A few days later I received this:

@Sravankumar removed themselves from this message Apr 23

:roll_eyes:

I wonder, if you are doing this for a commercial project, would it help to get assistance from a colleague or a local freelancer?

"And here am adding jboss script"
<
#!/bin/bash
set -vx
HOST_NAME=$HOSTNAME
APP_SERVER=$Appserver
DEPLOY_USER=$USERNAME
PASSWORD=$PASSWORD
Deploy_Location=$Deploypath
DEPLOY_FILENAME=$Deployname
ID_RSA=$ID_RSA
DEPLOY_FILE=$Deployfile
BUILD_NUM_PARM=$5

echo "Deploy filename: "  $DEPLOY_FILE

if [ -z $DEPLOY_FILE ]
then
  echo "DEPLOY_FILE is empty"
  exit 1
fi

cat 
scp -oStrictHostKeyChecking=no -i $ID_RSA -r ${DEPLOY_FILE} ${DEPLOY_USER}@${HOST_NAME}:/tmp/

rc=$?
echo "Return code: " $rc
if [ $rc -ne 0 ]; then
  echo "first scp command failed: $rc"
  exit $rc
fi
/>

Hi Halfer,

Reformatted second file and i was facing issue in days please help me for this issue how can we connect without giving password i added private key in ssh permission and in cirlceci environment variable i add my deployment server details like hostname,password,etc . And i was doing commercial project

Can any one suggest me how to connect with out password circlecci to jboss server?

I suggest you re-format your code file above, so it is readable, as I have requested many times. It will be like so:

#!/bin/bash
# This script expects the $ID_RSA variable to contain a private key for the deploy user
...

You will need to click on the “edit” (pencil) icon to get to the editor.

I am not seeing much of a problem statement here (when you try what you are doing, we need to see what happens, like error messages etc). But, one step at a time.

Just now reformatted above code as well please check and help me

:cry: OK, close enough, despite the non-code at the start and end.

So, the next thing you need to work on is debugging. You want to connect to a Jboss server with a private key. Great! You have even provided some code that is, after a fashion, readable.

So, what problem are you having with this? The log indicates that scp tries to connect to the remote server, and asks for a password on the console, and fails because there is no console. So, it is either ignoring the private key or the key is failing.

You need to find out why that is. Try one of these with the rest of the command:

scp -v
scp -vv
scp -vvv

These will give you verbose information about what the command is doing. You can then copy and paste that log here in your question, again in a formatted block.

Good luck!

#!/bin/bash -eo pipefail
scp -o StrictHostKeyChecking=no -v medical-0.1.war sravan@169.116.42.73:/tmp/
Executing: program /usr/bin/ssh host 169.116.42.73, user sreddy26, command scp -v -t /tmp/
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014

debug1: Reading configuration data /home/circleci/.ssh/config

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: /etc/ssh/ssh_config line 1: Applying options for *

debug1: Connecting to 169.116.42.73 [169.116.42.73] port 22.

debug1: connect to address 169.116.42.73 port 22: Connection timed out

ssh: connect to host 169.116.42.73 port 22: Connection timed out

lost connection
Exited with code 1

I tried which you given command getting error sorry Halfer i corrected ip address my IP :169.116.42.73

This will be my last reply.

The error message indicates that the server is unreachable, so that’s an entirely different error. You need to be able to contact the server you are deploying to.

Also, the last byte of your IP is 733, which is not possible. I suspect you have transcribed this wrongly in your post.

I mean this remark to be helpful: you need some one-to-one help/coaching. Using CI is hard, and it requires some familiarity with Linux, networking and trouble-shooting. I recommend that you approach someone locally, and bring them into your office, or get a good freelancer from TopTal or AirPair etc. Trying to get by with volunteer assistance is not going to cut it.

And when i ran this command in circleci cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
am getting permission denied error.
#!/bin/bash -eo pipefail
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
/bin/bash: /home/circleci/.ssh/authorized_keys: Permission denied
Exited with code 1

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.