ssh-action
ssh-action copied to clipboard
ssh: handshake failed on every attempt
Hey there,
I'm stuck and wasn't able to find a solution in reading previous issues. I keep getting the following error:
2020/08/29 01:19:13 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Here is my YAML:
name: Deploy branch to staging
on:
push:
branches: [ develop ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands
uses: appleboy/ssh-action@master
with:
script_stop: true
host: ${{ secrets.NEWDEV_HOST }}
username: ${{ secrets.NEWDEV_USERNAME }}
key: ${{ secrets.NEWDEV_SSH_KEY }}
port: ${{ secrets.NEWDEV_SSH_PORT }}
script: whoami
My ssh key is a pem file:
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
The correct values are in .ssh/authorized_keys
on the remote server. I am able to ssh from multiple other machines using this key. There is no passcode.
I'm stumped! This is on EC2 if that makes a difference.
https://github.com/appleboy/ssh-action#setting-up-ssh-key
I just followed those steps exactly (adding another key).
I get the same error on the Github action page. I'm able to log in fine using SSH from the terminal using that newly created key.
I must be missing something else. I don't believe it is Firewall related as SSH does respond and gives the handshake failed response. The key works from the ssh on the terminal when I use ssh -i github_deploy_id_rsa [email protected]
Just checking the basics here:
host is the dns name of the server (for example newdevsite.example.com
)
username is the ssh username (my username does have a hyphen in it ec2-user
)
key is the text of the private keyfile. No encoding just copied and pasted.
port is 22 (I tried leaving this off since it is the default but that made no difference)
I'm not sure what else could be going wrong. Hmmm
I got the same error
My action file
name: deploy
on:
push:
branches: [ master ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Connect and run Scripts
uses: appleboy/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOST: ${{ secrets.HOST }}
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
port: ${{ secrets.PORT }}
script: |
whoami
echo "$HOST"
ls -a
I just resolve the issue my RSA PRIVATE KEY was incomplete
Try to run cat ~/.ssh/id_rsa
Thx.
@militem-code Thanks! However you got the ParsePrivateKey: ssh: invalid openssh private key format
error which is helpful. Unfortunately I get none of that. I'm able to confirm my key is correct from the command line. There is something else going on
executing remote ssh commands1s proxy_use_insecure_cipher: false Run appleboy/ssh-action@master /usr/bin/docker run --name e5ae592eecc69186d449d19429204e230021df_e58eb3 --label e5ae59 --workdir /github/workspace --rm -e INPUT_SCRIPT_STOP -e INPUT_HOST -e INPUT_USERNAME -e INPUT_KEY -e INPUT_PORT -e INPUT_SCRIPT -e INPUT_DEBUG -e INPUT_PASSPHRASE -e INPUT_PASSWORD -e INPUT_SYNC -e INPUT_USE_INSECURE_CIPHER -e INPUT_CIPHER -e INPUT_TIMEOUT -e INPUT_COMMAND_TIMEOUT -e INPUT_KEY_PATH -e INPUT_FINGERPRINT -e INPUT_PROXY_HOST -e INPUT_PROXY_PORT -e INPUT_PROXY_USERNAME -e INPUT_PROXY_PASSWORD -e INPUT_PROXY_PASSPHRASE -e INPUT_PROXY_TIMEOUT -e INPUT_PROXY_KEY -e INPUT_PROXY_KEY_PATH -e INPUT_PROXY_FINGERPRINT -e INPUT_PROXY_CIPHER -e INPUT_PROXY_USE_INSECURE_CIPHER -e INPUT_ENVS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/xxx/xxx":"/github/workspace" e5ae59:2eecc69186d449d19429204e230021df ======CMD====== whoami ======END====== ======ENV====== 2020/09/11 19:43:51 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
======END======
I an confirm this error. All of a sudden it started to fail. Nothing has changed on the secrets
Yea. I'm stumped on this too, can't find what is wrong
I'm also unable to get it to work. Getting 2020/09/20 20:24:23 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
@Siedlerchr @Oliyy @timahrentlov Where is the target ssh server hosted? I'm curious is this is specific to AWS.
It's hosted on Digital Ocean.
@Cabalist our server is hosted at Hetzner
@Cabalist This is failing for me too, exactly in this way, on a custom server.
Failing for me as well:
2020/09/23 07:48:52 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
Failing for me too. Running server on digital ocean. Was working fine a few days ago.
I can confirm the error
Any news about the error? I've been having the same issue too.
This is failing for me too, haven't had issues before today's attempted deployment.
I was using this package for a custom CI pipeline on my digital ocean server, but due to this error I had to stop. If anyone else is using DO i recommend using their new app platform which comes with a built in CI pipeline!
@kraj011 What new app platform do you use?
I will create a new video to demo how to use the plugin with the DO server.
@appleboy It came out very recently; here's a link to it: DO App Platform
I've been having the same issue too, someone already solved?
a similar error, I haven't found a solution yet although the authorization key works on the server
UPD re-entered all data in secret and it worked the IP or username may have been entered incorrectly
Well I was finally able to make it work. I don't remember well what I changed because it was so long ago, but here is my YAML file:
name: CD
on:
push:
branches: [main]
jobs:
deploy:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Repository checkout
uses: actions/checkout@v2
- name: Connects to VPS via SSH
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_IP }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_KEY }}
passphrase: ${{ secrets.SERVER_PASSPHRASE }}
script: |
cd ${{ secrets.PROJECT_PATH }}
sudo git checkout main
sudo git pull origin main
python3 manage.py migrate
sudo systemctl restart crm-backend
I got it! @v0.1.4 work at the moment I guess something is broken in the master branch. So don't use @master.
-
name: Run scripts on servers via SSH
uses: appleboy/[email protected]
with:
host: "${{ secrets.NODE1 }},${{ secrets.NODE2 }},${{ secrets.NODE3 }}"
#sync: true
port: ${{ secrets.SSH_PORT }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY_ACTIONS }}
passphrase: ${{ secrets.SSH_KEY_ACTIONS_PASSPHRASE }}
script: |
echo && hostname
cd ${{ secrets.DEPLOY_SETUP_PATH }}
git rev-parse --short HEAD
v0.1.4 vs master version:
https://github.com/appleboy/ssh-action/compare/v0.1.4...master
I think no difference between v0.1.4 and master.
LOL that's so weird :-p
i found reason. because ssh_key is incorrect.
cat ~/.ssh/id_rsa
don't run at server. use cat ~/.ssh/known_hosts
You need to use the matching pub key.
In case it's helpful for anyone else, I dropped down to ssh as a quick hack to unblock myself (in addition to double-checking the authorized_keys on my DigitalOcean droplet):
- name: Deploy
run: |
TEMP=$(mktemp)
echo "${{ secrets.SSH_PRIVATE_KEY }}" > $TEMP
ssh -o 'StrictHostKeyChecking no' -i $TEMP [email protected] 'bash -s' < scripts/deploy.sh
That's a good hack :-p
I dropped down to ssh as a quick hack to unblock myself (in addition to double-checking the authorized_keys on my DigitalOcean droplet):