.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Zonemaster::Config 3pm" .TH Zonemaster::Config 3pm "2022-06-28" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Zonemaster::Config \- configuration access module for Zonemaster .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& Zonemaster\->config\->no_network(1); # Forbid network traffic \& \& my $value = Zonemaster::Config\->get\->{key}{subkey}; # Not really recommended way to access config data .Ve .SH "LOADING CONFIGURATION" .IX Header "LOADING CONFIGURATION" Configuration data is loaded in several stages, each one overlaying the result from the previous one (that is, the later in the list take priority over the earlier). The first stage is hardcoded into the source code and loaded while it is being compiled, to make sure that there will always be some basic information available. Later, when the configuration object is first used, the system will look for a file named \fIconfig.json\fR in each of a list of directories. If the file exists, is readable and contains proper \s-1JSON\s0 data, it will be loaded and overlaid on the current internal config. The directories are, in order from first checked to last: .IP "The Zonemaster perl module installation directory" 4 .IX Item "The Zonemaster perl module installation directory" This is where the installation process puts the default configuration. It is not meant to be modified by the user, and it will be overwritten when the module is upgraded (or reinstalled for any other reason). If you really need to know where it is, you can either check the log message left when loading it or run this command to find the path: .Sp .Vb 1 \& perl \-MFile::ShareDir=dist_dir \-E \*(Aqsay dist_dir( "Zonemaster" )\*(Aq .Ve .IP "/etc/zonemaster" 4 .IX Item "/etc/zonemaster" Intended to hold system-global configuration changes. .IP "/usr/local/etc/zonemaster" 4 .IX Item "/usr/local/etc/zonemaster" Basically the same as the previous one, but for those who like to keep their locally installed software inside \fI/usr/local\fR. .IP "~/.zonemaster" 4 .IX Item "~/.zonemaster" That is, a \fI.zonemaster\fR directory in the home directory of the current user. Intended, obviously, for configuration changes local to one particular user. .PP The possible contents of the \s-1JSON\s0 data is described further down in this manual page. .SH "METHODS FOR CONFIGURATION ITEMS" .IX Header "METHODS FOR CONFIGURATION ITEMS" .IP "no_network([$value])" 4 .IX Item "no_network([$value])" Returns the value of the \f(CW\*(C`no_network\*(C'\fR flag. If given a defined value, sets the value to that value. .IP "ipv4_ok([$value])" 4 .IX Item "ipv4_ok([$value])" Returns the value of the \f(CW\*(C`ipv4\*(C'\fR flag. If given a defined value, sets the value to that value. .IP "ipv6_ok([$value])" 4 .IX Item "ipv6_ok([$value])" Returns the value of the \f(CW\*(C`ipv6\*(C'\fR flag. If given a defined value, sets the value to that value. .IP "\fBresolver_defaults()\fR" 4 .IX Item "resolver_defaults()" Returns a reference to the resolver_defaults hash. .IP "resolver_source([$addr])" 4 .IX Item "resolver_source([$addr])" Returns the source address all resolver objects should use when sending queries, if one is set. If given an argument, sets the source address to the argument. .IP "\fBlogfilter()\fR" 4 .IX Item "logfilter()" Returns a reference to the logfilter hash. .IP "\fBasnroots()\fR" 4 .IX Item "asnroots()" Returns a reference to the list of \s-1ASN\s0 lookup domains. .SH "METHODS" .IX Header "METHODS" .IP "\fBget()\fR" 4 .IX Item "get()" Returns a reference to a hash with configuration values. .IP "\fBpolicy()\fR" 4 .IX Item "policy()" Returns a reference to the current policy data. The format of that data is described further down in this document. .IP "load_policy_file($filename)" 4 .IX Item "load_policy_file($filename)" Load policy information from the given file and merge it into the pre-loaded policy. Information from the loaded file overrides the pre-loaded information when the same keys exist in both places. .Sp If the given name does not lead directly to a readable file, each of the usual directories will be checked if the name is there. If the plain name isn't, the suffix \f(CW\*(C`.json\*(C'\fR will be appended and another try will be done. For example, a file \fI\f(CI$HOME\fI/.zonemaster/Example.json\fR may be loaded by calling this method with the string \f(CW"Example"\fR. .IP "load_config_file($filename)" 4 .IX Item "load_config_file($filename)" Load configuration information from the given file and merge it into the pre-loaded config. Information from the loaded file overrides the pre-loaded information when the same keys exist in both places. .IP "load_module_policy($module)" 4 .IX Item "load_module_policy($module)" Loads policy data included in a test module. The argument must be the short form (without the initial \f(CW\*(C`Zonemaster::Test::\*(C'\fR) and correctly capitalized. .IP "\s-1BUILD\s0" 4 .IX Item "BUILD" Internal method only mentioned here to please Pod::Coverage. .IP "should_run($name)" 4 .IX Item "should_run($name)" Given a test case name, it returns true if that test case should be included in a test run according to the currently active policy or false if not. .SH "CONFIGURATION DATA" .IX Header "CONFIGURATION DATA" The configuration data is stored internally in a nested hash (possibly with arrays as values in places). As of this writing, the file format used is \s-1JSON.\s0 .PP The interesting keys are as follows. .SS "resolver" .IX Subsection "resolver" \fIdefaults\fR .IX Subsection "defaults" .PP These are the default flag and timing values used for the resolver objects used to actually send \s-1DNS\s0 queries. .IP "usevc" 4 .IX Item "usevc" If set, only use \s-1TCP.\s0 Default not set. .IP "retrans" 4 .IX Item "retrans" The number of seconds between retries. Default 3. .IP "dnssec" 4 .IX Item "dnssec" If set, sets the \s-1DO\s0 flag in queries. Default not set. .IP "recurse" 4 .IX Item "recurse" If set, sets the \s-1RD\s0 flag in queries. Default not set (and almost certainly should remain that way). .IP "retry" 4 .IX Item "retry" The number of times a query is sent before we give up. Can be set to zero, although that's not very useful (since no queries will be sent at all). Defaults to 2. .IP "igntc" 4 .IX Item "igntc" If set, queries that get truncated \s-1UDP\s0 responses will be automatically retried over \s-1TCP.\s0 Default not set. .SS "net" .IX Subsection "net" .IP "ipv4" 4 .IX Item "ipv4" If set, resolver objects are allowed to send queries over IPv4. Default set. .IP "ipv6" 4 .IX Item "ipv6" If set, resolver objects are allowed to send queries over IPv6. Default set. .SS "no_network" .IX Subsection "no_network" If set to a true value, network traffic is forbidden. Use when you want to be sure that any data is only taken from a preloaded cache. .SS "asnroots" .IX Subsection "asnroots" This key must be a list of domain names. The domains will be assumed to be Cymru-style \s-1AS\s0 lookup zones. Normally only the first name in the list will be used, the rest are backups in case the earlier ones don't work. .SS "logfilter" .IX Subsection "logfilter" By using this key, the log level of messages can be set in a much more fine-grained way than by the policy file. The intended use is to remove known erroneous results. If you, for example, know that a certain name server is recursive and for some reason should be, you can use this functionality to lower the severity of the complaint about it to a lower level than normal. .PP The the data under the \f(CW\*(C`logfilter\*(C'\fR key should be structured like this: .PP .Vb 6 \& Module \& Tag \& "when" \& Hash with conditions \& "set" \& Level to set if all conditions match .Ve .PP The hash with conditions should have keys matching the attributes of the log entry that's being filtered (check the translation files to see what they are). The values for the keys should be either a single value that the attribute should be, or an array of values any one of which the attribute should be. .PP A complete entry might could look like this: .PP .Vb 9 \& "SYSTEM": { \& "FILTER_THIS": { \& "when": { \& "count": 1, \& "type": ["this", "or"] \& }, \& "set": "INFO" \& } \& } .Ve .PP This would set the level to \f(CW\*(C`INFO\*(C'\fR for any \f(CW\*(C`SYSTEM:FILTER_THIS\*(C'\fR messages that had a \f(CW\*(C`count\*(C'\fR attribute set to 1 and a \f(CW\*(C`type\*(C'\fR attribute set to either \f(CW\*(C`this\*(C'\fR or \f(CW\*(C`or\*(C'\fR. .SH "POLICY DATA" .IX Header "POLICY DATA" Like the configuration data, policy data is stored in \s-1JSON\s0 format. Structurally, it's a bit less complex. All the keys on the top level, with one exception, are names of test implementation modules (without the \f(CW\*(C`Zonemaster::Test::\*(C'\fR prefix). Each of those keys hold another hash, where the keys are the tags that the module in question can emit and the values are the the severity levels that should apply to the tags. Any tags that are not found in the policy data will default to level \f(CW\*(C`DEBUG\*(C'\fR. .PP The one exception is a top-level key \f(CW\*(C`_\|_testcases_\|_\*(C'\fR. The value of that must be a hash where the keys are names of test cases from the test specifications, and the corresponding values are booleans specifying if the test case in question should be executed or not. Any missing test cases are treated as if they had the value \f(CW\*(C`true\*(C'\fR set. The test cases \f(CW\*(C`basic00\*(C'\fR, \f(CW\*(C`basic01\*(C'\fR and \f(CW\*(C`basic02\*(C'\fR will be executed even if their values are set to \f(CW\*(C`false\*(C'\fR, since part of their function is to verify that the given name can be tested at all. The values here only apply when test modules are asked to run all their tests. A test case that is set to \f(CW\*(C`false\*(C'\fR here will still run if asked for specifically. .PP The easiest way to create a modified policy is to copy the default one and change the relevant values.