From 579fe9226d478f598be3f26329a7b6af01b9a24d Mon Sep 17 00:00:00 2001 From: somebody Date: Thu, 18 Apr 2024 13:55:06 +0200 Subject: [PATCH] DHCP: Add control socket and tools --- nix/nixos-module/container/dhcp-server.nix | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/nix/nixos-module/container/dhcp-server.nix b/nix/nixos-module/container/dhcp-server.nix index 64883d8..de9c0f7 100644 --- a/nix/nixos-module/container/dhcp-server.nix +++ b/nix/nixos-module/container/dhcp-server.nix @@ -176,6 +176,16 @@ in builtins.attrValues ( builtins.mapAttrs makePxe pxeClassData ); + + control-socket = { + socket-type = "unix"; + socket-name = "/run/kea/dhcp4-socket"; + }; + hooks-libraries = [ { + library = "/run/current-system/sw/lib/kea/hooks/libdhcp_stat_cmds.so"; + } { + library = "/run/current-system/sw/lib/kea/hooks/libdhcp_lease_cmds.so"; + } ]; }; }; services.kea.dhcp6 = lib.mkIf enabled { @@ -245,6 +255,15 @@ in # else null # ) dhcp.fixed-hosts # ))); + control-socket = { + socket-type = "unix"; + socket-name = "/run/kea/dhcp6.socket"; + }; + hooks-libraries = [ { + library = "/run/current-system/sw/lib/kea/hooks/libdhcp_stat_cmds.so"; + } { + library = "/run/current-system/sw/lib/kea/hooks/libdhcp_lease_cmds.so"; + } ]; }; }; services.kea.dhcp-ddns = lib.mkIf enabled { @@ -281,6 +300,28 @@ in lib.hasSuffix ".ip6.arpa" name) ) config.site.dns.localZones ); + control-socket = { + socket-type = "unix"; + socket-name = "/run/kea/dhcp-ddns.socket"; + }; + }; + }; + + services.kea.ctrl-agent = lib.mkIf enabled { + enable = true; + settings.control-sockets = { + dhcp4 = { + socket-type = "unix"; + socket-name = "/run/kea/dhcp4.socket"; + }; + dhcp6 = { + socket-type = "unix"; + socket-name = "/run/kea/dhcp6.socket"; + }; + d2 = { + socket-type = "unix"; + socket-name = "/run/kea/dhcp-ddns.socket"; + }; }; };