Kea 2.2.0
d2_config.cc
Go to the documentation of this file.
1// Copyright (C) 2013-2021 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#include <config.h>
8
9#include <d2srv/d2_log.h>
10#include <d2srv/d2_cfg_mgr.h>
13#include <asiolink/io_error.h>
14
15#include <boost/foreach.hpp>
16#include <boost/scoped_ptr.hpp>
17#include <boost/algorithm/string/predicate.hpp>
18
19#include <sstream>
20#include <string>
21
22using namespace isc::process;
23using namespace isc::data;
24
25namespace isc {
26namespace d2 {
27
28// *********************** D2Params *************************
29
31 const size_t port,
32 const size_t dns_server_timeout,
33 const dhcp_ddns::NameChangeProtocol& ncr_protocol,
34 const dhcp_ddns::NameChangeFormat& ncr_format)
35 : ip_address_(ip_address),
36 port_(port),
37 dns_server_timeout_(dns_server_timeout),
38 ncr_protocol_(ncr_protocol),
39 ncr_format_(ncr_format) {
41}
42
44 : ip_address_(isc::asiolink::IOAddress("127.0.0.1")),
45 port_(53001), dns_server_timeout_(100),
46 ncr_protocol_(dhcp_ddns::NCR_UDP),
47 ncr_format_(dhcp_ddns::FMT_JSON) {
49}
50
52
53void
55 if ((ip_address_.toText() == "0.0.0.0") || (ip_address_.toText() == "::")) {
57 "D2Params: IP address cannot be \"" << ip_address_ << "\"");
58 }
59
60 if (port_ == 0) {
61 isc_throw(D2CfgError, "D2Params: port cannot be 0");
62 }
63
64 if (dns_server_timeout_ < 1) {
66 "D2Params: DNS server timeout must be larger than 0");
67 }
68
69 if (ncr_format_ != dhcp_ddns::FMT_JSON) {
70 isc_throw(D2CfgError, "D2Params: NCR Format:"
71 << dhcp_ddns::ncrFormatToString(ncr_format_)
72 << " is not yet supported");
73 }
74
75 if (ncr_protocol_ != dhcp_ddns::NCR_UDP) {
76 isc_throw(D2CfgError, "D2Params: NCR Protocol:"
77 << dhcp_ddns::ncrProtocolToString(ncr_protocol_)
78 << " is not yet supported");
79 }
80}
81
82std::string
84 std::ostringstream s;
85 s << "listening on " << getIpAddress() << ", port " << getPort()
86 << ", using " << ncrProtocolToString(ncr_protocol_);
87 return (s.str());
88}
89
90bool
91D2Params::operator == (const D2Params& other) const {
92 return ((ip_address_ == other.ip_address_) &&
93 (port_ == other.port_) &&
94 (dns_server_timeout_ == other.dns_server_timeout_) &&
95 (ncr_protocol_ == other.ncr_protocol_) &&
96 (ncr_format_ == other.ncr_format_));
97}
98
99bool
100D2Params::operator != (const D2Params& other) const {
101 return (!(*this == other));
102}
103
104std::string
106 std::ostringstream stream;
107
108 stream << ", ip-address: " << ip_address_.toText()
109 << ", port: " << port_
110 << ", dns-server-timeout_: " << dns_server_timeout_
111 << ", ncr-protocol: "
112 << dhcp_ddns::ncrProtocolToString(ncr_protocol_)
113 << ", ncr-format: " << ncr_format_
114 << dhcp_ddns::ncrFormatToString(ncr_format_);
115
116 return (stream.str());
117}
118
119std::ostream&
120operator<<(std::ostream& os, const D2Params& config) {
121 os << config.toText();
122 return (os);
123}
124
125// *********************** TSIGKeyInfo *************************
126// Note these values match corresponding values for Bind9's
127// dnssec-keygen
128const char* TSIGKeyInfo::HMAC_MD5_STR = "HMAC-MD5";
129const char* TSIGKeyInfo::HMAC_SHA1_STR = "HMAC-SHA1";
130const char* TSIGKeyInfo::HMAC_SHA224_STR = "HMAC-SHA224";
131const char* TSIGKeyInfo::HMAC_SHA256_STR = "HMAC-SHA256";
132const char* TSIGKeyInfo::HMAC_SHA384_STR = "HMAC-SHA384";
133const char* TSIGKeyInfo::HMAC_SHA512_STR = "HMAC-SHA512";
134
135TSIGKeyInfo::TSIGKeyInfo(const std::string& name, const std::string& algorithm,
136 const std::string& secret, uint32_t digestbits)
137 :name_(name), algorithm_(algorithm), secret_(secret),
138 digestbits_(digestbits), tsig_key_() {
139 remakeKey();
140}
141
143}
144
145const dns::Name&
146TSIGKeyInfo::stringToAlgorithmName(const std::string& algorithm_id) {
147 if (boost::iequals(algorithm_id, HMAC_MD5_STR)) {
149 } else if (boost::iequals(algorithm_id, HMAC_SHA1_STR)) {
151 } else if (boost::iequals(algorithm_id, HMAC_SHA224_STR)) {
153 } else if (boost::iequals(algorithm_id, HMAC_SHA256_STR)) {
155 } else if (boost::iequals(algorithm_id, HMAC_SHA384_STR)) {
157 } else if (boost::iequals(algorithm_id, HMAC_SHA512_STR)) {
159 }
160
161 isc_throw(BadValue, "Unknown TSIG Key algorithm: " << algorithm_id);
162}
163
164void
165TSIGKeyInfo::remakeKey() {
166 try {
167 // Since our secret value is base64 encoded already, we need to
168 // build the input string for the appropriate D2TsigKey constructor.
169 // If secret isn't a valid base64 value, the constructor will throw.
170 std::ostringstream stream;
171 stream << dns::Name(name_).toText() << ":"
172 << secret_ << ":"
173 << stringToAlgorithmName(algorithm_);
174 if (digestbits_ > 0) {
175 stream << ":" << digestbits_;
176 }
177
178 tsig_key_.reset(new D2TsigKey(stream.str()));
179 } catch (const std::exception& ex) {
180 isc_throw(D2CfgError, "Cannot make D2TsigKey: " << ex.what());
181 }
182}
183
186 ElementPtr result = Element::createMap();
187 // Set user-context
188 contextToElement(result);
189 // Set name
190 result->set("name", Element::create(name_));
191 // Set algorithm
192 result->set("algorithm", Element::create(algorithm_));
193 // Set secret
194 result->set("secret", Element::create(secret_));
195 // Set digest-bits
196 result->set("digest-bits",
197 Element::create(static_cast<int64_t>(digestbits_)));
198
199 return (result);
200}
201
202// *********************** DnsServerInfo *************************
203DnsServerInfo::DnsServerInfo(const std::string& hostname,
204 isc::asiolink::IOAddress ip_address,
205 uint32_t port,
206 bool enabled,
207 const TSIGKeyInfoPtr& tsig_key_info,
208 bool inherited_key)
209 : hostname_(hostname), ip_address_(ip_address), port_(port),
210 enabled_(enabled), tsig_key_info_(tsig_key_info),
211 inherited_key_(inherited_key) {
212}
213
215}
216
217const std::string
219 if (tsig_key_info_) {
220 return (tsig_key_info_->getName());
221 }
222
223 return ("");
224}
225
226std::string
228 std::ostringstream stream;
229 stream << (getIpAddress().toText()) << " port:" << getPort();
230 return (stream.str());
231}
232
235 ElementPtr result = Element::createMap();
236 // Set user-context
237 contextToElement(result);
238 // Set hostname
239 result->set("hostname", Element::create(hostname_));
240 // Set ip-address
241 result->set("ip-address", Element::create(ip_address_.toText()));
242 // Set port
243 result->set("port", Element::create(static_cast<int64_t>(port_)));
244 // Set key-name
245 if (tsig_key_info_ && !inherited_key_) {
246 result->set("key-name", Element::create(tsig_key_info_->getName()));
247 }
248
249 return (result);
250}
251
252std::ostream&
253operator<<(std::ostream& os, const DnsServerInfo& server) {
254 os << server.toText();
255 return (os);
256}
257
258// *********************** DdnsDomain *************************
259
260DdnsDomain::DdnsDomain(const std::string& name,
262 const std::string& key_name)
263 : name_(name), servers_(servers), key_name_(key_name) {
264}
265
267}
268
271 ElementPtr result = Element::createMap();
272 // Set user-context
273 contextToElement(result);
274 // Set name
275 result->set("name", Element::create(name_));
276 // Set servers
277 ElementPtr servers = Element::createList();
278 for (DnsServerInfoStorage::const_iterator server = servers_->begin();
279 server != servers_->end(); ++server) {
280 ElementPtr dns_server = (*server)->toElement();
281 servers->add(dns_server);
282 }
283 // the dns server list may not be empty
284 if (!servers->empty()) {
285 result->set("dns-servers", servers);
286 }
287 // Set key-name
288 if (!key_name_.empty()) {
289 result->set("key-name", Element::create(key_name_));
290 }
291
292 return (result);
293}
294
295// *********************** DdnsDomainLstMgr *************************
296
298
299DdnsDomainListMgr::DdnsDomainListMgr(const std::string& name) : name_(name),
300 domains_(new DdnsDomainMap()) {
301}
302
303
305}
306
307void
309 if (!domains) {
311 "DdnsDomainListMgr::setDomains: Domain list may not be null");
312 }
313
314 domains_ = domains;
315
316 // Look for the wild card domain. If present, set the member variable
317 // to remember it. This saves us from having to look for it every time
318 // we attempt a match.
319 DdnsDomainMap::iterator gotit = domains_->find(wildcard_domain_name_);
320 if (gotit != domains_->end()) {
321 wildcard_domain_ = gotit->second;
322 }
323}
324
325bool
326DdnsDomainListMgr::matchDomain(const std::string& fqdn, DdnsDomainPtr& domain) {
327 // First check the case of one domain to rule them all.
328 if ((size() == 1) && (wildcard_domain_)) {
329 domain = wildcard_domain_;
330 return (true);
331 }
332
333 // Iterate over the domain map looking for the domain which matches
334 // the longest portion of the given fqdn.
335
336 size_t req_len = fqdn.size();
337 size_t match_len = 0;
338 DdnsDomainMapPair map_pair;
339 DdnsDomainPtr best_match;
340 BOOST_FOREACH (map_pair, *domains_) {
341 std::string domain_name = map_pair.first;
342 size_t dom_len = domain_name.size();
343
344 // If the domain name is longer than the fqdn, then it cant be match.
345 if (req_len < dom_len) {
346 continue;
347 }
348
349 // If the lengths are identical and the names match we're done.
350 if (req_len == dom_len) {
351 if (boost::iequals(fqdn, domain_name)) {
352 // exact match, done
353 domain = map_pair.second;
354 return (true);
355 }
356 } else {
357 // The fqdn is longer than the domain name. Adjust the start
358 // point of comparison by the excess in length. Only do the
359 // comparison if the adjustment lands on a boundary. This
360 // prevents "onetwo.net" from matching "two.net".
361 size_t offset = req_len - dom_len;
362 if ((fqdn[offset - 1] == '.') &&
363 (boost::iequals(fqdn.substr(offset), domain_name))) {
364 // Fqdn contains domain name, keep it if its better than
365 // any we have matched so far.
366 if (dom_len > match_len) {
367 match_len = dom_len;
368 best_match = map_pair.second;
369 }
370 }
371 }
372 }
373
374 if (!best_match) {
375 // There's no match. If they specified a wild card domain use it
376 // otherwise there's no domain for this entry.
377 if (wildcard_domain_) {
378 domain = wildcard_domain_;
379 return (true);
380 }
381
383 return (false);
384 }
385
386 domain = best_match;
387 return (true);
388}
389
392 ElementPtr result = Element::createList();
393 // Iterate on ddns domains
394 for (DdnsDomainMap::const_iterator domain = domains_->begin();
395 domain != domains_->end(); ++domain) {
396 ElementPtr ddns_domain = domain->second->toElement();
397 result->add(ddns_domain);
398 }
399
400 return (result);
401}
402
403// *************************** PARSERS ***********************************
404
405// *********************** TSIGKeyInfoParser *************************
406
409 std::string name = getString(key_config, "name");
410 std::string algorithm = getString(key_config, "algorithm");
411 uint32_t digestbits = getInteger(key_config, "digest-bits");
412 std::string secret = getString(key_config, "secret");
413 ConstElementPtr user_context = key_config->get("user-context");
414
415 // Algorithm must be valid.
416 try {
418 } catch (const std::exception& ex) {
419 isc_throw(D2CfgError, "tsig-key : " << ex.what()
420 << " (" << getPosition("algorithm", key_config) << ")");
421 }
422
423 // Non-zero digest-bits must be an integral number of octets, greater
424 // than 80 and at least half of the algorithm key length. It defaults
425 // to zero and JSON parsing ensures it's a multiple of 8.
426 if ((digestbits > 0) &&
427 ((digestbits < 80) ||
428 (boost::iequals(algorithm, TSIGKeyInfo::HMAC_SHA224_STR)
429 && (digestbits < 112)) ||
430 (boost::iequals(algorithm, TSIGKeyInfo::HMAC_SHA256_STR)
431 && (digestbits < 128)) ||
432 (boost::iequals(algorithm, TSIGKeyInfo::HMAC_SHA384_STR)
433 && (digestbits < 192)) ||
434 (boost::iequals(algorithm, TSIGKeyInfo::HMAC_SHA512_STR)
435 && (digestbits < 256)))) {
436 isc_throw(D2CfgError, "tsig-key: digest-bits too small : ("
437 << getPosition("digest-bits", key_config)
438 << ")");
439 }
440
441 // Everything should be valid, so create the key instance.
442 // It is possible for the D2TsigKey constructor to fail such as
443 // with an invalid secret content.
444 TSIGKeyInfoPtr key_info;
445 try {
446 key_info.reset(new TSIGKeyInfo(name, algorithm, secret, digestbits));
447 } catch (const std::exception& ex) {
448 isc_throw(D2CfgError, ex.what() << " ("
449 << key_config->getPosition() << ")");
450 }
451
452 // Add user-context
453 if (user_context) {
454 key_info->setContext(user_context);
455 }
456
457 return (key_info);
458}
459
460// *********************** TSIGKeyInfoListParser *************************
461
465 ConstElementPtr key_config;
466 TSIGKeyInfoParser key_parser;
467 BOOST_FOREACH(key_config, key_list->listValue()) {
468 TSIGKeyInfoPtr key = key_parser.parse(key_config);
469
470 // Duplicates are not allowed and should be flagged as an error.
471 if (keys->find(key->getName()) != keys->end()) {
472 isc_throw(D2CfgError, "Duplicate TSIG key name specified : "
473 << key->getName()
474 << " (" << getPosition("name", key_config) << ")");
475 }
476
477 (*keys)[key->getName()] = key;
478 }
479
480 return (keys);
481}
482
483// *********************** DnsServerInfoParser *************************
484
487 ConstElementPtr domain_config,
488 const TSIGKeyInfoMapPtr keys) {
489 std::string hostname = getString(server_config, "hostname");
490 std::string ip_address = getString(server_config, "ip-address");
491 uint32_t port = getInteger(server_config, "port");
492 std::string key_name = getString(server_config, "key-name");
493 ConstElementPtr user_context = server_config->get("user-context");
494
495 // Key name is optional. If it is not blank, then find the key in the
496 // list of defined keys.
497 TSIGKeyInfoPtr tsig_key_info;
498 bool inherited_key = true;
499 if (key_name.empty()) {
500 std::string domain_key_name = getString(domain_config, "key-name");
501 if (!domain_key_name.empty()) {
502 key_name = domain_key_name;
503 }
504 } else {
505 inherited_key = false;
506 }
507 if (!key_name.empty()) {
508 if (keys) {
509 TSIGKeyInfoMap::iterator kit = keys->find(key_name);
510 if (kit != keys->end()) {
511 tsig_key_info = kit->second;
512 }
513 }
514
515 if (!tsig_key_info) {
516 if (inherited_key) {
517 isc_throw(D2CfgError, "DdnsDomain : specifies an "
518 << "undefined key: " << key_name << " ("
519 << getPosition("key-name", domain_config) << ")");
520 } else {
521 isc_throw(D2CfgError, "Dns Server : specifies an "
522 << "undefined key: " << key_name << " ("
523 << getPosition("key-name", server_config) << ")");
524 }
525 }
526 }
527
528 // The configuration must specify one or the other.
529 if (hostname.empty() == ip_address.empty()) {
530 isc_throw(D2CfgError, "Dns Server must specify one or the other"
531 " of hostname or IP address"
532 << " (" << server_config->getPosition() << ")");
533 }
534
535 DnsServerInfoPtr server_info;
536 if (!hostname.empty()) {
550 isc_throw(D2CfgError, "Dns Server : hostname is not yet supported"
551 << " (" << getPosition("hostname", server_config) << ")");
552 } else {
553 try {
554 // Create an IOAddress from the IP address string given and then
555 // create the DnsServerInfo.
556 isc::asiolink::IOAddress io_addr(ip_address);
557 server_info.reset(new DnsServerInfo(hostname, io_addr, port,
558 true, tsig_key_info,
559 inherited_key));
560 } catch (const isc::asiolink::IOError& ex) {
561 isc_throw(D2CfgError, "Dns Server : invalid IP address : "
562 << ip_address
563 << " (" << getPosition("ip-address", server_config) << ")");
564 }
565 }
566
567 // Add user-context
568 if (user_context) {
569 server_info->setContext(user_context);
570 }
571
572 return (server_info);
573}
574
575// *********************** DnsServerInfoListParser *************************
576
579 ConstElementPtr domain_config,
580 const TSIGKeyInfoMapPtr keys) {
582 ConstElementPtr server_config;
583 DnsServerInfoParser parser;
584 BOOST_FOREACH(server_config, server_list->listValue()) {
585 DnsServerInfoPtr server =
586 parser.parse(server_config, domain_config, keys);
587 servers->push_back(server);
588 }
589
590 return (servers);
591}
592
593// *********************** DdnsDomainParser *************************
594
596 const TSIGKeyInfoMapPtr keys) {
597 std::string name = getString(domain_config, "name");
598 std::string key_name = getString(domain_config, "key-name");
599 ConstElementPtr user_context = domain_config->get("user-context");
600
601 // Parse the list of DNS servers
602 ConstElementPtr servers_config;
603 try {
604 servers_config = domain_config->get("dns-servers");
605 } catch (const std::exception& ex) {
606 isc_throw(D2CfgError, "DdnsDomain : missing dns-server list"
607 << " (" << servers_config->getPosition() << ")");
608 }
609
610 DnsServerInfoListParser server_parser;
612 server_parser.parse(servers_config, domain_config, keys);
613 if (servers->size() == 0) {
614 isc_throw(D2CfgError, "DNS server list cannot be empty"
615 << servers_config->getPosition());
616 }
617
618 // Instantiate the new domain and add it to domain storage.
619 DdnsDomainPtr domain(new DdnsDomain(name, servers, key_name));
620
621 // Add user-context
622 if (user_context) {
623 domain->setContext(user_context);
624 }
625
626 return (domain);
627}
628
629// *********************** DdnsDomainListParser *************************
630
632 const TSIGKeyInfoMapPtr keys) {
633 DdnsDomainMapPtr domains(new DdnsDomainMap());
634 DdnsDomainParser parser;
635 ConstElementPtr domain_config;
636 BOOST_FOREACH(domain_config, domain_list->listValue()) {
637 DdnsDomainPtr domain = parser.parse(domain_config, keys);
638
639 // Duplicates are not allowed
640 if (domains->find(domain->getName()) != domains->end()) {
641 isc_throw(D2CfgError, "Duplicate domain specified:"
642 << domain->getName()
643 << " (" << getPosition("name", domain_config) << ")");
644 }
645
646 (*domains)[domain->getName()] = domain;
647 }
648
649 return (domains);
650}
651
652// *********************** DdnsDomainListMgrParser *************************
653
656 const std::string& mgr_name,
657 const TSIGKeyInfoMapPtr keys) {
658 DdnsDomainListMgrPtr mgr(new DdnsDomainListMgr(mgr_name));
659
660 // Parse the list of domains
661 ConstElementPtr domains_config = mgr_config->get("ddns-domains");
662 if (domains_config) {
663 DdnsDomainListParser domain_parser;
664 DdnsDomainMapPtr domains = domain_parser.parse(domains_config, keys);
665
666 // Add the new domain to the domain storage.
667 mgr->setDomains(domains);
668 }
669
670 return(mgr);
671}
672
673} // end of isc::dhcp namespace
674} // end of isc namespace
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Exception thrown when the error during configuration handling occurs.
Definition: d2_config.h:136
Acts as a storage vault for D2 global scalar parameters.
Definition: d2_config.h:143
D2Params()
Default constructor The default constructor creates an instance that has updates disabled.
Definition: d2_config.cc:43
const isc::asiolink::IOAddress & getIpAddress() const
Return the IP address D2 listens on.
Definition: d2_config.h:174
bool operator!=(const D2Params &other) const
Compares two D2Params's for inequality.
Definition: d2_config.cc:100
size_t getPort() const
Return the TCP/UPD port D2 listens on.
Definition: d2_config.h:179
bool operator==(const D2Params &other) const
Compares two D2Params's for equality.
Definition: d2_config.cc:91
virtual ~D2Params()
Destructor.
Definition: d2_config.cc:51
std::string getConfigSummary() const
Return summary of the configuration used by D2.
Definition: d2_config.cc:83
std::string toText() const
Generates a string representation of the class contents.
Definition: d2_config.cc:105
virtual void validateContents()
Validates member values.
Definition: d2_config.cc:54
DdnsDomainListMgrPtr parse(data::ConstElementPtr mgr_config, const std::string &mgr_name, const TSIGKeyInfoMapPtr keys)
Performs the actual parsing of the given manager element.
Definition: d2_config.cc:655
Provides storage for and management of a list of DNS domains.
Definition: d2_config.h:634
DdnsDomainListMgr(const std::string &name)
Constructor.
Definition: d2_config.cc:299
virtual bool matchDomain(const std::string &fqdn, DdnsDomainPtr &domain)
Matches a given name to a domain based on a longest match scheme.
Definition: d2_config.cc:326
void setDomains(DdnsDomainMapPtr domains)
Sets the manger's domain list to the given list of domains.
Definition: d2_config.cc:308
static const char * wildcard_domain_name_
defines the domain name for denoting the wildcard domain.
Definition: d2_config.h:637
virtual ~DdnsDomainListMgr()
Destructor.
Definition: d2_config.cc:304
uint32_t size() const
Returns the number of domains in the domain list.
Definition: d2_config.h:677
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: d2_config.cc:391
Parser for a list of DdnsDomains.
Definition: d2_config.h:882
DdnsDomainMapPtr parse(data::ConstElementPtr domain_list_config, const TSIGKeyInfoMapPtr keys)
Performs the actual parsing of the given list "ddns-domain" elements.
Definition: d2_config.cc:631
Parser for DdnsDomain.
Definition: d2_config.h:863
DdnsDomainPtr parse(data::ConstElementPtr domain_config, const TSIGKeyInfoMapPtr keys)
Performs the actual parsing of the given "ddns-domain" element.
Definition: d2_config.cc:595
Represents a DNS domain that is may be updated dynamically.
Definition: d2_config.h:558
DdnsDomain(const std::string &name, DnsServerInfoStoragePtr servers, const std::string &key_name="")
Constructor.
Definition: d2_config.cc:260
virtual ~DdnsDomain()
Destructor.
Definition: d2_config.cc:266
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: d2_config.cc:270
Parser for a list of DnsServerInfos.
Definition: d2_config.h:839
DnsServerInfoStoragePtr parse(data::ConstElementPtr server_list_config, data::ConstElementPtr domain_config, const TSIGKeyInfoMapPtr keys)
Performs the actual parsing of the given list "dns-server" elements.
Definition: d2_config.cc:578
Parser for DnsServerInfo.
Definition: d2_config.h:811
DnsServerInfoPtr parse(data::ConstElementPtr server_config, data::ConstElementPtr domain_config, const TSIGKeyInfoMapPtr keys)
Performs the actual parsing of the given "dns-server" element.
Definition: d2_config.cc:486
Represents a specific DNS Server.
Definition: d2_config.h:421
std::string toText() const
Returns a text representation for the server.
Definition: d2_config.cc:227
const std::string getKeyName() const
Convenience method which returns the server's TSIG key name.
Definition: d2_config.cc:218
DnsServerInfo(const std::string &hostname, isc::asiolink::IOAddress ip_address, uint32_t port=STANDARD_DNS_PORT, bool enabled=true, const TSIGKeyInfoPtr &tsig_key_info=TSIGKeyInfoPtr(), bool inherited_key=true)
Constructor.
Definition: d2_config.cc:203
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: d2_config.cc:234
uint32_t getPort() const
Getter which returns the server's port number.
Definition: d2_config.h:462
const isc::asiolink::IOAddress & getIpAddress() const
Getter which returns the server's ip_address.
Definition: d2_config.h:469
virtual ~DnsServerInfo()
Destructor.
Definition: d2_config.cc:214
TSIGKeyInfoMapPtr parse(data::ConstElementPtr key_list_config)
Performs the parsing of the given list "tsig-key" elements.
Definition: d2_config.cc:463
Parser for TSIGKeyInfo.
Definition: d2_config.h:772
TSIGKeyInfoPtr parse(data::ConstElementPtr key_config)
Performs the actual parsing of the given "tsig-key" element.
Definition: d2_config.cc:408
Represents a TSIG Key.
Definition: d2_config.h:266
static const char * HMAC_SHA224_STR
Definition: d2_config.h:273
TSIGKeyInfo(const std::string &name, const std::string &algorithm, const std::string &secret, uint32_t digestbits=0)
Constructor.
Definition: d2_config.cc:135
virtual ~TSIGKeyInfo()
Destructor.
Definition: d2_config.cc:142
static const char * HMAC_MD5_STR
Defines string values for the supported TSIG algorithms.
Definition: d2_config.h:270
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: d2_config.cc:185
static const char * HMAC_SHA1_STR
Definition: d2_config.h:271
static const char * HMAC_SHA256_STR
Definition: d2_config.h:272
static const dns::Name & stringToAlgorithmName(const std::string &algorithm_id)
Converts algorithm id to dns::TSIGKey algorithm dns::Name.
Definition: d2_config.cc:146
static const char * HMAC_SHA512_STR
Definition: d2_config.h:275
static const char * HMAC_SHA384_STR
Definition: d2_config.h:274
static const data::Element::Position & getPosition(const std::string &name, const data::ConstElementPtr parent)
Utility method that returns position of an element.
static std::string getString(isc::data::ConstElementPtr scope, const std::string &name)
Returns a string parameter from a scope.
static int64_t getInteger(isc::data::ConstElementPtr scope, const std::string &name)
Returns an integer parameter from a scope.
The Name class encapsulates DNS names.
Definition: name.h:223
std::string toText(bool omit_final_dot=false) const
Convert the Name to a string.
Definition: name.cc:507
static const Name & HMACMD5_NAME()
HMAC-MD5 (RFC2845)
Definition: tsigkey.cc:261
static const Name & HMACSHA224_NAME()
HMAC-SHA256 (RFC4635)
Definition: tsigkey.cc:285
static const Name & HMACSHA256_NAME()
HMAC-SHA256 (RFC4635)
Definition: tsigkey.cc:279
static const Name & HMACSHA1_NAME()
HMAC-SHA1 (RFC4635)
Definition: tsigkey.cc:273
static const Name & HMACSHA512_NAME()
HMAC-SHA256 (RFC4635)
Definition: tsigkey.cc:297
static const Name & HMACSHA384_NAME()
HMAC-SHA256 (RFC4635)
Definition: tsigkey.cc:291
const Name & name_
Definition: dns/message.cc:693
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
Definition: macros.h:26
boost::shared_ptr< DdnsDomainListMgr > DdnsDomainListMgrPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_cfg_mgr.h:153
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_config.h:612
boost::shared_ptr< DdnsDomainMap > DdnsDomainMapPtr
Defines a pointer to DdnsDomain storage containers.
Definition: d2_config.h:621
boost::shared_ptr< DnsServerInfo > DnsServerInfoPtr
Defines a pointer for DnsServerInfo instances.
Definition: d2_config.h:542
std::map< std::string, DdnsDomainPtr > DdnsDomainMap
Defines a map of DdnsDomains, keyed by the domain name.
Definition: d2_config.h:615
std::pair< std::string, DdnsDomainPtr > DdnsDomainMapPair
Defines a iterator pairing domain name and DdnsDomain.
Definition: d2_config.h:618
isc::log::Logger dhcp_to_d2_logger("dhcp-to-d2")
Definition: d2_log.h:19
boost::shared_ptr< TSIGKeyInfo > TSIGKeyInfoPtr
Defines a pointer for TSIGKeyInfo instances.
Definition: d2_config.h:404
std::vector< DnsServerInfoPtr > DnsServerInfoStorage
Defines a storage container for DnsServerInfo pointers.
Definition: d2_config.h:545
std::map< std::string, TSIGKeyInfoPtr > TSIGKeyInfoMap
Defines a map of TSIGKeyInfos, keyed by the name.
Definition: d2_config.h:407
std::ostream & operator<<(std::ostream &os, const D2Params &config)
Dumps the contents of a D2Params as text to an output stream.
Definition: d2_config.cc:120
boost::shared_ptr< DnsServerInfoStorage > DnsServerInfoStoragePtr
Defines a pointer to DnsServerInfo storage containers.
Definition: d2_config.h:548
const isc::log::MessageID DHCP_DDNS_NO_MATCH
Definition: d2_messages.h:48
boost::shared_ptr< TSIGKeyInfoMap > TSIGKeyInfoMapPtr
Defines a pointer to map of TSIGkeyInfos.
Definition: d2_config.h:413
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
boost::shared_ptr< Element > ElementPtr
Definition: data.h:24
NameChangeFormat
Defines the list of data wire formats supported.
Definition: ncr_msg.h:60
NameChangeProtocol
Defines the list of socket protocols supported.
Definition: ncr_io.h:68
std::string ncrProtocolToString(NameChangeProtocol protocol)
Function which converts NameChangeProtocol enums to text labels.
Definition: ncr_io.cc:36
std::string ncrFormatToString(NameChangeFormat format)
Function which converts NameChangeFormat enums to text labels.
Definition: ncr_msg.cc:35
Defines the logger used by the top-level component of kea-lfc.
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
Definition: user_context.cc:15