Files
dmzconf/wg.mk
2026-03-02 19:22:48 +01:00

30 lines
863 B
Makefile

public_key = $(shell cat /etc/wireguard/dmz_public_key)
name := $(shell git config list | grep user.nam | cut -d= -f2)
# Local keys
wireguard/dmz_private_key: | /bin/wg wireguard/
wg genkey > $@
chmod 700 $@
wireguard/dmz_public_key: wireguard/dmz_private_key | /bin/wg
$| pubkey < $< > $@
##############################
wgkeys.rec: wireguard/dmz_public_key
$(info Adding wireguard key as '$(name)')
recins --verbose $@ -t $(basename $@) -f name -v '$(name)' -f pubkey -v '$(shell cat $<)'
git add $@
git commit -m"add wireguard key for $(name)"
$(info Remember to git push)
wireguard/dmz.conf: xecut/nimbus/dmz.conf | wireguard/dmz_private_key
sed 's/PRIVATE_KEY/$(shell cat $|)/' $< > $@
###### Wireguard configuration #####
wireguard/wg_peers.txt: wgkeys.rec | xecut/nimbus/wireguard_peer.fmt
recsel $< -t $(basename $<) | recfmt -f $| > $@