Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ services:
environment:
WIREGUARD_CIDR: "10.128.0.0/24"
WIREGUARD_MTU: "1420"
MAX_SLOTS: "4"
restart: unless-stopped
deploy:
resources:
Expand Down
4 changes: 3 additions & 1 deletion gnosisvpn-server/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ set -euo pipefail

: "${WIREGUARD_CIDR:?WIREGUARD_CIDR must be set, e.g. 10.128.0.0/24}"
WIREGUARD_MTU="${WIREGUARD_MTU:-1420}"
# Maximum number of peers (available slots) that can connect to this exit node.
max_slots="${MAX_SLOTS:-4}"

cidr_ip="${WIREGUARD_CIDR%%/*}"
IFS='.' read -r o1 o2 o3 o4 <<<"${cidr_ip}"
Expand All @@ -11,7 +13,7 @@ IFS='.' read -r o1 o2 o3 o4 <<<"${cidr_ip}"
# (matching production) always runs to .254 regardless of the exact prefix length.
wg_address="${o1}.${o2}.${o3}.$((o4 + 1))"
wg_start="${o1}.${o2}.${o3}.$((o4 + 2))"
wg_end="${o1}.${o2}.${o3}.254"
wg_end="${o1}.${o2}.${o3}.$((o4 + 1 + max_slots))"

# gnosis_vpn-server's own wrapper.sh generates a WireGuard key when PRIVATE_KEY isn't set,
# but doesn't persist it - a fresh key on every restart would break peer registration.
Expand Down
15 changes: 15 additions & 0 deletions setup-wizard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,18 @@ fields:
secret: false
pattern: ^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/\d{1,2}$
patternErrorMessage: Must be a valid CIDR, e.g. 10.128.0.0/24

- id: MAX_SLOTS
target:
type: environment
name: MAX_SLOTS
service: gnosisvpn-server
title: Maximum connected peers (advanced)
required: false
description: |-
Maximum number of peers that can be connected to this exit node at the same time. It
determines the number of available slots in the WireGuard client address pool. Leave
empty to use the default (`4`).
secret: false
pattern: ^([1-9]|[1-9]\d|1\d{2}|2[0-4]\d|25[0-2])$
patternErrorMessage: Must be a number between 1 and 252
Loading