create wireguard local configuration
This commit is contained in:
10
wg.mk
10
wg.mk
@@ -1,15 +1,21 @@
|
|||||||
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
|
wgkeys.rec: /etc/wireguard/dmz_public_key
|
||||||
recins $@ -t $(basename $@) -f name -v "$(name)" -f pubkey -v "$(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
|
||||||
|
sed 's/PRIVATE_KEY/$(shell cat $|)/' $< > $@
|
||||||
|
|
||||||
/etc/wireguard/dmz_private_key: | /bin/wg
|
/etc/wireguard/dmz_private_key: | /bin/wg
|
||||||
$| genkey > $@
|
$| genkey > $@
|
||||||
chmod 700 $@
|
chmod 700 $@
|
||||||
|
|
||||||
|
ansible/host_vars/local_host.yml: wgkeys.rec
|
||||||
|
recsel $< -t $(basename $<) -e 'name = "$(name)"' -P pubkey
|
||||||
|
|
||||||
/etc/wireguard/dmz_public_key: /etc/wireguard/dmz_private_key | /bin/wg
|
/etc/wireguard/dmz_public_key: /etc/wireguard/dmz_private_key | /bin/wg
|
||||||
$| pubkey < $< > $@
|
$| pubkey < $< > $@
|
||||||
|
|
||||||
.PHONY: wgkeys
|
.PHONY: wgkeys
|
||||||
wgkeys: /etc/wireguard/dmz_public_key ## Create dmz-keys on your machine for wiregurd.
|
wgkeys: /etc/wireguard/dmz.conf ## Create dmz-keys on your machine for wiregurd.
|
||||||
|
|||||||
14
xecut/nimbus/wireguard_client.conf
Normal file
14
xecut/nimbus/wireguard_client.conf
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
[Interface]
|
||||||
|
Address = 10.0.0.1/24
|
||||||
|
SaveConfig = true
|
||||||
|
PrivateKey = PRIVATE_KEY
|
||||||
|
ListenPort = 51900
|
||||||
|
|
||||||
|
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
|
||||||
|
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
|
||||||
|
|
||||||
|
[Peer]
|
||||||
|
PublicKey = GH+qA1Au9BraGhNt7Aqp8tdhGVfH8ENnY3VzKhe69XQ=
|
||||||
|
AllowedIPs = 10.0.0.2/32
|
||||||
|
|
||||||
Reference in New Issue
Block a user