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

Pass secrets to SSH command #28

Open
alexandrubau opened this issue Nov 21, 2021 · 1 comment
Open

Pass secrets to SSH command #28

alexandrubau opened this issue Nov 21, 2021 · 1 comment

Comments

@alexandrubau
Copy link

alexandrubau commented Nov 21, 2021

How can I pass secrets to the SSH command?
Running the following command doesn't output MY_SECRET as an environment variable.

Thanks

- name: Start container services
   uses: garygrossgarten/github-action-ssh@release
   env:
     MY_SECRET: ${{ secrets.MY_SECRET }}
   with:
     host: ${{ steps.tf_out.outputs.vm_ip }}
     username: terraform
     privateKey: ${{ secrets.TF_KEY }}
     command: |
       printenv
@manuel-hegner
Copy link

The action environment is not exported to the ssh host. There would be grave security concerns. You can pass them yourself with something like this, because ${{}} is evaluated before passing the string to the ssh action. But be careful, this could makes the secret a part of the ssh history or visible through ps.

- name: Start container services
   uses: garygrossgarten/github-action-ssh@release
   with:
     host: ${{ steps.tf_out.outputs.vm_ip }}
     username: terraform
     privateKey: ${{ secrets.TF_KEY }}
     command: |
       MY_SECRET: ${{ secrets.MY_SECRET }}
       printenv

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

No branches or pull requests

2 participants