Skip to content

subs1stem/wg-assistant

Repository files navigation

wg-assistant

Telegram bot for managing WireGuard VPN.

🎯 Features

  • Add new clients with automatic configuration and QR code generation.
  • Manage clients: delete, disable, enable.
  • View client status (endpoint, traffic, etc.).
  • Register an unlimited number of servers.

✅ Supported platforms

🛠 Installation

Before installation, create an account for your bot using BotFather. You can read more about BotFather here.

Also, you need to know your chat ID. You can find it out using special bots, for example, userinfobot.

🐋 Docker (recommended)

  • Preinstall: Install Docker.
  • Step 1: Clone the repository and go to the directory with it:
    git clone https://github.com/subs1stem/wg-assistant.git
    cd wg-assistant
  • Step 2: Copy and edit the .env file:
    cp .env.example .env
    nano .env
  • Step 3: Copy and edit the servers configuration file:
    cp servers.example.json servers.json
    nano servers.json

Important

If you don't want to use SSH connection to the Linux host at this stage, go here.

  • Step 4: Create an image of your bot:
    sudo docker build -t subs1stem/wg-assistant .
  • Step 5: Run a container with your image:
    sudo docker run --name wg-assistant --restart unless-stopped -d subs1stem/wg-assistant
    or with mounting the bot configuration files inside the container:
    sudo docker run --name wg-assistant --restart unless-stopped \
    -v ./servers.json:/app/servers.json \
    -v ./.env:/app/.env \
    -d subs1stem/wg-assistant

📦 Local deployment

If you want to deploy the bot on the same host as the WireGuard server and avoid using SSH, you can keep the simplest configuration without credentials:

{
  "MyServer": {
    "type": "Linux",
    "data": {
      "endpoint": "myserver.com"
    }
  }
}

or for AmneziaWG:

{
  "MyServer": {
    "type": "Linux",
    "protocol": "AmneziaWG",
    "data": {
      "interface_name": "awg0",
      "endpoint": "myserver.com",
      "path_to_config": "/etc/amnezia/amneziawg/awg0.conf"
    }
  }
}

After that, you need to build the image with the argument LOCAL_DEPLOYMENT_WG=true or LOCAL_DEPLOYMENT_AWG=true depending on the protocol you are using. This will install the necessary utilities inside the container.

For WireGuard:

sudo docker build --build-arg LOCAL_DEPLOYMENT_WG=true --build-arg -t subs1stem/wg-assistant .

For AmneziaWG:

sudo docker build --build-arg LOCAL_DEPLOYMENT_AWG=true --build-arg -t subs1stem/wg-assistant .

Or use both arguments if you have both VPNs on your server:

sudo docker build --build-arg LOCAL_DEPLOYMENT_WG=true --build-arg LOCAL_DEPLOYMENT_AWG=true -t subs1stem/wg-assistant .

Finally, run the container with the server configuration directories mounted.

For WireGuard:

sudo docker run --name wg-assistant \
  --restart unless-stopped \
  --cap-add NET_ADMIN \
  --network host \
  -v /etc/wireguard:/etc/wireguard \
  -d subs1stem/wg-assistant

For AmneziaWG:

sudo docker run --name wg-assistant \
  --restart unless-stopped \
  --cap-add NET_ADMIN \
  --network host \
  -v /etc/amnezia/amneziawg:/etc/amnezia/amneziawg \
  -d subs1stem/wg-assistant

For both:

sudo docker run --name wg-assistant \
  --restart unless-stopped \
  --cap-add NET_ADMIN \
  --network host \
  -v /etc/wireguard:/etc/wireguard \
  -v /etc/amnezia/amneziawg:/etc/amnezia/amneziawg \
  -d subs1stem/wg-assistant