Wireguard web interface
Find a file
Matthew Nickson bc6f0f491f
Added MySQL as a datastore
The specific datastore backend to use can now be set by using
command line options or by using environment variables. The default
datastore backend is still jsondb but mysql can now also be used as a
backend. Environment variables have also been added to control settings
relevant to the database. SQL queries are made by directly accessing the
database/sql API. TLS is also supported.

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
2022-03-16 22:49:18 +00:00
.github chore: update stale.yml 2021-11-21 21:46:51 +01:00
custom/js Change info box render size on large screens (#155) 2022-02-12 19:52:50 +01:00
db Add empty db directory in vcs 2020-04-23 23:47:19 +07:00
emailer Remove From prefix from SMTP (#154) 2022-02-12 19:52:42 +01:00
handler Changed GetAllocatedIPs to use IStore 2022-03-13 23:21:00 +00:00
model Allow passing extra allowed subnets (#114) 2022-01-29 08:45:00 +01:00
router Abstracts database storage & Status page UI (#88) 2021-08-28 15:10:30 +02:00
store Added MySQL as a datastore 2022-03-16 22:49:18 +00:00
templates Added MySQL as a datastore 2022-03-16 22:49:18 +00:00
util Added MySQL as a datastore 2022-03-16 22:49:18 +00:00
.dockerignore Single binary build (#10) 2020-05-21 15:51:24 +07:00
.gitignore Single binary build (#10) 2020-05-21 15:51:24 +07:00
docker-compose.yaml Fixed typo (#113) 2021-11-09 11:01:42 +01:00
Dockerfile Update Dockerfile 2021-12-04 09:02:29 +01:00
go.mod Added MySQL as a datastore 2022-03-16 22:49:18 +00:00
go.sum Added MySQL as a datastore 2022-03-16 22:49:18 +00:00
Jenkinsfile Create Jenkinsfile 2021-12-05 14:02:07 +01:00
LICENSE Create LICENSE 2020-04-25 11:07:12 +07:00
main.go Added MySQL as a datastore 2022-03-16 22:49:18 +00:00
package.json Add docker build 2020-04-25 00:33:22 +07:00
prepare_assets.sh I've modify the place where I inserted code to minimize the number of files touched. (#131) 2021-12-04 09:03:56 +01:00
README.md SMTP support (#146) 2022-01-29 09:01:37 +01:00
yarn.lock Bump ssri from 8.0.0 to 8.0.1 (#51) 2021-03-26 20:02:02 +01:00

wireguard-ui

A web user interface to manage your WireGuard setup.

Features

  • Friendly UI
  • Authentication
  • Manage extra client's information (name, email, etc)
  • Retrieve configs using QR code / file

Run WireGuard-UI

Default username and password are admin.

Using docker compose

You can take a look at this example of docker-compose.yml. Please adjust volume mount points to work with your setup. Then run it like below:

docker-compose up

Note:

There is a Status option that needs docker to be able to access the network of the host in order to read the wireguard interface stats. See the cap_add and network_mode options on the docker-compose.yaml

Environment Variables

Set the SESSION_SECRET environment variable to a random value.

In order to sent the wireguard configuration to clients via email, set the following environment variables:

  • using SendGrid API
SENDGRID_API_KEY: Your sendgrid api key
EMAIL_FROM_ADDRESS: the email address you registered on sendgrid
EMAIL_FROM_NAME: the sender's email address
  • using SMTP
SMTP_HOSTNAME
SMTP_PORT
SMTP_USERNAME
SMTP_PASSWORD
SMTP_AUTH_TYPE
EMAIL_FROM_ADDRESS: the sender's email address
EMAIL_FROM_NAME: the sender's name

Using binary file

Download the binary file from the release and run it with command:

./wireguard-ui

Auto restart WireGuard daemon

WireGuard-UI only takes care of configuration generation. You can use systemd to watch for the changes and restart the service. Following is an example:

systemd

Create /etc/systemd/system/wgui.service

[Unit]
Description=Restart WireGuard
After=network.target

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

[Install]
RequiredBy=wgui.path

Create /etc/systemd/system/wgui.path

[Unit]
Description=Watch /etc/wireguard/wg0.conf for changes

[Path]
PathModified=/etc/wireguard/wg0.conf

[Install]
WantedBy=multi-user.target

Apply it

systemctl enable wgui.{path,service}
systemctl start wgui.{path,service}

openrc

Create and chmod +x /usr/local/bin/wgui

#!/bin/sh
wg-quick down wg0
wg-quick up wg0

Create and chmod +x /etc/init.d/wgui

#!/sbin/openrc-run

command=/sbin/inotifyd
command_args="/usr/local/bin/wgui /etc/wireguard/wg0.conf:w"
pidfile=/run/${RC_SVCNAME}.pid
command_background=yes

Apply it

rc-service wgui start
rc-update add wgui default

Build

Build docker image

Go to the project root directory and run the following command:

docker build -t wireguard-ui .

Build binary file

Prepare the assets directory

./prepare_assets.sh

Then you can embed resources by generating Go source code

rice embed-go
go build -o wireguard-ui

Or, append resources to executable as zip file

go build -o wireguard-ui
rice append --exec wireguard-ui

Screenshot

wireguard-ui

License

MIT. See LICENSE.

Support

If you like the project and want to support it, you can buy me a coffee

Buy Me A Coffee