Code Monkey home page Code Monkey logo

ssh-agent-action's Introduction

ssh-agent

GitHub action to load a key into in memory using a temp disk (tmpfs).

It can be used as an attempt to keep the private ssh key from being written to disk.

Usage

โš ๏ธ Beware this action only works with passphrase-less key.

    - name: Load ssh key in agent
      id: agent
      uses: LeastAuthority/ssh-agent-action@v1
      with:
        private_key: ${{ secrets.SSH_KEY }}

Alternatively, assuming that the private_key is already available as a file in an existing tmpfs (e.g. using mount-tmpfs), the input can be the path to that file.

    - name: Load ssh key in agent
      id: agent
      uses: LeastAuthority/ssh-agent-action@v1
      with:
        private_key: /path/to/private_key

The action set a variable in the environment which can be used to find the socket to interact with the agent. By default, the name of the variable is SSH_AUTH_SOCK and the path to the socket is ${{ github.workspace }}/S.agent.ssh. Those can be changed respectively with the auth_sock_name and auth_sock_path inputs.

Without changing anything, most ssh client should now be able to use the key.

    - name: Test ssh connection
      run: |
        ssh -a -x -o StrictHostKeyChecking=no [email protected]  whoami

The ssh-agent can be re-used inside a docker container.

    - name: Test ssh connectivity inside docker
      run: |
        docker run \
        -e SSH_AUTH_SOCK=${SSH_AUTH_SOCK} \
        -v ${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK} \
        codingkoopa/openssh ssh -a -x -o StrictHostKeyChecking=no [email protected] whoami

ssh-agent-action's People

Contributors

btlogy avatar the-la-bot avatar

Watchers

Shae Erisson avatar James Cloos avatar Liz Pruszko Steininger avatar  avatar

ssh-agent-action's Issues

Use absolute path to sock by default

When using docker container, it is a bit easier when the path to the socket is absolute rather than relative the the workspace.

Changing the default value to prefix it with the workspace should not hurt.

Add a license file

Least Authority being a open-source oriented organization, the code hosted in the repository, even small, should be covered by an explicit LICENSE file to avoid falling into the "All right reserved" software by default.

From Least Authority website:

Open source tools are at the core of our products and services.

Import existing action

This action has already been implemented elsewhere, and this repository will make it re-usable w/o changing the existing interface.

Support use with private_key input being a path to an existing file

Description

If the private key has already been written in a file, forcing its extraction as a string to be set in a variable and copied over again in a tmpfs seems pointless.

Motivation

In some cases, the key is obtained using other actions/steps which already mitigate the risk of the key being written on disk.
Otherwise, if already on disk, it's too late to mitigate those risks by using a tmpfs anyway.

Acceptance criteria

Calling the action with a path to an existing private_key rather than a secret string should skip the tmpfs steps and directly load the key in the agent.

Additional information

This issue has been created in a specific case where the key is exchanged via the MagicWormhole and already made available in a tmpfs (private repo: LeastAuthority/mw-projects#104).

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.