Giter Site home page Giter Site logo

ssh-socket-action's Introduction

SSH Socket Setup GitHub Action

Set up (or re-use) an SSH socket with a private key.

Usage

Inputs

Following inputs can be used as step.with keys

Name Required Type Description
host Yes String Remote hostname.
port No Number SSH Port (default: 22).
socket-path No String Path at which to create socket.
key Yes String base64 private key
lifetime No Number Seconds to keep key (default: 600)
purge-entry No Boolean Purge known_hosts entry for host (default: true)

You may encode your private key in base64 via:

openssl base64 -in {PRIVATE_KEY_FILE} -out {OUTPUT_PRIVATE_KEY_FILE}

Store that in GitHub Secrets to securely pass to the action.

Outputs

Name Description
socket-path Path at which socket was created
agent-pid SSH Agent PID.

Example usage

- name: SSH Socket Setup
  id: ssh-socket-action
  uses: sourcetoad/ssh-socket-action@v1
  with:
      host: github.com
      port: 22 # optional
      socket-path: /tmp/ssh_agent.sock # optional
      key: ${{ secrets.BASE64_SECRET_KEY }}

- name: Use SSH socket
  run: ls -l "${{ steps.ssh-socket-action.outputs.socket-path }}"

Development

Install package dependencies:

yarn install

Build dist/index.js:

ncc build index.js

Install as Local Action

For quicker troubleshooting cycles, the action can be copied directly into another project. This way, changes to the action and it's usage can happen simultaneously, in one commit.

  1. Copy this repository into your other project as .github/actions/ssh-socket-action. Be careful: simply cloning in place will likely install it as a submodule--make sure to copy the files without .git
  2. In your other project's workflow, in the action step, set
    uses: ./.github/actions/ssh-socket-action
  3. When making changes to the local action, make sure to rebuild dist and commit it

ssh-socket-action's People

Contributors

bankamah avatar chase-patterson avatar dependabot[bot] avatar ibotpeaches avatar jyann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

icodein

ssh-socket-action's Issues

Investigate failure with recent GH - 20211114.1

We have a project that does this prior to this action.

mkdir -p $HOME/.ssh
echo "${{ secrets.SECRET }}" > $HOME/.ssh/foo.key
chmod 600 $HOME/.ssh/foo.key
export GIT_SSH_COMMAND="ssh -i $HOME/.ssh/foo.key"
git submodule update --init --recursive

To pull a submodule with a specific deployment key for that repo. This ends up breaking downstream calling of this action we end up getting.

Host key verification failed.
fatal: Could not read from remote repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.