Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pevers committed Nov 28, 2022
1 parent dfa2058 commit 8b75828
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 2 deletions.
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
# wireguard-action
Wireguard GitHub Action
# wg-action

WireGuard GitHub Action to access our internal registries from GitHub actions.

## Setup

This action requires you to define a set of input parameters.

```
name: access-cluster
on:
push:
branches:
- "main"
jobs:
test_access_cluster:
runs-on: ubuntu-latest
steps:
- name: Install WG
uses: promaton/wg-action@main
with:
interface_private_key: "${{ secrets.INTERFACE_PRIVATE_KEY }}"
interface_address: "${{ secrets.INTERFACE_ADDRESS }}"
peer_public_key: "${{ secrets.PEER_PUBLIC_KEY }}"
peer_allowed_ips: "${{ secrets.PEER_ALLOWED_IPS }}"
peer_endpoint: "${{ secrets.PEER_ENDPOINT }}"
# Optional
interface_dns: "${{ secrets.INTERFACE_DNS }}"
```
48 changes: 48 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: 'WireGuard'
description: 'Connect a WireGuard VPN client for a GitHub Actions runner'
branding:
icon: 'lock'
color: 'red'
inputs:
interface_private_key:
description: "The interface private key"
required: true
interface_address:
description: "The interface address"
required: true
interface_dns:
description: "The interface DNS"
required: false
peer_public_key:
description: "The peer public key"
required: true
peer_allowed_ips:
description: "The peer allowed IPs"
required: true
peer_endpoint:
description: "The peer endpoint"
required: true
runs:
using: "composite"
steps:
- name: Install wireguard
shell: bash
run: sudo apt-get install wireguard openresolv
- name: Create wireguard tunnel configuration
shell: bash
run: |
touch tunnel.conf
echo "[Interface]" >> tunnel.conf
echo "PrivateKey = ${{ inputs.interface_private_key }}" >> tunnel.conf
echo "Address = ${{ inputs.interface_address }}" >> tunnel.conf
if [ -n "${{ inputs.interface_dns }}" ]; then
echo "DNS = ${{ inputs.interface_dns }}" >> tunnel.conf
fi
echo -e "\n[Peer]" >> tunnel.conf
echo "PublicKey = ${{ inputs.peer_public_key }}" >> tunnel.conf
echo "AllowedIPs = ${{ inputs.peer_allowed_ips }}" >> tunnel.conf
echo "Endpoint = ${{ inputs.peer_endpoint }}" >> tunnel.conf
cat tunnel.conf
sudo cp tunnel.conf /etc/wireguard/
wg-quick up tunnel

0 comments on commit 8b75828

Please sign in to comment.