|
unbound 0.1
|
The config checker checks for syntax and other errors in the unbound.conf file, and can be used to check for errors before the server is started or sigHUPped. More...
#include "config.h"#include <ctype.h>#include "util/as112.h"#include "util/log.h"#include "util/config_file.h"#include "util/module.h"#include "util/net_help.h"#include "util/regional.h"#include "iterator/iterator.h"#include "iterator/iter_fwd.h"#include "iterator/iter_hints.h"#include "validator/validator.h"#include "services/localzone.h"#include "services/listen_dnsport.h"#include "services/view.h"#include "services/authzone.h"#include "respip/respip.h"#include "sldns/sbuffer.h"#include "sldns/str2wire.h"Macros | |
| #define | COMPARE_ZONE_NAME(confname, builtname, len) |
Functions | |
| static void | usage (void) |
| Give checkconf usage, and exit (1). | |
| static void | print_option (struct config_file *cfg, const char *opt, int final) |
| Print given option to stdout. | |
| static void | check_mod (struct config_file *cfg, struct module_func_block *fb) |
| check if module works with config | |
| static int | str_addr_is_localhost (const char *a) |
| true if addr is a localhost address, 127.0.0.1 or ::1 (with maybe "@port" after it) | |
| static void | donotquerylocalhostcheck (struct config_file *cfg) |
| check do-not-query-localhost | |
| static void | nodefaultzonescheck (struct config_file *cfg) |
| static void | localzonechecks (struct config_file *cfg) |
| check localzones | |
| static void | acl_view_tag_checks (struct config_file *cfg, struct views *views) |
| checks for acl and views | |
| static void | view_and_respipchecks (struct config_file *cfg) |
| check view and response-ip configuration | |
| static void | warn_hosts (const char *typ, struct config_stub *list) |
| emit warnings for IP in hosts | |
| static void | interfacechecks (struct config_file *cfg) |
| check interface strings | |
| static void | ifautomaticportschecks (char *ifautomaticports) |
| check interface-automatic-ports | |
| static void | controlinterfacechecks (struct config_file *cfg) |
| check control interface strings | |
| static void | aclchecks (struct config_file *cfg) |
| check acl ips | |
| static void | tcpconnlimitchecks (struct config_file *cfg) |
| check tcp connection limit ips | |
| static void | allowproxychecks (struct config_file *cfg) |
| check allow-proxy ips | |
| static int | is_file (const char *fname) |
| true if fname is a file | |
| static int | is_dir (const char *fname) |
| true if fname is a directory | |
| static char * | basedir (char *fname) |
| get base dir of a fname | |
| static void | check_chroot_string (const char *desc, char **ss, const char *chrootdir, struct config_file *cfg) |
| check chroot for a file string | |
| static void | check_chroot_filelist (const char *desc, struct config_strlist *list, const char *chrootdir, struct config_file *cfg) |
| check file list, every file must be inside the chroot location | |
| static void | check_chroot_filelist_wild (const char *desc, struct config_strlist *list, const char *chrootdir, struct config_file *cfg) |
| check file list, with wildcard processing | |
| static void | check_modules_exist (const char *module_conf) |
| check that the modules exist, are compiled in | |
| static int | file_list_contains (struct config_strlist *list, char *fname, struct config_file *cfg) |
| Compare filename with list of files, true if list contains the name. | |
| static int | file_list_contains_wild (struct config_strlist *list, char *fname, struct config_file *cfg) |
| Compare filename with list of files, true if list contains the name, with glob compare. | |
| static void | check_file_clobber (struct config_file *cfg) |
| Check if the auth-zone/rpz zonefile: conflicts with other files, so it would overwrite that file. | |
| static void | morechecks (struct config_file *cfg) |
| check configuration for errors | |
| static void | check_fwd (struct config_file *cfg) |
| check forwards | |
| static void | check_hints (struct config_file *cfg) |
| check hints | |
| static void | check_auth (struct config_file *cfg, int readauth) |
| check auth zones | |
| static void | checkconf (const char *cfgfile, const char *opt, int final, int quiet, int readauth) |
| check config file | |
| int | main (int argc, char *argv[]) |
| Main routine for checkconf. | |
Variables | |
| int | optind |
| getopt global, in case header files fail to declare it. | |
| char * | optarg |
| getopt global, in case header files fail to declare it. | |
The config checker checks for syntax and other errors in the unbound.conf file, and can be used to check for errors before the server is started or sigHUPped.
Exit status 1 means an error.
| #define COMPARE_ZONE_NAME | ( | confname, | |
| builtname, | |||
| len ) |
|
static |
Give checkconf usage, and exit (1).
References usage().
|
static |
Print given option to stdout.
| cfg | config |
| opt | option name without trailing :. This is different from config_set_option. |
| final | if final pathname with chroot applied has to be printed. |
References config_file::auto_trust_anchor_file_list, config_get_option(), config_print_func(), fatal_exit(), fname_after_chroot(), config_strlist::next, config_file::pidfile, print_option(), and config_strlist::str.
Referenced by checkconf(), and print_option().
|
static |
check if module works with config
References module_env::cfg, check_mod(), module_func_block::deinit, module_func_block::destartup, edns_known_options_delete(), edns_known_options_init(), fatal_exit(), module_func_block::init, module_func_block::name, regional_create(), regional_destroy(), module_env::scratch, module_env::scratch_buffer, sldns_buffer_free(), sldns_buffer_new(), and module_func_block::startup.
Referenced by check_mod(), and checkconf().
|
static |
true if addr is a localhost address, 127.0.0.1 or ::1 (with maybe "@port" after it)
References str_addr_is_localhost().
Referenced by donotquerylocalhostcheck(), and str_addr_is_localhost().
|
static |
check do-not-query-localhost
References config_stub::addrs, module_env::cfg, config_file::donotquery_localhost, donotquerylocalhostcheck(), config_file::forwards, config_stub::name, config_strlist::next, config_stub::next, config_strlist::str, str_addr_is_localhost(), and config_file::stubs.
Referenced by donotquerylocalhostcheck(), and morechecks().
|
static |
check localzones
References fatal_exit(), local_zones_apply_cfg(), local_zones_create(), local_zones_delete(), and localzonechecks().
Referenced by localzonechecks(), and morechecks().
|
static |
checks for acl and views
References config_file::acl_tag_actions, config_file::acl_tag_datas, config_file::acl_tags, config_file::acl_view, acl_view_tag_checks(), fatal_exit(), find_tag_id(), LDNS_RR_BUF_SIZE, local_zone_str2type(), view::lock, netblockstrtoaddr(), config_str2list::next, config_str3list::next, config_strbytelist::next, sldns_get_errorstr_parse(), sldns_str2wire_rr_buf(), config_str2list::str, config_str3list::str, config_strbytelist::str, config_str2list::str2, config_str3list::str2, config_str3list::str3, and views_find_view().
Referenced by acl_view_tag_checks(), and view_and_respipchecks().
|
static |
check view and response-ip configuration
References acl_view_tag_checks(), fatal_exit(), config_file::module_conf, respip_global_apply_cfg(), respip_set_create(), respip_set_delete(), respip_set_is_empty(), respip_views_apply_cfg(), view_and_respipchecks(), views_apply_cfg(), views_create(), and views_delete().
Referenced by morechecks(), and view_and_respipchecks().
|
static |
emit warnings for IP in hosts
References addr_is_ip6(), extstrtoaddr(), config_stub::hosts, config_stub::name, config_strlist::next, config_stub::next, config_strlist::str, and warn_hosts().
Referenced by morechecks(), and warn_hosts().
|
static |
check interface strings
References config_del_strarray(), config_file::dnscrypt_port, extstrtoaddr(), fatal_exit(), config_file::https_port, if_is_dnscrypt(), if_is_https(), if_is_pp2(), if_is_quic(), config_file::ifs, interfacechecks(), ipstrtoaddr(), netblockstrtoaddr(), config_file::num_ifs, config_file::num_out_ifs, config_file::out_ifs, config_file::port, config_file::proxy_protocol_port, config_file::quic_port, and resolve_interface_names().
Referenced by interfacechecks(), and morechecks().
|
static |
check interface-automatic-ports
References fatal_exit(), and ifautomaticportschecks().
Referenced by ifautomaticportschecks(), and morechecks().
|
static |
check control interface strings
References config_del_strarray(), config_file::control_ifs, config_file::control_port, controlinterfacechecks(), extstrtoaddr(), fatal_exit(), config_strlist_head::first, config_strlist::next, resolve_interface_names(), and config_strlist::str.
Referenced by controlinterfacechecks(), and morechecks().
|
static |
check acl ips
References aclchecks(), config_file::acls, fatal_exit(), netblockstrtoaddr(), config_str2list::next, config_str2list::str, and config_str2list::str2.
Referenced by aclchecks(), and morechecks().
|
static |
check tcp connection limit ips
References fatal_exit(), netblockstrtoaddr(), config_str2list::next, config_str2list::str, config_str2list::str2, config_file::tcp_connection_limits, and tcpconnlimitchecks().
Referenced by morechecks(), and tcpconnlimitchecks().
|
static |
check allow-proxy ips
References config_file::allow_proxy, allowproxychecks(), fatal_exit(), netblockstrtoaddr(), config_strlist::next, and config_strlist::str.
Referenced by allowproxychecks(), and morechecks().
|
static |
true if fname is a file
References is_file().
Referenced by check_chroot_string(), is_file(), and morechecks().
|
static |
|
static |
get base dir of a fname
References basedir(), and fatal_exit().
Referenced by basedir(), and morechecks().
|
static |
check chroot for a file string
References check_chroot_string(), fatal_exit(), fname_after_chroot(), and is_file().
Referenced by check_chroot_filelist(), check_chroot_filelist_wild(), check_chroot_string(), and morechecks().
|
static |
check file list, every file must be inside the chroot location
References check_chroot_filelist(), check_chroot_string(), config_strlist::next, and config_strlist::str.
Referenced by check_chroot_filelist(), and morechecks().
|
static |
check file list, with wildcard processing
References check_chroot_filelist_wild(), check_chroot_string(), fname_after_chroot(), config_strlist::next, and config_strlist::str.
Referenced by check_chroot_filelist_wild(), and morechecks().
|
static |
check that the modules exist, are compiled in
References check_modules_exist(), fatal_exit(), and module_list_avail().
Referenced by check_modules_exist(), and morechecks().
|
static |
Compare filename with list of files, true if list contains the name.
References fatal_exit(), file_list_contains(), fname_after_chroot(), config_strlist::next, and config_strlist::str.
Referenced by check_file_clobber(), and file_list_contains().
|
static |
Compare filename with list of files, true if list contains the name, with glob compare.
References fatal_exit(), file_list_contains_wild(), fname_after_chroot(), log_err(), config_strlist::next, and config_strlist::str.
Referenced by check_file_clobber(), and file_list_contains_wild().
|
static |
Check if the auth-zone/rpz zonefile: conflicts with other files, so it would overwrite that file.
Refuse it aliasing any read-side bootstrap file.
References config_file::auths, config_file::auto_trust_anchor_file_list, check_file_clobber(), fatal_exit(), file_list_contains(), file_list_contains_wild(), config_strlist_head::first, fname_after_chroot(), config_auth::name, config_auth::next, config_file::root_hints, config_file::tls_session_ticket_keys, config_file::trust_anchor_file_list, config_file::trusted_keys_file_list, and config_auth::zonefile.
Referenced by check_file_clobber(), and morechecks().
|
static |
check configuration for errors
References aclchecks(), allowproxychecks(), config_file::auto_trust_anchor_file_list, basedir(), check_chroot_filelist(), check_chroot_filelist_wild(), check_chroot_string(), check_file_clobber(), check_modules_exist(), config_file::chrootdir, config_file::control_cert_file, config_file::control_key_file, config_file::control_use_cert, controlinterfacechecks(), config_file::directory, config_file::disable_edns_do, config_file::do_ip4, config_file::do_ip6, config_file::do_tcp, config_file::do_udp, donotquerylocalhostcheck(), config_file::edns_buffer_size, fatal_exit(), fname_after_chroot(), config_file::forwards, config_file::if_automatic_ports, ifautomaticportschecks(), interfacechecks(), is_dir(), is_file(), localzonechecks(), config_file::logfile, config_file::module_conf, morechecks(), config_file::msg_buffer_size, config_file::num_threads, options_remote_is_address(), config_file::pidfile, config_file::prefer_ip4, config_file::prefer_ip6, config_file::remote_control_enable, config_file::root_hints, config_file::server_cert_file, config_file::server_key_file, config_strlist::str, config_file::stubs, tcpconnlimitchecks(), config_file::trust_anchor_file_list, config_file::trust_anchor_list, config_file::trusted_keys_file_list, config_file::username, config_file::verbosity, view_and_respipchecks(), and warn_hosts().
Referenced by checkconf(), and morechecks().
|
static |
check forwards
References check_fwd(), fatal_exit(), forwards_apply_cfg(), forwards_create(), and forwards_delete().
Referenced by check_fwd(), and checkconf().
|
static |
check hints
References check_hints(), fatal_exit(), hints_apply_cfg(), hints_create(), and hints_delete().
Referenced by check_hints(), and checkconf().
|
static |
check auth zones
References auth_zones_apply_cfg(), auth_zones_create(), auth_zones_delete(), check_auth(), fatal_exit(), and config_file::module_conf.
Referenced by check_auth(), and checkconf().
|
static |
check config file
References check_auth(), check_fwd(), check_hints(), check_mod(), checkconf(), config_create(), config_delete(), config_read(), fatal_exit(), iter_get_funcblock(), log_err(), config_file::module_conf, morechecks(), print_option(), pythonmod_get_funcblock(), and val_get_funcblock().
Referenced by checkconf(), and main().
| int main | ( | int | argc, |
| char * | argv[] ) |
Main routine for checkconf.
References checkconf(), log_ident_set(), log_init(), main, optarg, optind, and usage().