2023-04-20 21:30:16 +02:00
|
|
|
// Copyright (C) 2014-2023 Internet Systems Consortium, Inc. ("ISC")
|
2014-05-06 15:37:00 +02:00
|
|
|
//
|
2015-12-15 21:37:34 +01:00
|
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2014-05-06 15:37:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
|
2014-05-06 17:41:55 +01:00
|
|
|
@page configBackend Kea Configuration Backends
|
2014-05-06 15:37:00 +02:00
|
|
|
|
2014-05-06 17:41:55 +01:00
|
|
|
@section configBackendIntro Introduction
|
2014-05-06 15:37:00 +02:00
|
|
|
|
2016-09-20 20:45:23 +01:00
|
|
|
Kea started as a sub-project in BIND10 that used a program (called
|
|
|
|
bindctl) to deliver configuration information to its modules. This
|
|
|
|
potentially allowed for modules to get their configuration information
|
2017-07-23 17:19:23 -04:00
|
|
|
in a variety of ways using what were known as configuration backends.
|
2016-09-20 20:45:23 +01:00
|
|
|
After BIND10 was cancelled, the Kea project briefly tried to maintain
|
|
|
|
backward compatibility with the BIND10 framework, but the effort
|
|
|
|
was discontinued due to lack of interest.
|
|
|
|
|
|
|
|
Currently the Kea team does not plan to develop any additional
|
|
|
|
configuration backends. Instead, effort is being focused on enhancing
|
|
|
|
the current control channel (see @ref ctrlSocket) to be as flexible
|
|
|
|
as possible. If you are thinking about developing new ways to
|
|
|
|
configure Kea, the recommendation is to write an external piece of
|
|
|
|
software that will communicate with Kea using this channel.
|
2016-09-19 22:43:27 +02:00
|
|
|
|
2016-09-21 10:01:44 +02:00
|
|
|
@section configBackendHistoric Alternate Configuration Backends
|
2016-09-19 22:43:27 +02:00
|
|
|
|
2016-09-20 20:45:23 +01:00
|
|
|
While this section currently has no practical value, it may become useful
|
2016-09-19 22:43:27 +02:00
|
|
|
one day to develop a minimalistic, stripped down Kea version that does
|
|
|
|
not have any command interface at all. This could prove useful for running
|
|
|
|
Kea in embedded regime.
|
|
|
|
|
2016-09-20 20:45:23 +01:00
|
|
|
The following steps are needed for the DHCPv4 server to be able to
|
|
|
|
process a new method of configuration. (It is assumed that the
|
|
|
|
modified component is DHCPv4. Similar approach applies to the other
|
|
|
|
components: DHCPv6 or DHCP-DDNS):
|
2014-06-18 20:46:21 +02:00
|
|
|
|
|
|
|
-# Write your own implementation of isc::dhcp::ControlledDhcpv4Srv::init(),
|
2016-09-20 20:45:23 +01:00
|
|
|
isc::dhcp::ControlledDhcpv4Srv::init() and isc::dhcp::ControlledDhcpv4Srv::cleanup(),
|
2014-07-11 14:32:37 +01:00
|
|
|
and put it in the src/bin/dhcp4 directory (e.g. as foo_controller.cc).
|
|
|
|
-# Modify src/bin/dhcp4/Makefile.am to include your file (e.g. foo_controller.cc) in
|
|
|
|
the build.
|
|
|
|
-# Modify the AC_ARG_WITH(kea-config,...) macro in configure.ac to include an
|
|
|
|
entry for your configuration backend.
|
|
|
|
-# Add your own AM_CONDITIONAL(CONFIG_BACKEND_FOO, ...) and
|
|
|
|
AC_DEFINE(CONFIG_BACKEND_FOO, ...) macros to configure.ac (following the
|
|
|
|
above-mentioned AC_ARG_WITH macro) to set the C++ macro for your backend.
|
|
|
|
-# Modify the sanity check in configure.ac to allow your configuration backend name.
|
2014-06-18 20:46:21 +02:00
|
|
|
|
|
|
|
Optionally you can also:
|
|
|
|
|
2014-07-11 14:32:37 +01:00
|
|
|
-# Implement unit tests for your backend in the src/bin/dhcp4/tests directory.
|
|
|
|
-# Modify src/bin/dhcp4/tests/Makefile.am to include the file(s) containing the
|
|
|
|
unit tests.
|
2014-05-06 15:37:00 +02:00
|
|
|
|
2014-05-06 17:41:55 +01:00
|
|
|
@section configBackendJSONDesign The JSON Configuration Backend
|
2014-05-06 15:37:00 +02:00
|
|
|
|
2014-07-11 14:32:37 +01:00
|
|
|
The following are some details of the JSON backend framework.
|
2014-05-06 15:37:00 +02:00
|
|
|
|
2014-07-11 14:32:37 +01:00
|
|
|
-# Each backend uses the common code for configuration and command
|
2014-06-18 20:46:21 +02:00
|
|
|
processing callbacks. They all assume that JSON formatted parameters are sent
|
|
|
|
and they are expected to return well formatted JSON responses. The exact
|
2014-07-11 14:32:37 +01:00
|
|
|
format of configuration and commands is module-specific.<br/><br/>
|
|
|
|
-# A command handler handles the reading the configuration from a
|
2014-06-18 20:46:21 +02:00
|
|
|
file. Its main responsibility is to load the configuration and process
|
|
|
|
it. The JSON backend must call that handler when starting up the server.
|
2014-07-11 14:32:37 +01:00
|
|
|
This is implemented in configure() in the kea_controller.cc files
|
|
|
|
in src/bin/dhcp4 and src/bin/dhcp6 directories.<br/><br/>
|
|
|
|
-# The current JSON parser in @ref
|
|
|
|
isc::data::Element::fromJSON() has been extended to allow optional
|
2023-04-19 17:58:06 +03:00
|
|
|
preprocessing. For now, that capability simply removes whole-line
|
2014-07-11 14:32:37 +01:00
|
|
|
comments starting with the hash character, but it is expected to grow over
|
2014-06-18 20:46:21 +02:00
|
|
|
time (in-line comments and file inclusions are the obvious envisaged
|
2014-07-11 14:32:37 +01:00
|
|
|
additions). This is implemented in @ref isc::data::Element::fromJSONFile.<br/><br/>
|
2014-07-09 13:57:56 +02:00
|
|
|
-# The current format of the BIND10 configuration file (BIND 10 stored its
|
2014-07-11 14:32:37 +01:00
|
|
|
configuration in (installation directory) /var/bind10/b10-config.db) has been
|
2014-07-09 13:57:56 +02:00
|
|
|
retained as the configuration file format. Its actual naming is now arbitrary
|
|
|
|
and left up to the user (it is passed as a parameter to the -c command line
|
|
|
|
option). From the implementation perspective, this is slight change
|
|
|
|
from the BIND10 days, as back then a subset of the configuration was received by
|
2014-10-29 06:44:33 -07:00
|
|
|
the daemon processes. Nowadays the whole configuration is passed. To take a
|
2020-06-18 16:29:16 +02:00
|
|
|
specific example, the following is how b10-config.db looked many years ago:
|
2014-05-06 15:37:00 +02:00
|
|
|
@code
|
|
|
|
{
|
|
|
|
"Init": { ... }
|
|
|
|
"Dhcp4": {
|
|
|
|
"subnet4" { subnet definitions here },
|
|
|
|
"option-data" { option data here },
|
|
|
|
"interfaces": [ "eth0" ],
|
|
|
|
...
|
|
|
|
},
|
|
|
|
"Dhcp6": {
|
|
|
|
"subnet6" { subnet definitions here },
|
|
|
|
"option-data" { option data here },
|
|
|
|
"interfaces": [ "eth0" ],
|
|
|
|
...
|
|
|
|
},
|
|
|
|
"Logging": {
|
|
|
|
"Loggers": [{"name": *, "severity": "DEBUG" }]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@endcode
|
2014-05-06 17:41:55 +01:00
|
|
|
The Kea components used to receive only relevant parts of it (e.g. Kea4
|
2014-07-11 14:32:37 +01:00
|
|
|
received configuration data that only contained the content of the Dhcp4 element).
|
|
|
|
Now each component receives all of it: the code
|
|
|
|
iterates over the top level elements and picks the appropriate
|
|
|
|
tree (or get the element by name). That approach makes the common configuration
|
|
|
|
(such as the logging initialization code) very easy to share among Kea4, Kea6 and
|
|
|
|
DHCP-DDNS.<br/><br/>
|
2014-05-06 17:41:55 +01:00
|
|
|
-# The .spec files used in BIND 10 by the control program to validate commands
|
2017-12-17 00:38:14 +01:00
|
|
|
have been removed in 1.4.<br/><br/>
|
2014-07-11 14:32:37 +01:00
|
|
|
-# A shell script has been added (as src/bin/keactrl/keactrl) to
|
2014-05-06 17:41:55 +01:00
|
|
|
start, stop and reconfigure the daemons. Its only
|
2014-07-11 14:32:37 +01:00
|
|
|
job is to pass the configuration file to each daemon and remember its PID file, so
|
|
|
|
that sending signals is possible (for configuration reload or shutdown). It is also
|
2020-06-18 16:29:16 +02:00
|
|
|
able to print out a status.<br/><br/>
|
|
|
|
-# The capability to share the same configuration file between servers and
|
2020-06-29 16:12:36 +02:00
|
|
|
agents, and the Logging toplevel entry, were removed in 1.7.10.
|
2014-05-06 17:41:55 +01:00
|
|
|
*/
|