Feature #17615
openIntroduce KEA DHCP provider for smart-proxy
Description
Introduce KEA DHCP provider for smart-proxy.
KEA is next-gen fast milti-node DHCP server by ISC. It uses DB backend not just for leases and reservations, but for a configuration as well.
The (planned) API allows user to query/configure/manage all aspects of KEA and DHCP operations eliminating the need for access to KEA nodes or DB.
However, that API is UNIX sockets only, thus this request to implement RESTful HTTP frontend to that API.
Updated by Konstantin Orekhov almost 8 years ago
Some additional resources on KEA that Dmitri had asked me in the original thread:
Kea has no management api whatsoever (it's a step backwards compared to dhcpd in this regard), which makes it pretty challenging to interface with it.
As per KEA's engineers, here's the current state of API - http://kea.isc.org/wiki/ControlAPIDesign.
and http://kea.isc.org/wiki/ControlAPIRequirements.
It's something, and in a way better than parsing leases file (oth it's worse -- db schemas change more often, which makes such an interface brittle). I don't remember finding db schema docs though, and personally would be hesitant to jump in before the project publishes this information.
KEA team response:
--------------------
The schemas are stable for a while, but we occasionally add something new. Obviously, our goal is to keep the changes backward compatible, but if that's not possible, we try to make the old schema migration as easy as possible. So far we mostly added new columns and new tables and not changed any of the existing fields. As you may be aware, we do have support for MySQL, PostgreSQL and recently added support for Cassandra, which remains a bit experimental. Regarding our schemas, you may want to read the following:
http://kea.isc.org/docs/kea-guide.html#kea-database-version
Sections 4.1 through 4.3 give you a good overview. As for the actual schemas, they're available in src/share/database/scripts in the Kea sources. Here's the direct link for our github repo:
https://github.com/isc-projects/kea/tree/master/src/share/database/scripts
For example, for MySQL go to mysql/dhcpdb_create.mysql for the latest schema or check the upgrade_A.B_to_C.D files for upgrade scripts for older schemas.
--------------------
Until KEA APIs are released, this page describes interactions with the DB directly (something I think KEA smart-proxy could use now) - http://kea.isc.org/wiki/HostReservationsHowTo
Updated by Perry Gagne over 7 years ago
Looks like there management API is coming along.
Updated by Matt Williams about 6 years ago
Perry Gagne wrote:
Looks like there management API is coming along.
As of Kea 1.2 (released April 2017), there is a full REST API provided https://kea.isc.org/docs/kea-guide.html#kea-ctrl-agent and https://kea.isc.org/docs/kea-guide.html#ctrl-channel
Updated by Lukas Zapletal about 2 years ago
For the record, a smart proxy plugin does seem to exist, but the code is not available (e.g. might not be even open source): https://rubygems.org/gems/smart_proxy_dhcp_kea
Updated by Bernhard Suttner about 2 years ago
I contacted the author of the smart_proxy_dhcp_kea plugin. Hope he will respond and provide the source code of the plugin.
Updated by Djerk Geurts about 2 years ago
Bernhard Suttner wrote:
I contacted the author of the smart_proxy_dhcp_kea plugin. Hope he will respond and provide the source code of the plugin.
Thank you!
As a note of caution, this plugin expects a local KEA installation. As such it doesn't use a REST API for remotely managing a KEA server. At least that's my understanding from the example config file /usr/local/share/gems/gems/smart_proxy_dhcp_kea-0.1.2/config/dhcp_remote_kea.yml.example
:
---
#
# Configuration file for ISC dhcp provider
#
#:config: /etc/dhcp/dhcpd.conf
#:leases: /var/lib/dhcpd/dhcpd.leases
#
# Redhat 5
#
#:config: /etc/dhcpd.conf
#
# Settings for Ubuntu
#
#:config: /etc/dhcp3/dhcpd.conf
#:leases: /var/lib/dhcp3/dhcpd.leases
# Specifies TSIG key name and secret
#:key_name: secret_key_name
#:key_secret: secret_key
#:omapi_port: 7911
# use :server setting in dhcp.yml if you are managing a dhcp server which is not localhost
Updated by Stephen Collier 11 months ago
the repo is at
https://gitlab.cern.ch/pcifra/smart-proxy-dhcp-kea
Source code can be examined