generate local keys
This commit is contained in:
25
wg.mk
25
wg.mk
@@ -1,21 +1,22 @@
|
|||||||
public_key = $(shell cat /etc/wireguard/dmz_public_key)
|
public_key = $(shell cat /etc/wireguard/dmz_public_key)
|
||||||
name := $(shell git config list | grep user.nam | cut -d= -f2)
|
name := $(shell git config list | grep user.nam | cut -d= -f2)
|
||||||
|
|
||||||
wgkeys.rec: /etc/wireguard/dmz_public_key
|
|
||||||
recins $@ -t $(basename $@) -f name -v "$(name)" -f pubkey -v "$(public_key)"
|
|
||||||
|
|
||||||
/etc/wireguard/dmz.conf: xecut/nimbus/wireguard_client.conf | /etc/wireguard/dmz_private_key
|
# Local keys
|
||||||
sed 's/PRIVATE_KEY/$(shell cat $|)/' $< > $@
|
|
||||||
|
|
||||||
/etc/wireguard/dmz_private_key: | /bin/wg
|
wireguard/dmz_private_key: | /bin/wg wireguard/
|
||||||
$| genkey > $@
|
wg genkey > $@
|
||||||
chmod 700 $@
|
chmod 700 $@
|
||||||
|
|
||||||
ansible/host_vars/local_host.yml: wgkeys.rec
|
wireguard/dmz_public_key: wireguard/dmz_private_key | /bin/wg
|
||||||
recsel $< -t $(basename $<) -e 'name = "$(name)"' -P pubkey
|
|
||||||
|
|
||||||
/etc/wireguard/dmz_public_key: /etc/wireguard/dmz_private_key | /bin/wg
|
|
||||||
$| pubkey < $< > $@
|
$| pubkey < $< > $@
|
||||||
|
|
||||||
.PHONY: wgkeys
|
##############################
|
||||||
wgkeys: /etc/wireguard/dmz.conf ## Create dmz-keys on your machine for wiregurd.
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
%rec: wgkeys
|
%rec: wgkeys
|
||||||
%key: name
|
%type: name,pubkey line
|
||||||
%type: name line
|
%mandatory: name
|
||||||
%mandatory: pubkey
|
+ pubkey
|
||||||
|
|
||||||
name: Malin Freeborn
|
name: Malin Freeborn
|
||||||
pubkey: loNnXRalD0ZyOLadSWm31rqOuRfEbgtX9O4/z7eSIho=
|
pubkey: loNnXRalD0ZyOLadSWm31rqOuRfEbgtX9O4/z7eSIho=
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user