scp-action icon indicating copy to clipboard operation
scp-action copied to clipboard

SCP Proxy Not working - SSH Handshake Failed

Open IanBarnesZa opened this issue 5 years ago • 15 comments

Hi,

I am getting the following error when attempting to SCP a file using a jump host (proxy):

error copy file to dest: ***, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain

More details from that output:

Run appleboy/scp-action@master
  with:
    host: ***
    username: ***
    key: ***
    port: ***
    proxy_host: ***
    proxy_username: ***
    proxy_key: ***
    proxy_port: ***
    source: deploy/deploy.zip
    target: ~/
    use_insecure_cipher: false
    proxy_use_insecure_cipher: false
    timeout: 30s
    command_timeout: 10m
    rm: false
    debug: false
    strip_components: 0
    overwrite: false
    proxy_timeout: 30s
  env:
    BUILD_NUMBER: 12

redacted

tar all files into /tmp/130780587/yLVqwr7IQG.tar
scp file to server.
2020/06/30 12:57:27 error copy file to dest: ***, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
drone-scp error:  error copy file to dest: ***, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain

My config:

   - name: Upload deploy to Webserver
      uses: appleboy/scp-action@master
      with:
        host: ${{ secrets.WEBSERVER_HOST }}
        username: ${{ secrets.WEBSERVER_USERNAME }}
        key: ${{ secrets.BASTION_KEY }}
        port: ${{ secrets.WEBSERVER_PORT }}
        proxy_host: ${{ secrets.BASTION_HOST }}
        proxy_username: ${{ secrets.BASTION_USERNAME }}
        proxy_key: ${{ secrets.BASTION_KEY }}
        proxy_port: ${{ secrets.BASTION_PORT }}
        source: "deploy/deploy.zip"
        target: "~/"

The really strange part is if I use ssh-action (https://github.com/appleboy/ssh-action) with the same config I can run commands just fine...

Here is that config:

- name: Connect to Webserver and deploy
      uses: appleboy/ssh-action@master
      with:
        host: ${{ secrets.WEBSERVER_HOST }}
        username: ${{ secrets.WEBSERVER_USERNAME }}
        key: ${{ secrets.BASTION_KEY }}
        port: ${{ secrets.WEBSERVER_PORT }}
        proxy_host: ${{ secrets.BASTION_HOST }}
        proxy_username: ${{ secrets.BASTION_USERNAME }}
        proxy_key: ${{ secrets.BASTION_KEY }}
        proxy_port: ${{ secrets.BASTION_PORT }}
        script: |
          ls -al

And output from that:

with:
    host: ***
    username: ***
    key: ***
    port: ***
    proxy_host: ***
    proxy_username: ***
    proxy_key: ***
    proxy_port: ***
    script: ls -al
  
    sync: false
    use_insecure_cipher: false
    timeout: 30s
    command_timeout: 10m
    proxy_timeout: 30s
    proxy_use_insecure_cipher: false
    script_stop: false
    debug: false

======CMD======
ls -al

======END======
out: total 40
out: drwxr-xr-x 5 *** *** 4096 Jun 16 08:39 .
out: drwxr-xr-x 3 root   root   4096 Jun 15 09:49 ..
out: -rw------- 1 *** ***  641 Jun 30 11:21 .bash_history
out: -rw-r--r-- 1 *** ***  ***0 Apr  4  2018 .bash_logout
out: -rw-r--r-- 1 *** *** 3771 Apr  4  2018 .bashrc
out: drwx------ 2 *** *** 4096 Jun 15 10:11 .cache
out: drwx------ 3 *** *** 4096 Jun 15 10:11 .gnupg
out: -rw------- 1 *** ***  400 Jun 16 08:57 .joe_state
out: -rw-r--r-- 1 *** ***  807 Apr  4  2018 .profile
out: drwx------ 2 *** *** 4096 Jun 15 09:49 .ssh
out: -rw-r--r-- 1 *** ***    0 Jun 15 10:11 .sudo_as_admin_successful
==============================================
✅ Successfully executed commands to all host.
==============================================

Any ideas?

Thanks Ian

IanBarnesZa avatar Jun 30 '20 13:06 IanBarnesZa

Hello @IanBarnesZa im also running into this issue at the moment.

drone-scp error:  error copy file to dest: ***, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain```

I'm specifying a key, so I'm surprised at this error message


--------------------------------------------------------------------------------------------------------------
Ninja edit.

Works now. Had to clean up my ssh settings

oneEyedSunday avatar Jul 17 '20 01:07 oneEyedSunday

I'm seeing the same thing, right down to the mysterious attempted methods [none]. Any chance you found a solution, @IanBarnesZa?

sampsyo avatar Jul 24 '20 22:07 sampsyo

I got the same error but no luck for me.

quynhlv avatar Jul 29 '20 12:07 quynhlv

I got the same issue.

The same config works in ssh-action, but scp-action failed with error "ssh: handshake failed: ssh: unable to authenticate, attempted methods [none]".

Yanchenkov avatar Jan 29 '21 04:01 Yanchenkov

Same issue here!

Also using ssh-action and wanting to use scp-action to copy files first, but no luck.

bicrypt avatar Mar 23 '21 22:03 bicrypt

I'm getting the same error

I'm using ssh-action with proxy and it works like a charm, but scp-action with the same configuration fails

error copy file to dest: ***, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain drone-scp error: error copy file to dest: ***, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain

My configuration:

  - name: copy file via ssh key
    uses: appleboy/scp-action@master
    with:
      host: ${{ secrets.TEST_SERVER_HOST }}
      username: ${{ secrets.TEST_SERVER_USERNAME }}
      password : ${{ secrets.TEST_SERVER_PASSWORD }}
      proxy_host: ${{ secrets.JUMP_SERVER_HOST }}
      proxy_username: ${{ secrets.JUMP_SERVER_USERNAME }}
      proxy_key: ${{ secrets.JUMP_SERVER_KEY }}
      proxy_passphrase: ${{ secrets.JUMP_SERVER_KEY_PASSPHRASE }}
      source: "docker-compose.yml,.env"
      target: ${{ env.DEPLOYMENT_PATH }}

  - name: Executing remote ssh commands using ssh key
    uses: appleboy/ssh-action@master
    with:
      host: ${{ secrets.TEST_SERVER_HOST }}
      username: ${{ secrets.TEST_SERVER_USERNAME }}
      password : ${{ secrets.TEST_SERVER_PASSWORD }}
      proxy_host: ${{ secrets.JUMP_SERVER_HOST }}
      proxy_username: ${{ secrets.JUMP_SERVER_USERNAME }}
      proxy_key: ${{ secrets.JUMP_SERVER_KEY }}
      proxy_passphrase: ${{ secrets.JUMP_SERVER_KEY_PASSPHRASE }}
      script: pwd

manuel-cid avatar Apr 22 '21 09:04 manuel-cid

@manuel-cid I will take it. I will find out what's different between scp-action and ssh-action.

appleboy avatar Apr 23 '21 00:04 appleboy

@appleboy is there any update?

odyss009 avatar May 25 '21 09:05 odyss009

I also had the same error. I was using cat ~/.ssh/key.pem to view the key on terminal. Then, i was copying the key and creating the secret. I was able see the output similar to

-----BEGIN RSA PRIVATE KEY-----
wvqgvreh rebrtykrb8k78kbbk5bn578bn5...
-----END RSA PRIVATE KEY-----%

The problem was with the % at the end. After removing the %, the error was gone.

mohammed8079 avatar Jun 17 '21 20:06 mohammed8079

Hello. For me, it's not working as well. However it works If I switch from scp-action to ssh-action and leave everything the same, except changing source,target to script

dreddko avatar Aug 06 '21 13:08 dreddko

encounter same issue.. I was able to do same config at ssh-action.. but no luck on scp-action..

my ssh key format is using the ed25519..

content :

-----BEGIN OPENSSH PRIVATE KEY-----
xxxx
-----END OPENSSH PRIVATE KEY-----

not sure is it not support for ed25519 but ssh-action does support ed25519?


UPDATE:

tried PEM format id_rsa.. still encounter same issue.. with error: error copy file to dest: ***, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain

zigang93 avatar Sep 22 '21 04:09 zigang93

@appleboy any updates here ? It's been quite a while since this doesn't work

ocervell avatar Sep 24 '21 13:09 ocervell

same bug, @appleboy any update?

und3fined avatar Oct 19 '21 13:10 und3fined

@und3fined @ocervell @zigang93 @dreddko I bump new version https://github.com/appleboy/scp-action/releases/tag/v0.1.2 please try it out.

appleboy avatar Oct 23 '21 10:10 appleboy

Yeah! It's worked!

und3fined avatar Oct 25 '21 03:10 und3fined