Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use password and key at same time #178

Closed
aawnu opened this issue Aug 16, 2022 · 14 comments · Fixed by #226
Closed

Use password and key at same time #178

aawnu opened this issue Aug 16, 2022 · 14 comments · Fixed by #226

Comments

@aawnu
Copy link

aawnu commented Aug 16, 2022

My host requires the use of both password and ssh-key to connect, but this action does not allow it returning the following: 20***/08/16 19:04:14 can't set password and key at the same time

Its used as follows:

name: Migration

on:
  push:
    branches:
      - master

jobs:
  ssh-migration:
    needs: phpunit
    runs-on: ubuntu-latest
    steps:
      - uses: appleboy/ssh-action@v0.1.4
        with:
          host: ${{ secrets.HOST }}
          username: ${{ secrets.SSH_USER }}
          password: ${{ secrets.SSH_PASS }}
          port: ${{ secrets.SSH_PORT }}
          key: ${{ secrets.SSH_KEY }}
          script: |
            cd ${{ secrets.SSH_BASE_PATH }}/laravel
            php artisan migrate
@zploited
Copy link

zploited commented Sep 1, 2022

I have the exact same problem. Have been looking for different solutions, but never found one :(
Then i came across this project, and hoped it would work, but again with no luck.

Is it going to be supported?
It is really annoying that the host requires both, but not much i can do about it

@AlexWestergaard you use simply? ;)
Did you find a solution yet?

@aawnu
Copy link
Author

aawnu commented Sep 1, 2022

@zploited for simple hosting solutions I use Simply, yes, but mostly Digital Ocean.

I did not find a fix for this action; ended up making a cronjob that checks migrations and composer updates on the go instead.

@zploited
Copy link

zploited commented Sep 1, 2022

ok, I have found another action that could solve it for me:

  • for uploading with sftp: wangyucode/sftp-upload-action
  • for running ssh commands: garygrossgarten/github-action-ssh

both can use both password and private key, and I just deployed to simply with it

@aawnu
Copy link
Author

aawnu commented Sep 1, 2022

I don't find anything on arygrossgarten/github-action-ssh

Nevermind, spelling error, I found it garygrossgarten/github-action-ssh

@zploited
Copy link

zploited commented Sep 1, 2022

woops, yes, I missed the g when copying ;)
Good you found out

@castilloedwin
Copy link

What you need to do is to create a new ssh-key without password, I did it like this and it worked!

@aawnu
Copy link
Author

aawnu commented Oct 8, 2022

What you need to do is to create a new ssh-key without password, I did it like this and it worked!

That is not really an option when the host/provider requires both.

@castilloedwin
Copy link

You need to create an user that does this task (no password).

@aawnu
Copy link
Author

aawnu commented Feb 10, 2023

You need to create an user that does this task (no password).

I am not sure if you are failing to read key words like host and requires and that its not optional.

@castilloedwin
Copy link

Doesn't your host let you to create Linux users? for example I have two users, the first one is to manage the server and the second one for github actions and without set a password to get into, just ssh-key (with limited permissions).

@aawnu
Copy link
Author

aawnu commented Feb 21, 2023

Doesn't your host let you to create Linux users? for example I have two users, the first one is to manage the server and the second one for github actions and without set a password to get into, just ssh-key (with limited permissions).

Correct, the host is not a VPS and is a single-user predefined username+password. I can add key through dashboard for ssh - but it still requires both username and password on authentication.

Thus, I need it to support all 3 at once.

@castilloedwin
Copy link

Yeah, I got it, that's the problem because of appleboy cannot type the password (when the terminal prompt shows up) like a human. I had the same problem, for that reason I decided to create a no password new user.

@appleboy
Copy link
Owner

I will take a look.

@appleboy
Copy link
Owner

try v0.1.8 version

    - name: correct password but wrong key
      uses: appleboy/ssh-action@v0.1.8
      with:
        host: ${{ secrets.HOST }}
        username: ${{ secrets.USERNAME }}
        password: ${{ secrets.PASSWORD }}
        key: "1234"
        port: ${{ secrets.PORT }}
        script: whoami

    - name: wrong password but correct key
      uses: appleboy/ssh-action@v0.1.8
      with:
        host: ${{ secrets.HOST }}
        username: ${{ secrets.USERNAME }}
        password: "abcdef"
        key: ${{ secrets.KEY }}
        port: ${{ secrets.PORT }}
        script: whoami

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants