Giter Site home page Giter Site logo

runner-open-ssh's Introduction

Connect with open-sshd

This GitHub Action opens an SSH connection to the github actions runner through an intermediary server. It is intended to debug jobs through SSH.

Pre-requisites

The gateway server has to be accessible from internet. The gateway ssh server configuration (usually in /etc/ssh/sshd_config) needs the following configuration

AllowTcpForwarding yes
GatewayPorts yes

How to use

First add the action to your workflow.

  - name: Debug through SSH
    uses: edipizarro/runner-open-ssh @main
    with:
      sshPublicKey: ${{ secrets.SSH_PUBLIC_KEY }}
      gatewayPrivateKey: ${{ secrets.GATEWAY_PRIVATE_KEY }}
      gatewayIP: ${{ secrets.GATEWAY_IP }}
      maxLifeTime: 30
  • sshPublicKey: Public SSH key that will be authorized in the github runner.
  • gatewayPrivateKey: Private SSH Key that can access the Gateway server. The action will use this key to SSH to the gateway server and open a proxy on port 2222, consequently, the gateway server will be able to SSH with the runner.
  • gatewayIP is the public IP of the gateway (used by the runner to ssh to the gateway)
  • maxLifeTime is the maximum life of the connection in seconds. default value is 3600 (1 hour). When the action SSH's to the gateway, it runs "sleep ${maxLifeTime}".

After the job is run, the runner creates a proxy on the gateway on port 2222. So, to connect to the runner, first ssh to the gateway server, and from there run "ssh -p 2222 runner@localhost".

The ssh proxy connection is run as a background process (using the ampersand &). And to keep the action alive a tmux terminal is attached.

If you want to close the connection before the maxLifeTime (to continue to the next action or just to finish the job), execute 'tmux kill-session'. This will kill the tmux session and then the action will finish. You can also just cancel the action.

runner-open-ssh's People

Contributors

edipizarro avatar

Watchers

 avatar

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.