-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwireguard.nix
More file actions
63 lines (56 loc) · 1.78 KB
/
wireguard.nix
File metadata and controls
63 lines (56 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
###############################################################################
# Wireguard config
###############################################################################
{ config, lib, pkgs, ... }:
{
sops.secrets = {
"wg0_private_key" = {};
"wg0_elk_allowedips" = {};
"wg0_elk_endpoint" = {};
"wg0_wazuh_allowedips" = {};
"wg0_wazuh_endpoint" = {};
"wg1_private_key" = {};
"wg1_vps_endpoint" = {};
"wg1_vps_allowedips" = {};
};
sops.templates."wg0.conf" = {
content = ''
[Interface]
PrivateKey = ${config.sops.placeholder."wg0_private_key"}
Address = 10.10.10.4/24
[Peer]
# Elk
PublicKey = wW4FLWFhZGOyzUnnf3cFTNlcmcXgc7E7S6LobwFF3Tc=
AllowedIPs = ${config.sops.placeholder."wg0_elk_allowedips"}
Endpoint = ${config.sops.placeholder."wg0_elk_endpoint"}
PersistentKeepalive = 25
[Peer]
# Wazuh
PublicKey = na1tRGq7v+sZyAwPMJrYzI2MFq7z4Y8EKhWaMaB5ZB4=
AllowedIPs = ${config.sops.placeholder."wg0_wazuh_allowedips"}
Endpoint = ${config.sops.placeholder."wg0_wazuh_endpoint"}
PersistentKeepalive = 25
'';
path = "/run/secrets/wg0.conf";
mode = "0400";
};
sops.templates."wg1.conf" = {
content = ''
[Interface]
PrivateKey = ${config.sops.placeholder."wg1_private_key"}
Address = 10.10.90.2/24
[Peer]
# VPS
PublicKey = fXpSh3d1icVlTOPV/AS5YLTfg/4rkaCPWJMls0oPK3E=
AllowedIPs = ${config.sops.placeholder."wg1_vps_allowedips"}
Endpoint = ${config.sops.placeholder."wg1_vps_endpoint"}
PersistentKeepalive = 25
'';
path = "/run/secrets/wg1.conf";
mode = "0400";
};
networking.wg-quick.interfaces = {
wg0.configFile = config.sops.templates."wg0.conf".path;
wg1.configFile = config.sops.templates."wg1.conf".path;
};
networking.firewall.checkReversePath = "loose";}