{"id":13492318,"url":"https://github.com/vx3r/wg-gen-web","last_synced_at":"2025-10-07T11:26:00.227Z","repository":{"id":41414464,"uuid":"237155370","full_name":"vx3r/wg-gen-web","owner":"vx3r","description":"Simple Web based configuration generator for WireGuard","archived":false,"fork":false,"pushed_at":"2024-05-07T15:15:00.000Z","size":1367,"stargazers_count":1650,"open_issues_count":49,"forks_count":193,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-04-07T17:06:40.268Z","etag":null,"topics":["docker","go","vpn","vuejs","vuetify","web-ui","wireguard"],"latest_commit_sha":null,"homepage":"https://wg-gen-web-demo.127-0-0-1.fr","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vx3r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-WTFPL","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-30T06:46:31.000Z","updated_at":"2025-04-07T16:36:23.000Z","dependencies_parsed_at":"2024-06-20T09:30:25.819Z","dependency_job_id":"eda4dd0d-b433-4d8d-8b07-f81e8523ea7a","html_url":"https://github.com/vx3r/wg-gen-web","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vx3r%2Fwg-gen-web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vx3r%2Fwg-gen-web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vx3r%2Fwg-gen-web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vx3r%2Fwg-gen-web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vx3r","download_url":"https://codeload.github.com/vx3r/wg-gen-web/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254364270,"owners_count":22058878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","go","vpn","vuejs","vuetify","web-ui","wireguard"],"created_at":"2024-07-31T19:01:04.952Z","updated_at":"2025-10-07T11:25:55.164Z","avatar_url":"https://github.com/vx3r.png","language":"Go","funding_links":[],"categories":["Go","Repositories","vuejs","[💾 sysadmin-devops](https://github.com/stars/ketsapiwiq/lists/sysadmin-devops)","Projects"],"sub_categories":["User Interface"],"readme":"# Wg Gen Web\n\n\u003ch1 align=\"center\"\u003e\u003cimg height=\"420\" src=\"./wg-gen-web_cover.png\" alt=\"Simple Web based configuration generator for WireGuard\"\u003e\u003c/h1\u003e\n\nSimple Web based configuration generator for [WireGuard](https://wireguard.com).\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/vx3r/wg-gen-web)](https://goreportcard.com/report/github.com/vx3r/wg-gen-web)\n[![License: WTFPL](https://img.shields.io/badge/License-WTFPL-brightgreen.svg)](http://www.wtfpl.net/about/)\n![Discord](https://img.shields.io/discord/681699554189377567)\n![Build docker images via buildx](https://github.com/vx3r/wg-gen-web/actions/workflows/dockerimage.yml/badge.svg)\n![GitHub last commit](https://img.shields.io/github/last-commit/vx3r/wg-gen-web)\n![Docker Pulls](https://img.shields.io/docker/pulls/vx3r/wg-gen-web)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/vx3r/wg-gen-web)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/vx3r/wg-gen-web)\n\n## Why another one ?\n\nAll WireGuard UI implementations are trying to manage the service by applying configurations and creating network rules.\nThis implementation only generates configuration and its up to you to create network rules and apply configuration to WireGuard.\nFor example by monitoring generated directory with [inotifywait](https://github.com/inotify-tools/inotify-tools/wiki). \n\nThe goal is to run Wg Gen Web in a container and WireGuard on host system.\n\n## Features\n\n * Self-hosted and web based\n * Automatically select IP from the network pool assigned to client\n * QR-Code for convenient mobile client configuration\n * Sent email to client with QR-code and client config\n * Enable / Disable client\n * Generation of `wg0.conf` after any modification\n * IPv6 ready\n * User authentication (Oauth2 OIDC)\n * Dockerized\n * Pretty cool look\n\n![Screenshot](wg-gen-web_screenshot.png)\n\n## Running\n\n### Docker\n\nThe easiest way to run Wg Gen Web is using the container image\n```\ndocker run --rm -it -v /tmp/wireguard:/data -p 8080:8080 -e \"WG_CONF_DIR=/data\" vx3r/wg-gen-web:latest\n```\nDocker compose snippet, used for demo server, wg-json-api service is optional\n```\nversion: '3.6'\nservices:\n  wg-gen-web-demo:\n    image: vx3r/wg-gen-web:latest\n    container_name: wg-gen-web-demo\n    restart: unless-stopped\n    expose:\n      - \"8080/tcp\"\n    environment:\n      - WG_CONF_DIR=/data\n      - WG_INTERFACE_NAME=wg0.conf\n      - SMTP_HOST=smtp.gmail.com\n      - SMTP_PORT=587\n      - SMTP_USERNAME=no-reply@gmail.com\n      - SMTP_PASSWORD=******************\n      - SMTP_FROM=Wg Gen Web \u003cno-reply@gmail.com\u003e\n      - OAUTH2_PROVIDER_NAME=github\n      - OAUTH2_PROVIDER=https://github.com\n      - OAUTH2_CLIENT_ID=******************\n      - OAUTH2_CLIENT_SECRET=******************\n      - OAUTH2_REDIRECT_URL=https://wg-gen-web-demo.127-0-0-1.fr\n    volumes:\n      - /etc/wireguard:/data\n  wg-json-api:\n    image: james/wg-api:latest\n    container_name: wg-json-api\n    restart: unless-stopped\n    cap_add:\n      - NET_ADMIN\n    network_mode: \"host\"\n    command: wg-api --device wg0 --listen \u003cAPI_LISTEN_IP\u003e:8182\n```\nPlease note that mapping ```/etc/wireguard``` to ```/data``` inside the docker, will erase your host's current configuration.\nIf needed, please make sure to backup your files from ```/etc/wireguard```.\n\nA 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.\n\nTo get the value for **\u003cAPI_LISTEN_IP\u003e** take a look at the [WireGuard Status Display](#wireguard-status-display) section. If the status display should be disabled, remove the whole service from the docker-compose file or \nuse 127.0.0.1 as \u003cAPI_LISTEN_IP\u003e.\n\n### Directly without docker\n\nFill free to download latest artifacts from my GitLab server:\n* [Backend](https://github.com/vx3r/wg-gen-web/-/jobs/artifacts/master/download?job=build-back)\n* [Frontend](https://github.com/vx3r/wg-gen-web/-/jobs/artifacts/master/download?job=build-front)\n\nPut everything in one directory, create `.env` file with all configurations and run the backend.\n\n## Automatically apply changes to WireGuard\n\n### Using ```systemd```\nUsing `systemd.path` monitor for directory changes see [systemd doc](https://www.freedesktop.org/software/systemd/man/systemd.path.html)\n```\n# /etc/systemd/system/wg-gen-web.path\n[Unit]\nDescription=Watch /etc/wireguard for changes\n\n[Path]\nPathModified=/etc/wireguard\n\n[Install]\nWantedBy=multi-user.target\n```\nThis `.path` will activate unit file with the same name\n```\n# /etc/systemd/system/wg-gen-web.service\n[Unit]\nDescription=Reload WireGuard\nAfter=network.target\n\n[Service]\nType=oneshot\nExecStart=/usr/bin/systemctl reload wg-quick@wg0.service\n\n[Install]\nWantedBy=multi-user.target\n```\nWhich will reload WireGuard service \n\n### Using ```inotifywait```\nFor any other init system, create a daemon running this script\n```\n#!/bin/sh\nwhile inotifywait -e modify -e create /etc/wireguard; do\n  wg-quick down wg0\n  wg-quick up wg0\ndone\n```\n\n## How to use with existing WireGuard configuration\n\nAfter first run Wg Gen Web will create `server.json` in data directory with all server informations.\n\nFeel free to modify this file in order to use your existing keys\n\n## What is out of scope\n\n * Generation or application of any `iptables` or `nftables` rules\n * Application of configuration to WireGuard by Wg Gen Web itself\n\n## Authentication\n\nWg Gen Web can use Oauth2 OpenID Connect provider to authenticate users.\nCurrently there are 4 implementations:\n- `fake` not a real implementation, use this if you don't want to authenticate your clients.\n\nAdd the environment variable:\n\n```\nOAUTH2_PROVIDER_NAME=fake\n```\n\n- `github` in order to use GitHub as Oauth2 provider.\n\nAdd the environment variable:\n\n```\nOAUTH2_PROVIDER_NAME=github\nOAUTH2_PROVIDER=https://github.com\nOAUTH2_CLIENT_ID=********************\nOAUTH2_CLIENT_SECRET=********************\nOAUTH2_REDIRECT_URL=https://wg-gen-web-demo.127-0-0-1.fr\n```\n\n- `google` in order to use Google as Oauth2 provider. Not yet implemented\n```\nhelp wanted\n```\n\n- `oauth2oidc` in order to use RFC compliant Oauth2 OpenId Connect provider.\n\nAdd the environment variable:\n\n```\nOAUTH2_PROVIDER_NAME=oauth2oidc\nOAUTH2_PROVIDER=https://gitlab.com\nOAUTH2_CLIENT_ID=********************\nOAUTH2_CLIENT_SECRET=********************\nOAUTH2_REDIRECT_URL=https://wg-gen-web-demo.127-0-0-1.fr\n```\n\nWg Gen Web will only access your profile to get email address and your name, no other unnecessary scopes will be requested.\n\n## WireGuard Status Display\nWg Gen Web integrates a [WireGuard API implementation](https://github.com/jamescun/wg-api) to display client stats.\nIn order to enable the Status API integration, the following settings need to be configured:\n```\n# https://github.com/jamescun/wg-api integration\nWG_STATS_API=http://\u003cAPI_LISTEN_IP\u003e:8182\n\n# Optional: Token Auth\nWG_STATS_API_TOKEN=\n\n# Optional: Basic Auth\nWG_STATS_API_USER=\nWG_STATS_API_PASS=\n```\n\nTo setup the WireGuard API take a look at [https://github.com/jamescun/wg-api/blob/master/README.md](https://github.com/jamescun/wg-api/blob/master/README.md), or simply use the provided docker-compose file from above.\n\n### API_LISTEN_IP\nDue to the fact that the wg-api container operates on the host network, the wg-gen-web container cannot directly talk to the API. Thus the docker-host gateway IP of the wg-gen-web container has to be used. If the default bridge network (docker0) is used, this IP should be `172.17.0.1`. If a custom network is used, you can find the gateway IP by inspecting the output of:\n```\ndocker network inspect \u003cnetwork name\u003e\n```\nUse the IP address found for **Gateway** as the **API_LISTEN_IP**.\n\nPlease feel free to test and report any bugs.\n\n## Need Help\n\n * Join us on [Discord](https://discord.gg/fjx7gGJ)\n * Create an issue\n\n## Development\n\n### Backend\n\nFrom the top level directory run\n\n```\n$ go run main.go\n```\n\n### Frontend\n\nInside another terminal session navigate into the `ui` folder\n\n```\n$ cd ui\n```\nInstall required dependencies\n```\n$ npm install\n```\nSet the base url for the api\n```\n$ export VUE_APP_API_BASE_URL=http://localhost:8080/api/v1.0\n```\nStart the development server. It will rebuild and reload the site once you make a change to the source code.\n```\n$ npm run serve\n```\n\nNow you can access the site from a webbrowser with the url `http://localhost:8081`.\n\n## Application stack\n\n * [Gin, HTTP web framework written in Go](https://github.com/gin-gonic/gin)\n * [go-template, data-driven templates for generating textual output](https://golang.org/pkg/text/template/)\n * [Vue.js, progressive javaScript framework](https://github.com/vuejs/vue)\n * [Vuetify, material design component framework](https://github.com/vuetifyjs/vuetify)\n\n## License\n\n * Do What the Fuck You Want to Public License. [LICENSE-WTFPL](LICENSE-WTFPL) or http://www.wtfpl.net\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvx3r%2Fwg-gen-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvx3r%2Fwg-gen-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvx3r%2Fwg-gen-web/lists"}