Skip to main content

A Django app for managing WireGuard Interfaces.

Project description

This is a Django app that provides management via Admin Site for WireGuard interfaces and peers.

Checkout the Documentation.

Installation

Install with pip: pip install django-wireguard

Quick start

  1. Add “django_wireguard” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'django_wireguard',
    ]
  2. Run python manage.py migrate to create the models.

  3. Visit http://localhost:8000/admin/ to manage the VPN. Note: you must enable the Django Admin Site first https://docs.djangoproject.com/en/3.1/ref/contrib/admin/.

Enabling the Wagtail Integration

  1. Add “django_wireguard.wagtail” to your INSTALLED_APPS setting after simple_vpn:

    INSTALLED_APPS = [
        ...
        'django_wireguard'
        'django_wireguard.wagtail',
    ]
  2. You can manage the VPN from the Wagtail Admin Panel Settings. Inspect a WireguardPeer object to view their configuration.

Configuration

The following settings can be provided:

  • WIREGUARD_ENDPOINT the endpoint for the peer configuration. Set it to the server Public IP address or domain. Default: localhost.

  • WIREGUARD_STORE_PRIVATE_KEYS set this to False to disable auto generation of peer private keys. Default: True.

  • WIREGUARD_WAGTAIL_SHOW_IN_SETTINGS set this to False to show WireGuard models in root sidebar instead of settings panel. Default: True.

Two signals are sent whenever a WireGuard interface is created or deleted to emulate WireGuard’s PostUp/PostDown configuration options. These signals are sent upon interface creation at the network level, not at database level.

Testing with Docker

  1. Build the test image by running:

    docker build -f Dockerfile.test -t django_wg_test .
  2. Run the tests

    • To run all tests, including Wireguard integration tests:
      1. Make sure the WireGuard kernel modules are installed and loaded on the host machine

      2. Run all tests with NET_ADMIN capability enabled:

        docker run --cap-add NET_ADMIN django_wg_test
    • To run unit tests without Wireguard support:

      docker run django_wg_test --exclude-tag net

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-wireguard-0.2.0.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

django_wireguard-0.2.0-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file django-wireguard-0.2.0.tar.gz.

File metadata

  • Download URL: django-wireguard-0.2.0.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.3

File hashes

Hashes for django-wireguard-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fd90189e1e29749043340f252eacc7f4a81ba62578d1727aa5ad47d11ad1a835
MD5 8248f925e085762254f593dc9b8679a9
BLAKE2b-256 4625c20945ec9972c3f655289d7b29547d1e1833bb8bba33e1f1737726bf6e8d

See more details on using hashes here.

File details

Details for the file django_wireguard-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: django_wireguard-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.3

File hashes

Hashes for django_wireguard-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4b7733a0876c3197c8a12ac6c325c2cb58feee0cbbd693e649bdcbd23dc967e
MD5 c779abd2138f806cef659bd0bdcdb55c
BLAKE2b-256 2f4c6ba8bfb9cfc9fde0d524b2ecf345f6cfe3dad15e6b8681b0e204ad18b4d8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page