mirror of
https://github.com/flynx/proxmox-utils.git
synced 2025-10-29 19:20:10 +00:00
experimenting...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
31dbf3acd2
commit
44307bfec7
@ -18,6 +18,7 @@ readConfig
|
|||||||
SOFTWARE=(
|
SOFTWARE=(
|
||||||
make
|
make
|
||||||
w3m links
|
w3m links
|
||||||
|
tree
|
||||||
qrencode
|
qrencode
|
||||||
htop iftop iotop
|
htop iftop iotop
|
||||||
tmux
|
tmux
|
||||||
|
|||||||
@ -31,6 +31,10 @@ ALLOWED_IPS ?= ${ALLOWED_IPS}
|
|||||||
cat $< | wg pubkey > $@
|
cat $< | wg pubkey > $@
|
||||||
|
|
||||||
|
|
||||||
|
%_ip:
|
||||||
|
./getFreeClientIP > $@
|
||||||
|
|
||||||
|
|
||||||
# NOTE: the first letter of each pattern is quoted to prevent it from
|
# NOTE: the first letter of each pattern is quoted to prevent it from
|
||||||
# being substituted when generating this Makefile from template.
|
# being substituted when generating this Makefile from template.
|
||||||
$(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY)
|
$(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY)
|
||||||
@ -46,39 +50,44 @@ $(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY)
|
|||||||
|
|
||||||
# XXX need to figure out a way to link this to the .config file without
|
# XXX need to figure out a way to link this to the .config file without
|
||||||
# conflicting with the server's wg0.conf
|
# conflicting with the server's wg0.conf
|
||||||
%.client: $(CLIENT_TPL) $(SERVER_CLIENT_TPL) \
|
.PRECIOUS: %.wg
|
||||||
$(CLIENT_DIR)/%_id $(CLIENT_DIR)/%_id.pub \
|
%.wg: $(CLIENT_TPL) $(SERVER_CLIENT_TPL) \
|
||||||
|
%_id %_id.pub %_ip \
|
||||||
$(SERVER_CONF) $(SERVER_PUBLIC_KEY)
|
$(SERVER_CONF) $(SERVER_PUBLIC_KEY)
|
||||||
@ mkdir -p $(CLIENT_DIR)
|
@ mkdir -p $(shell dirname "$*")
|
||||||
cat "$<" \
|
cat "$<" \
|
||||||
| sed \
|
| sed \
|
||||||
-e 's/\$${\DNS}/$(DNS)/g' \
|
-e 's/\$${\DNS}/$(DNS)/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/\$${\ALLOWED_IPS}/$(subst /,\/,$(ALLOWED_IPS))/g' \
|
-e 's/\$${\ALLOWED_IPS}/$(subst /,\/,$(ALLOWED_IPS))/g' \
|
||||||
-e 's/\$${\CLIENT_IP}/$(shell ./getFreeClientIP)\/32/g' \
|
-e 's/\$${\CLIENT_IP}/$(shell cat $*_ip)\/32/g' \
|
||||||
-e 's/\$${\CLIENT_PRIVATE_KEY}/'$$(sed -e 's/\//\\\//g' "$(CLIENT_DIR)/$*_id")'/g' \
|
-e 's/\$${\CLIENT_PRIVATE_KEY}/$(shell sed -e 's/\//\\\//g' "$*_id")/g' \
|
||||||
-e 's/\$${\SERVER_PUBLIC_KEY}/'$$(sed -e 's/\//\\\//g' "$(SERVER_PUBLIC_KEY)")'/g' \
|
-e 's/\$${\SERVER_PUBLIC_KEY}/$(shell sed -e 's/\//\\\//g' "$(SERVER_PUBLIC_KEY)")/g' \
|
||||||
> "$(CLIENT_DIR)/$*.conf"
|
> "$@"
|
||||||
cat "$(SERVER_CLIENT_TPL)" \
|
cat "$(SERVER_CLIENT_TPL)" \
|
||||||
| sed \
|
| sed \
|
||||||
-e 's/\$${\CLIENT_IP}/$(shell ./getFreeClientIP)\/32/g' \
|
-e 's/\$${\CLIENT_IP}/$(shell cat $*_ip)\/32/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}/$(shell sed -e 's/\//\\\//g' "$*_id.pub")/g' \
|
||||||
-e 's/\$${\SERVER_PUBLIC_KEY}/'$$(sed -e 's/\//\\\//g' "$(SERVER_PUBLIC_KEY)")'/g' \
|
-e 's/\$${\SERVER_PUBLIC_KEY}/$(shell sed -e 's/\//\\\//g' "$(SERVER_PUBLIC_KEY)")/g' \
|
||||||
>> "$(SERVER_CONF)"
|
>> "$(SERVER_CONF)"
|
||||||
make update $*.show
|
make update $*.show
|
||||||
|
|
||||||
|
|
||||||
%.show: $(CLIENT_DIR)/%.conf
|
%.show: %.wg
|
||||||
@ [ "$(QRCODE)" == "1" ] \
|
@ [ "$(QRCODE)" == "1" ] \
|
||||||
&& ( echo "# Profile: $*" \
|
&& ( echo "# Profile: $*" \
|
||||||
&& qrencode -t UTF8 -r "$(CLIENT_DIR)/$*.conf" )
|
&& qrencode -t UTF8 -r "$<" )
|
||||||
@ cat "$(CLIENT_DIR)/$*.conf"
|
@ cat "$<"
|
||||||
@ echo
|
@ echo
|
||||||
|
|
||||||
|
|
||||||
|
%.client: $(CLIENT_DIR)/%.wg update $(CLIENT_DIR)/%.show
|
||||||
|
@
|
||||||
|
|
||||||
|
|
||||||
update:
|
update:
|
||||||
wg syncconf $(INTERFACE) <(wg-quick strip $(INTERFACE))
|
wg syncconf $(INTERFACE) <(wg-quick strip $(INTERFACE))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user