2021-02-08 22:26:22 +00:00
|
|
|
# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
{ depot, lib, pkgs, rebuilder, config, ... }:
|
|
|
|
let
|
|
|
|
inherit (depot.ops) secrets;
|
2021-03-29 11:47:44 +00:00
|
|
|
|
|
|
|
internetAddresses = {
|
|
|
|
v4 = { local = "195.74.55.21"; remote = "195.74.55.20"; };
|
|
|
|
v6 = {
|
|
|
|
local = "2a03:ee40:8080:9:1::2";
|
|
|
|
remote = "2a03:ee40:8080:9:1::1";
|
|
|
|
};
|
|
|
|
};
|
2021-02-08 22:26:22 +00:00
|
|
|
in {
|
|
|
|
imports = [
|
2021-03-29 11:47:44 +00:00
|
|
|
../lib/bgp.nix
|
2021-02-08 22:26:22 +00:00
|
|
|
../lib/blade.nix
|
2021-03-22 02:43:17 +00:00
|
|
|
../lib/fup.nix
|
2021-02-08 22:26:22 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
boot.loader.grub.device = "/dev/disk/by-id/usb-USB_SanDisk_3.2Gen1_0101cabb1ebdbdc0fd7b18edd207d43717c39c4a59d1b138b363e315841eca15743400000000000000000000443273100087260091558107b6a8e06e-0:0";
|
|
|
|
|
2021-03-29 11:47:44 +00:00
|
|
|
services.lukegbgp = {
|
|
|
|
enable = true;
|
|
|
|
config = {
|
|
|
|
local.routerID = internetAddresses.v4.local;
|
|
|
|
peering.veloxserv = {
|
|
|
|
local = {
|
|
|
|
asn = 205479;
|
|
|
|
v4 = internetAddresses.v4.local;
|
|
|
|
v6 = internetAddresses.v6.local;
|
|
|
|
};
|
|
|
|
remote = {
|
|
|
|
asn = 3170;
|
|
|
|
export_community = 4001;
|
|
|
|
routers = [{ v4 = internetAddresses.v4.remote; v6 = internetAddresses.v6.remote; }];
|
|
|
|
};
|
|
|
|
};
|
2021-03-29 12:06:39 +00:00
|
|
|
export.v4 = [ "92.118.28.0/24" ];
|
|
|
|
export.v6 = [ "2a09:a441::/32" ];
|
2021-03-29 11:47:44 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-02-08 22:26:22 +00:00
|
|
|
# Networking!
|
|
|
|
networking = {
|
|
|
|
hostName = "blade-tuvok";
|
|
|
|
hostId = "525229f7";
|
2021-03-29 20:39:42 +00:00
|
|
|
interfaces.br-public.ipv4.addresses = [{
|
|
|
|
address = "92.118.28.253";
|
|
|
|
prefixLength = 24;
|
|
|
|
}];
|
|
|
|
interfaces.br-public.ipv6.addresses = [{
|
|
|
|
address = "2a09:a441::fffe";
|
|
|
|
prefixLength = 48;
|
|
|
|
}];
|
2021-03-12 14:47:08 +00:00
|
|
|
interfaces.en-internet.ipv4.addresses = [{
|
2021-03-29 11:47:44 +00:00
|
|
|
address = internetAddresses.v4.local;
|
2021-03-12 14:47:08 +00:00
|
|
|
prefixLength = 31;
|
2021-02-08 22:26:22 +00:00
|
|
|
}];
|
2021-03-12 14:47:08 +00:00
|
|
|
interfaces.en-internet.ipv6.addresses = [{
|
2021-03-29 11:47:44 +00:00
|
|
|
address = internetAddresses.v6.local;
|
2021-03-12 14:47:08 +00:00
|
|
|
prefixLength = 126;
|
|
|
|
}];
|
2021-03-29 11:47:44 +00:00
|
|
|
defaultGateway = internetAddresses.v4.remote;
|
|
|
|
defaultGateway6 = internetAddresses.v6.remote;
|
2021-03-19 21:27:42 +00:00
|
|
|
firewall.allowedTCPPorts = [ 80 443 ];
|
2021-03-20 01:08:33 +00:00
|
|
|
firewall.extraCommands = "iptables -A INPUT -p vrrp -i br-mgmt -j ACCEPT";
|
2021-02-08 22:26:22 +00:00
|
|
|
};
|
2021-02-08 22:33:42 +00:00
|
|
|
my.ip.tailscale = "100.119.123.33";
|
2021-03-12 14:47:08 +00:00
|
|
|
my.blade.bay = 6;
|
|
|
|
my.blade.macAddress = {
|
|
|
|
internal = "e4:11:5b:ac:e3:fe";
|
|
|
|
storage = "e4:11:5b:ac:e4:02";
|
|
|
|
internet = "e4:11:5b:ac:e4:00";
|
|
|
|
};
|
2021-02-09 01:17:54 +00:00
|
|
|
|
|
|
|
services.ceph = {
|
|
|
|
mon.enable = true;
|
2021-02-09 22:29:11 +00:00
|
|
|
osd = {
|
|
|
|
enable = true;
|
|
|
|
daemons = [ "3" ];
|
|
|
|
};
|
2021-02-09 01:17:54 +00:00
|
|
|
};
|
2021-03-19 19:45:03 +00:00
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
virtualHosts."objdump.zxcvbnm.ninja" = {
|
|
|
|
useACMEHost = "objdump.zxcvbnm.ninja";
|
|
|
|
default = true;
|
|
|
|
forceSSL = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://localhost:7480";
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_redirect off;
|
|
|
|
client_max_body_size 0;
|
|
|
|
proxy_buffering off;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
security.acme = {
|
|
|
|
acceptTerms = true;
|
|
|
|
email = "letsencrypt@lukegb.com";
|
|
|
|
certs."objdump.zxcvbnm.ninja" = {
|
|
|
|
group = config.services.nginx.group;
|
|
|
|
dnsProvider = "cloudflare";
|
|
|
|
credentialsFile = secrets.cloudflareCredentials;
|
|
|
|
extraDomainNames = [
|
|
|
|
"*.objdump.zxcvbnm.ninja"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2021-03-22 02:50:27 +00:00
|
|
|
my.fup.listen = [
|
2021-03-22 13:46:28 +00:00
|
|
|
"0.0.0.0" "[::]"
|
2021-03-22 02:50:27 +00:00
|
|
|
];
|
2021-03-20 01:08:33 +00:00
|
|
|
|
2021-03-29 21:36:03 +00:00
|
|
|
services.keepalived = let
|
|
|
|
mgmtBase = {
|
2021-03-20 01:08:33 +00:00
|
|
|
interface = "br-mgmt";
|
|
|
|
state = "MASTER";
|
|
|
|
priority = 50;
|
2021-03-29 21:36:03 +00:00
|
|
|
};
|
|
|
|
in {
|
|
|
|
enable = true;
|
|
|
|
vrrpInstances.mgmtGateway = mgmtBase // {
|
2021-03-29 11:47:44 +00:00
|
|
|
virtualIps = [
|
|
|
|
{ addr = "10.100.0.1/23"; }
|
|
|
|
{ addr = "92.118.28.1/24"; dev = "br-public"; }
|
|
|
|
];
|
2021-03-20 01:08:33 +00:00
|
|
|
virtualRouterId = 1;
|
|
|
|
};
|
2021-03-29 21:36:03 +00:00
|
|
|
vrrpInstances.mgmtGateway6 = mgmtBase // {
|
|
|
|
virtualIps = [
|
|
|
|
{ addr = "2a09:a441::/48"; dev = "br-public"; }
|
|
|
|
];
|
|
|
|
virtualRouterId = 2;
|
|
|
|
};
|
2021-03-20 01:08:33 +00:00
|
|
|
};
|
2021-02-08 22:26:22 +00:00
|
|
|
}
|