mirror of
https://github.com/WGDashboard/WGDashboard.git
synced 2026-12-01 17:07:47 +00:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36e9a88a7f | ||
|
|
8d21152947 | ||
|
|
0018a9b1e2 | ||
|
|
dded6a86df | ||
|
|
4ee6b462dc | ||
|
|
e27dd986bc | ||
|
|
e6448f2ffd | ||
|
|
e2b5a59291 |
+8
-3
@@ -1,9 +1,14 @@
|
|||||||
.git
|
.git
|
||||||
.github
|
.github
|
||||||
*.md
|
|
||||||
tests/
|
tests/
|
||||||
docs/
|
docs/
|
||||||
|
|
||||||
|
*.md
|
||||||
|
|
||||||
|
**/node_modules
|
||||||
|
**/venv
|
||||||
|
**/__pycache__
|
||||||
|
**/*.pyc
|
||||||
|
|
||||||
src/db
|
src/db
|
||||||
src/wg-dashboard.ini
|
src/wg-dashboard.ini
|
||||||
src/static/app
|
|
||||||
src/static/client
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ jobs:
|
|||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
with:
|
with:
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
@@ -74,7 +74,7 @@ jobs:
|
|||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|
||||||
docker_scan:
|
docker_scan:
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
|
|||||||
@@ -1,76 +0,0 @@
|
|||||||
FROM golang:1.24 AS awg-go
|
|
||||||
|
|
||||||
RUN git clone https://github.com/WGDashboard/amneziawg-go /awg
|
|
||||||
WORKDIR /awg
|
|
||||||
RUN go mod download && \
|
|
||||||
go mod verify && \
|
|
||||||
go build -ldflags '-linkmode external -extldflags "-fno-PIC -static"' -v -o /usr/bin
|
|
||||||
|
|
||||||
FROM alpine:latest AS awg-tools
|
|
||||||
|
|
||||||
RUN apk update && apk add --no-cache \
|
|
||||||
make git build-base linux-headers \
|
|
||||||
&& git clone https://github.com/WGDashboard/amneziawg-tools \
|
|
||||||
&& cd amneziawg-tools/src \
|
|
||||||
&& make \
|
|
||||||
&& chmod +x wg*
|
|
||||||
|
|
||||||
FROM alpine:latest
|
|
||||||
LABEL maintainer="[email protected]"
|
|
||||||
|
|
||||||
RUN apk update && apk add --no-cache \
|
|
||||||
iproute2 iptables bash curl wget unzip procps sudo \
|
|
||||||
tzdata wireguard-tools python3 py3-psutil py3-bcrypt openresolv
|
|
||||||
|
|
||||||
COPY --from=awg-go /usr/bin/amneziawg-go /usr/bin/amneziawg-go
|
|
||||||
COPY --from=awg-tools /amneziawg-tools/src/wg /usr/bin/awg
|
|
||||||
COPY --from=awg-tools /amneziawg-tools/src/wg-quick/linux.bash /usr/bin/awg-quick
|
|
||||||
|
|
||||||
# Declaring environment variables, change Peernet to an address you like, standard is a 24 bit subnet.
|
|
||||||
ARG wg_net="10.0.0.1" \
|
|
||||||
wg_port="51820"
|
|
||||||
|
|
||||||
# Following ENV variables are changable on container runtime because /entrypoint.sh handles that. See compose.yaml for more info.
|
|
||||||
ENV TZ="Europe/Amsterdam" \
|
|
||||||
global_dns="9.9.9.9" \
|
|
||||||
wgd_port="10086" \
|
|
||||||
public_ip=""
|
|
||||||
|
|
||||||
# Using WGDASH -- like wg_net functionally as a ARG command. But it is needed in entrypoint.sh so it needs to be exported as environment variable.
|
|
||||||
ENV WGDASH=/opt/wgdashboard
|
|
||||||
|
|
||||||
# Doing WireGuard Dashboard installation measures. Modify the git clone command to get the preferred version, with a specific branch for example.
|
|
||||||
RUN mkdir /data \
|
|
||||||
&& mkdir /configs \
|
|
||||||
&& mkdir -p ${WGDASH}/src \
|
|
||||||
&& mkdir -p /etc/amnezia/amneziawg
|
|
||||||
COPY ./src ${WGDASH}/src
|
|
||||||
|
|
||||||
# Generate basic WireGuard interface. Echoing the WireGuard interface config for readability, adjust if you want it for efficiency.
|
|
||||||
# Also setting the pipefail option, verbose: https://github.com/hadolint/hadolint/wiki/DL4006.
|
|
||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
||||||
RUN out_adapt=$(ip -o -4 route show to default | awk '{print $NF}') \
|
|
||||||
&& echo -e "[Interface]\n\
|
|
||||||
Address = ${wg_net}/24\n\
|
|
||||||
PrivateKey =\n\
|
|
||||||
PostUp = iptables -t nat -I POSTROUTING 1 -s ${wg_net}/24 -o ${out_adapt} -j MASQUERADE\n\
|
|
||||||
PostUp = iptables -I FORWARD -i wg0 -o wg0 -j DROP\n\
|
|
||||||
PreDown = iptables -t nat -D POSTROUTING -s ${wg_net}/24 -o ${out_adapt} -j MASQUERADE\n\
|
|
||||||
PreDown = iptables -D FORWARD -i wg0 -o wg0 -j DROP\n\
|
|
||||||
ListenPort = ${wg_port}\n\
|
|
||||||
SaveConfig = true\n\
|
|
||||||
DNS = ${global_dns}" > /configs/wg0.conf.template \
|
|
||||||
&& chmod 600 /configs/wg0.conf.template
|
|
||||||
|
|
||||||
# Defining a way for Docker to check the health of the container. In this case: checking the gunicorn process.
|
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
||||||
CMD sh -c 'pgrep gunicorn > /dev/null && pgrep tail > /dev/null' || exit 1
|
|
||||||
|
|
||||||
# Copy the basic entrypoint.sh script.
|
|
||||||
COPY ./docker/entrypoint.sh /entrypoint.sh
|
|
||||||
|
|
||||||
# Exposing the default WireGuard Dashboard port for web access.
|
|
||||||
EXPOSE 10086
|
|
||||||
WORKDIR $WGDASH
|
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
|
||||||
+42
-9
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# Pull the current golang-alpine image.
|
# Pull the current golang-alpine image.
|
||||||
FROM golang:1.26-alpine3.23 AS awg-go
|
FROM golang:1.27-alpine3.24 AS awg-go-builder
|
||||||
|
|
||||||
# Install build-dependencies.
|
# Install build-dependencies.
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
@@ -30,7 +30,7 @@ RUN go version && \
|
|||||||
# AWG TOOLS BUILDING STAGE
|
# AWG TOOLS BUILDING STAGE
|
||||||
# Base: Alpine
|
# Base: Alpine
|
||||||
#
|
#
|
||||||
FROM alpine:3.24 AS awg-tools
|
FROM alpine:3.24 AS awg-tools-builder
|
||||||
|
|
||||||
# Install needed dependencies.
|
# Install needed dependencies.
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
@@ -55,7 +55,7 @@ RUN make && chmod +x wg*
|
|||||||
#
|
#
|
||||||
|
|
||||||
# Use the python-alpine image for building pip dependencies
|
# Use the python-alpine image for building pip dependencies
|
||||||
FROM python:3.14-alpine3.23 AS pip-builder
|
FROM python:3.15-alpine3.24 AS pip-builder
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
@@ -85,13 +85,32 @@ RUN . /opt/wgdashboard/src/venv/bin/activate && \
|
|||||||
pip3 install --upgrade pip && \
|
pip3 install --upgrade pip && \
|
||||||
pip3 install -r /opt/wgdashboard/src/requirements.txt
|
pip3 install -r /opt/wgdashboard/src/requirements.txt
|
||||||
|
|
||||||
|
#
|
||||||
|
# WGDashboard FRONTEND BUILDING
|
||||||
|
# Base: Node Alpine
|
||||||
|
#
|
||||||
|
FROM node:26-alpine3.24 AS frontend-builder
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
|
||||||
|
# Copy frontend source, package files and lockfiles
|
||||||
|
COPY ./src/static/ ./
|
||||||
|
|
||||||
|
# Build the admin frontend
|
||||||
|
WORKDIR /workspace/app
|
||||||
|
RUN npm ci && npm run build
|
||||||
|
|
||||||
|
# Build the client frontend
|
||||||
|
WORKDIR /workspace/client
|
||||||
|
RUN npm ci && npm run build
|
||||||
|
|
||||||
#
|
#
|
||||||
# WGDashboard RUNNING STAGE
|
# WGDashboard RUNNING STAGE
|
||||||
# Base: Alpine
|
# Base: Alpine
|
||||||
#
|
#
|
||||||
|
|
||||||
# Running with the python-alpine image.
|
# Running with the python-alpine image.
|
||||||
FROM python:3.14-alpine3.23 AS final
|
FROM python:3.15-alpine3.24 AS final
|
||||||
LABEL maintainer="[email protected]"
|
LABEL maintainer="[email protected]"
|
||||||
|
|
||||||
# Install only the runtime dependencies
|
# Install only the runtime dependencies
|
||||||
@@ -102,9 +121,9 @@ RUN apk add --no-cache \
|
|||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
|
|
||||||
# Copy only the final binaries from the AWG builder stages
|
# Copy only the final binaries from the AWG builder stages
|
||||||
COPY --from=awg-go /usr/bin/amneziawg-go /usr/bin/amneziawg-go
|
COPY --from=awg-go-builder /usr/bin/amneziawg-go /usr/bin/amneziawg-go
|
||||||
COPY --from=awg-tools /workspace/awg-tools/src/wg /usr/bin/awg
|
COPY --from=awg-tools-builder /workspace/awg-tools/src/wg /usr/bin/awg
|
||||||
COPY --from=awg-tools /workspace/awg-tools/src/wg-quick/linux.bash /usr/bin/awg-quick
|
COPY --from=awg-tools-builder /workspace/awg-tools/src/wg-quick/linux.bash /usr/bin/awg-quick
|
||||||
|
|
||||||
# Environment variables
|
# Environment variables
|
||||||
ARG wg_net="10.0.0.1"
|
ARG wg_net="10.0.0.1"
|
||||||
@@ -121,11 +140,25 @@ ENV TZ="Europe/Amsterdam" \
|
|||||||
RUN mkdir /data /configs -p ${WGDASH}/src /etc/amnezia/amneziawg \
|
RUN mkdir /data /configs -p ${WGDASH}/src /etc/amnezia/amneziawg \
|
||||||
&& echo "name_servers=${global_dns}" >> /etc/resolvconf.conf
|
&& echo "name_servers=${global_dns}" >> /etc/resolvconf.conf
|
||||||
|
|
||||||
# Copy the venv and source files from local compiled locations or repos
|
# Copy application source
|
||||||
COPY ./src ${WGDASH}/src
|
COPY ./src ${WGDASH}/src
|
||||||
COPY --from=pip-builder /opt/wgdashboard/src/venv /opt/wgdashboard/src/venv
|
|
||||||
|
# Copy Python dependencies
|
||||||
|
COPY --from=pip-builder \
|
||||||
|
/opt/wgdashboard/src/venv \
|
||||||
|
${WGDASH}/src/venv
|
||||||
|
|
||||||
|
RUN rm -rf ${WGDASH}/src/static/dist \
|
||||||
|
${WGDASH}/src/static/app \
|
||||||
|
${WGDASH}/src/static/client
|
||||||
|
|
||||||
|
COPY --from=frontend-builder \
|
||||||
|
/workspace/dist/ \
|
||||||
|
${WGDASH}/src/static/dist/
|
||||||
|
|
||||||
COPY ./docker/wg0.conf.template /tmp/wg0.conf.template
|
COPY ./docker/wg0.conf.template /tmp/wg0.conf.template
|
||||||
COPY ./docker/wg-dashboard-oidc-providers.json.template /tmp/wg-dashboard-oidc-providers.json.template
|
COPY ./docker/wg-dashboard-oidc-providers.json.template /tmp/wg-dashboard-oidc-providers.json.template
|
||||||
|
|
||||||
# Copy in the runtime script, essential.
|
# Copy in the runtime script, essential.
|
||||||
COPY ./docker/entrypoint.sh /entrypoint.sh
|
COPY ./docker/entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
|||||||
@@ -121,6 +121,20 @@ Updating the WGDashboard container should be through 'The Docker Way' - by pulli
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 🧩 Custom Startup Scripts
|
||||||
|
|
||||||
|
Every file placed in `/data/custom-init.d/` is executed with `bash` at container startup, in alphabetical order, right before WGDashboard starts. A failing script is logged but does not stop the container.
|
||||||
|
|
||||||
|
This is useful for installing additional packages, for example `/data/custom-init.d/apk-add`:
|
||||||
|
```bash
|
||||||
|
apk update > /dev/null 2>&1
|
||||||
|
apk add --no-cache util-linux openssh-client > /dev/null 2>&1
|
||||||
|
```
|
||||||
|
|
||||||
|
> 📁 When using a Docker volume for `/data`, you can also bind-mount the directory directly, e.g. `./custom-init.d:/data/custom-init.d:ro`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 🔐 Port Forwarding Note
|
## 🔐 Port Forwarding Note
|
||||||
|
|
||||||
When using multiple WireGuard interfaces, remember to **open their respective ports** on the host.
|
When using multiple WireGuard interfaces, remember to **open their respective ports** on the host.
|
||||||
@@ -202,6 +216,7 @@ ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
|||||||
|
|
||||||
- **`ensure_installation`**: Sets up the app, database, and Python environment.
|
- **`ensure_installation`**: Sets up the app, database, and Python environment.
|
||||||
- **`set_envvars`**: Writes `wg-dashboard.ini` and applies environment variables.
|
- **`set_envvars`**: Writes `wg-dashboard.ini` and applies environment variables.
|
||||||
|
- **`run_custom_init`**: Runs user scripts from `/data/custom-init.d/`.
|
||||||
- **`start_core`**: Starts the main WGDashboard service.
|
- **`start_core`**: Starts the main WGDashboard service.
|
||||||
- **`ensure_blocking`**: Tails the error log to keep the container process alive.
|
- **`ensure_blocking`**: Tails the error log to keep the container process alive.
|
||||||
|
|
||||||
|
|||||||
@@ -258,6 +258,24 @@ set_envvars() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Run user-provided drop-in scripts, e.g. to install additional packages
|
||||||
|
run_custom_init() {
|
||||||
|
local init_dir="/data/custom-init.d"
|
||||||
|
|
||||||
|
[[ -d "$init_dir" ]] || return 0
|
||||||
|
|
||||||
|
printf "\n------------------ RUNNING CUSTOM SCRIPTS ------------------\n"
|
||||||
|
|
||||||
|
for script in "$init_dir"/*; do
|
||||||
|
[[ -f "$script" ]] || continue
|
||||||
|
|
||||||
|
echo "Running custom script: ${script}"
|
||||||
|
if ! bash "$script"; then
|
||||||
|
echo "Custom script ${script} exited with an error, continuing."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# Start service and monitor logs
|
# Start service and monitor logs
|
||||||
start_and_monitor() {
|
start_and_monitor() {
|
||||||
printf "\n---------------------- STARTING CORE -----------------------\n"
|
printf "\n---------------------- STARTING CORE -----------------------\n"
|
||||||
@@ -331,4 +349,5 @@ start_and_monitor() {
|
|||||||
# Main execution flow
|
# Main execution flow
|
||||||
ensure_installation
|
ensure_installation
|
||||||
set_envvars
|
set_envvars
|
||||||
|
run_custom_init
|
||||||
start_and_monitor
|
start_and_monitor
|
||||||
|
|||||||
+57
-33
@@ -9,8 +9,7 @@ from zipfile import ZipFile
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
from jinja2 import Template
|
from flask import Flask, request, render_template, session, send_file, current_app
|
||||||
from flask import Flask, request, render_template, session, send_file, current_app, redirect, url_for
|
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
from icmplib import ping, traceroute
|
from icmplib import ping, traceroute
|
||||||
from flask.json.provider import DefaultJSONProvider
|
from flask.json.provider import DefaultJSONProvider
|
||||||
@@ -20,7 +19,8 @@ from sqlalchemy import RowMapping
|
|||||||
|
|
||||||
from modules.Utilities import (
|
from modules.Utilities import (
|
||||||
RegexMatch, StringToBoolean, ValidateDNSAddress,
|
RegexMatch, StringToBoolean, ValidateDNSAddress,
|
||||||
GenerateWireguardPublicKey, GenerateWireguardPrivateKey
|
GenerateWireguardPublicKey, GenerateWireguardPrivateKey,
|
||||||
|
RenderSandboxedTemplate
|
||||||
)
|
)
|
||||||
from packaging import version
|
from packaging import version
|
||||||
from modules.Email import EmailSender
|
from modules.Email import EmailSender
|
||||||
@@ -945,8 +945,17 @@ def API_addPeers(configName):
|
|||||||
allowed_ips: list[str] = data.get('allowed_ips', [])
|
allowed_ips: list[str] = data.get('allowed_ips', [])
|
||||||
allowed_ips_validation: bool = data.get('allowed_ips_validation', True)
|
allowed_ips_validation: bool = data.get('allowed_ips_validation', True)
|
||||||
|
|
||||||
endpoint_allowed_ip: str = data.get('endpoint_allowed_ip', DashboardConfig.GetConfig("Peers", "peer_endpoint_allowed_ip")[1])
|
config = WireguardConfigurations.get(configName)
|
||||||
dns_addresses: str = data.get('DNS', DashboardConfig.GetConfig("Peers", "peer_global_DNS")[1])
|
overridePeerSettings = config.configurationInfo.OverridePeerSettings
|
||||||
|
|
||||||
|
endpoint_allowed_ip: str = data.get('endpoint_allowed_ip', (
|
||||||
|
overridePeerSettings.EndpointAllowedIPs
|
||||||
|
if overridePeerSettings.EndpointAllowedIPs else DashboardConfig.GetConfig("Peers", "peer_endpoint_allowed_ip")[1]
|
||||||
|
))
|
||||||
|
dns_addresses: str = data.get('DNS', (
|
||||||
|
overridePeerSettings.DNS
|
||||||
|
if overridePeerSettings.DNS else DashboardConfig.GetConfig("Peers", "peer_global_DNS")[1]
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
mtu: int = data.get('mtu', None)
|
mtu: int = data.get('mtu', None)
|
||||||
@@ -955,7 +964,10 @@ def API_addPeers(configName):
|
|||||||
preshared_key: str = data.get('preshared_key', "")
|
preshared_key: str = data.get('preshared_key', "")
|
||||||
|
|
||||||
if type(mtu) is not int or mtu < 0 or mtu > 1460:
|
if type(mtu) is not int or mtu < 0 or mtu > 1460:
|
||||||
default: str = DashboardConfig.GetConfig("Peers", "peer_mtu")[1]
|
default: str = (
|
||||||
|
str(overridePeerSettings.MTU)
|
||||||
|
if overridePeerSettings.MTU else DashboardConfig.GetConfig("Peers", "peer_mtu")[1]
|
||||||
|
)
|
||||||
if default.isnumeric():
|
if default.isnumeric():
|
||||||
try:
|
try:
|
||||||
mtu = int(default)
|
mtu = int(default)
|
||||||
@@ -964,7 +976,10 @@ def API_addPeers(configName):
|
|||||||
else:
|
else:
|
||||||
mtu = 0
|
mtu = 0
|
||||||
if type(keep_alive) is not int or keep_alive < 0:
|
if type(keep_alive) is not int or keep_alive < 0:
|
||||||
default = DashboardConfig.GetConfig("Peers", "peer_keep_alive")[1]
|
default = (
|
||||||
|
str(overridePeerSettings.PersistentKeepalive)
|
||||||
|
if overridePeerSettings.PersistentKeepalive else DashboardConfig.GetConfig("Peers", "peer_keep_alive")[1]
|
||||||
|
)
|
||||||
if default.isnumeric():
|
if default.isnumeric():
|
||||||
try:
|
try:
|
||||||
keep_alive = int(default)
|
keep_alive = int(default)
|
||||||
@@ -973,7 +988,6 @@ def API_addPeers(configName):
|
|||||||
else:
|
else:
|
||||||
keep_alive = 0
|
keep_alive = 0
|
||||||
|
|
||||||
config = WireguardConfigurations.get(configName)
|
|
||||||
if not config.getStatus():
|
if not config.getStatus():
|
||||||
config.toggleConfiguration()
|
config.toggleConfiguration()
|
||||||
ipStatus, availableIps = config.getAvailableIP(-1)
|
ipStatus, availableIps = config.getAvailableIP(-1)
|
||||||
@@ -1040,9 +1054,8 @@ def API_addPeers(configName):
|
|||||||
if ipStatus:
|
if ipStatus:
|
||||||
for subnet in availableIps.keys():
|
for subnet in availableIps.keys():
|
||||||
for ip in availableIps[subnet]:
|
for ip in availableIps[subnet]:
|
||||||
allowed_ips = [ip]
|
allowed_ips.append(ip)
|
||||||
break
|
break
|
||||||
break
|
|
||||||
else:
|
else:
|
||||||
return ResponseObject(False, "No more available IP can assign")
|
return ResponseObject(False, "No more available IP can assign")
|
||||||
|
|
||||||
@@ -1140,23 +1153,36 @@ def API_GetPeerHistoricalEndpoints():
|
|||||||
if not configurationName or not id:
|
if not configurationName or not id:
|
||||||
return ResponseObject(False, "Please provide configurationName and id")
|
return ResponseObject(False, "Please provide configurationName and id")
|
||||||
fp, p = WireguardConfigurations.get(configurationName).searchPeer(id)
|
fp, p = WireguardConfigurations.get(configurationName).searchPeer(id)
|
||||||
if fp:
|
if not fp:
|
||||||
result = p.getEndpoints()
|
return ResponseObject(False, "Peer does not exist")
|
||||||
geo = {}
|
endpoints = p.getEndpoints()
|
||||||
try:
|
ips = [x['endpoint'] for x in endpoints]
|
||||||
r = requests.post(f"http://ip-api.com/batch?fields=city,country,lat,lon,query",
|
unique_ips = list(set(ips))
|
||||||
data=json.dumps([x['endpoint'] for x in result]))
|
def chunks(lst, size=100):
|
||||||
d = r.json()
|
for i in range(0, len(lst), size):
|
||||||
|
yield lst[i:i + size]
|
||||||
|
geo_cache = {}
|
||||||
except Exception as e:
|
try:
|
||||||
return ResponseObject(data=result, message="Failed to request IP address geolocation. " + str(e))
|
for batch in chunks(unique_ips, 100):
|
||||||
|
r = requests.post(
|
||||||
return ResponseObject(data={
|
"http://ip-api.com/batch?fields=city,country,lat,lon,query",
|
||||||
"endpoints": p.getEndpoints(),
|
data=json.dumps(batch),
|
||||||
"geolocation": d
|
timeout=5
|
||||||
})
|
)
|
||||||
return ResponseObject(False, "Peer does not exist")
|
r.raise_for_status()
|
||||||
|
data = r.json()
|
||||||
|
for item in data:
|
||||||
|
geo_cache[item["query"]] = item
|
||||||
|
geolocation = [geo_cache[ip] for ip in ips]
|
||||||
|
except Exception as e:
|
||||||
|
return ResponseObject(
|
||||||
|
data={"endpoints": endpoints},
|
||||||
|
message="Failed to request IP address geolocation. " + str(e)
|
||||||
|
)
|
||||||
|
return ResponseObject(data={
|
||||||
|
"endpoints": endpoints,
|
||||||
|
"geolocation": geolocation
|
||||||
|
})
|
||||||
|
|
||||||
@app.get(f'{APP_PREFIX}/api/getPeerSessions')
|
@app.get(f'{APP_PREFIX}/api/getPeerSessions')
|
||||||
def API_GetPeerSessions():
|
def API_GetPeerSessions():
|
||||||
@@ -1597,10 +1623,9 @@ def API_Email_Send():
|
|||||||
if configuration is not None:
|
if configuration is not None:
|
||||||
fp, p = configuration.searchPeer(data.get('Peer'))
|
fp, p = configuration.searchPeer(data.get('Peer'))
|
||||||
if fp:
|
if fp:
|
||||||
template = Template(body)
|
|
||||||
download = p.downloadPeer()
|
download = p.downloadPeer()
|
||||||
body = template.render(peer=p.toJson(), configurationFile=download)
|
body = RenderSandboxedTemplate(body, peer=p.toJson(), configurationFile=download)
|
||||||
subject = Template(data.get('Subject', '')).render(peer=p.toJson(), configurationFile=download)
|
subject = RenderSandboxedTemplate(data.get('Subject', ''), peer=p.toJson(), configurationFile=download)
|
||||||
if data.get('IncludeAttachment', False):
|
if data.get('IncludeAttachment', False):
|
||||||
u = str(uuid4())
|
u = str(uuid4())
|
||||||
peerName = p.toJson().get('name', '').strip()
|
peerName = p.toJson().get('name', '').strip()
|
||||||
@@ -1629,11 +1654,10 @@ def API_Email_PreviewBody():
|
|||||||
return ResponseObject(False, "Peer does not exist")
|
return ResponseObject(False, "Peer does not exist")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
template = Template(body)
|
|
||||||
download = p.downloadPeer()
|
download = p.downloadPeer()
|
||||||
return ResponseObject(data={
|
return ResponseObject(data={
|
||||||
"Body": Template(body).render(peer=p.toJson(), configurationFile=download),
|
"Body": RenderSandboxedTemplate(body, peer=p.toJson(), configurationFile=download),
|
||||||
"Subject": Template(subject).render(peer=p.toJson(), configurationFile=download)
|
"Subject": RenderSandboxedTemplate(subject, peer=p.toJson(), configurationFile=download)
|
||||||
})
|
})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return ResponseObject(False, message=str(e))
|
return ResponseObject(False, message=str(e))
|
||||||
|
|||||||
@@ -37,6 +37,15 @@ class AmneziaConfiguration(WireguardConfiguration):
|
|||||||
self.I3 = ""
|
self.I3 = ""
|
||||||
self.I4 = ""
|
self.I4 = ""
|
||||||
self.I5 = ""
|
self.I5 = ""
|
||||||
|
self.HeaderProtectionKey = ""
|
||||||
|
self.ContentPaddingAddition = 0
|
||||||
|
self.RekeyAfterTime = 0
|
||||||
|
self.RekeyTimeout = 0
|
||||||
|
self.RejectAfterTime = 0
|
||||||
|
self.KeepaliveTimeout = 0
|
||||||
|
self.MaxHandshakeAttempts = 0
|
||||||
|
self.RandomTrailers = 0
|
||||||
|
self.DisableCookies = 0
|
||||||
self.J1 = ""
|
self.J1 = ""
|
||||||
self.J2 = ""
|
self.J2 = ""
|
||||||
self.J3 = ""
|
self.J3 = ""
|
||||||
@@ -84,6 +93,15 @@ class AmneziaConfiguration(WireguardConfiguration):
|
|||||||
"I3": self.I3,
|
"I3": self.I3,
|
||||||
"I4": self.I4,
|
"I4": self.I4,
|
||||||
"I5": self.I5,
|
"I5": self.I5,
|
||||||
|
"HeaderProtectionKey": self.HeaderProtectionKey,
|
||||||
|
"ContentPaddingAddition": self.ContentPaddingAddition,
|
||||||
|
"RekeyAfterTime": self.RekeyAfterTime,
|
||||||
|
"RekeyTimeout": self.RekeyTimeout,
|
||||||
|
"RejectAfterTime": self.RejectAfterTime,
|
||||||
|
"KeepaliveTimeout": self.KeepaliveTimeout,
|
||||||
|
"MaxHandshakeAttempts": self.MaxHandshakeAttempts,
|
||||||
|
"RandomTrailers": self.RandomTrailers,
|
||||||
|
"DisableCookies": self.DisableCookies,
|
||||||
"J1": self.J1,
|
"J1": self.J1,
|
||||||
"J2": self.J2,
|
"J2": self.J2,
|
||||||
"J3": self.J3,
|
"J3": self.J3,
|
||||||
@@ -152,7 +170,8 @@ class AmneziaConfiguration(WireguardConfiguration):
|
|||||||
f'{dbName}_history_endpoint', self.metadata,
|
f'{dbName}_history_endpoint', self.metadata,
|
||||||
sqlalchemy.Column('id', sqlalchemy.String(255), nullable=False),
|
sqlalchemy.Column('id', sqlalchemy.String(255), nullable=False),
|
||||||
sqlalchemy.Column('endpoint', sqlalchemy.String(255), nullable=False),
|
sqlalchemy.Column('endpoint', sqlalchemy.String(255), nullable=False),
|
||||||
sqlalchemy.Column('time', time_col_type)
|
sqlalchemy.Column('time', time_col_type),
|
||||||
|
extend_existing=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.infoTable = sqlalchemy.Table(
|
self.infoTable = sqlalchemy.Table(
|
||||||
|
|||||||
@@ -145,7 +145,9 @@ class DashboardConfig:
|
|||||||
|
|
||||||
for col_name, col_type in expected_columns.items():
|
for col_name, col_type in expected_columns.items():
|
||||||
if col_name not in existing_columns:
|
if col_name not in existing_columns:
|
||||||
type_str = col_type().compile(dialect=self.engine.dialect)
|
type_str = (
|
||||||
|
col_type if isinstance(col_type, db.types.TypeEngine) else col_type()
|
||||||
|
).compile(dialect=self.engine.dialect)
|
||||||
current_app.logger.info(f"Adding missing column '{col_name}' to table '{table_name}'")
|
current_app.logger.info(f"Adding missing column '{col_name}' to table '{table_name}'")
|
||||||
preparer = self.engine.dialect.identifier_preparer
|
preparer = self.engine.dialect.identifier_preparer
|
||||||
quoted_table = preparer.quote_identifier(table_name)
|
quoted_table = preparer.quote_identifier(table_name)
|
||||||
|
|||||||
+12
-3
@@ -7,12 +7,12 @@ import json
|
|||||||
import os, subprocess, uuid, random, re
|
import os, subprocess, uuid, random, re
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import jinja2
|
|
||||||
import sqlalchemy as db
|
import sqlalchemy as db
|
||||||
from .PeerJob import PeerJob
|
from .PeerJob import PeerJob
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
from .PeerShareLink import PeerShareLink
|
from .PeerShareLink import PeerShareLink
|
||||||
from .Utilities import GenerateWireguardPublicKey, CheckAddress, ValidateDNSAddress
|
from .Utilities import GenerateWireguardPublicKey, CheckAddress, ValidateDNSAddress, \
|
||||||
|
RenderSandboxedTemplate
|
||||||
|
|
||||||
|
|
||||||
class Peer:
|
class Peer:
|
||||||
@@ -207,6 +207,15 @@ class Peer:
|
|||||||
"I3": self.configuration.I3,
|
"I3": self.configuration.I3,
|
||||||
"I4": self.configuration.I4,
|
"I4": self.configuration.I4,
|
||||||
"I5": self.configuration.I5,
|
"I5": self.configuration.I5,
|
||||||
|
"HeaderProtectionKey": self.configuration.HeaderProtectionKey,
|
||||||
|
"ContentPaddingAddition": self.configuration.ContentPaddingAddition,
|
||||||
|
"RekeyAfterTime": self.configuration.RekeyAfterTime,
|
||||||
|
"RekeyTimeout": self.configuration.RekeyTimeout,
|
||||||
|
"RejectAfterTime": self.configuration.RejectAfterTime,
|
||||||
|
"KeepaliveTimeout": self.configuration.KeepaliveTimeout,
|
||||||
|
"MaxHandshakeAttempts": self.configuration.MaxHandshakeAttempts,
|
||||||
|
"RandomTrailers": self.configuration.RandomTrailers,
|
||||||
|
"DisableCookies": self.configuration.DisableCookies,
|
||||||
"J1": self.configuration.J1,
|
"J1": self.configuration.J1,
|
||||||
"J2": self.configuration.J2,
|
"J2": self.configuration.J2,
|
||||||
"J3": self.configuration.J3,
|
"J3": self.configuration.J3,
|
||||||
@@ -237,7 +246,7 @@ class Peer:
|
|||||||
if val is not None and ((type(val) is str and len(val) > 0) or (type(val) is int and val > 0)):
|
if val is not None and ((type(val) is str and len(val) > 0) or (type(val) is int and val > 0)):
|
||||||
final["file"] += f"{key} = {val}\n"
|
final["file"] += f"{key} = {val}\n"
|
||||||
|
|
||||||
final["file"] = jinja2.Template(final["file"]).render(configuration=self.configuration)
|
final["file"] = RenderSandboxedTemplate(final["file"], configuration=self.configuration)
|
||||||
|
|
||||||
|
|
||||||
if self.configuration.Protocol == "awg":
|
if self.configuration.Protocol == "awg":
|
||||||
|
|||||||
@@ -1,6 +1,21 @@
|
|||||||
import re, ipaddress
|
import re, ipaddress
|
||||||
import subprocess
|
import subprocess
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
|
from jinja2.sandbox import SandboxedEnvironment
|
||||||
|
|
||||||
|
sandboxEnvironment = SandboxedEnvironment()
|
||||||
|
|
||||||
|
def RenderSandboxedTemplate(source: str, **context) -> str:
|
||||||
|
"""
|
||||||
|
Render a Jinja2 template within a sandboxed environment. Template sources built with
|
||||||
|
user-provided content (e.g. email body, peer configuration file) must go through this
|
||||||
|
function, so unsafe attribute access (such as __globals__) is denied and template
|
||||||
|
injection cannot escalate into arbitrary code execution.
|
||||||
|
@param source: Template source string, may contain user-provided content
|
||||||
|
@param context: Variables passed into the template
|
||||||
|
@return: Rendered template
|
||||||
|
"""
|
||||||
|
return sandboxEnvironment.from_string(source).render(**context)
|
||||||
|
|
||||||
def RegexMatch(regex, text) -> bool:
|
def RegexMatch(regex, text) -> bool:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ WireGuard Configuration
|
|||||||
"""
|
"""
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import jinja2
|
|
||||||
import sqlalchemy, random, shutil, configparser, ipaddress, os, subprocess, time, re, uuid, psutil, traceback
|
import sqlalchemy, random, shutil, configparser, ipaddress, os, subprocess, time, re, uuid, psutil, traceback
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
@@ -21,7 +20,8 @@ from .Utilities import StringToBoolean, \
|
|||||||
ValidateDNSAddress, \
|
ValidateDNSAddress, \
|
||||||
ValidateEndpointAllowedIPs, \
|
ValidateEndpointAllowedIPs, \
|
||||||
CheckAddress, \
|
CheckAddress, \
|
||||||
CheckPeerKey
|
CheckPeerKey, \
|
||||||
|
RenderSandboxedTemplate
|
||||||
from .WireguardConfigurationInfo import WireguardConfigurationInfo, PeerGroupsClass
|
from .WireguardConfigurationInfo import WireguardConfigurationInfo, PeerGroupsClass
|
||||||
from .DashboardWebHooks import DashboardWebHooks
|
from .DashboardWebHooks import DashboardWebHooks
|
||||||
|
|
||||||
@@ -126,6 +126,15 @@ class WireguardConfiguration:
|
|||||||
"I3": self.I3,
|
"I3": self.I3,
|
||||||
"I4": self.I4,
|
"I4": self.I4,
|
||||||
"I5": self.I5,
|
"I5": self.I5,
|
||||||
|
"HeaderProtectionKey": self.HeaderProtectionKey,
|
||||||
|
"ContentPaddingAddition": self.ContentPaddingAddition,
|
||||||
|
"RekeyAfterTime": self.RekeyAfterTime,
|
||||||
|
"RekeyTimeout": self.RekeyTimeout,
|
||||||
|
"RejectAfterTime": self.RejectAfterTime,
|
||||||
|
"KeepaliveTimeout": self.KeepaliveTimeout,
|
||||||
|
"MaxHandshakeAttempts": self.MaxHandshakeAttempts,
|
||||||
|
"RandomTrailers": self.RandomTrailers,
|
||||||
|
"DisableCookies": self.DisableCookies,
|
||||||
"J1": self.J1,
|
"J1": self.J1,
|
||||||
"J2": self.J2,
|
"J2": self.J2,
|
||||||
"J3": self.J3,
|
"J3": self.J3,
|
||||||
@@ -240,7 +249,7 @@ class WireguardConfiguration:
|
|||||||
self.Status = self.getStatus()
|
self.Status = self.getStatus()
|
||||||
|
|
||||||
def __dropDatabase(self):
|
def __dropDatabase(self):
|
||||||
existingTables = [self.Name, f'{self.Name}_restrict_access', f'{self.Name}_transfer', f'{self.Name}_deleted']
|
existingTables = [self.Name, f'{self.Name}_restrict_access', f'{self.Name}_transfer', f'{self.Name}_deleted', f'{self.Name}_history_endpoint']
|
||||||
try:
|
try:
|
||||||
with self.engine.begin() as conn:
|
with self.engine.begin() as conn:
|
||||||
for name in existingTables:
|
for name in existingTables:
|
||||||
@@ -315,7 +324,8 @@ class WireguardConfiguration:
|
|||||||
f'{dbName}_history_endpoint', self.metadata,
|
f'{dbName}_history_endpoint', self.metadata,
|
||||||
sqlalchemy.Column('id', sqlalchemy.String(255), nullable=False),
|
sqlalchemy.Column('id', sqlalchemy.String(255), nullable=False),
|
||||||
sqlalchemy.Column('endpoint', sqlalchemy.String(255), nullable=False),
|
sqlalchemy.Column('endpoint', sqlalchemy.String(255), nullable=False),
|
||||||
sqlalchemy.Column('time', time_col_type)
|
sqlalchemy.Column('time', time_col_type),
|
||||||
|
extend_existing=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.infoTable = sqlalchemy.Table(
|
self.infoTable = sqlalchemy.Table(
|
||||||
@@ -949,8 +959,8 @@ class WireguardConfiguration:
|
|||||||
files.sort(key=lambda x: x[1], reverse=True)
|
files.sort(key=lambda x: x[1], reverse=True)
|
||||||
|
|
||||||
for f, ct in files:
|
for f, ct in files:
|
||||||
if RegexMatch(rf"^({self.Name})_(\d+)\\.(conf)$", f):
|
if RegexMatch(rf"^({self.Name})_(\d+)\.(conf)$", f):
|
||||||
s = re.search(rf"^({self.Name})_(\d+)\\.(conf)$", f)
|
s = re.search(rf"^({self.Name})_(\d+)\.(conf)$", f)
|
||||||
date = s.group(2)
|
date = s.group(2)
|
||||||
d = {
|
d = {
|
||||||
"filename": f,
|
"filename": f,
|
||||||
@@ -991,7 +1001,11 @@ class WireguardConfiguration:
|
|||||||
if backupFileName not in backups:
|
if backupFileName not in backups:
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
os.remove(os.path.join(self.__getProtocolPath(), 'WGDashboard_Backup', backupFileName))
|
backupPath = os.path.join(self.__getProtocolPath(), 'WGDashboard_Backup')
|
||||||
|
for ext in ('.conf', '.sql'):
|
||||||
|
f = os.path.join(backupPath, os.path.splitext(backupFileName)[0] + ext)
|
||||||
|
if os.path.exists(f):
|
||||||
|
os.remove(f)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@@ -1024,7 +1038,7 @@ class WireguardConfiguration:
|
|||||||
allowEdit = ["Address", "PreUp", "PostUp", "PreDown", "PostDown", "ListenPort", "Table"]
|
allowEdit = ["Address", "PreUp", "PostUp", "PreDown", "PostDown", "ListenPort", "Table"]
|
||||||
awgKeys = []
|
awgKeys = []
|
||||||
if self.Protocol == 'awg':
|
if self.Protocol == 'awg':
|
||||||
awgKeys = ["Jc", "Jmin", "Jmax", "S1", "S2", "S3", "S4", "H1", "H2", "H3", "H4", "I1", "I2", "I3", "I4", "I5", "J1", "J2", "J3", "Itime"]
|
awgKeys = ["Jc", "Jmin", "Jmax", "S1", "S2", "S3", "S4", "H1", "H2", "H3", "H4", "I1", "I2", "I3", "I4", "I5", "HeaderProtectionKey", "ContentPaddingAddition", "RekeyAfterTime", "RekeyTimeout", "RejectAfterTime", "KeepaliveTimeout", "MaxHandshakeAttempts", "RandomTrailers", "DisableCookies", "J1", "J2", "J3", "Itime"]
|
||||||
allowEdit += awgKeys
|
allowEdit += awgKeys
|
||||||
start = original.index("[Interface]")
|
start = original.index("[Interface]")
|
||||||
try:
|
try:
|
||||||
@@ -1092,6 +1106,7 @@ class WireguardConfiguration:
|
|||||||
doRenameStatement("_restrict_access")
|
doRenameStatement("_restrict_access")
|
||||||
doRenameStatement("_deleted")
|
doRenameStatement("_deleted")
|
||||||
doRenameStatement("_transfer")
|
doRenameStatement("_transfer")
|
||||||
|
doRenameStatement("_history_endpoint")
|
||||||
conn.execute(
|
conn.execute(
|
||||||
self.infoTable.update()
|
self.infoTable.update()
|
||||||
.where(self.infoTable.c.ID == self.Name)
|
.where(self.infoTable.c.ID == self.Name)
|
||||||
@@ -1242,7 +1257,7 @@ class WireguardConfiguration:
|
|||||||
elif key == "OverridePeerSettings":
|
elif key == "OverridePeerSettings":
|
||||||
for (key, val) in value.items():
|
for (key, val) in value.items():
|
||||||
try:
|
try:
|
||||||
status, msg = self.__validateOverridePeerSettings(key, jinja2.Template(val).render(configuration=self.toJson()))
|
status, msg = self.__validateOverridePeerSettings(key, RenderSandboxedTemplate(val, configuration=self.toJson()))
|
||||||
if not status:
|
if not status:
|
||||||
return False, msg, key
|
return False, msg, key
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ pyotp==2.10.0
|
|||||||
Flask==3.1.2
|
Flask==3.1.2
|
||||||
flask-cors==6.0.5
|
flask-cors==6.0.5
|
||||||
icmplib==3.0.4
|
icmplib==3.0.4
|
||||||
gunicorn==26.0.0
|
gunicorn==26.2.0
|
||||||
requests==2.34.2
|
requests==2.34.2
|
||||||
tcconfig==0.30.1
|
tcconfig==0.30.1
|
||||||
sqlalchemy==2.0.51
|
sqlalchemy==2.1.6
|
||||||
sqlalchemy_utils==0.42.1
|
sqlalchemy_utils==0.43.0
|
||||||
psycopg[binary]==3.3.4
|
psycopg[binary]==3.3.6
|
||||||
PyMySQL==1.2.0
|
PyMySQL==1.2.3
|
||||||
tzlocal==5.3.1
|
tzlocal==5.4.5
|
||||||
python-jose==3.5.0
|
python-jose[cryptography]==3.5.0
|
||||||
pydantic==2.13.4
|
pydantic==2.14.2
|
||||||
|
|||||||
Generated
+1747
-2433
File diff suppressed because it is too large
Load Diff
+18
-18
@@ -12,36 +12,36 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@volar/language-server": "2.4.28",
|
"@volar/language-server": "2.4.30",
|
||||||
"@vue/language-server": "3.2.7",
|
"@vue/language-server": "3.3.14",
|
||||||
"@vuepic/vue-datepicker": "^14.0.0",
|
"@vuepic/vue-datepicker": "^14.0.0",
|
||||||
"@vueuse/core": "^14.2.1",
|
"@vueuse/core": "^15.0.0",
|
||||||
"@vueuse/shared": "^14.3.0",
|
"@vueuse/shared": "^15.0.0",
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"bootstrap": "^5.3.2",
|
"bootstrap": "^5.3.2",
|
||||||
"bootstrap-icons": "^1.11.3",
|
"bootstrap-icons": "^1.13.2",
|
||||||
"cidr-tools": "^12.0.2",
|
"cidr-tools": "^13.0.4",
|
||||||
"css-color-converter": "^2.0.0",
|
"css-color-converter": "^2.0.0",
|
||||||
"dayjs": "^1.11.19",
|
"dayjs": "^1.11.23",
|
||||||
"electron-builder": "^26.7.0",
|
"electron-builder": "^26.18.0",
|
||||||
"fuse.js": "^7.3.0",
|
"fuse.js": "^7.5.0",
|
||||||
"i": "^0.3.7",
|
"i": "^0.3.7",
|
||||||
"is-cidr": "^6.0.3",
|
"is-cidr": "^7.0.3",
|
||||||
"npm": "^11.13.0",
|
"npm": "^12.2.1",
|
||||||
"ol": "^10.9.0",
|
"ol": "^10.11.0",
|
||||||
"pinia": "^3.0.4",
|
"pinia": "^4.1.0",
|
||||||
"pinia-plugin-persistedstate": "^4.7.1",
|
"pinia-plugin-persistedstate": "^4.7.1",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
"qrcodejs": "^1.0.0",
|
"qrcodejs": "^1.0.0",
|
||||||
"simple-code-editor": "^2.0.9",
|
"simple-code-editor": "^2.0.9",
|
||||||
"uuid": "^14.0.0",
|
"uuid": "^14.0.3",
|
||||||
"vue": "^3.5.32",
|
"vue": "^3.5.32",
|
||||||
"vue-chartjs": "^5.3.3",
|
"vue-chartjs": "^5.3.4",
|
||||||
"vue-router": "^5.0.6"
|
"vue-router": "^5.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^6.0.6",
|
"@vitejs/plugin-vue": "^6.0.10",
|
||||||
"vite": "^8.0.16"
|
"vite": "^8.3.5"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"tar": "^7.5.6"
|
"tar": "^7.5.6"
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ const deleteConfigurationModal = ref(false)
|
|||||||
v-model="data[key]"
|
v-model="data[key]"
|
||||||
:id="'configuration_' + key">
|
:id="'configuration_' + key">
|
||||||
</div>
|
</div>
|
||||||
<div v-for="key in ['Jc', 'Jmin', 'Jmax', 'S1', 'S2', 'S3', 'S4', 'H1', 'H2', 'H3', 'H4', 'I1', 'I2', 'I3', 'I4', 'I5']"
|
<div v-for="key in ['Jc', 'Jmin', 'Jmax', 'S1', 'S2', 'S3', 'S4', 'H1', 'H2', 'H3', 'H4', 'I1', 'I2', 'I3', 'I4', 'I5', 'HeaderProtectionKey', 'ContentPaddingAddition', 'RekeyAfterTime', 'RekeyTimeout', 'RejectAfterTime', 'KeepaliveTimeout', 'MaxHandshakeAttempts', 'RandomTrailers', 'DisableCookies']"
|
||||||
v-if="configurationInfo.Protocol === 'awg'">
|
v-if="configurationInfo.Protocol === 'awg'">
|
||||||
<label :for="'configuration_' + key" class="form-label">
|
<label :for="'configuration_' + key" class="form-label">
|
||||||
<small class="text-muted">
|
<small class="text-muted">
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
|
type="button"
|
||||||
:disabled="!this.passwordValid"
|
:disabled="!this.passwordValid"
|
||||||
class="ms-auto btn bg-success-subtle text-success-emphasis border-1 border-success-subtle rounded-3 shadow-sm" @click="this.useValidation()">
|
class="ms-auto btn bg-success-subtle text-success-emphasis border-1 border-success-subtle rounded-3 shadow-sm" @click="this.useValidation()">
|
||||||
<i class="bi bi-save2-fill me-2"></i>
|
<i class="bi bi-save2-fill me-2"></i>
|
||||||
@@ -141,4 +142,4 @@ export default {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -49,11 +49,20 @@ export default {
|
|||||||
H2: 0,
|
H2: 0,
|
||||||
H3: 0,
|
H3: 0,
|
||||||
H4: 0,
|
H4: 0,
|
||||||
I1: "0",
|
I1: "",
|
||||||
I2: "0",
|
I2: "",
|
||||||
I3: "0",
|
I3: "",
|
||||||
I4: "0",
|
I4: "",
|
||||||
I5: "0"
|
I5: "",
|
||||||
|
HeaderProtectionKey: "",
|
||||||
|
ContentPaddingAddition: "0-64",
|
||||||
|
RekeyAfterTime: "100-140",
|
||||||
|
RekeyTimeout: "4-7",
|
||||||
|
RejectAfterTime: "160-200",
|
||||||
|
KeepaliveTimeout: "8-12",
|
||||||
|
MaxHandshakeAttempts: "14-20",
|
||||||
|
RandomTrailers: "on",
|
||||||
|
DisableCookies: "on"
|
||||||
},
|
},
|
||||||
numberOfAvailableIPs: "0",
|
numberOfAvailableIPs: "0",
|
||||||
error: false,
|
error: false,
|
||||||
@@ -72,9 +81,15 @@ export default {
|
|||||||
this.newConfiguration[key] = this.rand(1, 2**31);
|
this.newConfiguration[key] = this.rand(1, 2**31);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initialize I1 to I5 as "0"
|
// Initialize HeaderProtectionKey
|
||||||
['I1', 'I2', 'I3', 'I4', 'I5'].forEach(key => {
|
let headerProtectionKey = new Uint8Array(32);
|
||||||
this.newConfiguration[key] = "0";
|
window.crypto.getRandomValues(headerProtectionKey);
|
||||||
|
this.newConfiguration.HeaderProtectionKey = btoa(String.fromCharCode(...headerProtectionKey));
|
||||||
|
|
||||||
|
// S1-S4 are recommended be the same to work with RandomTrailers and must 12 or more to work with HeaderProtectionKey
|
||||||
|
let constantS = 12 + this.rand(1, 2**5);
|
||||||
|
['S1', 'S2', 'S3', 'S4'].forEach(key => {
|
||||||
|
this.newConfiguration[key] = constantS;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -388,7 +403,7 @@ export default {
|
|||||||
|
|
||||||
<div class="card rounded-3"
|
<div class="card rounded-3"
|
||||||
v-if="this.newConfiguration.Protocol === 'awg'"
|
v-if="this.newConfiguration.Protocol === 'awg'"
|
||||||
v-for="key in ['Jc', 'Jmin', 'Jmax', 'S1', 'S2', 'S3', 'S4', 'H1', 'H2', 'H3', 'H4', 'I1', 'I2', 'I3', 'I4', 'I5']">
|
v-for="key in ['Jc', 'Jmin', 'Jmax', 'S1', 'S2', 'S3', 'S4', 'H1', 'H2', 'H3', 'H4', 'I1', 'I2', 'I3', 'I4', 'I5', 'HeaderProtectionKey', 'ContentPaddingAddition', 'RekeyAfterTime', 'RekeyTimeout', 'RejectAfterTime', 'KeepaliveTimeout', 'MaxHandshakeAttempts', 'RandomTrailers', 'DisableCookies']">
|
||||||
<div class="card-header">{{ key }}</div>
|
<div class="card-header">{{ key }}</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
|
|||||||
Generated
+534
-676
File diff suppressed because it is too large
Load Diff
@@ -9,20 +9,20 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.18.0",
|
"axios": "^1.21.0",
|
||||||
"bootstrap": "^5.3.8",
|
"bootstrap": "^5.3.8",
|
||||||
"bootstrap-icons": "^1.13.1",
|
"bootstrap-icons": "^1.13.2",
|
||||||
"dayjs": "^1.11.21",
|
"dayjs": "^1.11.23",
|
||||||
"oidc-client-ts": "^3.5.0",
|
"oidc-client-ts": "^3.5.0",
|
||||||
"pinia": "^3.0.4",
|
"pinia": "^4.1.0",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
"uuid": "^14.0.0",
|
"uuid": "^14.0.3",
|
||||||
"vue": "^3.5.35",
|
"vue": "^3.5.44",
|
||||||
"vue-router": "^5.1.0"
|
"vue-router": "^5.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^6.0.6",
|
"@vitejs/plugin-vue": "^6.0.10",
|
||||||
"vite": "^8.0.16",
|
"vite": "^8.3.5",
|
||||||
"vite-plugin-vue-devtools": "^8.1.2"
|
"vite-plugin-vue-devtools": "^8.2.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+505
-399
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user