int val_add_valpolicy(val_context_t *context, void *policy_definition, val_policy_entry_t **pol);
int val_remove_valpolicy(val_context_t *context, val_policy_entry_t *pol);
typedef struct { char *keyword; char *zone; char *value; long ttl; } libval_policy_definition_t;
The val_add_valpolicy() function can be used to dynamically add a new policy for a given context (the policies are not added persistently to the system configuration). The policy_definition field contains an implementation-specific definition of the validator policy to be added. For the libval library this is represented by the libval_policy_definition_t structure, which contains four fields: keyword, zone and value arguments are identical to keyword, zone and additional-data defined below for dnsval.conf. ttl specifies the duration in seconds for which the policy is kept in effect. A tt value of -1 adds to policy to the context indefinitely. A handle to the newly added policy is returned in *pol. This structure is opaque to the applications; applications must not modify the contents of the memory returned in *pol.
Applications may also revoke the effects of a newly added policy, pol, before the expiry of its timeout interval using the val_remove_valpolicy() policy.
The validator library reads configuration information from three separate files, resolv.conf, root.hints, and dnsval.conf.
This nameserver option is used to specify the IP address of the name server to which queries must be sent by default. For example,
nameserver 10.0.0.1
This search option is used to specify the search path for issuing queries. For example,
search test.dnssec-tools.org dnssec-tools.org
The forward option is used to redirect queries for names that match a given zone name to the provided name server. For example,
forward 76.216.12.217 test.dnssec-tools.org
If the resolv.conf file contains no name servers, the validator tries to recursively answer the query using information present in root.hints.
dig @e.root-servers.net . ns > root.hints
<label> <keyword> <additional-data>;
Policies are identified by simple text strings called labels, which must be unique within the configuration system. For example, ``browser'' could be used as the label that defines the validator policy for all web-browsers in a system. A label value of ``:'' identifies the default policy, the policy that is used when a NULL context is specified as the ctx parameter for interfaces listed in libval(3), val_getaddrinfo(3), and val_gethostbyname(3). The default policy must be unique within the configuration system.
keyword specifies the policy component within the policy fragment. The format of additional-data depends on the keyword specified.
If multiple policy fragments are defined for the same label and keyword combination then the first definition in the file is used.
The following keywords are defined for dnsval.conf:
browser trust-anchor example.com "257 3 5 AQO8XS4y9r77X 9SHBmrx MoJf1Pf9\ AT9Mr/L5BBGtO9/e9f/zl4FFgM2l B6M2 XEm6mp6 mit4tzp\ B/sAEQw1McYz6bJdKkTiqtuWTCfDmgQhI6 /Ha0 Ef GPNSqn\ Y 99FmbSeWNIRaa4fgSCVFhvbrYq1nXkNVy QPeEVHk oDNCA\ lr qOA3lw==" example.org "257 3 5 AQO8XS4y9r77X 9SHBmrx MoJf1Pf9\ AT9Mr/L5BBGtO9/e9f/zl4FFgM2l B6M2 XEm6mp6 mit4tzp\ B/sAEQw1McYz6bJdKkTiqtuWTCfDmgQhI6 /Ha0 Ef GPNSqn\ Y 99FmbSeWNIRaa4fgSCVFhvbrYq1nXkNVy QPeEVHk oDNCA\ lr qOA3lw==" ;
This zone-security-expectation DNSSEC validator policy construct makes it possible to define various islands of trust for DNSSEC-enabled zones and to ignore or validate data from selected zones. The default zone security expectation for a domain is ``validate''. In the following example, for DNSSEC validator contexts created with a DNSSEC validator policy label of ``browser'', the DNSSEC validation is only performed for names under the example.com domain; names under the somebogus.org domain are always considered to be untrusted and DNSSEC validation for all other domain names is ignored.
browser zone-security-expectation example.com validate somebogusname.org untrusted . ignore ;
The default value for the provably insecure status for a domain is ``trusted''. In the following example, for DNSSEC validator contexts created with the default label, the provably insecure condition is treated as valid for all domains except the net domain, where this condition is treated as invalid.
: provably-insecure-status . trusted net untrusted ;
mta clock-skew example.com -1 ;
dlv dlv-trust-points . dlv.isc.org. ;
In order for DLV to be used in the above example, there must be a trust-anchor policy defined for the dlv.isc.org zone, with the zone-security-expectation policy for dlv.isc.org set to validate.
Apart from zone-specific configuration options, it is also possible to configure global options for the validation in dnsval.conf. Global options can be specified using the construct below.
global-options keyowrd1 value1 keyword2 value2 ... ;
There can only be one global-options construct defined for dnsval.conf. If multiple constructs are defined, only the first is used.
The following keywords are defined for global-options in dnsval.conf
An example global-policy construct is given below:
global-policy trust-oob-answers yes edns0-size 4096 env-policy enable app-policy enable log 5:stderr ;
This allows users with a simple way of overriding resolver policies. The system-specific resolv.conf can remain unchanged, while any additional policies that may have to be specified for libval can be used in the configure-supplied resolv.conf file.
include /path/to/override/file/dnsval.conf
The files are read in breadth-first. The policies are evaluated in a manner that gives the last-defined policy more precedence over earlier ones. Therefore, an administrator may supply a dnsval.conf with default policies including another file from the user's home directory. The included file may be used for overriding policies specified in the base dnsval.conf file.
1. If env-policy is ``override'', use the label specified in the VAL_CONTEXT_LABEL env variable (if defined).
2. If env-policy is ``enable'' and the policy specified by the application is NULL, use the label specified in the VAL_CONTEXT_LABEL env variable (if defined).
3. if app-policy is ``override'', use the label generated from the application name. If this policy label does not exist in the configuration system, use the default policy.
4. if app-policy is ``enable'' and the policy specified by the application is NULL, use the label generated from the application name.
5. If policy specified by the application is not NULL, use this label.
6. Use default policy
The following use-cases can therefore be defined
The administrator may set the app-policy to enable if non-NULL policies specified by the application during validator context creation is deemed acceptable.
If VAL_CONTEXT_LABEL is specified globally for the system, the administrator may instead choose the env-policy global option to be enable instead of override. In this case, the label given in VAL_CONTEXT_LABEL is used only when the policy specified by the application is non-NULL.
The label in VAL_CONTEXT_LABEL is used only if it is defined. If this value is NULL, libval will read other policy labels as guided by the precedence rules listed above.
root.hints
http://www.dnssec-tools.org http://dnssec-tools.sourceforge.net