Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2024-01-10 06:17:00 +03:00
parent 96c6b07fe7
commit 72be4b3b62
3 changed files with 5 additions and 5 deletions

View File

@ -41,7 +41,7 @@ xread "Wireguard endpoint: " ENDPOINT
DFL_ENDPOINT_PORT=${DFL_ENDPOINT_PORT:=51820} DFL_ENDPOINT_PORT=${DFL_ENDPOINT_PORT:=51820}
xread "Wireguard endpoint port: " ENDPOINT_PORT xread "Wireguard endpoint port: " ENDPOINT_PORT
CLIENT_IPS=10.42.1.0/16 CLIENT_IPS=${CLIENT_IPS:-10.42.0.0/16}
readVars readVars

View File

@ -54,13 +54,13 @@ $(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY)
-e 's/\$${\ENDPOINT}/$(ENDPOINT)/g' \ -e 's/\$${\ENDPOINT}/$(ENDPOINT)/g' \
-e 's/\$${\ENDPOINT_PORT}/$(ENDPOINT_PORT)/g' \ -e 's/\$${\ENDPOINT_PORT}/$(ENDPOINT_PORT)/g' \
-e 's/\$${\ALLOWED_IPS}/$(subst /,\/,$(ALLOWED_IPS))/g' \ -e 's/\$${\ALLOWED_IPS}/$(subst /,\/,$(ALLOWED_IPS))/g' \
-e 's/\$${\CLIENT_IP}/$(subst /,\/,$(CLIENT_IP))/g' \ -e 's/\$${\CLIENT_IP}/$(shell ./getFreeClientIP)\/$(patsubst %/,,$(CLIENT_IP))/g' \
-e 's/\$${\CLIENT_PRIVATE_KEY}/'$$(sed -e 's/\//\\\//g' "$(CLIENT_DIR)/$*_id")'/g' \ -e 's/\$${\CLIENT_PRIVATE_KEY}/'$$(sed -e 's/\//\\\//g' "$(CLIENT_DIR)/$*_id")'/g' \
-e 's/\$${\SERVER_PUBLIC_KEY}/'$$(sed -e 's/\//\\\//g' "$(SERVER_PUBLIC_KEY)")'/g' \ -e 's/\$${\SERVER_PUBLIC_KEY}/'$$(sed -e 's/\//\\\//g' "$(SERVER_PUBLIC_KEY)")'/g' \
> "$(CLIENT_DIR)/$*.conf" > "$(CLIENT_DIR)/$*.conf"
cat "$(SERVER_CLIENT_TPL)" \ cat "$(SERVER_CLIENT_TPL)" \
| sed \ | sed \
-e 's/\$${\CLIENT_IP}/$(subst /,\/,$(CLIENT_IP))/g' \ -e 's/\$${\CLIENT_IP}/$(shell ./getFreeClientIP)\/$(patsubst %/,,$(CLIENT_IP))/g' \
-e 's/\$${\ENDPOINT}/$(ENDPOINT)/g' \ -e 's/\$${\ENDPOINT}/$(ENDPOINT)/g' \
-e 's/\$${\ENDPOINT_PORT}/$(ENDPOINT_PORT)/g' \ -e 's/\$${\ENDPOINT_PORT}/$(ENDPOINT_PORT)/g' \
-e 's/\$${\CLIENT_PUBLIC_KEY}/'$$(sed -e 's/\//\\\//g' "$(CLIENT_DIR)/$*_id.pub")'/g' \ -e 's/\$${\CLIENT_PUBLIC_KEY}/'$$(sed -e 's/\//\\\//g' "$(CLIENT_DIR)/$*_id.pub")'/g' \

View File

@ -2,8 +2,8 @@
CLIENT_IPS=${CLIENT_IPS} CLIENT_IPS=${CLIENT_IPS}
BASE_IP=${CLIENT_IPS/0\/*} BASE_IP=${CLIENT_IPS/.0\/*}
IPs=($(cat /etc/wireguard/clients/* \ IPs=($(cat /etc/wireguard/clients/* 2> /dev/null \
| grep Address \ | grep Address \
| cut -d'.' -f 4 \ | cut -d'.' -f 4 \
| cut -d '/' -f 1 \ | cut -d '/' -f 1 \