diff --git a/wireguard/make.sh b/wireguard/make.sh index 3ebb57a..e9edd4e 100755 --- a/wireguard/make.sh +++ b/wireguard/make.sh @@ -98,20 +98,21 @@ echo "# Copying assets..." @ lxc-attach $ID -- chmod +x /root/getFreeClientIP #echo "# Setup: wireguard server..." -@ lxc-attach $ID -- bash -c 'cd /root && make server' +@ lxc-attach $ID -- bash -c "cd /root && make server" echo "# Setup: wireguard default profile..." -@ lxc-attach $ID -- bash -c "cd /root && make default.client" +@ lxc-attach $ID -- bash -c "cd /root \ + && QRCODE=${QRCODE} make default.client" @ lxc-attach $ID -- chmod 600 /etc/wireguard/wg0.conf echo "# client config:" @ mkdir -p clients @ pct pull $ID /etc/wireguard/clients/default.conf clients/default.conf # show the profile as a qrcode... -if [ "$QRCODE" ] ; then - echo "# default profile:" - @ lxc-attach $ID -- qrencode -t UTF8 -r /etc/wireguard/clients/default.conf -fi +#if [ "$QRCODE" ] ; then +# echo "# default profile:" +# @ lxc-attach $ID -- qrencode -t UTF8 -r /etc/wireguard/clients/default.conf +#fi #echo "# Setup: bridge device..." @ lxc-attach $ID wg-quick up wg0 diff --git a/wireguard/templates/root/Makefile b/wireguard/templates/root/Makefile index c115917..061d152 100644 --- a/wireguard/templates/root/Makefile +++ b/wireguard/templates/root/Makefile @@ -11,6 +11,7 @@ SERVER_PUBLIC_KEY := $(SERVER_DIR)/server_id.pub CLIENT_TPL := templates/client.conf CLIENT_DIR := $(SERVER_DIR)/clients/ +QRCODE ?= 1 ENDPOINT ?= ${ENDPOINT} ENDPOINT_PORT ?= ${ENDPOINT_PORT} @@ -61,7 +62,8 @@ $(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY) -e 's/\$${\CLIENT_PUBLIC_KEY}/'$$(sed -e 's/\//\\\//g' "$(CLIENT_DIR)/$*_id.pub")'/g' \ -e 's/\$${\SERVER_PUBLIC_KEY}/'$$(sed -e 's/\//\\\//g' "$(SERVER_PUBLIC_KEY)")'/g' \ >> "$(SERVER_CONF)" - + [ -z "$$QRCODE" ] \ + || qrencode -t UTF8 -r "$(CLIENT_DIR)/$*.conf" server: $(SERVER_CONF)