depot/ops/nixos/bvm-radius/default.nix

49 lines
1.5 KiB
Nix
Raw Normal View History

2021-09-24 22:50:30 +00:00
# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0
{ config, depot, pkgs, ... }:
let
inherit (depot.ops) secrets;
in {
imports = [
../lib/bvm.nix
];
# Networking!
networking = {
hostName = "bvm-radius";
hostId = "dcc75f10";
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 = {
extraCommands = ''
# Allow JANET inbound RADIUS traffic.
ip46tables -A nixos-fw -p udp --dport 1812 --src roaming0.ja.net -j nixos-fw-accept
ip46tables -A nixos-fw -p udp --dport 1812 --src roaming1.ja.net -j nixos-fw-accept
ip46tables -A nixos-fw -p udp --dport 1812 --src roaming2.ja.net -j nixos-fw-accept
# 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
2021-09-25 12:32:27 +00:00
environment.systemPackages = with pkgs; [
freeradius
];
2021-09-24 22:50:30 +00:00
system.stateVersion = "21.05";
}