No description
Find a file
Andrea Zucchelli 7daedf8f94
All checks were successful
Create and publish Worker container image / build-and-push-image (push) Successful in 1m5s
Create and publish Frontend container image / build-and-push-image (push) Successful in 3m31s
chore: session expires in 30 min
2025-02-13 21:06:02 +01:00
.forgejo/workflows fix(ci): 2 missing actions urls 2025-02-10 16:48:38 +01:00
static chore(css): better css, no dark mode only boomer mode 2025-02-10 16:33:55 +01:00
templates chore(css): better css, no dark mode only boomer mode 2025-02-10 16:33:55 +01:00
test first commit 2025-02-05 00:28:28 +01:00
wg_connection_manager fix: reserved ip check 2025-02-13 20:56:05 +01:00
wg_connection_manager_worker feat(worker): don't disconnect if timeout=0 2025-02-10 16:52:08 +01:00
wg_manager chore: session expires in 30 min 2025-02-13 21:06:02 +01:00
.env-dist first commit 2025-02-05 00:28:28 +01:00
.gitignore first commit 2025-02-05 00:28:28 +01:00
compose-example.yaml first commit 2025-02-05 00:28:28 +01:00
compose.yaml feat: better valkey socket permission in compose 2025-02-07 10:45:40 +01:00
Containerfile first commit 2025-02-05 00:28:28 +01:00
Containerfile-worker feat: disconnect inactive connections 2025-02-10 16:34:07 +01:00
LICENSE first commit 2025-02-05 00:28:28 +01:00
manage.py first commit 2025-02-05 00:28:28 +01:00
pyproject.toml first commit 2025-02-05 00:28:28 +01:00
README.md first commit 2025-02-05 00:28:28 +01:00
requirements-test.txt first commit 2025-02-05 00:28:28 +01:00
requirements-worker.txt first commit 2025-02-05 00:28:28 +01:00
requirements.txt first commit 2025-02-05 00:28:28 +01:00

WG-MANAGER

This simple Django web interface helps to manage wg connections in a client/server scenario. Users are allowed to create, enable and disable wg peers.

Warning
this program is alpha quality, not fully tested and can break your computer :D also it must run with root privileges :(

Quickstart container

The container version is made of 3 containers a valkey/redis container a celery worker backend and the django app as frontend.
The django apps invokes the worker via celery through valkey, the worker executes the privileged operations on the wireguard interfaces, the celery worker container ha NET_ADMIN capability and lives in the host network

there's a sample compose file compose.yaml.

first prepare the environment

in wg_manager dir create your own settings.py:

from .settings_dist import *
# your customization here

or simply make a symbolic link:

ln -s settings_dist.py settings.py

copy .env-dist and create your own .env set the variable WG_INTERFACE according to the name of the wg interface you want to manage

start the service

you can start the service running:

docker compose up

The you can connect to the web interface on http://127.0.0.1:4000 default superuser credentials are:

  • user: admin
  • password: admin

you can import existing wireguard peer by visiting the /sync url http://127.0.0.1:4000/sync

Remember that the db inside the container get destroyed every time the container get destroyed.
You can mount the db as a volume by adding the db as volume in the wg-manager service:

volumes:
    #...
    - ./db.sqlite3:/app/db.sqlite3
    #...

WARNING: the db.sqlite3 must exists in the host directory before starting the containers.

Quickstart standalone

create a python venv:

python -m venv venv

activate it

. venv/bin/activate

install the requirements

pip install -r requirements.txt

in wg_manager dir create your own settings.py:

from .settings_dist import *
# your customization here

or simply make a symbolic link:

ln -s settings_dist.py settings.py

copy .env-dist and create your own .env set the variable WG_INTERFACE according to the name of the wg interface you want to manage

set USE_CELERY=False in environemnt to use only the django app without the privileged worker

create the sqlite db:

./manage.py migrate

collect static assets:

./manage.py collectstatic

create the superuser:

./manage.py createsuperuser

if you already have connections you can import them in the db with:

./manage.py sync

you can test with the integrated dev server:

./manage.py runserver

and then deploy it using a proper web server like gunicorn:

gunicorn wg_manager.wsgi

with a proper tls enabled reverse proxy before it.