feat: frikandel as wireguard hub
This commit is contained in:
parent
dd42eeca69
commit
cec9562e15
|
@ -103,7 +103,7 @@
|
||||||
|
|
||||||
frikandel = {
|
frikandel = {
|
||||||
hostname = "frikandel.b12f.io";
|
hostname = "frikandel.b12f.io";
|
||||||
sshUser = "root";
|
sshUser = "yule";
|
||||||
};
|
};
|
||||||
|
|
||||||
maoam = {
|
maoam = {
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
./pie
|
./pie
|
||||||
self.nixosModules.yule
|
self.nixosModules.yule
|
||||||
self.nixosModules.docker
|
self.nixosModules.docker
|
||||||
|
self.nixosModules.wireguard-client
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,5 +4,6 @@
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
|
|
||||||
./networking.nix
|
./networking.nix
|
||||||
|
./wireguard.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
networking.hostId = "44234773";
|
networking.hostId = "44234773";
|
||||||
networking.nameservers = [ "9.9.9.9" ];
|
networking.nameservers = [ "9.9.9.9" ];
|
||||||
|
|
||||||
|
services.openssh.openFirewall = true;
|
||||||
|
|
||||||
# Network configuration (Hetzner uses static IP assignments, and we don't use DHCP here)
|
# Network configuration (Hetzner uses static IP assignments, and we don't use DHCP here)
|
||||||
networking.useDHCP = false;
|
networking.useDHCP = false;
|
||||||
networking.interfaces.enp1s0 = {
|
networking.interfaces.enp1s0 = {
|
||||||
|
|
|
@ -4,53 +4,52 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
age.secrets.wg-private-key-server.file = "${flake.self}/secrets/wg-private-pie-server.age";
|
age.secrets.wg-private-key-server.file = "${flake.self}/secrets/wg-private-frikandel-server.age";
|
||||||
|
|
||||||
|
boot.kernel.sysctl = {
|
||||||
|
"net.ipv4.ip_forward" = 1;
|
||||||
|
};
|
||||||
|
|
||||||
networking.nat = {
|
networking.nat = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableIPv6 = true;
|
enableIPv6 = true;
|
||||||
internalInterfaces = [ "wg-server" ];
|
internalInterfaces = [ "wg-server" ];
|
||||||
};
|
};
|
||||||
networking.firewall.allowedUDPPorts = [ 51898 ];
|
|
||||||
|
networking.firewall.allowedUDPPorts = [ 51899 ];
|
||||||
|
networking.firewall.extraForwardRules = [
|
||||||
|
"iifname wg0 accept"
|
||||||
|
"iifname enp1s0 reject"
|
||||||
|
];
|
||||||
|
|
||||||
# Enable WireGuard
|
# Enable WireGuard
|
||||||
networking.wg-quick.interfaces = {
|
networking.wg-quick.interfaces = {
|
||||||
wg-server = {
|
wg0 = {
|
||||||
listenPort = 51898;
|
listenPort = 51899;
|
||||||
|
|
||||||
address = [ "10.0.1.2/32" ];
|
address = [ "10.0.1.7/32" ];
|
||||||
|
|
||||||
dns = [ "10.0.1.2" ];
|
|
||||||
|
|
||||||
privateKeyFile = "/run/agenix/wg-private-key-server";
|
privateKeyFile = "/run/agenix/wg-private-key-server";
|
||||||
|
|
||||||
peers = [
|
peers = [
|
||||||
# {
|
{ # pie
|
||||||
# # router
|
publicKey = "8M/+y6AqbSsbK0JENkjRXqlRR56iiM/QRjGGtEM+Uj8=";
|
||||||
# publicKey = "";
|
allowedIPs = [ "10.0.1.2/32" ];
|
||||||
# allowedIPs = ["10.0.1.1/32"];
|
persistentKeepalive = 25;
|
||||||
|
}
|
||||||
# persistentKeepalive = 25;
|
{ # droppie
|
||||||
# }
|
|
||||||
{
|
|
||||||
# droppie
|
|
||||||
publicKey = "qsnBMoj9Z16D8PJ5ummRtIfT5AiMpoF3SoOCo4sbyiw=";
|
publicKey = "qsnBMoj9Z16D8PJ5ummRtIfT5AiMpoF3SoOCo4sbyiw=";
|
||||||
allowedIPs = [ "10.0.1.3/32" ];
|
allowedIPs = [ "10.0.1.3/32" ];
|
||||||
|
|
||||||
persistentKeepalive = 25;
|
persistentKeepalive = 25;
|
||||||
}
|
}
|
||||||
{
|
{ # chocolatebar
|
||||||
# chocolatebar
|
|
||||||
publicKey = "nk8EtGE/QsnSEm1lhLS3/w83nOBD2OGYhODIf92G91A=";
|
publicKey = "nk8EtGE/QsnSEm1lhLS3/w83nOBD2OGYhODIf92G91A=";
|
||||||
allowedIPs = [ "10.0.1.5/32" ];
|
allowedIPs = [ "10.0.1.5/32" ];
|
||||||
|
|
||||||
persistentKeepalive = 25;
|
persistentKeepalive = 25;
|
||||||
}
|
}
|
||||||
{
|
{ # biolimo
|
||||||
# biolimo
|
|
||||||
publicKey = "4ymN7wwBuhF+h+5fFN0TqXmVyOe1AsWiTqRL0jJ3CDc=";
|
publicKey = "4ymN7wwBuhF+h+5fFN0TqXmVyOe1AsWiTqRL0jJ3CDc=";
|
||||||
allowedIPs = [ "10.0.1.6/32" ];
|
allowedIPs = [ "10.0.1.6/32" ];
|
||||||
|
|
||||||
persistentKeepalive = 25;
|
persistentKeepalive = 25;
|
||||||
}
|
}
|
||||||
];
|
];
|
|
@ -39,20 +39,6 @@ in {
|
||||||
|
|
||||||
pub-solar.core.disk-encryption-active = false;
|
pub-solar.core.disk-encryption-active = false;
|
||||||
|
|
||||||
services.openssh.openFirewall = true;
|
|
||||||
|
|
||||||
security.sudo.extraRules = [
|
|
||||||
{
|
|
||||||
users = ["${psCfg.user.name}"];
|
|
||||||
commands = [
|
|
||||||
{
|
|
||||||
command = "ALL";
|
|
||||||
options = ["NOPASSWD"];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
# This value determines the NixOS release from which the default
|
# This value determines the NixOS release from which the default
|
||||||
# settings for stateful data, like file locations and database versions
|
# settings for stateful data, like file locations and database versions
|
||||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
./networking.nix
|
./networking.nix
|
||||||
./backup.nix
|
./backup.nix
|
||||||
./wireguard.nix
|
|
||||||
./unbound.nix
|
./unbound.nix
|
||||||
./dhcpd.nix
|
./dhcpd.nix
|
||||||
./wake-droppie.nix
|
./wake-droppie.nix
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
networking.hosts = flake.self.lib.addLocalHostname ["caddy.local"];
|
networking.hosts = flake.self.lib.addLocalHostname ["caddy.local"];
|
||||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||||
|
|
||||||
services.openssh.allowSFTP = true;
|
services.openssh.openFirewall = true;
|
||||||
|
|
||||||
# Caddy reverse proxy for local services like cups
|
# Caddy reverse proxy for local services like cups
|
||||||
services.caddy = {
|
services.caddy = {
|
||||||
|
@ -29,4 +29,11 @@
|
||||||
auto_https off
|
auto_https off
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
age.secrets.wg-private-key.file = "${flake.self}/secrets/wg-private-pie.age";
|
||||||
|
|
||||||
|
pub-solar.wireguard-client = {
|
||||||
|
ownIPs = [ "10.0.1.2/32" ];
|
||||||
|
wireguardPrivateKeyFile = "/run/agenix/wg-private-key";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,14 +37,17 @@
|
||||||
"\"pie.local. 10800 IN A 192.168.178.2\""
|
"\"pie.local. 10800 IN A 192.168.178.2\""
|
||||||
"\"pie.local. 10800 IN AAAA 2a02:908:5b1:e3c0:3077:2::\""
|
"\"pie.local. 10800 IN AAAA 2a02:908:5b1:e3c0:3077:2::\""
|
||||||
|
|
||||||
"\"vpn.b12f.io. 10800 IN AAAA 2a02:908:5b1:e3c0:3077:2::\""
|
|
||||||
|
|
||||||
"\"pie.b12f.io. 10800 IN A 10.0.1.2\""
|
"\"pie.b12f.io. 10800 IN A 10.0.1.2\""
|
||||||
"\"firefly.b12f.io. 10800 IN A 10.0.1.2\""
|
"\"firefly.b12f.io. 10800 IN A 10.0.1.2\""
|
||||||
"\"firefly-importer.b12f.io. 10800 IN A 10.0.1.2\""
|
"\"firefly-importer.b12f.io. 10800 IN A 10.0.1.2\""
|
||||||
"\"paperless.b12f.io. 10800 IN A 10.0.1.2\""
|
"\"paperless.b12f.io. 10800 IN A 10.0.1.2\""
|
||||||
"\"invoicing.b12f.io. 10800 IN A 10.0.1.2\""
|
"\"invoicing.b12f.io. 10800 IN A 10.0.1.2\""
|
||||||
|
|
||||||
|
"\"vpn.b12f.io. 10800 IN A 128.140.109.213\""
|
||||||
|
"\"vpn.b12f.io. 10800 IN AAAA 2a02:908:5b1:e3c0:3077:2::\""
|
||||||
|
|
||||||
|
"\"frikandel.b12f.io. 10800 IN A 10.0.1.7\""
|
||||||
|
|
||||||
"\"fritz.box. 10800 IN A 192.168.178.1\""
|
"\"fritz.box. 10800 IN A 192.168.178.1\""
|
||||||
"\"fritz.box. 10800 IN AAAA fd00::3ea6:2fff:fe57:30b0\""
|
"\"fritz.box. 10800 IN AAAA fd00::3ea6:2fff:fe57:30b0\""
|
||||||
];
|
];
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib; let
|
||||||
cfg = config.pub-solar.core;
|
cfg = config.pub-solar.core;
|
||||||
|
psCfg = config.pub-solar;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./boot.nix
|
./boot.nix
|
||||||
|
@ -28,6 +29,17 @@ in {
|
||||||
|
|
||||||
# Limit the use of sudo to the group wheel
|
# Limit the use of sudo to the group wheel
|
||||||
security.sudo.execWheelOnly = true;
|
security.sudo.execWheelOnly = true;
|
||||||
|
security.sudo.extraRules = [
|
||||||
|
{
|
||||||
|
users = ["${psCfg.user.name}"];
|
||||||
|
commands = [
|
||||||
|
{
|
||||||
|
command = "ALL";
|
||||||
|
options = ["NOPASSWD"];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
# Remove the complete default environment of packages like
|
# Remove the complete default environment of packages like
|
||||||
# nano, perl and rsync
|
# nano, perl and rsync
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.enable = true;
|
networking.firewall.enable = true;
|
||||||
|
networking.nftables.enable = true;
|
||||||
|
|
||||||
# For rage encryption, all hosts need a ssh key pair
|
# For rage encryption, all hosts need a ssh key pair
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
|
|
|
@ -35,10 +35,10 @@ in {
|
||||||
privateKeyFile = cfg.wireguardPrivateKeyFile;
|
privateKeyFile = cfg.wireguardPrivateKeyFile;
|
||||||
peers = [
|
peers = [
|
||||||
{
|
{
|
||||||
# pie-server
|
# frikandel
|
||||||
publicKey = "8M/+y6AqbSsbK0JENkjRXqlRR56iiM/QRjGGtEM+Uj8=";
|
publicKey = "p6YKNYBlySKfhTN+wbSsKdoNjzko/XSAiTAlCJzP1jA=";
|
||||||
allowedIPs = [ "10.0.1.2/32" ];
|
allowedIPs = [ "10.0.1.0/24" ];
|
||||||
endpoint = "[2a02:908:5b1:e3c0:3077:2::]:51898";
|
endpoint = "[2a01:4f8:c2c:b60::]:51899";
|
||||||
persistentKeepalive = 25;
|
persistentKeepalive = 25;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -12,6 +12,8 @@ let
|
||||||
|
|
||||||
pie-host = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINcTORdlVno0B9R6Yh9qmlOZKA/ZQ8RBzXK7/1rBbE02 root@pie.local";
|
pie-host = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINcTORdlVno0B9R6Yh9qmlOZKA/ZQ8RBzXK7/1rBbE02 root@pie.local";
|
||||||
|
|
||||||
|
frikandel-host = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPzrEsby3KYpKRuSnTMp2Iq4ENgucQUy6SJ+906nwllS root@frikandel";
|
||||||
|
|
||||||
baseKeys = [
|
baseKeys = [
|
||||||
bbcom
|
bbcom
|
||||||
];
|
];
|
||||||
|
@ -34,6 +36,10 @@ let
|
||||||
pieKeys = [
|
pieKeys = [
|
||||||
pie-host
|
pie-host
|
||||||
];
|
];
|
||||||
|
|
||||||
|
frikandelKeys = [
|
||||||
|
frikandel-host
|
||||||
|
];
|
||||||
in {
|
in {
|
||||||
"vnc-cert-chocolatebar.pem".publicKeys = chocolatebarKeys ++ baseKeys;
|
"vnc-cert-chocolatebar.pem".publicKeys = chocolatebarKeys ++ baseKeys;
|
||||||
"vnc-key-chocolatebar.pem".publicKeys = chocolatebarKeys ++ baseKeys;
|
"vnc-key-chocolatebar.pem".publicKeys = chocolatebarKeys ++ baseKeys;
|
||||||
|
@ -63,6 +69,7 @@ in {
|
||||||
"wg-private-pie.age".publicKeys = pieKeys ++ baseKeys;
|
"wg-private-pie.age".publicKeys = pieKeys ++ baseKeys;
|
||||||
"wg-private-droppie.age".publicKeys = droppieKeys ++ baseKeys;
|
"wg-private-droppie.age".publicKeys = droppieKeys ++ baseKeys;
|
||||||
"wg-private-pie-server.age".publicKeys = pieKeys ++ baseKeys;
|
"wg-private-pie-server.age".publicKeys = pieKeys ++ baseKeys;
|
||||||
|
"wg-private-frikandel-server.age".publicKeys = frikandelKeys ++ baseKeys;
|
||||||
|
|
||||||
"invoiceplane-db-password.age".publicKeys = pieKeys ++ baseKeys;
|
"invoiceplane-db-password.age".publicKeys = pieKeys ++ baseKeys;
|
||||||
"invoiceplane-db-secrets.env".publicKeys = pieKeys ++ baseKeys;
|
"invoiceplane-db-secrets.env".publicKeys = pieKeys ++ baseKeys;
|
||||||
|
|
BIN
secrets/wg-private-frikandel-server.age
Normal file
BIN
secrets/wg-private-frikandel-server.age
Normal file
Binary file not shown.
Loading…
Reference in a new issue