Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2024-01-10 04:54:54 +03:00
parent 4b2c3819ce
commit bef70ee5b4
3 changed files with 1 additions and 34 deletions

View File

@ -1,8 +0,0 @@
#!/usr/bin/bash
SERVER_TEMPLATE=
CLIENT_TEMPLATE=
PRIVATE_KEY=
PUBLIC_KEY=

View File

@ -1,24 +0,0 @@
#!/usr/bin/bash
SERVER_TEMPLATE=${SERVER_TEMPLATE:=templates/wg0.conf}
SERVER_CONF=/etc/wireguard/wg0.conf
PUBLIC_KEY=/etc/wireguard/server_id
PRIVATE_KEY=/etc/wireguard/server_id.pub
if ! [ -e "$PRIVATE_KEY" ] ; then
wg genkey > "$PRIVATE_KEY"
fi
if ! [ -e "$PUBLIC_KEY" ] ; then
cat "$PRIVATE_KEY" | wg pubkey > "$PUBLIC_KEY"
fi
PRIVATE_KEY=$(cat "$PRIVATE_KEY")
cat ${SERVER_TEMPLATE} \
| sed \
-q 's/\${SERVER_PRIVATE_KEY}/'${PRIVATE_KEY}'/g' \
> "${SERVER_CONF}"
./make-client

View File

@ -73,7 +73,7 @@ OPTS_STAGE_2="\
#----------------------------------------------------------------------
echo "# Building config..."
buildAssets ENDPOINT ENDPOINT_PORT
buildAssets ENDPOINT ENDPOINT_PORT DNS
echo "# Creating CT..."
pctCreateAlpine $ID "${OPTS_STAGE_1}" "$PASS"
@ -89,7 +89,6 @@ echo "# Copying assets..."
echo "# Setup: wireguard default profile..."
@ lxc-attach $ID -- bash -c "cd /root && \
ENDPOINT_PORT=51820 \
CLIENT_IP=10.42.0.1/32 \
ALLOWED_IPS=0.0.0.0/0 \
make default.client"