.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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::Engine::Profile 3pm" .TH Zonemaster::Engine::Profile 3pm 2024-04-22 "perl v5.38.2" "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::Engine::Profile \- A simple system for configuring Zonemaster Engine .SH SYNOPSIS .IX Header "SYNOPSIS" This module has two parts: .IP \(bu 4 a \fIprofile\fR representation class .IP \(bu 4 a global profile object (the \fIeffective profile\fR) that configures Zonemaster Engine .PP A \fIprofile\fR consists of a collection of named properties. .PP The properties determine the configurable behaviors of Zonemaster Engine with regard to what tests are to be performed, how they are to be performed, and how the results are to be analyzed. For details on available properties see the "PROFILE PROPERTIES" section. .PP Here is an example for updating the effective profile with values from a given file and setting all properties not mentioned in the file to default values. For details on the file format see the "REPRESENTATIONS" section. .PP .Vb 1 \& use Zonemaster::Engine::Profile; \& \& my $json = read_file( "/path/to/foo.profile" ); \& my $foo = Zonemaster::Engine::Profile\->from_json( $json ); \& my $profile = Zonemaster::Engine::Profile\->default; \& $profile\->merge( $foo ); \& Zonemaster::Engine::Profile\->effective\->merge( $profile ); .Ve .PP Here is an example for serializing the default profile to JSON. .PP .Vb 1 \& my $string = Zonemaster::Engine::Profile\->default\->to_json; .Ve .PP For any given profile: .IP \(bu 4 At any moment, each property is either set or unset. .IP \(bu 4 At any moment, every set property has a valid value. .IP \(bu 4 It is possible to set the value of each unset property. .IP \(bu 4 It is possible to update the value of each set property. .IP \(bu 4 It is NOT possible to unset the value of any set property. .SH "CLASS ATTRIBUTES" .IX Header "CLASS ATTRIBUTES" .SS effective .IX Subsection "effective" A Zonemaster::Engine::Profile. This is the effective profile. It serves as the global runtime configuration for Zonemaster Engine. Update it to change the configuration. .PP The effective profile is initialized with the default values declared in the "PROFILE PROPERTIES" section. .PP For the effective profile, all properties are always set (to valid values). This is based on the assumption that \fIdefault.profile\fR specifies a valid value for each and every property. .SH "CLASS METHODS" .IX Header "CLASS METHODS" .SS new .IX Subsection "new" A constructor that returns a new profile with all properties unset. .PP .Vb 1 \& my $profile = Zonemaster::Engine::Profile\->new; .Ve .SS default .IX Subsection "default" A constructor that returns a new profile with the default property values declared in the "PROFILE PROPERTIES" section. .PP .Vb 1 \& my $default = Zonemaster::Engine::Profile\->default; .Ve .SS from_json .IX Subsection "from_json" A constructor that returns a new profile with values parsed from a JSON string. .PP .Vb 1 \& my $profile = Zonemaster::Engine::Profile\->from_json( \*(Aq{ "no_network": true }\*(Aq ); .Ve .PP The returned profile has set values for all properties specified in the given string. The remaining properties are unset. .PP Dies if the given string is illegal according to the "JSON REPRESENTATION" section or if the property values are illegal according to the "PROFILE PROPERTIES" section. .SS from_yaml .IX Subsection "from_yaml" A constructor that returns a new profile with values parsed from a YAML string. .PP .Vb 4 \& my $profile = Zonemaster::Engine::Profile\->from_yaml( <get( \*(Aqnet.ipv6\*(Aq ); .Ve .PP Returns value of the given property, or \f(CW\*(C`undef\*(C'\fR if the property is unset. For boolean properties the returned value is either \f(CW1\fR for true or \f(CW0\fR for false. For properties with complex types, the returned value is a deep copy . .PP Dies if the given property name is invalid. .SS set .IX Subsection "set" Set the value of a property. .PP .Vb 1 \& $profile1\->set( \*(Aqnet.ipv6\*(Aq, 0 ); .Ve .PP Takes a property name and value and updates the property accordingly. For boolean properties any truthy value is interpreted as true and any falsy value except \f(CW\*(C`undef\*(C'\fR is interpreted as false. .PP Dies if the given property name is invalid. .PP Dies if the value is \f(CW\*(C`undef\*(C'\fR or otherwise invalid for the given property. .SS merge .IX Subsection "merge" Merge the profile data of another profile into this one. .PP .Vb 1 \& $profile1\->merge( $other ); .Ve .PP Properties from the other profile take precedence when the same property name exists in both profiles. The other profile object remains unmodified. .SS to_json .IX Subsection "to_json" Serialize the profile to the "JSON REPRESENTATION" format. .PP .Vb 1 \& my $string = $profile\->to_json(); .Ve .PP Returns a string. .SS to_yaml .IX Subsection "to_yaml" Serialize the profile to the "JSON REPRESENTATION" format. .PP .Vb 1 \& my $string = $profile\->to_yaml(); .Ve .PP Returns a string. .SH SUBROUTINES .IX Header "SUBROUTINES" .SS _get_profile_paths .IX Subsection "_get_profile_paths" Internal method used to get all the paths of a nested hashes-of-hashes. It creates a hash where keys are dotted keys of the nested hashes-of-hashes that exist in \f(CW%profile_properties_details\fR. .PP .Vb 1 \& _get_profile_paths(\e%paths, $internal); .Ve .SS _get_value_from_nested_hash .IX Subsection "_get_value_from_nested_hash" Internal method used to get a value in a nested hashes-of-hashes. .PP .Vb 1 \& _get_value_from_nested_hash( $hash_ref, @path ); .Ve .PP Where \f(CW$hash_ref\fR is the hash to explore and \f(CW@path\fR are the labels of the property to get. .PP .Vb 1 \& @path = split /\e./, q{resolver.defaults.usevc}; .Ve .SS _set_value_to_nested_hash .IX Subsection "_set_value_to_nested_hash" Internal method used to set a value in a nested hashes-of-hashes. .PP .Vb 1 \& _set_value_from_nested_hash( $hash_ref, $value, @path ); .Ve .PP Where \f(CW$hash_ref\fR is the hash to explore and \f(CW@path\fR are the labels of the property to set. .PP .Vb 1 \& @path = split /\e./, q{resolver.defaults.usevc}; .Ve .SH "PROFILE PROPERTIES" .IX Header "PROFILE PROPERTIES" Each property has a name and is either set or unset. If it is set it has a value that is valid for that specific property. Here is a listing of all the properties and their respective sets of valid values. .PP Default values are listed here as specified in the distributed default profile JSON file. .SS resolver.defaults.usevc .IX Subsection "resolver.defaults.usevc" A boolean. If true, only use TCP. Default false. .SS resolver.defaults.retrans .IX Subsection "resolver.defaults.retrans" An integer between 1 and 255 inclusive. The number of seconds between retries. Default 3. .SS resolver.defaults.recurse .IX Subsection "resolver.defaults.recurse" A boolean. If true, sets the RD flag in queries. Default false. .PP This should almost certainly be kept false. .SS resolver.defaults.retry .IX Subsection "resolver.defaults.retry" An integer between 1 and 255 inclusive. The number of times a query is sent before we give up. Default 2. .SS resolver.defaults.igntc .IX Subsection "resolver.defaults.igntc" A boolean. If false, UDP queries that get responses with the \f(CW\*(C`TC\*(C'\fR flag set will be automatically resent over TCP. Default false. .SS resolver.defaults.fallback .IX Subsection "resolver.defaults.fallback" A boolean. If true, UDP queries that get responses with the \f(CW\*(C`TC\*(C'\fR flag set will be automatically resent over TCP or using EDNS. Default true. .PP In ldns\-1.7.0 (NLnet Labs), in case of truncated answer when UDP is used, the same query is resent with EDNS0 and TCP (if needed). If you want the original answer (with TC bit set) and avoid this kind of replay, set this flag to false. .SS resolver.source .IX Subsection "resolver.source" Deprecated (planned removal: v2024.1). Use "resolver.source4" and "resolver.source6". A string that is either an IP address or the exact string \f(CW"os_default"\fR. The source address all resolver objects should use when sending queries. If \f(CW"os_default"\fR, the OS default address is used. Default \f(CW"os_default"\fR. .SS resolver.source4 .IX Subsection "resolver.source4" A string that is an IPv4 address or the empty string or undefined. The source address all resolver objects should use when sending queries over IPv4. If the empty string or undefined, use the OS default IPv4 address if available. Default "" (empty string). .SS resolver.source6 .IX Subsection "resolver.source6" A string that is an IPv6 address or the empty string or undefined. The source address all resolver objects should use when sending queries over IPv6. If the empty string or undefined, use the OS default IPv6 address if available. Default "" (empty string). .SS net.ipv4 .IX Subsection "net.ipv4" A boolean. If true, resolver objects are allowed to send queries over IPv4. Default true. .SS net.ipv6 .IX Subsection "net.ipv6" A boolean. If true, resolver objects are allowed to send queries over IPv6. Default true. .SS no_network .IX Subsection "no_network" A boolean. If true, network traffic is forbidden. Default false. .PP Use when you want to be sure that any data is only taken from a preloaded cache. .SS "asnroots (DEPRECATED)" .IX Subsection "asnroots (DEPRECATED)" An arrayref of domain names. Default \f(CW\*(C`["asnlookup.zonemaster.net"]\*(C'\fR. .PP The domains will be assumed to be Cymru-style AS lookup zones. Only the first name in the list will be used. .SS asn_db.style .IX Subsection "asn_db.style" A string that is either \f(CW"Cymru"\fR or \f(CW"RIPE"\fR. Defines which method will be used for AS lookup zones. Default \f(CW"Cymru"\fR. .SS asn_db.sources .IX Subsection "asn_db.sources" An arrayref of domain names when asn_db.style is set to \f(CW"Cymru"\fR or whois servers when asn_db.style is set to \f(CW"RIPE"\fR. Only the first item in the list will be used. Default \f(CW"asnlookup.zonemaster.net"\fR. .SS "cache (EXPERIMENTAL)" .IX Subsection "cache (EXPERIMENTAL)" A hash of hashes. The currently supported keys are \f(CW"redis"\fR. .PP See more information in cache.redis. .PP Undefined by default. .SS "cache.redis (EXPERIMENTAL)" .IX Subsection "cache.redis (EXPERIMENTAL)" A hashref. The currently supported keys are \f(CW"server"\fR and \f(CW"expire"\fR. .PP Specifies the address of the Redis server used to perform global caching (\f(CW\*(C`cache.redis.server\*(C'\fR) and an optional expire time (\f(CW\*(C`cache.redis.expire\*(C'\fR). .PP \&\f(CW\*(C`cache.redis.server\*(C'\fR must be a string in the form \f(CW\*(C`host:port\*(C'\fR. \&\f(CW\*(C`cache.redis.expire\*(C'\fR must be a non-negative integer and defines a time in seconds. Default 5 seconds. .SS logfilter .IX Subsection "logfilter" A complex data structure. Default \f(CW\*(C`{}\*(C'\fR. .PP Specifies the severity level of each tag emitted by a specific module. The intended use is to remove known erroneous results. E.g. if you 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. The \f(CW\*(C`test_levels\*(C'\fR item also specifies tag severity level, but with coarser granularity and lower precedence. .PP The data under the \f(CW\*(C`logfilter\*(C'\fR key should be structured like this: .PP .Vb 7 \& Module \& Tag \& Array of exceptions \& "when" \& Hash with conditions \& "set" \& Severity 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 logfilter structure might look like this: .PP .Vb 10 \& { \& "A_MODULE": { \& "SOME_TAG": [ \& { \& "when": { \& "count": 1, \& "type": [ \& "this", \& "or" \& ] \& }, \& "set": "INFO" \& }, \& { \& "when": { \& "count": 128, \& "type": [ \& "that" \& ] \& }, \& "set": "INFO" \& } \& ] \& }, \& "ANOTHER_MODULE": { \& "OTHER_TAG": [ \& { \& "when": { \& "bananas": 0 \& }, \& "set": "WARNING" \& } \& ] \& } \& } .Ve .PP This would set the severity level to \f(CW\*(C`INFO\*(C'\fR for any \f(CW\*(C`A_MODULE:SOME_TAG\*(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. This also would set the level to \f(CW\*(C`INFO\*(C'\fR for any \f(CW\*(C`A_MODULE:SOME_TAG\*(C'\fR messages that had a \f(CW\*(C`count\*(C'\fR attribute set to 128 and a \f(CW\*(C`type\*(C'\fR attribute set to \f(CW\*(C`that\*(C'\fR. And this would set the level to \f(CW\*(C`WARNING\*(C'\fR for any \f(CW\*(C`ANOTHER_MODULE:OTHER_TAG\*(C'\fR messages that had a \f(CW\*(C`bananas\*(C'\fR attribute set to 0. .SS test_levels .IX Subsection "test_levels" A complex data structure. .PP Specifies the severity level of each tag emitted by a specific module. The \f(CW\*(C`logfilter\*(C'\fR item also specifies tag severity level, but with finer granularity and higher precedence. .PP At the top level of this data structure are two levels of nested hashrefs. The keys of the top level hash are names of test implementation modules (without the \f(CW\*(C`Zonemaster::Engine::Test::\*(C'\fR prefix). The keys of the second level hashes are tags that the respective modules emit. The values of the second level hashes are mapped to severity levels. .PP The various test case specifications define the default severity level for some of the messages. These specifications are the only authoritative documents on the default severity level for the various messages. For messages not defined in any of these specifications please refer to the file located by dist_file("Zonemaster\-Engine", "default.profile"). For messages neither defined in test specifications, nor listed in \&\f(CW\*(C`default.profile\*(C'\fR, the default severity level is \f(CW\*(C`DEBUG\*(C'\fR. .PP \&\fINote:\fR Sometimes multiple test cases within the same test module define messages for the same tag. When they do, it is imperative that all test cases define the same severity level for the tag. .SS test_cases .IX Subsection "test_cases" An arrayref of names of implemented test cases (in all lower-case) as listed in the test case specifications . Default is an arrayref listing all the test cases. .PP Specifies which test cases can be run by the testing suite. .PP Note that an exception applies to test cases \f(CW\*(C`basic01\*(C'\fR and \f(CW\*(C`basic02\*(C'\fR: when running either the full testing suite or just the Basic test module, these test cases are always run no matter if they're excluded from this property. This is because their primary goal is to verify that the given domain name can be tested at all. .SS test_cases_vars.dnssec04.REMAINING_SHORT .IX Subsection "test_cases_vars.dnssec04.REMAINING_SHORT" A positive integer value. Recommended lower bound for signatures' remaining validity time (in seconds) in test case DNSSEC04. Related to the REMAINING_SHORT message tag from this test case. Default \f(CW43200\fR (12 hours in seconds). .SS test_cases_vars.dnssec04.REMAINING_LONG .IX Subsection "test_cases_vars.dnssec04.REMAINING_LONG" A positive integer value. Recommended upper bound for signatures' remaining validity time (in seconds) in test case DNSSEC04. Related to the REMAINING_LONG message tag from this test case. Default \f(CW15552000\fR (180 days in seconds). .SS test_cases_vars.dnssec04.DURATION_LONG .IX Subsection "test_cases_vars.dnssec04.DURATION_LONG" A positive integer value. Recommended upper bound for signatures' lifetime (in seconds) in the test case DNSSEC04. Related to the DURATION_LONG message tag from this test case. Default \f(CW15552000\fR (180 days in seconds). .SS test_cases_vars.zone02.SOA_REFRESH_MINIMUM_VALUE .IX Subsection "test_cases_vars.zone02.SOA_REFRESH_MINIMUM_VALUE" A positive integer value. Recommended lower bound for SOA refresh values (in seconds) in test case ZONE02. Related to the REFRESH_MINIMUM_VALUE_LOWER message tag from this test case. Default \f(CW14400\fR (4 hours in seconds). .SS test_cases_vars.zone04.SOA_RETRY_MINIMUM_VALUE .IX Subsection "test_cases_vars.zone04.SOA_RETRY_MINIMUM_VALUE" A positive integer value. Recommended lower bound for SOA retry values (in seconds) in test case ZONE04. Related to the RETRY_MINIMUM_VALUE_LOWER message tag from this test case. Default \f(CW3600\fR (1 hour in seconds). .SS test_cases_vars.zone05.SOA_EXPIRE_MINIMUM_VALUE .IX Subsection "test_cases_vars.zone05.SOA_EXPIRE_MINIMUM_VALUE" A positive integer value. Recommended lower bound for SOA expire values (in seconds) in test case ZONE05. Related to the EXPIRE_MINIMUM_VALUE_LOWER message tag from this test case. Default \f(CW604800\fR (1 week in seconds). .SS test_cases_vars.zone06.SOA_DEFAULT_TTL_MINIMUM_VALUE .IX Subsection "test_cases_vars.zone06.SOA_DEFAULT_TTL_MINIMUM_VALUE" A positive integer value. Recommended lower bound for SOA minimum values (in seconds) in test case ZONE06. Related to the SOA_DEFAULT_TTL_MAXIMUM_VALUE_LOWER message tag from this test case. Default \f(CW300\fR (5 minutes in seconds). .SS test_cases_vars.zone06.SOA_DEFAULT_TTL_MAXIMUM_VALUE .IX Subsection "test_cases_vars.zone06.SOA_DEFAULT_TTL_MAXIMUM_VALUE" A positive integer value. Recommended upper bound for SOA minimum values (in seconds) in test case ZONE06. Related to the SOA_DEFAULT_TTL_MAXIMUM_VALUE_HIGHER message tag from this test case. Default \f(CW86400\fR (1 day in seconds). .SH REPRESENTATIONS .IX Header "REPRESENTATIONS" .SS "JSON REPRESENTATION" .IX Subsection "JSON REPRESENTATION" Property names in "PROFILE PROPERTIES" section correspond to paths in a datastructure of nested JSON objects. Property values are stored at their respective paths. Paths are formed from property names by splitting them at dot characters (U+002E). The left-most path component corresponds to a key in the top-most JSON object. Properties with unset values are omitted in the JSON representation. .PP For a complete example, refer to the file located by dist_file( "Zonemaster-Engine", "default.profile" ). A profile with the only two properties set, \f(CW\*(C`net.ipv4\*(C'\fR = true and \&\f(CW\*(C`net.ipv6\*(C'\fR = true has this JSON representation: .PP .Vb 6 \& { \& "net": { \& "ipv4": true, \& "ipv6": true \& } \& } .Ve .SS "YAML REPRESENTATION" .IX Subsection "YAML REPRESENTATION" Similar to the "JSON REPRESENTATION" but uses a YAML format.