All Projects → freifunkMUC → wgkex

freifunkMUC / wgkex

Licence: GPL-3.0 license
Project for easy key exchange between Wireguard Clients and Servers

Programming Languages

python
139335 projects - #7 most used programming language
Starlark
911 projects
shell
77523 projects
Dockerfile
14818 projects
HTML
75241 projects

Projects that are alternatives of or similar to wgkex

Wireguard Docs
📖 Unofficial WireGuard Documentation: Setup, Usage, Configuration, and full example setups for VPNs supporting both servers & roaming clients.
Stars: ✭ 3,201 (+13237.5%)
Mutual labels:  wireguard
Softethervpn
Cross-platform multi-protocol VPN software. Pull requests are welcome. The stable version is available at https://github.com/SoftEtherVPN/SoftEtherVPN_Stable.
Stars: ✭ 8,531 (+35445.83%)
Mutual labels:  wireguard
aws-wireguard-linux
WireGuard VPN implemented on Amazon Linux 2 with Load Balancing
Stars: ✭ 93 (+287.5%)
Mutual labels:  wireguard
Freepac
科学上网/翻墙梯子/自由上网/SS/SSR/V2Ray/Brook 搭建教程 免费机场、VPN工具
Stars: ✭ 4,515 (+18712.5%)
Mutual labels:  wireguard
Streisand
Streisand sets up a new server running your choice of WireGuard, OpenConnect, OpenSSH, OpenVPN, Shadowsocks, sslh, Stunnel, or a Tor bridge. It also generates custom instructions for all of these services. At the end of the run you are given an HTML file with instructions that can be shared with friends, family members, and fellow activists.
Stars: ✭ 22,605 (+94087.5%)
Mutual labels:  wireguard
Wireguard Install
WireGuard VPN installer for Linux servers
Stars: ✭ 2,575 (+10629.17%)
Mutual labels:  wireguard
warp
WARP one-click script. Add an IPv4, IPv6 or dual-stack CloudFlare WARP network interface and Socks5 proxy for VPS. 一键脚本
Stars: ✭ 950 (+3858.33%)
Mutual labels:  wireguard
vault-plugin-secrets-wireguard
Vault's plugin for managing server and dynamic client configurations
Stars: ✭ 41 (+70.83%)
Mutual labels:  wireguard
W3 Goto World
🍅 Git/AWS/Google 镜像 ,SS/SSR/VMESS节点,WireGuard,IPFS, DeepWeb,Capitalism 、行业研究报告的知识储备库
Stars: ✭ 7,886 (+32758.33%)
Mutual labels:  wireguard
raspbian10-buster
Raspbian 10 (Buster) Lite Setup: with Wireguard, Pi-hole, Unbound
Stars: ✭ 54 (+125%)
Mutual labels:  wireguard
Tailscale
The easiest, most secure way to use WireGuard and 2FA.
Stars: ✭ 6,157 (+25554.17%)
Mutual labels:  wireguard
Algo
Set up a personal VPN in the cloud
Stars: ✭ 24,275 (+101045.83%)
Mutual labels:  wireguard
Subspace
A simple WireGuard VPN server GUI
Stars: ✭ 2,109 (+8687.5%)
Mutual labels:  wireguard
Boringtun
Userspace WireGuard® Implementation in Rust
Stars: ✭ 3,760 (+15566.67%)
Mutual labels:  wireguard
wired-vpn
WireGuard behind OIDC
Stars: ✭ 21 (-12.5%)
Mutual labels:  wireguard
OPNsensePIAWireguard
This script automates the process of getting Wireguard setup on OPNsense to connect to PIA's NextGen Wireguard servers. It will create Wireguard Instance(Local) and Peer(Endpoint) on your OPNsense setup.
Stars: ✭ 59 (+145.83%)
Mutual labels:  wireguard
Mullvadvpn App
The Mullvad VPN client app for desktop and mobile
Stars: ✭ 1,953 (+8037.5%)
Mutual labels:  wireguard
ansible-roles
Here are some Ansible roles I have built for my own use.
Stars: ✭ 48 (+100%)
Mutual labels:  wireguard
wireguard-kmod
WireGuard for UDM series routers
Stars: ✭ 328 (+1266.67%)
Mutual labels:  wireguard
wireguard-setup
WireGuard and Unbound setup with Packer and Terraform.
Stars: ✭ 55 (+129.17%)
Mutual labels:  wireguard

Coverage Status pylint Lint Bazel tests

WireGuard Key Exchange

wgkex is a WireGuard key exchange and management tool designed and run by FFMUC.

Overview

WireGuard Key Exchange is a tool consisting of two parts: a frontend (broker) and a backend (worker). These components communicate to each other via MQTT - a messaging bus.

Frontend broker

The frontend broker is where the client can push (register) its key before connecting. These keys are then pushed into an MQTT bus for all workers to consume.

The frontend broker exposes the following API endpoints for use:

/api/v1/wg/key/exchange

The listen address and port for the Flask server can be configured in wgkex.yaml under the broker_listen key:

broker_listen:
  # host defaults to 127.0.0.1 if unspecified
  host: 0.0.0.0
  # port defaults to 5000 if unspecified
  port: 5000

POST /api/v1/wg/key/exchange

JSON POST'd to this endpoint should be in this format:

{
  "domain": "CONFIGURED_DOMAIN",
  "public_key": "PUBLIC_KEY"
}

The broker will validate the domain and public key, and if valid, will push the key onto the MQTT bus.

Backend worker

The backend (worker) waits for new keys to appear on the MQTT message bus. Once a new key appears, the worker performs validation task on the key, then injects those keys into a WireGuard instance(While also updating the VxLAN FDB). It reports metrics like number of connected peers and instance data like local address, WG listening port and external domain name (configured in config.yml) back to the broker. Each worker must run on a machine with a unique hostname, as it is used for separation of metrics.

This tool is intended to facilitate running BATMAN over VXLAN over WireGuard as a means to create encrypted high-performance mesh links.

For further information, please see this presentation on the architecture

Installation

  • TBA

Configuration

  • Configuration file

The wgkex configuration file defaults to /etc/wgkex.yaml (Sample configuration file), however can also be overwritten by setting the environment variable WGKEX_CONFIG_FILE.

Running the broker and worker

Build using Bazel

Worker:

# defaults to /etc/wgkex.yaml if not set
export WGKEX_CONFIG_FILE=/opt/wgkex/wgkex.yaml
bazel build //wgkex/worker:app
# Artifact will now be placed into ./bazel-bin/wgkex/worker/app
./bazel-bin/wgkex/worker/app

Broker:

# defaults to /etc/wgkex.yaml if not set
export WGKEX_CONFIG_FILE=/opt/wgkex/wgkex.yaml
bazel build //wgkex/broker:app
# Artifact will now be placed into ./bazel-bin/wgkex/broker/app
./bazel-bin/wgkex/broker/app

Run using Python

Broker: (Using Flask development server)

FLASK_ENV=development FLASK_DEBUG=1 FLASK_APP=wgkex/broker/app.py python3 -m flask run

Worker:

python3 -c 'from wgkex.worker.app import main; main()'

Client usage

The client can be used via CLI:

$ wget -q  -O- --post-data='{"domain": "ffmuc_welt","public_key": "o52Ge+Rpj4CUSitVag9mS7pSXUesNM0ESnvj/wwehkg="}'   --header='Content-Type:application/json'   'http://127.0.0.1:5000/api/v1/wg/key/exchange'
{
  "Message": "OK"
}

Or via python:

import requests
key_data = {"domain": "ffmuc_welt","public_key": "o52Ge+Rpj4CUSitVag9mS7pSXUesNM0ESnvj/wwehkg="}
broker_url = "http://127.0.0.1:5000"
push_key = requests.get(f'{broker_url}/api/v1/wg/key/exchange', json=key_data)
print(f'Key push was: {push_key.json().get("Message")]}')

Worker

You can set up dummy interfaces for the worker using this script:

interface_linklocal() {
  # We generate a predictable v6 address
  local macaddr="$(echo $1 | wg pubkey |md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')"
  local oldIFS="$IFS"; IFS=':'; set -- $macaddr; IFS="$oldIFS"
  echo "fe80::$1$2:$3ff:fe$4:$5$6"
}

sudo ip link add wg-welt type wireguard
wg genkey | sudo wg set wg-welt private-key /dev/stdin
sudo wg set wg-welt listen-port 51820
addr=$(interface_linklocal $(sudo wg show wg-welt private-key))
sudo ip addr add $addr dev wg-welt
sudo ip link add vx-welt type vxlan id 99 dstport 0 local $addr dev wg-welt
sudo ip addr add fe80::1/64 dev vx-welt
sudo ip link set wg-welt up
sudo ip link set vx-welt up

Contact

Freifunk Munich Mattermost

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].