Simple Web based configuration generator for WireGuard
Go to file
vx3r 8985021065 add version in back and front #16 / client can ignore global PK #17 / #18 email is now optional 2020-02-25 17:57:41 +09:00
.github/workflows add version in back and front #16 / client can ignore global PK #17 / #18 email is now optional 2020-02-25 17:57:41 +09:00
api add version in back and front #16 / client can ignore global PK #17 / #18 email is now optional 2020-02-25 17:45:44 +09:00
core refactor backend and frontend, migrate structs, organize front view, add mtu 2020-02-19 16:19:16 +09:00
model add version in back and front #16 / client can ignore global PK #17 / #18 email is now optional 2020-02-25 15:56:04 +09:00
storage organise backend code / frontend combobox / edit allowed ips 2020-02-05 10:53:53 +09:00
template add version in back and front #16 / client can ignore global PK #17 / #18 email is now optional 2020-02-25 15:56:04 +09:00
ui add version in back and front #16 / client can ignore global PK #17 / #18 email is now optional 2020-02-25 17:45:44 +09:00
util add version in back and front #16 / client can ignore global PK #17 / #18 email is now optional 2020-02-25 17:45:44 +09:00
.env logo, send email 2020-02-03 16:19:24 +09:00
.gitignore Initial commit 2020-01-30 15:45:49 +09:00
.gitlab-ci.yml add version in back and front #16 / client can ignore global PK #17 / #18 email is now optional 2020-02-25 17:45:44 +09:00
Dockerfile add version in back and front #16 / client can ignore global PK #17 / #18 email is now optional 2020-02-25 17:45:44 +09:00
LICENSE-WTFPL Initial commit 2020-01-30 15:45:49 +09:00
README.md discord channel, app stack and issue #15 2020-02-25 12:42:37 +09:00
go.mod DockerFile best practices 2020-02-06 15:07:15 +09:00
main.go add version in back and front #16 / client can ignore global PK #17 / #18 email is now optional 2020-02-25 17:45:44 +09:00
wg-gen-web_cover.png logo, send email 2020-02-03 16:19:24 +09:00
wg-gen-web_screenshot.png organise backend code / frontend combobox / edit allowed ips 2020-02-05 10:53:53 +09:00

README.md

Wg Gen Web

Simple Web based configuration generator for WireGuard

Simple Web based configuration generator for WireGuard.

pipeline status Go Report Card Gitlab pipeline status (self-hosted) License: WTFPL Discord Build multi-arch Docker Images via buildx GitHub last commit Docker Pulls GitHub go.mod Go version GitHub code size in bytes

Why another one ?

All WireGuard UI implementations are trying to manage the service by applying configurations and creating network rules. This implementation only generates configuration and its up to you to create network rules and apply configuration to WireGuard. For example by monitoring generated directory with inotifywait.

The goal is to run Wg Gen Web in a container and WireGuard on host system.

Features

  • Self-hosted and web based
  • Automatically select IP from the netowrk pool assigned to client
  • QR-Code for convenient mobile client configuration
  • Sent email to client with QR-code and client config
  • Enable / Disable client
  • Generation of wg0.conf after any modification
  • Dockerized
  • Pretty cool look

Screenshot

Running

Docker

The easiest way to run Wg Gen Web is using the container image

docker run --rm -it -v /tmp/wireguard:/data -p 8080:8080 -e "WG_CONF_DIR=/data" vx3r/wg-gen-web:latest

Docker compose snippet

version: '3.6'
services:
  wg-gen-web:
    image: vx3r/wg-gen-web:latest
    container_name: wg-gen-web
    restart: unless-stopped
    expose:
      - "8080/tcp"
    environment:
      - WG_CONF_DIR=/data
      - WG_INTERFACE_NAME=wg0.conf
      - SMTP_HOST=smtp.gmail.com
      - SMTP_PORT=587
      - SMTP_USERNAME=account@gmail.com
      - SMTP_PASSWORD="*************"
      - SMTP_FROM=Wg Gen Web <account@gmail.com>
    volumes:
      - /etc/wireguard:/data

Please note that mapping /etc/wireguard to /data inside the docker, will erase your host's current configuration. If needed, please make sure to backup your files from /etc/wireguard.

A workaround would be to change the WG_INTERFACE_NAME to something different, as it will create a new interface (wg-auto.conf for example), note that if you do so, you will have to adapt your daemon accordingly.

Directly without docker

Fill free to download latest artefacts from my GitLab server:

Put everything in one directory, create .env file with all configurations and run the backend.

Automatically apply changes to WireGuard

Using systemd

Using systemd.path monitor for directory changes see systemd doc

# /etc/systemd/system/wg-gen-web.path
[Unit]
Description=Watch /etc/wireguard for changes

[Path]
PathModified=/etc/wireguard

[Install]
WantedBy=multi-user.target

This .path will activate unit file with the same name

# /etc/systemd/system/wg-gen-web.service
[Unit]
Description=Restart WireGuard
After=network.target

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl restart wg-quick@wg0.service

[Install]
WantedBy=multi-user.target

Which will restart WireGuard service

Using inotifywait

For any other init system, create a daemon running this script

#!/bin/sh
while inotifywait -e modify -e create /etc/wireguard; do
  wg-quick down wg0
  wg-quick up wg0
done

How to use with existing WireGuard configuration

After first run Wg Gen Web will create server.json in data directory with all server informations.

Feel free to modify this file in order to use your existing keys

What is out of scope

  • Generation or application of any iptables or nftables rules
  • Application of configuration to WireGuard by Wg Gen Web itself

TODO

  • Multi-user support behind Authelia (suggestions / thoughts are welcome)
  • Send configs by email to client

Need Help

  • Join us on Discord
  • Create an issue

Application stack

License