2021-09-24 22:50:30 +00:00
|
|
|
# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2021-09-27 08:00:41 +00:00
|
|
|
{ config, depot, lib, pkgs, ... }:
|
2021-09-24 22:50:30 +00:00
|
|
|
let
|
|
|
|
inherit (depot.ops) secrets;
|
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
../lib/bvm.nix
|
2021-09-25 20:51:24 +00:00
|
|
|
../lib/as205479-web.nix
|
2021-09-25 18:28:45 +00:00
|
|
|
./radius.nix
|
2021-09-24 22:50:30 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# Networking!
|
|
|
|
networking = {
|
|
|
|
hostName = "bvm-radius";
|
|
|
|
hostId = "dcc75f10";
|
2021-09-25 17:38:09 +00:00
|
|
|
tempAddresses = "disabled";
|
2021-09-24 22:50:30 +00:00
|
|
|
|
|
|
|
interfaces.enp1s0 = {
|
|
|
|
ipv4.addresses = [{ address = "10.100.0.207"; prefixLength = 23; }];
|
|
|
|
};
|
|
|
|
interfaces.enp2s0 = {
|
|
|
|
ipv4.addresses = [{ address = "92.118.28.9"; prefixLength = 24; }];
|
|
|
|
ipv6.addresses = [{ address = "2a09:a441::9"; prefixLength = 32; }];
|
|
|
|
};
|
|
|
|
defaultGateway = { address = "92.118.28.1"; interface = "enp2s0"; };
|
|
|
|
defaultGateway6 = { address = "2a09:a441::1"; interface = "enp2s0"; };
|
2021-09-25 12:32:27 +00:00
|
|
|
|
|
|
|
firewall = {
|
2021-09-25 20:51:24 +00:00
|
|
|
allowedTCPPorts = [ 80 443 ];
|
|
|
|
allowedUDPPorts = [ 443 ];
|
2021-09-25 12:32:27 +00:00
|
|
|
extraCommands = ''
|
|
|
|
# Allow JANET inbound RADIUS traffic.
|
2021-09-25 12:39:44 +00:00
|
|
|
# roaming0.ja.net
|
|
|
|
iptables -A nixos-fw -p udp --dport 1812 --src 194.82.174.185 -j nixos-fw-accept
|
|
|
|
ip6tables -A nixos-fw -p udp --dport 1812 --src 2001:630:1:128::185 -j nixos-fw-accept
|
|
|
|
# roaming1.ja.net
|
|
|
|
iptables -A nixos-fw -p udp --dport 1812 --src 194.83.56.233 -j nixos-fw-accept
|
|
|
|
ip6tables -A nixos-fw -p udp --dport 1812 --src 2001:630:1:12a::233 -j nixos-fw-accept
|
2022-01-07 11:49:24 +00:00
|
|
|
# roaming2.ja.net (old)
|
2021-09-25 12:39:44 +00:00
|
|
|
iptables -A nixos-fw -p udp --dport 1812 --src 194.83.56.249 -j nixos-fw-accept
|
|
|
|
ip6tables -A nixos-fw -p udp --dport 1812 --src 2001:630:1:129::249 -j nixos-fw-accept
|
2022-01-07 11:49:24 +00:00
|
|
|
# roaming2.ja.net (new)
|
|
|
|
iptables -A nixos-fw -p udp --dport 1812 --src 193.63.195.50 -j nixos-fw-accept
|
|
|
|
ip6tables -A nixos-fw -p udp --dport 1812 --src 2001:630:1:133::50 -j nixos-fw-accept
|
2021-09-25 12:32:27 +00:00
|
|
|
|
|
|
|
# Allow inbound RADIUS from authenticators.
|
|
|
|
ip6tables -A nixos-fw -p udp --dport 1812 --src 2a09:a443::/64 -j nixos-fw-accept
|
|
|
|
iptables -A nixos-fw -p udp --dport 1812 --src 92.118.30.0/24 -j nixos-fw-accept
|
|
|
|
'';
|
|
|
|
};
|
2021-09-24 22:50:30 +00:00
|
|
|
};
|
2021-09-25 12:19:07 +00:00
|
|
|
my.ip.tailscale = "100.120.98.116";
|
2021-09-24 22:50:30 +00:00
|
|
|
|
2022-03-07 00:52:03 +00:00
|
|
|
my.vault.acmeCertificates."as205479.net" = {
|
|
|
|
group = "acme";
|
|
|
|
reloadOrRestartUnits = [ "freeradius.service" ];
|
2021-09-25 17:38:09 +00:00
|
|
|
};
|
2021-09-27 08:00:41 +00:00
|
|
|
users.users.nginx.extraGroups = lib.mkAfter [ "acme" ];
|
2021-09-25 17:38:09 +00:00
|
|
|
|
2021-09-24 22:50:30 +00:00
|
|
|
system.stateVersion = "21.05";
|
|
|
|
}
|