appleboy / ssh-action

GitHub Actions for executing remote ssh commands.
https://github.com/marketplace/actions/ssh-remote-commands
MIT License
4.48k stars 551 forks source link

Issue with "diffie-hellman-group-exchange-sha256" - "handshake failed: ssh: no common algorithm for key exchange;" #245

Open harnerdesigns opened 1 year ago

harnerdesigns commented 1 year ago

Hello,

I'm trying to use the ssh-action action to modify some things on my server. I can connect to the server fine through SSH on the command line so the key works. However, when I run the action with the same key, it outputs the error:

handshake failed: ssh: no common algorithm for key exchange; client offered: [curve25519-sha256 curve25519-sha256@libssh.org ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 diffie-hellman-group14-sha256 diffie-hellman-group14-sha1 ext-info-c], server offered: [diffie-hellman-group-exchange-sha256]

Per issue #56, I added the use_insecure_cipher: true option, but then that gives me the error:

2023/04/24 19:00:16 ssh.ParsePrivateKey: asn1: structure error: length too large
2023/04/24 19:00:16 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain

Which I'm assuming means I need to regenerate the SSH key, but it's throwing me off that the key works fine when just directly SSH-ing through the command line, but doesn't work here.

Config:

    steps:
    - name: Run Backup Script
      uses: appleboy/ssh-action@v0.1.10
      with:
        host: ${{ secrets.DEPLOY_HOST }}
        username: ${{ secrets.DEPLOY_USER }}
        key: ${{ secrets.DEPLOY_KEY }}
        port: ${{ secrets.DEPLOY_PORT }}
        script: |
          cd /var/www/***
          ./***

Any help or insight here would be greatly appreciated!

appleboy commented 1 year ago

@harnerdesigns What is your OS and sshd version?

harnerdesigns commented 1 year ago

@appleboy

OS: It's a BlueHost shared server (I know I know, EIG sucks, but it wasn't my choice to host them there) so the normal OS checking commands are giving me grief, I believe it's a modified version of CentOS 7

SSH: OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017