2024-05-13 18:03:00 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2023-12-03 17:35:07 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
imports = [ ./module.nix ];
|
|
|
|
|
|
|
|
services.k-radius = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
settings = {
|
|
|
|
# URL to the Kanidm server
|
|
|
|
uri = "https://sso.dgnum.eu";
|
|
|
|
|
|
|
|
# verify the hostname of the Kanidm server
|
|
|
|
verify_hostnames = "true";
|
|
|
|
|
|
|
|
# Strict CA verification
|
|
|
|
verify_ca = "false";
|
|
|
|
verify_certificate = "false";
|
|
|
|
|
|
|
|
# Path to the kanidm ca
|
|
|
|
|
|
|
|
# Default vlans for groups that don't specify one.
|
|
|
|
radius_default_vlan = 99;
|
|
|
|
|
|
|
|
# A list of Kanidm groups which must be a member
|
|
|
|
# before they can authenticate via RADIUS.
|
|
|
|
radius_required_groups = [ "radius_access@sso.dgnum.eu" ];
|
|
|
|
|
|
|
|
# A mapping between Kanidm groups and VLANS
|
|
|
|
radius_groups = [
|
|
|
|
{
|
2024-02-17 22:56:10 +01:00
|
|
|
spn = "dgnum_members@sso.dgnum.eu";
|
2023-12-03 17:35:07 +01:00
|
|
|
vlan = 1;
|
|
|
|
}
|
|
|
|
{
|
2024-02-17 22:56:10 +01:00
|
|
|
spn = "dgnum_clients@sso.dgnum.eu";
|
2023-12-03 17:35:07 +01:00
|
|
|
vlan = 2;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
authTokenFile = config.age.secrets."radius-auth_token_file".path;
|
2024-02-02 10:51:31 +01:00
|
|
|
privateKeyPasswordFile = config.age.secrets."radius-private_key_password_file".path;
|
2023-12-03 17:35:07 +01:00
|
|
|
|
2024-02-02 10:51:31 +01:00
|
|
|
certs = builtins.listToAttrs (
|
|
|
|
builtins.map (name: lib.nameValuePair name config.age.secrets."radius-${name}_pem_file".path) [
|
2023-12-03 17:35:07 +01:00
|
|
|
"ca"
|
|
|
|
"cert"
|
|
|
|
"dh"
|
|
|
|
"key"
|
2024-02-02 10:51:31 +01:00
|
|
|
]
|
|
|
|
);
|
2023-12-03 17:35:07 +01:00
|
|
|
|
|
|
|
radiusClients = { };
|
2024-05-13 18:03:00 +02:00
|
|
|
|
|
|
|
extra-mods = {
|
|
|
|
dhcp_sql = import ./mod-dhcp_sql.nix {
|
|
|
|
inherit pkgs;
|
|
|
|
vlans = import ../user_vlans.nix;
|
|
|
|
};
|
|
|
|
dhcp_sqlippool = ./mod-dhcp_sqlippool;
|
|
|
|
};
|
|
|
|
extra-sites = {
|
|
|
|
dhcp = import ./site-dhcp.nix {
|
|
|
|
inherit pkgs;
|
|
|
|
vlans = import ../user_vlans.nix;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
dictionary = {
|
|
|
|
Client-Vlan = "integer";
|
|
|
|
Server-IP = "ipaddr";
|
|
|
|
Broadcast-IP = "ipaddr";
|
|
|
|
};
|
|
|
|
checkConfiguration = true;
|
2023-12-03 17:35:07 +01:00
|
|
|
};
|
|
|
|
|
2024-02-19 14:47:27 +01:00
|
|
|
age-secrets.autoMatch = [ "radius" ];
|
2023-12-03 17:35:07 +01:00
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [ 1812 ];
|
|
|
|
networking.firewall.allowedUDPPorts = [ 1812 ];
|
|
|
|
}
|