appleboy / scp-action

GitHub Action that copy files and artifacts via SSH.
https://github.com/marketplace/actions/scp-command-to-transfer-files
MIT License
1.14k stars 134 forks source link

SCP Proxy Not working - SSH Handshake Failed #30

Open IanBarnesZa opened 4 years ago

IanBarnesZa commented 4 years ago

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

oneEyedSunday commented 3 years ago

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
sampsyo commented 3 years ago

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

quynhlv commented 3 years ago

I got the same error but no luck for me.

Yanchenkov commented 3 years ago

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]".

bicrypt commented 3 years ago

Same issue here!

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

manuel-cid commented 3 years ago

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
appleboy commented 3 years ago

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

odyss009 commented 3 years ago

@appleboy is there any update?

mohammed8079 commented 3 years ago

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.

dreddko commented 2 years ago

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

zigang93 commented 2 years ago

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

ocervell commented 2 years ago

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

und3fined commented 2 years ago

same bug, @appleboy any update?

appleboy commented 2 years ago

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

und3fined commented 2 years ago

Yeah! It's worked!