diff --git a/wireguard/make.sh b/wireguard/make.sh index ae7de8c..a1438ef 100755 --- a/wireguard/make.sh +++ b/wireguard/make.sh @@ -41,6 +41,8 @@ xread "Wireguard endpoint: " ENDPOINT DFL_ENDPOINT_PORT=${DFL_ENDPOINT_PORT:=51820} xread "Wireguard endpoint port: " ENDPOINT_PORT +CLIENT_IPS=10.42.1.0/16 + readVars @@ -73,7 +75,7 @@ OPTS_STAGE_2="\ #---------------------------------------------------------------------- echo "# Building config..." -buildAssets ENDPOINT ENDPOINT_PORT DNS +buildAssets ENDPOINT ENDPOINT_PORT DNS CLIENT_IPS echo "# Creating CT..." pctCreateAlpine $ID "${OPTS_STAGE_1}" "$PASS" @@ -83,6 +85,7 @@ echo "# Installing dependencies..." echo "# Copying assets..." @ pct-push-r $ID ./assets / +@ lxc-attach $ID -- chmod +x /root/getFreeClientIP #echo "# Setup: wireguard server..." @ lxc-attach $ID -- bash -c 'cd /root && make server' diff --git a/wireguard/templates/root/Makefile b/wireguard/templates/root/Makefile index 9d80230..4a0953f 100644 --- a/wireguard/templates/root/Makefile +++ b/wireguard/templates/root/Makefile @@ -11,7 +11,7 @@ SERVER_PUBLIC_KEY := $(SERVER_DIR)/server_id.pub CLIENT_TPL := templates/client.conf CLIENT_DIR := $(SERVER_DIR)/clients/ -CLIENT_IPS ?= 10.42.0.0/16 +CLIENT_IPS ?= ${CLIENT_IPS} ENDPOINT_PORT ?= ${ENDPOINT_PORT} ENDPOINT ?= ${ENDPOINT} diff --git a/wireguard/templates/root/getFreeClientIP b/wireguard/templates/root/getFreeClientIP index fef3ad0..c89d0e3 100755 --- a/wireguard/templates/root/getFreeClientIP +++ b/wireguard/templates/root/getFreeClientIP @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash CLIENT_IPS=${CLIENT_IPS}