From e593892ad423162af0a871d15d08bb85c07ac106 Mon Sep 17 00:00:00 2001 From: apogiatzis Date: Sun, 15 Nov 2020 19:24:29 +0000 Subject: [PATCH] feat: action skeleton --- .gitignore | 1 + README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ action.yml | 25 +++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 action.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..496ee2c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..61f89ce --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# Ngrok tunelling Github Action + +This is a Github Action that can be used in your Github Workflow to tunnel incoming/outgoing TCP traffic in your workflow environment. + +The original use case for this was to achieve temporary deployment for CTF challenges under development but it can be as well used in many more other cases. + +## How to use this Action + +This action accepts the following parameters + +| Name| Description | Required | Default | +| ------------- |-------------|-----|-----| +| timeout | After this timeout the deployment will automatically shutdown the tunelling and therefore stop the action. (max is 6 hours) | No | 1h | +| port | The port in localhost to forward traffic from/to | Yes | - | +| ngrok_authtoken | Your ngrok authtoken| Yes | - | + +Here is an example of using this action: + +``` +name: CI +on: push + +jobs: + + deploy: + name: Deploy challenge + runs-on: ubuntu-latest + needs: cancel + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Run container + run: docker-compose up -d + + - uses: ./ + with: + timeout: 1h + port: 4000 + ngrok_authtoken: ${{ secrets.NGROK_AUTHTOKEN }} +``` \ No newline at end of file diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..e748322 --- /dev/null +++ b/action.yml @@ -0,0 +1,25 @@ +name: 'Ngrok TCP Tunelling' +description: 'A github action for tunelling TCP traffic from within Workflow environemt' +inputs: + timeout: + description: 'Challenge deployment timeout' + required: true + default: '1h' + port: + description: 'The port to forward traffic to' + required: true + ngrok_authtoken: + description: 'Ngrok authorization token' + required: true + +runs: + using: "composite" + steps: + - run: wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip + shell: bash + - run: unzip -qq ngrok-stable-linux-amd64.zip + shell: bash + - run: ./ngrok authtoken ${{ inputs.ngrok_authtoken }} + shell: bash + - run: timeout ${{ inputs.timeout }} ./ngrok tcp ${{ inputs.port }} + shell: bash \ No newline at end of file