{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"documentation/overview/","title":"Overview","text":"
WireGuard Portal is a simple, web based configuration portal for WireGuard. The portal uses the WireGuard wgctrl library to manage existing VPN interfaces. This allows for seamless activation or deactivation of new users, without disturbing existing VPN connections.
The configuration portal supports using a database (SQLite, MySQL, MsSQL or Postgres), OAuth or LDAP (Active Directory or OpenLDAP) as a user source for authentication and profile data.
"},{"location":"documentation/overview/#features","title":"Features","text":"wgX.conf
) if requiredThe easiest way to get started is to use the provided Docker image.
"},{"location":"documentation/configuration/examples/","title":"Examples","text":"Below are some sample YAML configurations demonstrating how to override some default values.
"},{"location":"documentation/configuration/examples/#basic-configuration","title":"Basic Configuration","text":"core:\n admin_user: test@example.com\n admin_password: password\n import_existing: false\n create_default_peer: true\n self_provisioning_allowed: true\n\nweb:\n site_title: My WireGuard Server\n site_company_name: My Company\n listening_address: :8080\n external_url: https://my.externa-domain.com\n csrf_secret: super-s3cr3t-csrf\n session_secret: super-s3cr3t-session\n request_logging: true\n\nadvanced:\n log_level: trace\n log_pretty: true\n log_json: false\n config_storage_path: /etc/wireguard\n expiry_check_interval: 5m\n\ndatabase:\n debug: true\n type: sqlite\n dsn: data/sqlite.db\n
"},{"location":"documentation/configuration/examples/#ldap-authentication-and-synchronization-configuration","title":"LDAP Authentication and Synchronization Configuration","text":"# ... (basic configuration)\n\nauth:\n ldap:\n\n # a sample LDAP provider with user sync enabled\n - id: ldap\n provider_name: Active Directory\n display_name: Login with</br>AD\n url: ldap://srv-ad1.company.local:389\n bind_user: ldap_wireguard@company.local\n bind_pass: super-s3cr3t-ldap\n base_dn: DC=COMPANY,DC=LOCAL\n login_filter: (&(objectClass=organizationalPerson)(mail={{login_identifier}})(!userAccountControl:1.2.840.113556.1.4.803:=2))\n sync_interval: 15m\n sync_filter: (&(objectClass=organizationalPerson)(!userAccountControl:1.2.840.113556.1.4.803:=2)(mail=*))\n disable_missing: true\n field_map:\n user_identifier: sAMAccountName\n email: mail\n firstname: givenName\n lastname: sn\n phone: telephoneNumber\n department: department\n memberof: memberOf\n admin_group: CN=WireGuardAdmins,OU=Some-OU,DC=COMPANY,DC=LOCAL\n registration_enabled: true\n log_user_info: true\n
"},{"location":"documentation/configuration/examples/#openid-connect-oidc-authentication-configuration","title":"OpenID Connect (OIDC) Authentication Configuration","text":"# ... (basic configuration)\n\nauth:\n oidc:\n\n # a sample provider where users with the attribute `wg_admin` set to `true` are considered as admins \n - id: oidc-with-admin-attribute\n provider_name: google\n display_name: Login with</br>Google\n base_url: https://accounts.google.com\n client_id: the-client-id-1234.apps.googleusercontent.com\n client_secret: A_CLIENT_SECRET\n extra_scopes:\n - https://www.googleapis.com/auth/userinfo.email\n - https://www.googleapis.com/auth/userinfo.profile\n field_map:\n user_identifier: sub\n email: email\n firstname: given_name\n lastname: family_name\n phone: phone_number\n department: department\n is_admin: wg_admin\n admin_mapping:\n - admin_value_regex: ^true$\n registration_enabled: true\n log_user_info: true\n\n # a sample provider where users in the group `the-admin-group` are considered as admins \n - id: oidc-with-admin-group\n provider_name: google2\n display_name: Login with</br>Google2\n base_url: https://accounts.google.com\n client_id: another-client-id-1234.apps.googleusercontent.com\n client_secret: A_CLIENT_SECRET\n extra_scopes:\n - https://www.googleapis.com/auth/userinfo.email\n - https://www.googleapis.com/auth/userinfo.profile\n field_map:\n user_identifier: sub\n email: email\n firstname: given_name\n lastname: family_name\n phone: phone_number\n department: department\n user_groups: groups\n admin_mapping:\n - admin_group_regex: ^the-admin-group$\n registration_enabled: true\n log_user_info: true\n
"},{"location":"documentation/configuration/examples/#plain-oauth2-authentication-configuration","title":"Plain OAuth2 Authentication Configuration","text":"# ... (basic configuration)\n\nauth:\n oauth:\n\n # a sample provider where users with the attribute `this-attribute-must-be-true` set to `true` or `True`\n # are considered as admins \n - id: google_plain_oauth-with-admin-attribute\n provider_name: google3\n display_name: Login with</br>Google3\n client_id: another-client-id-1234.apps.googleusercontent.com\n client_secret: A_CLIENT_SECRET\n auth_url: https://accounts.google.com/o/oauth2/v2/auth\n token_url: https://oauth2.googleapis.com/token\n user_info_url: https://openidconnect.googleapis.com/v1/userinfo\n scopes:\n - openid\n - email\n - profile\n field_map:\n user_identifier: sub\n email: email\n firstname: name\n is_admin: this-attribute-must-be-true\n admin_mapping:\n - admin_value_regex: ^(True|true)$\n registration_enabled: true\n\n # a sample provider where either users with the attribute `this-attribute-must-be-true` set to `true` or \n # users in the group `admin-group-name` are considered as admins \n - id: google_plain_oauth_with_groups\n provider_name: google4\n display_name: Login with</br>Google4\n client_id: another-client-id-1234.apps.googleusercontent.com\n client_secret: A_CLIENT_SECRET\n auth_url: https://accounts.google.com/o/oauth2/v2/auth\n token_url: https://oauth2.googleapis.com/token\n user_info_url: https://openidconnect.googleapis.com/v1/userinfo\n scopes:\n - openid\n - email\n - profile\n - i-want-some-groups\n field_map:\n email: email\n firstname: name\n user_identifier: sub\n is_admin: this-attribute-must-be-true\n user_groups: groups\n admin_mapping:\n admin_value_regex: ^true$\n admin_group_regex: ^admin-group-name$\n registration_enabled: true\n log_user_info: true\n
"},{"location":"documentation/configuration/overview/","title":"WireGuard Portal Configuration","text":"This page provides an overview of all available configuration options for WireGuard Portal. You can supply these configurations in a YAML file (e.g. config.yaml
) when starting the Portal. Complete configuration examples are available in the Configuration Examples page.
Below you will find sections like core
, advanced
, statistics
, mail
, auth
, database
, and web
. Each section describes the individual configuration keys, their default values, and a brief explanation of their purpose.
These are the primary configuration options that control fundamental WireGuard Portal behavior. More advanced options are found in the subsequent Advanced
section.
admin_user
","text":"admin@wgportal.local
admin_password
","text":"wgportal
wgportal
should be changed immediately.editable_keys
","text":"true
create_default_peer
","text":"false
create_default_peer_on_creation
","text":"false
re_enable_peer_after_user_enable
","text":"true
delete_peer_after_user_deleted
","text":"false
self_provisioning_allowed
","text":"false
import_existing
","text":"true
restore_state
","text":"true
Additional or more specialized configuration options for logging and interface creation details.
"},{"location":"documentation/configuration/overview/#log_level","title":"log_level
","text":"info
trace
, debug
, info
, warn
, error
.log_pretty
","text":"false
true
, log messages are colorized and formatted for readability (pretty-print).log_json
","text":"false
true
, log messages are structured in JSON format.start_listen_port
","text":"51820
start_cidr_v4
","text":"10.11.12.0/24
start_cidr_v6
","text":"fdfd:d3ad:c0de:1234::0/64
use_ip_v6
","text":"true
config_storage_path
","text":"wg-quick
style configuration files will be stored (if you need local filesystem configs).expiry_check_interval
","text":"15m
s
, m
, h
, d
for seconds, minutes, hours, days, see time.ParseDuration.rule_prio_offset
","text":"20000
route_table_offset
","text":"20000
api_admin_only
","text":"true
true
, the public REST API is accessible only to admin users. The API docs live at /api/v1/doc.html
.Configuration for the underlying database used by WireGuard Portal. Supported databases include SQLite, MySQL, Microsoft SQL Server, and Postgres.
"},{"location":"documentation/configuration/overview/#debug","title":"debug
","text":"false
true
, logs all database statements (verbose).slow_query_threshold
","text":"100ms
) above which queries are considered slow and logged as warnings. If empty or zero, slow query logging is disabled. Format uses s
, ms
for seconds, milliseconds, see time.ParseDuration.type
","text":"sqlite
sqlite
, mssql
, mysql
, postgres
.dsn
","text":"data/sqlite.db
user:pass@tcp(1.2.3.4:3306)/dbname?charset=utf8mb4&parseTime=True&loc=Local\n
Controls how WireGuard Portal collects and reports usage statistics, including ping checks and Prometheus metrics.
"},{"location":"documentation/configuration/overview/#use_ping_checks","title":"use_ping_checks
","text":"true
ping_check_workers
","text":"10
ping_unprivileged
","text":"false
false
, ping checks run without root privileges. This is currently considered BETA.ping_check_interval
","text":"1m
s
, m
, h
, d
for seconds, minutes, hours, days, see time.ParseDuration.data_collection_interval
","text":"1m
s
, m
, h
, d
for seconds, minutes, hours, days, see time.ParseDuration.collect_interface_data
","text":"true
true
, collects interface-level data (bytes in/out) for monitoring and statistics.collect_peer_data
","text":"true
true
, collects peer-level data (bytes, last handshake, endpoint, etc.).collect_audit_data
","text":"true
true
, logs certain portal events (such as user logins) to the database.listening_address
","text":":8787
:8787
).Options for configuring email notifications or sending peer configurations via email.
"},{"location":"documentation/configuration/overview/#host","title":"host
","text":"127.0.0.1
port
","text":"25
encryption
","text":"none
none
, tls
, starttls
.cert_validation
","text":"false
true
, validate the SMTP server certificate (relevant if encryption
= tls
).username
","text":"password
","text":"auth_type
","text":"plain
plain
, login
, crammd5
.from
","text":"Wireguard Portal <noreply@wireguard.local>
link_only
","text":"false
true
, emails only contain a link to WireGuard Portal, rather than attaching the full configuration.WireGuard Portal supports multiple authentication strategies, including OpenID Connect (oidc
), OAuth (oauth
), and LDAP (ldap
). Each can have multiple providers configured. Below are the relevant keys.
The oidc
array contains a list of OpenID Connect providers. Below are the properties for each OIDC provider entry inside auth.oidc
:
provider_name
","text":"display_name
","text":"base_url
","text":"https://accounts.google.com
).client_id
","text":"client_secret
","text":"extra_scopes
","text":"profile
, email
).field_map
","text":"Available fields: user_identifier
, email
, firstname
, lastname
, phone
, department
, is_admin
, user_groups
.
user_identifier
sub
or preferred_username
A unique identifier for the user. Often the OIDC sub
claim is used because it\u2019s guaranteed to be unique for the user within the IdP. Some providers also support preferred_username
if it\u2019s unique. email
email
The user\u2019s email address as provided by the IdP. Not always verified, depending on IdP settings. firstname
given_name
The user\u2019s first name, typically provided by the IdP in the given_name
claim. lastname
family_name
The user\u2019s last (family) name, typically provided by the IdP in the family_name
claim. phone
phone_number
The user\u2019s phone number. This may require additional scopes/permissions from the IdP to access. department
Custom claim (e.g., department
) If the IdP can provide organizational data, it may store it in a custom claim. Adjust accordingly (e.g., department
, org
, or another attribute). is_admin
Custom claim or derived role If the IdP returns a role or admin flag, you can map that to is_admin
. Often this is managed through custom claims or group membership. user_groups
groups
or another custom claim A list of group memberships for the user. Some IdPs provide groups
out of the box; others require custom claims or directory lookups. admin_mapping
","text":"is_admin
claim against a regular expression. Alternatively, a regular expression can be used to check if a user is member of a specific group listed in the user_group
claim. The regular expressions are defined in admin_value_regex
and admin_group_regex
.admin_value_regex
: A regular expression to match the is_admin
claim. By default, this expression matches the string \"true\" (^true$
).admin_group_regex
: A regular expression to match the user_groups
claim. Each entry in the user_groups
claim is checked against this regex.registration_enabled
","text":"true
, a new user will be created in WireGuard Portal if not already present.log_user_info
","text":"true
, OIDC user data is logged at the trace level upon login (for debugging).The oauth
array contains a list of plain OAuth2 providers. Below are the properties for each OAuth provider entry inside auth.oauth
:
provider_name
","text":"display_name
","text":"client_id
","text":"client_secret
","text":"auth_url
","text":"token_url
","text":"user_info_url
","text":"scopes
","text":"field_map
","text":"Available fields: user_identifier
, email
, firstname
, lastname
, phone
, department
, is_admin
, user_groups
.
user_identifier
sub
or preferred_username
A unique identifier for the user. Often the OIDC sub
claim is used because it\u2019s guaranteed to be unique for the user within the IdP. Some providers also support preferred_username
if it\u2019s unique. email
email
The user\u2019s email address as provided by the IdP. Not always verified, depending on IdP settings. firstname
given_name
The user\u2019s first name, typically provided by the IdP in the given_name
claim. lastname
family_name
The user\u2019s last (family) name, typically provided by the IdP in the family_name
claim. phone
phone_number
The user\u2019s phone number. This may require additional scopes/permissions from the IdP to access. department
Custom claim (e.g., department
) If the IdP can provide organizational data, it may store it in a custom claim. Adjust accordingly (e.g., department
, org
, or another attribute). is_admin
Custom claim or derived role If the IdP returns a role or admin flag, you can map that to is_admin
. Often this is managed through custom claims or group membership. user_groups
groups
or another custom claim A list of group memberships for the user. Some IdPs provide groups
out of the box; others require custom claims or directory lookups. admin_mapping
","text":"is_admin
claim against a regular expression. Alternatively, a regular expression can be used to check if a user is member of a specific group listed in the user_group
claim. The regular expressions are defined in admin_value_regex
and admin_group_regex
.admin_value_regex
: A regular expression to match the is_admin
claim. By default, this expression matches the string \"true\" (^true$
).admin_group_regex
: A regular expression to match the user_groups
claim. Each entry in the user_groups
claim is checked against this regex.registration_enabled
","text":"true
, new users are created automatically on successful login.log_user_info
","text":"true
, logs user info at the trace level upon login.The ldap
array contains a list of LDAP authentication providers. Below are the properties for each LDAP provider entry inside auth.ldap
:
url
","text":"ldap://srv-ad01.company.local:389
).start_tls
","text":"true
, use STARTTLS to secure the LDAP connection.cert_validation
","text":"true
, validate the LDAP server\u2019s TLS certificate.tls_certificate_path
","text":"tls_key_path
","text":"base_dn
","text":"DC=COMPANY,DC=LOCAL
).bind_user
","text":"company\\\\ldap_wireguard
or ldap_wireguard@company.local
).bind_pass
","text":"field_map
","text":"Description: Maps LDAP attributes to WireGuard Portal fields.
user_identifier
, email
, firstname
, lastname
, phone
, department
, memberof
.login_filter
","text":"{{login_identifier}}
to insert the username. For example: (&(objectClass=organizationalPerson)(mail={{login_identifier}})(!userAccountControl:1.2.840.113556.1.4.803:=2))\n
admin_group
","text":"CN=WireGuardAdmins,OU=Some-OU,DC=YOURDOMAIN,DC=LOCAL\n
sync_interval
","text":"30m
) to synchronize users from LDAP. Empty or 0
disables sync. Format uses s
, m
, h
, d
for seconds, minutes, hours, days, see time.ParseDuration. Only users that match the sync_filter
are synchronized, if disable_missing
is true
, users not found in LDAP are disabled.sync_filter
","text":"(&(objectClass=organizationalPerson)(!userAccountControl:1.2.840.113556.1.4.803:=2)(mail=*))\n
disable_missing
","text":"true
, any user not found in LDAP (during sync) is disabled in WireGuard Portal.registration_enabled
","text":"true
, new user accounts are created in WireGuard Portal upon first login.log_user_info
","text":"true
, logs LDAP user data at the trace level upon login.To build a standalone application, use the Makefile provided in the repository. Go version 1.23 or higher has to be installed to build WireGuard Portal. If you want to re-compile the frontend, NodeJS 18 and NPM >= 9 is required.
# build the frontend (optional)\nmake frontend\n\n# build the binary\nmake build\n
"},{"location":"documentation/getting-started/docker/","title":"Docker Container","text":""},{"location":"documentation/getting-started/docker/#image-usage","title":"Image Usage","text":"The preferred way to start WireGuard Portal as Docker container is to use Docker Compose.
A sample docker-compose.yml:
version: '3.6'\nservices:\n wg-portal:\n image: wgportal/wg-portal:latest\n restart: unless-stopped\n cap_add:\n - NET_ADMIN\n network_mode: \"host\"\n ports:\n - \"8888:8888\"\n volumes:\n - /etc/wireguard:/etc/wireguard\n - ./data:/app/data\n - ./config:/app/config\n
By default, the webserver is listening on port 8888.
Volumes for /app/data
and /app/config
should be used ensure data persistence across container restarts.
All images are hosted on Docker Hub at https://hub.docker.com/r/wgportal/wg-portal. There are three types of tags in the repository:
"},{"location":"documentation/getting-started/docker/#semantic-versioned-tags","title":"Semantic versioned tags","text":"For example, 1.0.19
.
These are official releases of WireGuard Portal. They correspond to the GitHub tags that we make, and you can see the release notes for them here: https://github.com/h44z/wg-portal/releases.
Once these tags show up in this repository, they will never change.
For production deployments of WireGuard Portal, we strongly recommend using one of these tags, e.g. wgportal/wg-portal:1.0.19, instead of the latest or canary tags.
If you only want to stay at the same major or major+minor version, use either v[MAJOR]
or [MAJOR].[MINOR]
tags. For example v1
or 1.0
.
Version 1 is currently stable, version 2 is in development.
"},{"location":"documentation/getting-started/docker/#latest","title":"latest","text":"This is the most recent build to master! It changes a lot and is very unstable.
We recommend that you don't use it except for development purposes.
"},{"location":"documentation/getting-started/docker/#branch-tags","title":"Branch tags","text":"For each commit in the master and the stable branch, a corresponding Docker image is build. These images use the master
or stable
tags.
You can configure WireGuard Portal using a yaml configuration file. The filepath of the yaml configuration file defaults to /app/config/config.yml
. It is possible to override the configuration filepath using the environment variable WG_PORTAL_CONFIG.
By default, WireGuard Portal uses a SQLite database. The database is stored in /app/data/sqlite.db
.
You should mount those directories as a volume: - /app/data - /app/config
A detailed description of the configuration options can be found here.
"},{"location":"documentation/getting-started/upgrade/","title":"Upgrade from V1","text":"For production deployments of WireGuard Portal, we strongly recommend using version 1. If you want to use version 2, please be aware that it is still in beta and not feature complete.
"},{"location":"documentation/getting-started/upgrade/#upgrade-from-v1-to-v2","title":"Upgrade from v1 to v2","text":"Before upgrading from V1, make sure that you have a backup of your currently working configuration files and database!
To start the upgrade process, start the wg-portal binary with the -migrateFrom parameter. The configuration (config.yml) for WireGuard Portal must be updated and valid before starting the upgrade.
To upgrade from a previous SQLite database, start wg-portal like:
./wg-portal-amd64 -migrateFrom=old_wg_portal.db\n
You can also specify the database type using the parameter -migrateFromType, supported types: mysql, mssql, postgres or sqlite. For example:
./wg-portal-amd64 -migrateFromType=mysql -migrateFrom=user:pass@tcp(1.2.3.4:3306)/dbname?charset=utf8mb4&parseTime=True&loc=Local\n
The upgrade will transform the old, existing database and store the values in the new database specified in the config.yml configuration file. Ensure that the new database does not contain any data!
If you are using Docker, you can adapt the docker-compose.yml file to start the upgrade process:
services:\n wg-portal:\n image: wgportal/wg-portal:latest\n # ... other settings\n restart: no\n command: [\"-migrateFrom=/app/data/wg_portal.db\"]\n
"},{"location":"documentation/rest-api/api-doc/","title":"REST API","text":""}]}