agent.xml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
  4. <!ENTITY mdash "&#x2017;" >
  5. ]>
  6. <chapter id="kea-ctrl-agent">
  7. <title>Kea Control Agent</title>
  8. <section id="agent-overview">
  9. <title>Overview</title>
  10. <para>Kea Control Agent (CA) is a daemon, first included in Kea 1.2, which
  11. exposes a RESTful control interface for managing Kea servers. The daemon
  12. can receive control commands over HTTP and either forward these commands
  13. to the respective Kea servers or handle these commands on its own. The
  14. determination whether the command should be handled by the CA or forwarded
  15. is made by checking the value of the 'service' parameter which may be
  16. included in the command from the controlling client. The details of the
  17. supported commands as well as their structures are provided in
  18. <xref linkend="ctrl-channel"/>.</para>
  19. <para>Hook libraries can be attached to the CA to provide support for
  20. additional commands or custom behavior of existing commands. Such hook
  21. libraries must implement callouts for 'control_command_receive' hook point.
  22. Details about creating new hook libraries and supported hook points can be
  23. found in
  24. <ulink url="https://jenkins.isc.org/job/Kea_doc/doxygen/">Kea Developer's Guide</ulink>.
  25. </para>
  26. <para>
  27. The CA processes received commands according to the following algorithm:
  28. <itemizedlist>
  29. <listitem>
  30. <simpara>
  31. Pass command into any installed hooks (regardless of service value(s)).
  32. If the command is handled by a hook, return the response.
  33. </simpara>
  34. </listitem>
  35. <listitem>
  36. <simpara>
  37. If the service specifies one more or services, the CA will forward the
  38. command to specified services and return the accumulated responses.
  39. </simpara>
  40. </listitem>
  41. <listitem>
  42. <simpara>
  43. If service is not specified or is an empty list, the CA will handle
  44. the command if it supports it.
  45. </simpara>
  46. </listitem>
  47. </itemizedlist>
  48. </para>
  49. </section>
  50. <section id="agent-configuration">
  51. <title>Configuration</title>
  52. <para>The following example demonstrates the basic CA configuration.</para>
  53. <para>
  54. <screen>
  55. {
  56. "Control-agent": {
  57. "http-host": "10.20.30.40",
  58. "http-port": 8080,
  59. "control-sockets": {
  60. "dhcp4-server": {
  61. "socket-type": "unix",
  62. "socket-name": "/path/to/the/unix/socket-v4"
  63. },
  64. "dhcp6-server": {
  65. "socket-type": "unix",
  66. "socket-name": "/path/to/the/unix/socket-v4"
  67. }
  68. },
  69. "hooks-libraries": [
  70. {
  71. "library": "/opt/local/control-agent-commands.so",
  72. "parameters": {
  73. "param1": "foo"
  74. }
  75. } ]
  76. },
  77. "Logging": {
  78. "loggers": [ {
  79. "name": "kea-ctrl-agent",
  80. "severity": "INFO"
  81. } ]
  82. }
  83. }</screen>
  84. </para>
  85. <warning>
  86. <simpara>
  87. In the Kea 1.2 beta release the Control Agent configuration can't be
  88. specified within the same configuration file as DHCPv4, DHCPv6 and D2
  89. configuration. The default configuration file for the CA is installed
  90. in the <filename>etc/kea/kea-ca.conf</filename>. In the Kea 1.2 final
  91. release the CA configuration will be merged into the default
  92. <filename>etc/kea/kea.conf.</filename>
  93. </simpara>
  94. </warning>
  95. <para>
  96. The <command>http-host</command> and <command>http-port</command>
  97. specify an IP address and port to which HTTP service will be bound.
  98. In case of the example configuration provided above, the RESTful
  99. service will be available under the URL of
  100. <command>http://10.20.30.40:8080/</command>. If these parameters
  101. are not specified, the default URL is http://127.0.0.1:8000/
  102. </para>
  103. <para>
  104. It has been mentioned in the <xref linkend="agent-overview"/> that
  105. CA can forward received commands to the specific Kea servers for
  106. processing. For example, <command>config-get</command> is sent to
  107. retrieve configuration of one of the Kea services. When CA receives
  108. this command, including a <command>service</command> parameter
  109. indicating that the client desires to retrieve configuration of
  110. the DHCPv4 server, the CA will forward this command to this server
  111. and then pass the received response back to the client. More about
  112. the <command>service</command> parameter and general structure of
  113. the commands can be found in <xref linkend="ctrl-channel"/>.
  114. </para>
  115. <para>
  116. The CA uses unix domain sockets to forward control commands and receive
  117. responses from other Kea services. The <command>dhcp4-server</command>,
  118. <command>dhcp6-server</command> and <command>d2-server</command> maps
  119. specify the files to which unix domain sockets are bound. In case
  120. of the configuration above, the CA will connect to the DHCPv4 server
  121. via <filename>/path/to/the/unix/socket-v4</filename> to forward the
  122. commands to it. Obviously, the DHCPv4 server must be configured to
  123. listen to connections via this same socket. In other words, the command
  124. socket configuration for the DHCPv4 server and CA (for this server)
  125. must match. Consult the <xref linkend="dhcp4-ctrl-channel"/> and the
  126. <xref linkend="dhcp6-ctrl-channel"/> to learn how the socket
  127. configuration is specified for the DHCPv4 and DHCPv6 services.
  128. </para>
  129. <para>
  130. Hooks libraries can be attached to the Control Agent just like to
  131. DHCPv4 and DHCPv6 servers. It currently supports one hook point
  132. 'control_command_receive' which makes it possible to delegate
  133. processing of some commands to the hooks library. The
  134. <command>hooks-libraries</command> list contains the list of hooks
  135. libraries that should be loaded by the CA, along with their configuration
  136. information specified with <command>parameters</command>.
  137. </para>
  138. <para>
  139. Please consult <xref linkend="logging"/> for the details how to
  140. configure logging. The CA's root logger's name is
  141. <command>kea-ctrl-agent</command> as given in the example above.
  142. </para>
  143. </section>
  144. <section id="agent-secure-connection">
  145. <title>Secure Connections</title>
  146. <para>
  147. Control Agent doesn't natively support secure HTTP connections like
  148. SSL or TLS. In order to setup secure connection please use one
  149. of the available third party HTTP servers and configure it to run
  150. as a reverse proxy to the Control Agent.
  151. </para>
  152. </section>
  153. <section id="agent-limitations">
  154. <title>Control Agent Limitations</title>
  155. <para>
  156. Control Agent is a new component, first released in Kea 1.2 beta. In
  157. this release it comes with two notable limitations:
  158. <itemizedlist>
  159. <listitem>
  160. <simpara>
  161. CA configuration must be specified in a separate configuration file
  162. from the configurations of other components. The default confirguation
  163. file for CA is located in <filename>etc/kea/kea-ca.conf</filename>.
  164. </simpara>
  165. </listitem>
  166. <listitem>
  167. <simpara>
  168. keactrl hasn't been updated to manage the Control Agent (start, stop
  169. reload). As a result, the CA must be started directly as described in
  170. <xref linkend="agent-launch"/>
  171. </simpara>
  172. </listitem>
  173. </itemizedlist>
  174. </para>
  175. </section>
  176. <section id="agent-launch">
  177. <title>Starting Control Agent</title>
  178. <para>
  179. The CA is started by running its binary and specifying the configuration file
  180. it should use. For example:
  181. <screen>
  182. $ ./kea-ctrl-agent -c /usr/local/etc/kea/kea-ca.conf
  183. </screen>
  184. </para>
  185. </section>
  186. </chapter>