9 Commits

6 changed files with 21 additions and 7 deletions

View File

@@ -13,7 +13,9 @@ include wg.mk
.PHONY: check
check: ## Check you have all dependencies
@command -v graph-easy >/dev/null || { echo "Install perl-graph-easy" && exit 1 ;}
@command -v ansible >/dev/null || { echo "Install ansible" && exit 1 ;}
@command -v recsel >/dev/null || { echo "Install recutils" && exit 1 ;}
@command -v wg >/dev/null || { echo "Install wireguard" && exit 1 ;}
@command -v lowdown >/dev/null || { echo "Install lowdown" && exit 1 ;}
@echo "All dependencies installed"

View File

@@ -7,7 +7,7 @@ all:
wireguard:
hosts:
192.168.0.93:
192.168.10.93:
arch:
hosts:
10.0.0.1:

View File

@@ -1,7 +1,7 @@
---
- name: Install Wireguard on Server
hosts: wireguard
become: true
user: root
tasks:
- name: Install wireguard tools and dig
@@ -14,6 +14,7 @@
ansible.builtin.copy:
src: wireguard/wg0.conf
dest: /etc/wireguard/wg0.conf
notify: Reload systemd daemon
- name: Get server public IP
ansible.builtin.command: dig +short myip.opendns.com @resolver1.opendns.com
@@ -30,3 +31,8 @@
name: wg-quick@wg0
enabled: yes
handlers:
- name: Reload systemd daemon
ansible.builtin.command:
cmd: systemctl daemon-reload

4
wg.mk
View File

@@ -45,8 +45,8 @@ ansible/playbooks/files/wireguard/wg0.conf: wireguard/wg_peers.txt | ansible/pla
wg-create: wireguard/dmz.conf ## Set up wireguard keys (do this before installing)
.PHONY: wg-install
wg-install: /etc/wireguard/dmz.conf ## Install wireguard keys (use sudo)
/etc/wireguard/dmz.conf: wireguard/dmz.conf | /bin/wg
wg-install:| /etc/wireguard/dmz.conf ## Install wireguard keys (use sudo)
/etc/wireguard/dmz.conf:| wireguard/dmz.conf /bin/wg
cp $< $@
.PHONY: wg-setup

View File

@@ -10,3 +10,10 @@ id: 2
name: Malin Freeborn
pubkey: loNnXRalD0ZyOLadSWm31rqOuRfEbgtX9O4/z7eSIho=
id: 3
name: coja
pubkey: snfw8r1hIAtTABGd7K9xIZ9RH62qMEK4fRqVm4EbniQ=
id: 4
name: netstat
pubkey: Z8bk25hHo6oadOX7KtoLUDXGW9r+thMiR320aiGmQAQ=

View File

@@ -1,12 +1,11 @@
# Client configuration for wireguard to nimbus at xecut.
[Interface]
Address = 10.0.0.2/32
Address = 10.0.0.{{id}}/32
PrivateKey = PRIVATE_KEY
DNS = 9.9.9.9
[Peer]
PublicKey = GH+qA1Au9BraGhNt7Aqp8tdhGVfH8ENnY3VzKhe69XQ=
Endpoint = space.xecut.me:51900
AllowedIPs = 10.0.0.{{id}}/24
AllowedIPs = 10.0.0.1/24