Convert Figma logo to code with AI

Place1 logowg-access-server

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

1,795
226
1,795
78

Top Related Projects

Mirror only. Official repository is at https://git.zx2c4.com/wireguard-go

28,868

Set up a personal VPN in the cloud

23,178

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.

A simple WireGuard VPN server GUI

24,052

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

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.

Quick Overview

WireGuard Access Server is a self-hosted VPN solution that provides a web UI for managing WireGuard peers. It offers features like automatic key rotation, access control, and integration with identity providers. The project aims to simplify the deployment and management of WireGuard VPN servers.

Pros

  • Easy-to-use web interface for managing WireGuard peers
  • Supports integration with identity providers (e.g., OIDC, SAML)
  • Automatic key rotation for enhanced security
  • Containerized deployment for easy setup and scalability

Cons

  • Requires self-hosting, which may be challenging for non-technical users
  • Limited documentation compared to some commercial VPN solutions
  • May require additional configuration for advanced networking scenarios
  • Relatively new project, which might have undiscovered issues or limitations

Getting Started

To get started with WireGuard Access Server, follow these steps:

  1. Install Docker on your server
  2. Create a docker-compose.yml file with the following content:
version: "3"
services:
  wg-access-server:
    image: place1/wg-access-server
    container_name: wg-access-server
    cap_add:
      - NET_ADMIN
    networks:
      - wg
    ports:
      - 8000:8000/tcp
      - 51820:51820/udp
    volumes:
      - ./config:/config
    restart: unless-stopped

networks:
  wg:
    driver: bridge
  1. Run the following command to start the server:
docker-compose up -d
  1. Access the web UI at http://your-server-ip:8000 and follow the setup wizard to configure your VPN server.

Competitor Comparisons

Mirror only. Official repository is at https://git.zx2c4.com/wireguard-go

Pros of wireguard-go

  • Pure Go implementation, offering better cross-platform compatibility
  • Directly maintained by the WireGuard project, ensuring up-to-date features and security
  • Lightweight and focused solely on WireGuard protocol implementation

Cons of wireguard-go

  • Lacks built-in user management and access control features
  • Requires additional setup and configuration for a complete VPN solution
  • No web interface for easy management and monitoring

Code Comparison

wg-access-server:

func (s *Server) Run(ctx context.Context) error {
    g, ctx := errgroup.WithContext(ctx)
    g.Go(func() error { return s.runAPIServer(ctx) })
    g.Go(func() error { return s.runWireGuard(ctx) })
    return g.Wait()
}

wireguard-go:

func (d *Device) Up() error {
    d.ipcMutex.Lock()
    defer d.ipcMutex.Unlock()
    d.isUp.Set(true)
    return d.BindUpdate()
}

The wg-access-server code shows a higher-level server implementation with API and WireGuard components, while wireguard-go focuses on low-level device operations. wg-access-server provides a more complete solution out of the box, whereas wireguard-go offers a foundation for building custom WireGuard-based applications.

28,868

Set up a personal VPN in the cloud

Pros of algo

  • More comprehensive security features, including IKEv2 and OpenVPN support
  • Automated server provisioning for multiple cloud providers
  • Extensive documentation and community support

Cons of algo

  • More complex setup process
  • Less user-friendly interface for non-technical users
  • Limited customization options compared to wg-access-server

Code comparison

algo:

- name: Install WireGuard
  apt:
    name:
      - wireguard
      - wireguard-tools
    state: present

wg-access-server:

func (s *Server) Start() error {
    if err := s.configureWireGuard(); err != nil {
        return fmt.Errorf("failed to configure wireguard: %w", err)
    }
    return s.startHTTPServer()
}

The algo code snippet shows the use of Ansible for package installation, while wg-access-server uses Go for server configuration and management. This reflects the different approaches of the two projects, with algo focusing on automated deployment and wg-access-server on a more customizable, programmatic approach.

23,178

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.

Pros of Streisand

  • Supports multiple VPN protocols (OpenVPN, WireGuard, OpenConnect, etc.)
  • Includes additional privacy-enhancing services (Tor, DNSCrypt, Shadowsocks)
  • Automated setup process for various cloud providers

Cons of Streisand

  • More complex setup and maintenance due to multiple services
  • Potentially overwhelming for users who only need basic VPN functionality
  • Less frequent updates and maintenance compared to wg-access-server

Code Comparison

wg-access-server:

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

Streisand:

- name: Set up WireGuard
  include_role:
    name: wireguard
  when: wireguard_enabled

The code snippets highlight the different approaches:

  • wg-access-server uses Go and focuses solely on WireGuard
  • Streisand uses Ansible playbooks to set up multiple services

Both projects aim to simplify VPN setup, but wg-access-server is more focused and user-friendly for WireGuard, while Streisand offers a broader range of privacy tools at the cost of increased complexity.

A simple WireGuard VPN server GUI

Pros of Subspace

  • More feature-rich with built-in DNS management and email notifications
  • Offers a user-friendly web UI for easier management
  • Supports multiple VPN protocols (WireGuard, OpenVPN, SOCKS5)

Cons of Subspace

  • More complex setup and configuration process
  • Requires more system resources due to additional features
  • Less focused on WireGuard specifically, which may impact performance

Code Comparison

wg-access-server:

func (s *Server) CreateDevice(ctx context.Context, req *proto.CreateDeviceRequest) (*proto.Device, error) {
    device := &Device{
        Name:      req.Name,
        PublicKey: req.PublicKey,
    }
    // ... (device creation logic)
}

Subspace:

func (s *Server) CreateDevice(ctx context.Context, req *api.CreateDeviceRequest) (*api.Device, error) {
    device := &Device{
        Name:     req.Name,
        Type:     req.Type,
        Enabled:  req.Enabled,
        IPAddress: req.IPAddress,
    }
    // ... (device creation logic with additional fields)
}

The code comparison shows that Subspace's device creation includes more fields and options, reflecting its broader feature set compared to wg-access-server's more focused approach on WireGuard.

24,052

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

Pros of headscale

  • Implements the full Tailscale control server protocol, offering better compatibility with Tailscale clients
  • Supports multi-user environments with namespaces, allowing for more granular access control
  • Provides a RESTful API for easier integration with other systems and automation

Cons of headscale

  • Lacks a built-in web UI, which may make management more challenging for some users
  • Has a steeper learning curve compared to wg-access-server due to its more complex feature set
  • May require additional setup and configuration for advanced features

Code Comparison

headscale:

func (h *Headscale) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    h.router.ServeHTTP(w, r)
}

wg-access-server:

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    s.router.ServeHTTP(w, r)
}

Both projects use similar HTTP server implementations, with headscale potentially offering more extensive routing options due to its broader feature set.

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.

Pros of Netmaker

  • Supports multiple network topologies (mesh, hub-and-spoke, etc.)
  • Offers advanced features like NAT traversal and automatic key rotation
  • Provides a user-friendly UI for network management

Cons of Netmaker

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

Code Comparison

Netmaker (Go):

func (server *Server) CreateNetwork(network *models.Network) error {
    network.SetDefaults()
    if err := server.DB.Create(network).Error; err != nil {
        return err
    }
    return nil
}

wg-access-server (TypeScript):

async function createNetwork(network: Network): Promise<void> {
  await db.networks.create(network);
  await generateWireguardConfig(network);
}

Both projects use different languages and approaches, but they share similar concepts for network creation and management. Netmaker's code appears more Go-idiomatic, while wg-access-server uses TypeScript with async/await syntax.

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-access-server

wg-access-server is a single binary that provides a WireGuard VPN server and device management web ui. We support user authentication, 1 click device registration that works with Mac, Linux, Windows, Ios and Android including QR codes. You can configure different network isolation modes for better control and more.

This project aims to deliver a simple VPN solution for developers, homelab enthusiasts and anyone else feeling adventurous.

wg-access-server is a functional but young project. Contributions are welcome!

Documentation

See our documentation website

Quick Links:

Running with Docker

Here's a quick command to run the server to try it out.

export WG_ADMIN_PASSWORD="example"
export WG_WIREGUARD_PRIVATE_KEY="$(wg genkey)"

docker run \
  -it \
  --rm \
  --cap-add NET_ADMIN \
  --device /dev/net/tun:/dev/net/tun \
  -v wg-access-server-data:/data \
  -e "WG_ADMIN_PASSWORD=$WG_ADMIN_PASSWORD" \
  -e "WG_WIREGUARD_PRIVATE_KEY=$WG_WIREGUARD_PRIVATE_KEY" \
  -p 8000:8000/tcp \
  -p 51820:51820/udp \
  place1/wg-access-server

If you open your browser using your LAN ip address you can even connect your phone to try it out: for example, i'll open my browser at http://192.168.0.XX:8000 using the local LAN IP address.

You can connect to the web server on the local machine browser at http://localhost:8000

Running on Kubernetes via Helm

wg-access-server ships a Helm chart to make it easy to get started on Kubernetes.

Here's a quick start, but you can read more at the Helm Chart Deployment Docs

# deploy
helm install my-release --repo https://place1.github.io/wg-access-server wg-access-server

# cleanup
helm delete my-release

Running with Docker-Compose

Download the the docker-compose.yml file from the repo and run the following command.

export WG_ADMIN_PASSWORD="example"
export WG_WIREGUARD_PRIVATE_KEY="$(wg genkey)"

docker-compose up

You can connect to the web server on the local machine browser at http://localhost:8000

If you open your browser to your machine's LAN IP address you'll be able to connect your phone using the UI and QR code!

Screenshots

Devices

Connect iOS

Connect MacOS

Sign In

Changelog

See the CHANGELOG.md file

Development

The software is made up a Golang Server and React App.

Here's how I develop locally:

  1. run cd website && npm install && npm start to get the frontend running on :3000
  2. run sudo go run ./main.go to get the server running on :8000

Here are some notes about the development configuration:

  • sudo is required because the server uses iptables/ip to configure the VPN networking
  • you'll access the website on :3000 and it'll proxy API requests to :8000 thanks to webpack
  • in-memory storage and generated wireguard keys will be used

GRPC codegeneration:

The client communicates with the server via gRPC-Web. You can edit the API specification in ./proto/*.proto.

After changing a service or message definition you'll want to re-generate server and client code using: ./codegen.sh.