Convert Figma logo to code with AI

EmbarkStudios logowg-ui

WireGuard Web UI for self-serve client configurations, with optional auth.

1,503
129
1,503
27

Top Related Projects

24,052

An open source, self-hosted implementation of the Tailscale control server

A simple WireGuard VPN server GUI

28,868

Set up a personal VPN in the cloud

Enterprise-ready zero-trust access platform built on WireGuard®.

An all-in-one WireGuard VPN solution with a web ui for connecting devices

26,843

CasaOS - A simple, easy-to-use, elegant open-source Personal Cloud system.

Quick Overview

WireGuard UI (wg-ui) is a web-based management interface for WireGuard VPN servers. It provides a user-friendly way to configure and manage WireGuard connections, users, and settings through a web browser, simplifying the process of setting up and maintaining a WireGuard VPN server.

Pros

  • Easy-to-use web interface for managing WireGuard configurations
  • Supports multiple users and devices with separate configurations
  • Integrates with OAuth providers for authentication
  • Provides real-time status monitoring of WireGuard connections

Cons

  • Requires additional setup compared to using WireGuard directly
  • May introduce potential security vulnerabilities if not properly configured
  • Limited customization options compared to manual configuration
  • Depends on external services for some features (e.g., OAuth providers)

Getting Started

To set up WireGuard UI, follow these steps:

  1. Install WireGuard on your server
  2. Download the latest release of wg-ui from the GitHub repository
  3. Configure the config.ini file with your desired settings
  4. Run the wg-ui binary:
./wg-ui
  1. Access the web interface at http://your-server-ip:8080
  2. Log in and start configuring your WireGuard VPN

Note: For production use, it's recommended to set up HTTPS and configure authentication methods as described in the project documentation.

Competitor Comparisons

24,052

An open source, self-hosted implementation of the Tailscale control server

Pros of headscale

  • More comprehensive Tailscale-compatible server implementation
  • Supports multiple users and namespaces
  • Offers OIDC integration for authentication

Cons of headscale

  • More complex setup and configuration
  • Requires additional infrastructure (e.g., database)
  • May have a steeper learning curve for new users

Code comparison

headscale (Go):

func (h *Headscale) CreatePreAuthKey(ctx context.Context, user *User, reusable bool, ephemeral bool, expiration *time.Time) (*PreAuthKey, error) {
    key := GenerateKey()
    preAuthKey := PreAuthKey{
        User:       user,
        Key:        key,
        Reusable:   reusable,
        Ephemeral:  ephemeral,
        Expiration: expiration,
    }
    // ... (additional logic)
}

wg-ui (JavaScript):

async function createClient(name) {
  const { publicKey, privateKey } = await generateKeyPair();
  const client = {
    name,
    publicKey,
    privateKey,
    allowedIPs: [],
  };
  clients.push(client);
  await saveConfig();
  return client;
}

The code snippets show different approaches: headscale implements a more complex pre-authentication system, while wg-ui focuses on simpler client creation and management.

A simple WireGuard VPN server GUI

Pros of Subspace

  • More comprehensive VPN solution with built-in DNS management and email notifications
  • Supports multiple VPN protocols (WireGuard, OpenVPN, IKEv2)
  • Includes a mobile app for easier management on-the-go

Cons of Subspace

  • More complex setup and configuration process
  • Requires more system resources due to additional features
  • Less focused on WireGuard specifically, which may not be ideal for users only interested in that protocol

Code Comparison

wg-ui:

func (s *Server) CreateUser(w http.ResponseWriter, r *http.Request) {
    var user User
    err := json.NewDecoder(r.Body).Decode(&user)
    if err != nil {
        http.Error(w, err.Error(), http.StatusBadRequest)
        return
    }
    // ... (user creation logic)
}

Subspace:

func (h *Handler) CreateUser(c echo.Context) error {
    u := new(models.User)
    if err := c.Bind(u); err != nil {
        return echo.NewHTTPError(http.StatusBadRequest, err.Error())
    }
    // ... (user creation logic)
    return c.JSON(http.StatusCreated, u)
}

Both projects use Go for backend implementation, but Subspace utilizes the Echo framework for handling HTTP requests, while wg-ui uses the standard net/http package.

28,868

Set up a personal VPN in the cloud

Pros of algo

  • More comprehensive VPN solution, including server setup and management
  • Supports multiple VPN protocols (WireGuard, IPsec/IKEv2)
  • Includes additional security features like DNS-based ad blocking

Cons of algo

  • More complex setup process
  • Requires more technical knowledge to configure and maintain
  • Less user-friendly interface for end-users

Code comparison

algo (setup script excerpt):

#!/usr/bin/env bash
set -e

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${SCRIPT_DIR}"

# Check for dependencies
if ! command -v python3 >/dev/null 2>&1; then
  echo "Python 3 is not installed. Please install it and try again."
  exit 1
fi

wg-ui (main.go excerpt):

func main() {
    flag.Parse()

    if *version {
        fmt.Printf("wg-ui version %s\n", Version)
        return
    }

    log.Printf("Starting wg-ui %s", Version)
}

The code comparison shows that algo uses a bash script for setup, while wg-ui is written in Go. This reflects the difference in complexity and approach between the two projects.

Enterprise-ready zero-trust access platform built on WireGuard®.

Pros of Firezone

  • More comprehensive VPN solution with built-in authentication and user management
  • Supports multiple VPN protocols (WireGuard, OpenVPN)
  • Actively maintained with regular updates and a growing community

Cons of Firezone

  • More complex setup and configuration compared to wg-ui
  • Requires more system resources due to its broader feature set
  • Steeper learning curve for administrators new to VPN management

Code Comparison

wg-ui (JavaScript):

const createConfig = async (req, res) => {
  const { name, email } = req.body;
  const config = await generateWireGuardConfig(name, email);
  res.json({ config });
};

Firezone (Elixir):

def create_device(attrs \\ %{}) do
  %Device{}
  |> Device.changeset(attrs)
  |> Repo.insert()
  |> case do
    {:ok, device} -> {:ok, device}
    {:error, changeset} -> {:error, changeset}
  end
end

While both projects aim to simplify WireGuard VPN management, Firezone offers a more feature-rich solution with multi-protocol support and built-in user management. However, this comes at the cost of increased complexity and resource requirements. wg-ui provides a simpler, more focused approach to WireGuard configuration, which may be preferable for smaller deployments or users seeking a lightweight solution.

An all-in-one WireGuard VPN solution with a web ui for connecting devices

Pros of wg-access-server

  • More active development with recent updates and contributions
  • Built-in OIDC support for authentication
  • Includes a CLI tool for easier management

Cons of wg-access-server

  • Less intuitive UI compared to wg-ui
  • Requires more configuration and setup
  • Limited documentation for advanced features

Code Comparison

wg-access-server:

func (s *Server) Start() error {
    s.wg.Add(2)
    go s.startHTTPServer()
    go s.startUDPServer()
    return nil
}

wg-ui:

async function startServer() {
    await initializeDatabase();
    app.listen(config.port, () => {
        console.log(`Server started on port ${config.port}`);
    });
}

The code snippets show different approaches to starting the server. wg-access-server uses goroutines for concurrent HTTP and UDP server initialization, while wg-ui follows a more straightforward asynchronous approach in JavaScript.

Both projects aim to provide a user-friendly interface for managing WireGuard VPN configurations, but they differ in implementation details and feature sets. wg-access-server offers more advanced features and authentication options, while wg-ui focuses on simplicity and ease of use. The choice between the two depends on specific requirements and user preferences.

26,843

CasaOS - A simple, easy-to-use, elegant open-source Personal Cloud system.

Pros of CasaOS

  • Comprehensive home server solution with a wide range of features
  • User-friendly interface for managing various services and applications
  • Active development and community support

Cons of CasaOS

  • More complex setup and configuration compared to wg-ui
  • Potentially higher resource usage due to its broader feature set
  • May include unnecessary features for users only interested in WireGuard management

Code Comparison

While a direct code comparison is not particularly relevant due to the different scopes of these projects, we can highlight some key differences in their implementation:

wg-ui (Go):

func (s *Server) CreateClient(ctx context.Context, client *Client) error {
    // WireGuard-specific client creation logic
}

CasaOS (Go):

func (s *System) InstallApp(ctx context.Context, app *App) error {
    // Broader application installation logic
}

CasaOS offers a more extensive API for managing various aspects of a home server, while wg-ui focuses specifically on WireGuard VPN management. The code structures reflect their respective scopes and purposes.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

WG UI

Build Status Embark Contributor Covenant

A basic, self-contained management service for WireGuard with a self-serve web UI.
Current stable release: v1.3.0

Features

  • Self-serve and web based
  • QR-Code for convenient mobile client configuration
  • Optional multi-user support behind an authenticating proxy
  • Simple authentication support
  • Zero external dependencies - just a single binary using the wireguard kernel module
  • Binary and container deployment

Screenshot

Running

The easiest way to run wg-ui is using the container image. To test it, run:

docker run --rm -it --privileged --entrypoint "/wireguard-ui" -v /tmp/wireguard-ui:/data -p 8080:8080 embarkstudios/wireguard-ui:latest --data-dir=/data --log-level=debug

When running in production, we recommend using the latest release as opposed to latest.

Important to know is that you need to have WireGuard installed on the machine in order for this to work, as this is 'just' a UI to manage WireGuard configs.

Configuration

You can configure wg-ui using commandline flags or environment variables. To see all available flags run:

docker run --rm -it embarkstudios/wireguard-ui:latest -h
./wireguard-ui -h

You can alternatively specify each flag through an environment variable of the form WIREGUARD_UI_<FLAG_NAME>, where <FLAG_NAME> is replaced with the flag name transformed to CONSTANT_CASE, e.g.

docker run --rm -it embarkstudios/wireguard-ui:latest --log-level=debug

and

docker run --rm -it -e WIREGUARD_UI_LOG_LEVEL=debug embarkstudios/wireguard-ui:latest

are the same.

Authentication

You can configure basic authentication using the flags/environment variables --auth-basic-user=<user> and --auth-basic-pass=<bcrypt hash> The password is a bcrypt hash that you can generate yourself using the docker container:

$ docker run -it embarkstudios/wireguard-ui:latest passwd mySecretPass
INFO[0001] Password Hash: $2a$14$D2jsPnpJixC0U0lyaGUd0OatV7QGzQ08yKV.gsmITVZgNevfZXj36

Docker images

There are two ways to run wg-ui today, you can run it with kernel module installed on your host which is the best way to do it if you want performance.

docker pull embarkstudios/wireguard-ui:latest

If you however do not have the possibility or interest in having kernel module loaded on your host, there is now a solution for that using a docker image based on wireguard-go. Keep in mind that this runs in userspace and not in kernel module.

docker pull embarkstudios/wireguard-ui:userspace

Both images are built for linux/amd64, linux/arm64 and linux/arm/v7. If you would need it for any other platform you can build wg-ui binaries with help from the documentation.

Install without Docker

You need to have WireGuard installed on the machine running wg-ui.

Unless you use the userspace version with docker you're required to have WireGuard installed on your host machine.

A few installation guides:
Ubuntu 20.04 LTS
CentOS 8
Debian 10

Go installation (Debian)

Install latest version of Go from (https://golang.org/dl/)

sudo tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz

Setup environment

Bash: ~/.bash_profile
ZSH: ~/.zshrc

export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
export GOPATH=$HOME/go

Install LTS version of nodejs for frontend.

sudo apt-get install curl software-properties-common
curl -sL https://deb.nodesource.com/setup_12.x | sudo bash -
sudo apt-get install nodejs

Fetch wg-ui

git clone https://github.com/EmbarkStudios/wg-ui.git && cd wg-ui

Build binary with ui

make build

Crosscompiling

make build-amd64
make build-armv5
make build-armv6
make build-armv7

Build step by step

make ui
make build

Developing

Start frontend server

npm install --prefix=ui
npm run --prefix=ui dev

Use frontend server when running the server

make build
sudo ./bin/wireguard-ui --log-level=debug --dev-ui-server http://localhost:5000

Contributing

We welcome community contributions to this project.

Please read our Contributor Guide for more information on how to get started.

License

Licensed under either of

at your option.