|
unbound 0.1
|
Contains autotrust implementation. More...
#include "config.h"#include "validator/autotrust.h"#include "validator/val_anchor.h"#include "validator/val_utils.h"#include "validator/val_sigcrypt.h"#include "util/data/dname.h"#include "util/data/packed_rrset.h"#include "util/log.h"#include "util/module.h"#include "util/net_help.h"#include "util/config_file.h"#include "util/regional.h"#include "util/random.h"#include "util/data/msgparse.h"#include "services/mesh.h"#include "services/cache/rrset.h"#include "validator/val_kcache.h"#include "sldns/sbuffer.h"#include "sldns/wire2str.h"#include "sldns/str2wire.h"#include "sldns/keyraw.h"#include "sldns/rrdef.h"#include <stdarg.h>#include <ctype.h>Macros | |
| #define | MIN_PENDINGCOUNT 2 |
| number of times a key must be seen before it can become valid | |
Functions | |
| static void | do_revoked (struct module_env *env, struct autr_ta *anchor, int *c) |
| Event: Revoked. | |
| struct autr_global_data * | autr_global_create (void) |
| Create new global 5011 data structure. | |
| void | autr_global_delete (struct autr_global_data *global) |
| Delete global 5011 data structure. | |
| int | probetree_cmp (const void *x, const void *y) |
| probe tree compare function | |
| size_t | autr_get_num_anchors (struct val_anchors *anchors) |
| See if autotrust anchors are configured and how many. | |
| static int | position_in_string (char *str, const char *sub) |
| Position in string. | |
| static void | verbose_key (struct autr_ta *ta, enum verbosity_value level, const char *format,...) ATTR_FORMAT(printf |
| Debug routine to print pretty key information. | |
| static int | parse_comments (char *str, struct autr_ta *ta, int header_seen) |
| Parse comments. | |
| static int | str_contains_data (char *str, char comment) |
| Check if a line contains data (besides comments). | |
| static int | dnskey_flags (uint16_t t, uint8_t *rdata, size_t len) |
| Get DNSKEY flags rdata without rdatalen in front of it. | |
| static int | rr_is_dnskey_sep (uint16_t t, uint8_t *rdata, size_t len) |
| Check if KSK DNSKEY. | |
| static int | ta_is_dnskey_sep (struct autr_ta *ta) |
| Check if TA is KSK DNSKEY. | |
| static int | rr_is_dnskey_revoked (uint16_t t, uint8_t *rdata, size_t len) |
| Check if REVOKED DNSKEY pass rdata without rdatalen in front of it. | |
| static struct autr_ta * | autr_ta_create (uint8_t *rr, size_t rr_len, size_t dname_len) |
| create ta | |
| static struct trust_anchor * | autr_tp_create (struct val_anchors *anchors, uint8_t *own, size_t own_len, uint16_t dc) |
| create tp | |
| static void | autr_rrset_delete (struct ub_packed_rrset_key *r) |
| delete assembled rrsets | |
| static void | autr_ta_delete (struct autr_ta *ta) |
| delete autotrust key data | |
| void | autr_point_delete (struct trust_anchor *tp) |
| Delete autr anchor, deletes the autr data but does not do unlinking from trees, caller does that. | |
| static struct trust_anchor * | find_add_tp (struct val_anchors *anchors, uint8_t *rr, size_t rr_len, size_t dname_len) |
| find or add a new trust point for autotrust | |
| static struct autr_ta * | add_trustanchor_frm_rr (struct val_anchors *anchors, uint8_t *rr, size_t rr_len, size_t dname_len, struct trust_anchor **tp) |
| Add trust anchor from RR. | |
| static struct autr_ta * | add_trustanchor_frm_str (struct val_anchors *anchors, char *str, struct trust_anchor **tp, uint8_t *origin, size_t origin_len, uint8_t **prev, size_t *prev_len, int *skip) |
| Add new trust anchor from a string in file. | |
| static struct trust_anchor * | load_trustanchor (struct val_anchors *anchors, char *str, const char *fname, uint8_t *origin, size_t origin_len, uint8_t **prev, size_t *prev_len, int *skip, int header_seen) |
| Load single anchor. | |
| static int | assemble_iterate_ds (struct autr_ta **list, uint8_t **rr, size_t *rr_len, size_t *dname_len) |
| iterator for DSes from keylist. | |
| static int | assemble_iterate_dnskey (struct autr_ta **list, uint8_t **rr, size_t *rr_len, size_t *dname_len) |
| iterator for DNSKEYs from keylist. | |
| static int | assemble_iterate_hasfirst (int iter(struct autr_ta **, uint8_t **, size_t *, size_t *), struct autr_ta *list) |
| see if iterator-list has any elements in it, or it is empty | |
| static size_t | assemble_iterate_count (int iter(struct autr_ta **, uint8_t **, size_t *, size_t *), struct autr_ta *list) |
| number of elements in iterator list | |
| static struct ub_packed_rrset_key * | ub_packed_rrset_heap_key (int iter(struct autr_ta **, uint8_t **, size_t *, size_t *), struct autr_ta *list) |
| Create a ub_packed_rrset_key allocated on the heap. | |
| static struct packed_rrset_data * | packed_rrset_heap_data (int iter(struct autr_ta **, uint8_t **, size_t *, size_t *), struct autr_ta *list) |
| Create packed_rrset data on the heap. | |
| static int | autr_assemble (struct trust_anchor *tp) |
| Assemble the trust anchors into DS and DNSKEY packed rrsets. | |
| static unsigned int | parse_int (char *line, int *ret) |
| parse integer | |
| static struct trust_anchor * | parse_id (struct val_anchors *anchors, char *line) |
| parse id sequence for anchor | |
| static int | parse_var_line (char *line, struct val_anchors *anchors, struct trust_anchor **anchor, int *header_seen, const char *nm) |
| Parse variable from trustanchor header. | |
| static int | handle_origin (char *line, uint8_t **origin, size_t *origin_len) |
| handle origin lines | |
| static int | read_multiline (char *buf, size_t len, FILE *in, int *linenr) |
| Read one line and put multiline RRs onto one line string. | |
| int | autr_read_file (struct val_anchors *anchors, const char *nm) |
| Read autotrust file. | |
| static const char * | trustanchor_state2str (autr_state_type s) |
| string for a trustanchor state | |
| static char * | autr_ctime_r (time_t *t, char *s) |
| ctime r for autotrust | |
| static int | print_id (FILE *out, char *fname, uint8_t *nm, size_t nmlen, uint16_t dclass) |
| print ID to file | |
| static int | autr_write_contents (FILE *out, char *fn, struct trust_anchor *tp) |
| void | autr_write_file (struct module_env *env, struct trust_anchor *tp) |
| Write autotrust file. | |
| static int | verify_dnskey (struct module_env *env, struct val_env *ve, struct trust_anchor *tp, struct ub_packed_rrset_key *rrset, struct module_qstate *qstate, struct val_qstate *vq) |
| Verify if dnskey works for trust point. | |
| static int32_t | rrsig_get_expiry (uint8_t *d, size_t len) |
| static time_t | min_expiry (struct module_env *env, struct packed_rrset_data *dd) |
| Find minimum expiration interval from signatures. | |
| static int | rr_is_selfsigned_revoked (struct module_env *env, struct val_env *ve, struct ub_packed_rrset_key *dnskey_rrset, size_t i, struct module_qstate *qstate, struct val_qstate *vq) |
| Is rr self-signed revoked key. | |
| static void | seen_trustanchor (struct autr_ta *ta, uint8_t seen) |
| Set fetched value. | |
| static void | seen_revoked_trustanchor (struct autr_ta *ta, uint8_t revoked) |
| set revoked value | |
| static void | revoke_dnskey (struct autr_ta *ta, int off) |
| revoke a trust anchor | |
| static int | dnskey_compare_skip_revbit (uint8_t *a, size_t a_len, uint8_t *b, size_t b_len) |
| Compare two RRs skipping the REVOKED bit. | |
| static int | ta_compare (struct autr_ta *a, uint16_t t, uint8_t *b, size_t b_len) |
| compare trust anchor with rdata, 0 if equal. | |
| static int | find_key (struct trust_anchor *tp, uint16_t t, uint8_t *rdata, size_t rdata_len, struct autr_ta **result) |
| Find key. | |
| static struct autr_ta * | add_key (struct trust_anchor *tp, uint32_t ttl, uint8_t *rdata, size_t rdata_len) |
| add key and clone RR and tp already locked. | |
| static time_t | key_ttl (struct ub_packed_rrset_key *k) |
| get TTL from DNSKEY rrset | |
| static void | set_tp_times (struct trust_anchor *tp, time_t rrsig_exp_interval, time_t origttl, int *changed) |
| update the time values for the trustpoint | |
| static void | init_events (struct trust_anchor *tp) |
| init events to zero | |
| static void | check_contains_revoked (struct module_env *env, struct val_env *ve, struct trust_anchor *tp, struct ub_packed_rrset_key *dnskey_rrset, int *changed, struct module_qstate *qstate, struct val_qstate *vq) |
| check for revoked keys without trusting any other information | |
| static int | key_matches_a_ds (struct module_env *env, struct val_env *ve, struct ub_packed_rrset_key *dnskey_rrset, size_t key_idx, struct ub_packed_rrset_key *ds_rrset) |
| See if a DNSKEY is verified by one of the DSes. | |
| static int | update_events (struct module_env *env, struct val_env *ve, struct trust_anchor *tp, struct ub_packed_rrset_key *dnskey_rrset, int *changed) |
| Set update events. | |
| static time_t | check_holddown (struct module_env *env, struct autr_ta *ta, unsigned int holddown) |
| Check if the holddown time has already exceeded setting: add-holddown: add holddown timer setting: del-holddown: del holddown timer. | |
| static void | reset_holddown (struct module_env *env, struct autr_ta *ta, int *changed) |
| Set last_change to now. | |
| static void | set_trustanchor_state (struct module_env *env, struct autr_ta *ta, int *changed, autr_state_type s) |
| Set the state for this trust anchor. | |
| static void | do_newkey (struct module_env *env, struct autr_ta *anchor, int *c) |
| Event: NewKey. | |
| static void | do_addtime (struct module_env *env, struct autr_ta *anchor, int *c) |
| Event: AddTime. | |
| static void | do_remtime (struct module_env *env, struct autr_ta *anchor, int *c) |
| Event: RemTime. | |
| static void | do_keyrem (struct module_env *env, struct autr_ta *anchor, int *c) |
| Event: KeyRem. | |
| static void | do_keypres (struct module_env *env, struct autr_ta *anchor, int *c) |
| Event: KeyPres. | |
| static void | anchor_state_update (struct module_env *env, struct autr_ta *anchor, int *c) |
| Do statestable transition matrix for anchor. | |
| static int | init_zsk_to_ksk (struct module_env *env, struct trust_anchor *tp, int *changed) |
| if ZSK init then trust KSKs | |
| static void | remove_missing_trustanchors (struct module_env *env, struct trust_anchor *tp, int *changed) |
| Remove missing trustanchors so the list does not grow forever. | |
| static int | do_statetable (struct module_env *env, struct trust_anchor *tp, int *changed) |
| Do the statetable from RFC5011 transition matrix. | |
| static void | autr_holddown_exceed (struct module_env *env, struct trust_anchor *tp, int *c) |
| See if time alone makes ADDPEND to VALID transition. | |
| static void | autr_cleanup_keys (struct trust_anchor *tp) |
| cleanup key list | |
| static time_t | calc_next_probe (struct module_env *env, time_t wait) |
| calculate next probe time | |
| static time_t | wait_probe_time (struct val_anchors *anchors) |
| what is first probe time (anchors must be locked) | |
| static void | reset_worker_timer_at (struct module_env *env, time_t next) |
| reset worker timer, at the time from wait_probe_time. | |
| static void | reset_worker_timer (struct module_env *env) |
| reset worker timer. | |
| static int | set_next_probe (struct module_env *env, struct trust_anchor *tp, struct ub_packed_rrset_key *dnskey_rrset) |
| set next probe for trust anchor | |
| static void | autr_tp_remove (struct module_env *env, struct trust_anchor *tp, struct ub_packed_rrset_key *dnskey_rrset) |
| Revoke and Delete a trust point. | |
| int | autr_process_prime (struct module_env *env, struct val_env *ve, struct trust_anchor *tp, struct ub_packed_rrset_key *dnskey_rrset, struct module_qstate *qstate, struct val_qstate *vq) |
| Perform autotrust processing. | |
| static void | autr_debug_print_ta (struct autr_ta *ta) |
| debug print a trust anchor key | |
| static void | autr_debug_print_tp (struct trust_anchor *tp) |
| debug print a trust point | |
| void | autr_debug_print (struct val_anchors *anchors) |
| Debug printout of rfc5011 tracked anchors. | |
| void | probe_answer_cb (void *arg, int ATTR_UNUSED(rcode), sldns_buffer *ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(sec), char *ATTR_UNUSED(why_bogus), int ATTR_UNUSED(was_ratelimited)) |
| static void | probe_anchor (struct module_env *env, struct trust_anchor *tp) |
| probe a trust anchor DNSKEY and unlocks tp | |
| static struct trust_anchor * | todo_probe (struct module_env *env, time_t *next) |
| fetch first to-probe trust-anchor and lock it and set retrytime | |
| time_t | autr_probe_timer (struct module_env *env) |
| Process probe timer. | |
Contains autotrust implementation.
The implementation was taken from the autotrust daemon (BSD licensed), written by Matthijs Mekking. It was modified to fit into unbound. The state table process is the same.
| #define MIN_PENDINGCOUNT 2 |
number of times a key must be seen before it can become valid
Referenced by do_addtime().
|
static |
Event: Revoked.
References do_revoked(), revoke_dnskey(), autr_ta::s, set_trustanchor_state(), VERB_ALGO, and verbose_key().
Referenced by anchor_state_update(), check_contains_revoked(), and do_revoked().
| struct autr_global_data * autr_global_create | ( | void | ) |
Create new global 5011 data structure.
References autr_global_create(), autr_global_data::probe, probetree_cmp(), and rbtree_init().
Referenced by anchors_create(), and autr_global_create().
| void autr_global_delete | ( | struct autr_global_data * | global | ) |
Delete global 5011 data structure.
| global | global autotrust state to delete. |
References autr_global_delete().
Referenced by anchors_delete(), and autr_global_delete().
| int probetree_cmp | ( | const void * | x, |
| const void * | y ) |
probe tree compare function
References anchor_cmp(), trust_anchor::autr, log_assert, autr_point_data::next_probe_time, and probetree_cmp().
Referenced by autr_global_create(), fptr_whitelist_rbtree_cmp(), and probetree_cmp().
| size_t autr_get_num_anchors | ( | struct val_anchors * | anchors | ) |
See if autotrust anchors are configured and how many.
| anchors | the trust anchors structure. |
References val_anchors::autr, autr_get_num_anchors(), rbtree_type::count, val_anchors::lock, and autr_global_data::probe.
Referenced by autr_get_num_anchors(), and worker_init().
|
static |
Position in string.
References position_in_string().
Referenced by parse_comments(), and position_in_string().
|
static |
Debug routine to print pretty key information.
Implementation of debug pretty key print.
| ta | trust anchor key with DNSKEY data. |
| level | verbosity level to print at. |
| format | printf style format string. |
References autr_ta::rr, autr_ta::rr_len, sldns_calc_keytag_raw(), sldns_wire2str_dname(), sldns_wirerr_get_rdata(), sldns_wirerr_get_rdatalen(), verbose(), verbose_key(), and verbosity.
Referenced by anchor_state_update(), check_contains_revoked(), check_holddown(), do_addtime(), do_remtime(), do_revoked(), init_zsk_to_ksk(), parse_comments(), remove_missing_trustanchors(), set_trustanchor_state(), update_events(), and verbose_key().
|
static |
Parse comments.
| str | to parse |
| ta | trust key autotrust metadata |
| header_seen | if an autotrust file header was seen. Without such a header it is a list of resource records. |
References autr_ta::last_change, log_err(), parse_comments(), autr_ta::pending_count, position_in_string(), autr_ta::s, VERB_OPS, and verbose_key().
Referenced by load_trustanchor(), and parse_comments().
|
static |
Check if a line contains data (besides comments).
References str_contains_data().
Referenced by add_trustanchor_frm_str(), autr_read_file(), and str_contains_data().
|
static |
Get DNSKEY flags rdata without rdatalen in front of it.
References dnskey_flags().
Referenced by dnskey_flags(), rr_is_dnskey_revoked(), rr_is_dnskey_sep(), and ta_is_dnskey_sep().
|
static |
Check if KSK DNSKEY.
pass rdata without rdatalen in front of it
References DNSKEY_BIT_SEP, dnskey_flags(), and rr_is_dnskey_sep().
Referenced by check_contains_revoked(), rr_is_dnskey_sep(), and update_events().
|
static |
Check if TA is KSK DNSKEY.
References DNSKEY_BIT_SEP, dnskey_flags(), autr_ta::rr, autr_ta::rr_len, sldns_wirerr_get_rdata(), sldns_wirerr_get_rdatalen(), sldns_wirerr_get_type(), and ta_is_dnskey_sep().
Referenced by autr_holddown_exceed(), do_statetable(), init_zsk_to_ksk(), remove_missing_trustanchors(), and ta_is_dnskey_sep().
|
static |
Check if REVOKED DNSKEY pass rdata without rdatalen in front of it.
References dnskey_flags(), and rr_is_dnskey_revoked().
Referenced by check_contains_revoked(), rr_is_dnskey_revoked(), and update_events().
|
static |
create ta
References autr_ta_create(), autr_ta::rr, and autr_ta::rr_len.
Referenced by add_key(), add_trustanchor_frm_rr(), and autr_ta_create().
|
static |
create tp
References trust_anchor::autr, val_anchors::autr, autr_tp_create(), trust_anchor::dclass, dname_count_labels(), dname_str(), rbnode_type::key, LDNS_MAX_DOMAINLEN, trust_anchor::lock, val_anchors::lock, log_err(), memdup(), trust_anchor::name, trust_anchor::namelabs, trust_anchor::namelen, trust_anchor::node, autr_point_data::pnode, autr_global_data::probe, rbtree_delete(), rbtree_insert(), and val_anchors::tree.
Referenced by autr_tp_create(), find_add_tp(), and parse_id().
|
static |
delete assembled rrsets
References autr_rrset_delete(), lruhash_entry::data, packed_rrset_key::dname, ub_packed_rrset_key::entry, and ub_packed_rrset_key::rk.
Referenced by autr_assemble(), autr_point_delete(), and autr_rrset_delete().
|
static |
delete autotrust key data
References autr_ta_delete(), and autr_ta::rr.
Referenced by add_trustanchor_frm_rr(), autr_cleanup_keys(), autr_point_delete(), autr_ta_delete(), and load_trustanchor().
| void autr_point_delete | ( | struct trust_anchor * | tp | ) |
Delete autr anchor, deletes the autr data but does not do unlinking from trees, caller does that.
| tp | trust point to delete. |
References trust_anchor::autr, autr_point_delete(), autr_rrset_delete(), autr_ta_delete(), trust_anchor::dnskey_rrset, trust_anchor::ds_rrset, autr_point_data::file, autr_point_data::keys, trust_anchor::lock, trust_anchor::name, and autr_ta::next.
Referenced by anchors_delfunc(), autr_point_delete(), and autr_tp_remove().
|
static |
find or add a new trust point for autotrust
References anchor_find(), trust_anchor::autr, autr_tp_create(), dname_count_labels(), find_add_tp(), trust_anchor::lock, log_err(), and sldns_wirerr_get_class().
Referenced by add_trustanchor_frm_rr(), and find_add_tp().
|
static |
Add trust anchor from RR.
References add_trustanchor_frm_rr(), autr_ta_create(), autr_ta_delete(), find_add_tp(), autr_ta::next, autr_ta::rr, and autr_ta::rr_len.
Referenced by add_trustanchor_frm_rr(), and add_trustanchor_frm_str().
|
static |
Add new trust anchor from a string in file.
| anchors | all anchors |
| str | string with anchor and comments, if any comments. |
| tp | trust point returned. |
| origin | what to use for @ |
| origin_len | length of origin |
| prev | previous rr name |
| prev_len | length of prev |
| skip | if true, the result is NULL, but not an error, skip it. |
References add_trustanchor_frm_rr(), add_trustanchor_frm_str(), LDNS_RR_BUF_SIZE, LDNS_RR_TYPE_DS, log_err(), memdup(), autr_ta::rr, autr_ta::rr_len, sldns_get_errorstr_parse(), sldns_str2wire_rr_buf(), sldns_wirerr_get_type(), and str_contains_data().
Referenced by add_trustanchor_frm_str(), and load_trustanchor().
|
static |
Load single anchor.
| anchors | all points. |
| str | comments line |
| fname | filename |
| origin | the $ORIGIN. |
| origin_len | length of origin |
| prev | passed to ldns. |
| prev_len | length of prev |
| skip | if true, the result is NULL, but not an error, skip it. |
| header_seen | if an autotrust file header was seen. Without such a header it is a list of resource records. |
References add_trustanchor_frm_str(), trust_anchor::autr, autr_ta_delete(), autr_point_data::file, autr_point_data::keys, load_trustanchor(), trust_anchor::lock, log_assert, log_err(), autr_ta::next, and parse_comments().
Referenced by autr_read_file(), and load_trustanchor().
|
static |
iterator for DSes from keylist.
return true if a next element exists
References assemble_iterate_ds(), LDNS_RR_TYPE_DS, autr_ta::next, and sldns_wirerr_get_type().
Referenced by assemble_iterate_ds(), and autr_assemble().
|
static |
iterator for DNSKEYs from keylist.
return true if a next element exists
References assemble_iterate_dnskey(), LDNS_RR_TYPE_DS, autr_ta::next, and sldns_wirerr_get_type().
Referenced by assemble_iterate_dnskey(), and autr_assemble().
|
static |
see if iterator-list has any elements in it, or it is empty
References assemble_iterate_hasfirst().
Referenced by assemble_iterate_hasfirst(), and autr_assemble().
|
static |
number of elements in iterator list
References assemble_iterate_count().
Referenced by assemble_iterate_count(), and autr_assemble().
|
static |
Create a ub_packed_rrset_key allocated on the heap.
It therefore does not have the correct ID value, and cannot be used inside the cache. It can be used in storage outside of the cache. Keys for the cache have to be obtained from alloc.h .
| iter | iterator over the elements in the list. It filters elements. |
| list | the list. |
References packed_rrset_key::dname, packed_rrset_key::dname_len, memdup(), ub_packed_rrset_key::rk, packed_rrset_key::rrset_class, sldns_wirerr_get_class(), sldns_wirerr_get_type(), packed_rrset_key::type, and ub_packed_rrset_heap_key().
Referenced by autr_assemble(), and ub_packed_rrset_heap_key().
|
static |
Create packed_rrset data on the heap.
| iter | iterator over the elements in the list. It filters elements. |
| list | the list. |
References packed_rrset_data::count, LDNS_RR_TYPE_RRSIG, log_assert, packed_rrset_heap_data(), autr_ta::rr, packed_rrset_data::rr_data, autr_ta::rr_len, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, packed_rrset_data::rrsig_count, sldns_wirerr_get_rdatalen(), sldns_wirerr_get_rdatawl(), sldns_wirerr_get_ttl(), sldns_wirerr_get_type(), and packed_rrset_data::ttl.
Referenced by autr_assemble(), and packed_rrset_heap_data().
|
static |
Assemble the trust anchors into DS and DNSKEY packed rrsets.
Uses only VALID and MISSING DNSKEYs. Read the sldns_rrs and builds packed rrsets
| tp | the trust point. Must be locked. |
References assemble_iterate_count(), assemble_iterate_dnskey(), assemble_iterate_ds(), assemble_iterate_hasfirst(), trust_anchor::autr, autr_assemble(), autr_rrset_delete(), lruhash_entry::data, trust_anchor::dnskey_rrset, trust_anchor::ds_rrset, ub_packed_rrset_key::entry, autr_point_data::keys, trust_anchor::numDNSKEY, trust_anchor::numDS, packed_rrset_heap_data(), and ub_packed_rrset_heap_key().
Referenced by autr_assemble(), autr_process_prime(), and autr_read_file().
|
static |
|
static |
parse id sequence for anchor
References autr_tp_create(), trust_anchor::dclass, parse_id(), parse_int(), and sldns_str2wire_dname().
Referenced by parse_id(), and parse_var_line().
|
static |
Parse variable from trustanchor header.
| line | to parse |
| anchors | the anchor is added to this, if "id:" is seen. |
| anchor | the anchor as result value or previously returned anchor value to read the variable lines into. |
| header_seen | if a header ';;id: example.com.' was seen. |
| nm | file name. |
References trust_anchor::autr, val_anchors::autr, autr_point_data::file, autr_point_data::last_queried, autr_point_data::last_success, trust_anchor::lock, val_anchors::lock, log_err(), autr_point_data::next_probe_time, parse_id(), parse_int(), parse_var_line(), autr_point_data::pnode, autr_global_data::probe, autr_point_data::query_failed, autr_point_data::query_interval, rbtree_delete(), rbtree_insert(), and autr_point_data::retry_time.
Referenced by autr_read_file(), and parse_var_line().
|
static |
handle origin lines
References handle_origin(), log_warn(), and sldns_str2wire_dname().
Referenced by autr_read_file(), and handle_origin().
|
static |
Read one line and put multiline RRs onto one line string.
References log_err(), and read_multiline().
Referenced by autr_read_file(), and read_multiline().
| int autr_read_file | ( | struct val_anchors * | anchors, |
| const char * | nm ) |
Read autotrust file.
| anchors | the anchors structure. |
| nm | name of the file (copied). |
References autr_assemble(), autr_read_file(), handle_origin(), load_trustanchor(), trust_anchor::lock, log_err(), log_warn(), parse_var_line(), read_multiline(), str_contains_data(), VERB_ALGO, and verbose().
Referenced by anchors_apply_cfg(), and autr_read_file().
|
static |
string for a trustanchor state
References trustanchor_state2str().
Referenced by autr_debug_print_ta(), set_trustanchor_state(), and trustanchor_state2str().
|
static |
ctime r for autotrust
References autr_ctime_r().
Referenced by autr_ctime_r(), autr_debug_print_ta(), and autr_debug_print_tp().
|
static |
print ID to file
References trust_anchor::dclass, log_err(), print_id(), and sldns_wire2str_dname().
Referenced by print_id().
| void autr_write_file | ( | struct module_env * | env, |
| struct trust_anchor * | tp ) |
Write autotrust file.
| env | environment with scratch space. |
| tp | trust point to write. |
References trust_anchor::autr, autr_write_file(), fatal_exit(), autr_point_data::file, log_assert, log_err(), VERB_ALGO, verbose(), and module_env::worker.
Referenced by autr_process_prime(), autr_tp_remove(), and autr_write_file().
|
static |
Verify if dnskey works for trust point.
| env | environment (with time) for verification |
| ve | validator environment (with options) for verification. |
| tp | trust point to verify with |
| rrset | DNSKEY rrset to verify. |
| qstate | qstate with region. |
| vq | validator query state. |
References ALGO_NEEDS_MAX, module_env::cfg, trust_anchor::dnskey_rrset, trust_anchor::ds_rrset, config_file::harden_algo_downgrade, sec_status_secure, sec_status_to_string(), val_verify_DNSKEY_with_TA(), VERB_ALGO, verbose(), and verify_dnskey().
Referenced by autr_process_prime(), and verify_dnskey().
|
static |
Find minimum expiration interval from signatures.
References packed_rrset_data::count, min_expiry(), module_env::now, packed_rrset_data::rr_data, packed_rrset_data::rr_len, and packed_rrset_data::rrsig_count.
Referenced by min_expiry(), and update_events().
|
static |
Is rr self-signed revoked key.
References dnskey_verify_rrset(), rr_is_selfsigned_revoked(), sec_status_secure, VERB_ALGO, and verbose().
Referenced by check_contains_revoked(), and rr_is_selfsigned_revoked().
|
static |
Set fetched value.
References autr_ta::fetched, autr_ta::pending_count, and seen_trustanchor().
Referenced by seen_trustanchor(), and update_events().
|
static |
set revoked value
References autr_ta::revoked, and seen_revoked_trustanchor().
Referenced by check_contains_revoked(), and seen_revoked_trustanchor().
|
static |
revoke a trust anchor
References revoke_dnskey(), autr_ta::rr, autr_ta::rr_len, sldns_wirerr_get_rdata(), sldns_wirerr_get_rdatalen(), and sldns_wirerr_get_type().
Referenced by do_revoked(), and revoke_dnskey().
|
static |
Compare two RRs skipping the REVOKED bit.
Pass rdata(no len)
References dnskey_compare_skip_revbit().
Referenced by dnskey_compare_skip_revbit(), and ta_compare().
|
static |
compare trust anchor with rdata, 0 if equal.
Pass rdata(no len)
References dnskey_compare_skip_revbit(), LDNS_RR_TYPE_DS, autr_ta::rr, autr_ta::rr_len, sldns_wirerr_get_rdata(), sldns_wirerr_get_rdatalen(), sldns_wirerr_get_type(), and ta_compare().
Referenced by find_key(), and ta_compare().
|
static |
Find key.
| tp | to search in |
| t | rr type of the rdata. |
| rdata | to look for (no rdatalen in it) |
| rdata_len | length of rdata |
| result | returns NULL or the ta key looked for. |
References trust_anchor::autr, find_key(), autr_point_data::keys, autr_ta::next, and ta_compare().
Referenced by check_contains_revoked(), find_key(), and update_events().
|
static |
add key and clone RR and tp already locked.
rdata without rdlen.
References add_key(), trust_anchor::autr, autr_ta_create(), autr_point_data::keys, LDNS_RR_CLASS_IN, trust_anchor::name, trust_anchor::namelen, autr_ta::next, autr_ta::rr, and autr_ta::rr_len.
Referenced by add_key(), and update_events().
|
static |
get TTL from DNSKEY rrset
References lruhash_entry::data, ub_packed_rrset_key::entry, key_ttl(), and packed_rrset_data::ttl.
Referenced by key_ttl(), and update_events().
|
static |
update the time values for the trustpoint
References trust_anchor::autr, autr_permit_small_holddown, autr_point_data::query_interval, autr_point_data::retry_time, set_tp_times(), VERB_ALGO, and verbose().
Referenced by set_tp_times(), and update_events().
|
static |
init events to zero
References trust_anchor::autr, autr_ta::fetched, init_events(), autr_point_data::keys, and autr_ta::next.
Referenced by init_events(), and update_events().
|
static |
check for revoked keys without trusting any other information
References check_contains_revoked(), packed_rrset_data::count, lruhash_entry::data, dnskey_calc_keytag(), do_revoked(), ub_packed_rrset_key::entry, find_key(), log_assert, log_err(), autr_ta::revoked, ub_packed_rrset_key::rk, autr_ta::rr, packed_rrset_data::rr_data, rr_is_dnskey_revoked(), rr_is_dnskey_sep(), rr_is_selfsigned_revoked(), autr_ta::rr_len, packed_rrset_data::rr_len, seen_revoked_trustanchor(), sldns_calc_keytag_raw(), sldns_wirerr_get_rdata(), sldns_wirerr_get_rdatalen(), packed_rrset_key::type, VERB_ALGO, and verbose_key().
Referenced by autr_process_prime(), and check_contains_revoked().
|
static |
See if a DNSKEY is verified by one of the DSes.
References packed_rrset_data::count, lruhash_entry::data, dnskey_calc_keytag(), dnskey_get_algo(), dnskey_size_is_supported(), ds_digest_algo_is_supported(), ds_digest_match_dnskey(), ds_get_digest_algo(), ds_get_key_algo(), ds_get_keytag(), ds_key_algo_is_supported(), ub_packed_rrset_key::entry, key_matches_a_ds(), val_favorite_ds_algo(), VERB_ALGO, and verbose().
Referenced by key_matches_a_ds(), and update_events().
|
static |
Set update events.
References add_key(), packed_rrset_data::count, lruhash_entry::data, trust_anchor::dclass, dnskey_algo_is_supported(), dnskey_size_is_supported(), trust_anchor::ds_rrset, ub_packed_rrset_key::entry, find_key(), init_events(), key_matches_a_ds(), key_ttl(), log_assert, log_nametypeclass(), min_expiry(), trust_anchor::name, ub_packed_rrset_key::rk, packed_rrset_data::rr_data, rr_is_dnskey_revoked(), rr_is_dnskey_sep(), packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, autr_ta::s, seen_trustanchor(), set_tp_times(), packed_rrset_key::type, update_events(), VERB_ALGO, VERB_DETAIL, and verbose_key().
Referenced by autr_process_prime(), and update_events().
|
static |
Check if the holddown time has already exceeded setting: add-holddown: add holddown timer setting: del-holddown: del holddown timer.
| env | environment with current time |
| ta | trust anchor to check for. |
| holddown | the timer value |
References check_holddown(), autr_ta::last_change, log_warn(), module_env::now, VERB_ALGO, and verbose_key().
Referenced by check_holddown(), do_addtime(), do_remtime(), and remove_missing_trustanchors().
|
static |
Set last_change to now.
References autr_ta::last_change, module_env::now, and reset_holddown().
Referenced by anchor_state_update(), reset_holddown(), and set_trustanchor_state().
|
static |
Set the state for this trust anchor.
References reset_holddown(), autr_ta::s, set_trustanchor_state(), trustanchor_state2str(), VERB_ALGO, and verbose_key().
Referenced by do_addtime(), do_keypres(), do_keyrem(), do_newkey(), do_remtime(), do_revoked(), init_zsk_to_ksk(), remove_missing_trustanchors(), and set_trustanchor_state().
|
static |
Event: NewKey.
References do_newkey(), autr_ta::s, and set_trustanchor_state().
Referenced by anchor_state_update(), and do_newkey().
|
static |
Event: AddTime.
References config_file::add_holddown, module_env::cfg, check_holddown(), do_addtime(), MIN_PENDINGCOUNT, autr_ta::pending_count, autr_ta::s, set_trustanchor_state(), VERB_ALGO, and verbose_key().
Referenced by anchor_state_update(), autr_holddown_exceed(), and do_addtime().
|
static |
Event: RemTime.
References module_env::cfg, check_holddown(), config_file::del_holddown, do_remtime(), autr_ta::s, set_trustanchor_state(), VERB_ALGO, and verbose_key().
Referenced by anchor_state_update(), and do_remtime().
|
static |
Event: KeyRem.
References do_keyrem(), autr_ta::pending_count, autr_ta::s, and set_trustanchor_state().
Referenced by anchor_state_update(), and do_keyrem().
|
static |
Event: KeyPres.
References do_keypres(), autr_ta::s, and set_trustanchor_state().
Referenced by anchor_state_update(), and do_keypres().
|
static |
Do statestable transition matrix for anchor.
References anchor_state_update(), do_addtime(), do_keypres(), do_keyrem(), do_newkey(), do_remtime(), do_revoked(), autr_ta::fetched, autr_ta::last_change, log_assert, reset_holddown(), autr_ta::revoked, autr_ta::s, VERB_ALGO, and verbose_key().
Referenced by anchor_state_update(), and do_statetable().
|
static |
if ZSK init then trust KSKs
References trust_anchor::autr, init_zsk_to_ksk(), autr_point_data::keys, autr_ta::last_change, autr_ta::next, autr_ta::rr, autr_ta::rr_len, autr_ta::s, set_trustanchor_state(), sldns_wirerr_get_type(), ta_is_dnskey_sep(), VERB_ALGO, and verbose_key().
Referenced by init_zsk_to_ksk(), and remove_missing_trustanchors().
|
static |
Remove missing trustanchors so the list does not grow forever.
References trust_anchor::autr, module_env::cfg, check_holddown(), init_zsk_to_ksk(), config_file::keep_missing, autr_point_data::keys, autr_ta::next, remove_missing_trustanchors(), autr_ta::s, set_trustanchor_state(), ta_is_dnskey_sep(), VERB_ALGO, and verbose_key().
Referenced by do_statetable(), and remove_missing_trustanchors().
|
static |
Do the statetable from RFC5011 transition matrix.
References anchor_state_update(), trust_anchor::autr, do_statetable(), autr_point_data::keys, autr_ta::next, remove_missing_trustanchors(), and ta_is_dnskey_sep().
Referenced by autr_process_prime(), and do_statetable().
|
static |
See if time alone makes ADDPEND to VALID transition.
References trust_anchor::autr, autr_holddown_exceed(), do_addtime(), autr_point_data::keys, autr_ta::next, autr_ta::s, and ta_is_dnskey_sep().
Referenced by autr_holddown_exceed(), and autr_process_prime().
|
static |
cleanup key list
References trust_anchor::autr, autr_cleanup_keys(), autr_ta_delete(), autr_point_data::keys, autr_ta::next, autr_ta::pending_count, autr_ta::rr, autr_ta::rr_len, autr_ta::s, and sldns_wirerr_get_type().
Referenced by autr_cleanup_keys(), and autr_process_prime().
|
static |
calculate next probe time
References autr_permit_small_holddown, calc_next_probe(), module_env::now, module_env::rnd, and ub_random_max().
Referenced by calc_next_probe(), set_next_probe(), and todo_probe().
|
static |
what is first probe time (anchors must be locked)
References val_anchors::autr, rbnode_type::key, autr_global_data::probe, rbtree_first(), RBTREE_NULL, and wait_probe_time().
Referenced by autr_tp_remove(), reset_worker_timer(), set_next_probe(), and wait_probe_time().
|
static |
reset worker timer, at the time from wait_probe_time.
References comm_timer_set(), module_env::now, module_env::probe_timer, reset_worker_timer_at(), VERB_ALGO, and verbose().
Referenced by autr_tp_remove(), reset_worker_timer(), reset_worker_timer_at(), and set_next_probe().
|
static |
reset worker timer.
This routine manages the locks on acquiring the next time for the timer.
References module_env::anchors, val_anchors::lock, reset_worker_timer(), reset_worker_timer_at(), and wait_probe_time().
Referenced by reset_worker_timer().
|
static |
set next probe for trust anchor
References module_env::anchors, trust_anchor::autr, val_anchors::autr, calc_next_probe(), trust_anchor::dclass, packed_rrset_key::dname, dname_count_labels(), packed_rrset_key::dname_len, trust_anchor::dnskey_rrset, rbnode_type::key, trust_anchor::lock, val_anchors::lock, log_assert, trust_anchor::name, trust_anchor::namelabs, trust_anchor::namelen, autr_point_data::next_probe_time, trust_anchor::node, module_env::now, autr_point_data::pnode, autr_global_data::probe, autr_point_data::query_interval, rbtree_delete(), rbtree_insert(), rbtree_search(), reset_worker_timer_at(), ub_packed_rrset_key::rk, set_next_probe(), val_anchors::tree, VERB_ALGO, verbose(), and wait_probe_time().
Referenced by autr_process_prime(), and set_next_probe().
|
static |
Revoke and Delete a trust point.
References module_env::anchors, anchors_init_parents_locked(), trust_anchor::autr, val_anchors::autr, autr_point_delete(), autr_tp_remove(), autr_write_file(), trust_anchor::dclass, packed_rrset_key::dname, rbnode_type::key, trust_anchor::lock, val_anchors::lock, log_nametypeclass(), trust_anchor::name, trust_anchor::namelabs, trust_anchor::namelen, autr_point_data::next_probe_time, trust_anchor::node, autr_point_data::pnode, autr_global_data::probe, rbtree_delete(), reset_worker_timer_at(), autr_point_data::revoked, ub_packed_rrset_key::rk, val_anchors::tree, VERB_OPS, and wait_probe_time().
Referenced by autr_process_prime(), and autr_tp_remove().
| int autr_process_prime | ( | struct module_env * | env, |
| struct val_env * | ve, | ||
| struct trust_anchor * | tp, | ||
| struct ub_packed_rrset_key * | dnskey_rrset, | ||
| struct module_qstate * | qstate, | ||
| struct val_qstate * | vq ) |
Perform autotrust processing.
| env | qstate environment with the anchors structure. |
| ve | validator environment for verification of rrsigs. |
| tp | trust anchor to process. |
| dnskey_rrset | DNSKEY rrset probed (can be NULL if bad prime result). allocated in a region. Has not been validated yet. |
| qstate | qstate with region. |
| vq | validator query state. |
References trust_anchor::autr, autr_assemble(), autr_cleanup_keys(), autr_holddown_exceed(), autr_process_prime(), autr_tp_remove(), autr_write_file(), check_contains_revoked(), trust_anchor::dclass, trust_anchor::dnskey_rrset, do_statetable(), trust_anchor::ds_rrset, autr_point_data::last_queried, autr_point_data::last_success, trust_anchor::lock, log_assert, log_err(), log_nametypeclass(), trust_anchor::name, module_env::now, autr_point_data::query_failed, autr_point_data::revoked, set_next_probe(), update_events(), VERB_ALGO, verbose(), and verify_dnskey().
Referenced by autr_process_prime(), and process_prime_response().
|
static |
debug print a trust anchor key
References autr_ctime_r(), autr_debug_print_ta(), autr_ta::fetched, autr_ta::last_change, log_info(), autr_ta::pending_count, autr_ta::revoked, autr_ta::rr, autr_ta::rr_len, autr_ta::s, sldns_wire2str_rr(), and trustanchor_state2str().
Referenced by autr_debug_print_ta(), and autr_debug_print_tp().
|
static |
debug print a trust point
References trust_anchor::autr, autr_ctime_r(), autr_debug_print_ta(), autr_debug_print_tp(), trust_anchor::dclass, dname_str(), trust_anchor::dnskey_rrset, trust_anchor::ds_rrset, autr_point_data::file, autr_point_data::keys, autr_point_data::last_queried, autr_point_data::last_success, LDNS_MAX_DOMAINLEN, log_info(), log_packed_rrset(), trust_anchor::name, autr_ta::next, autr_point_data::next_probe_time, trust_anchor::numDNSKEY, trust_anchor::numDS, autr_point_data::query_failed, autr_point_data::query_interval, and autr_point_data::retry_time.
Referenced by autr_debug_print(), and autr_debug_print_tp().
| void autr_debug_print | ( | struct val_anchors * | anchors | ) |
Debug printout of rfc5011 tracked anchors.
| anchors | all the anchors. |
References autr_debug_print(), autr_debug_print_tp(), trust_anchor::lock, val_anchors::lock, RBTREE_FOR, and val_anchors::tree.
Referenced by anchors_apply_cfg(), and autr_debug_print().
|
static |
probe a trust anchor DNSKEY and unlocks tp
References trust_anchor::autr, BIT_RD, edns_data::bits, edns_data::cookie_present, edns_data::cookie_valid, trust_anchor::dclass, EDNS_DO, edns_data::edns_present, edns_data::edns_version, edns_data::ext_rcode, module_env::key_cache, key_cache_remove(), query_info::local_alias, trust_anchor::lock, log_err(), log_query_info(), module_env::mesh, mesh_new_callback(), trust_anchor::name, trust_anchor::namelen, autr_point_data::next_probe_time, module_env::now, edns_data::opt_list_in, edns_data::opt_list_inplace_cb_out, edns_data::opt_list_out, edns_data::padding_block_size, probe_anchor(), query_info::qclass, query_info::qname, query_info::qname_len, query_info::qtype, regional_alloc_init(), module_env::rrset_cache, rrset_cache_remove(), module_env::scratch, module_env::scratch_buffer, sldns_buffer_capacity(), edns_data::udp_size, VERB_ALGO, and verbose().
Referenced by autr_probe_timer(), and probe_anchor().
|
static |
fetch first to-probe trust-anchor and lock it and set retrytime
References module_env::anchors, trust_anchor::autr, val_anchors::autr, calc_next_probe(), rbnode_type::key, trust_anchor::lock, val_anchors::lock, autr_point_data::next_probe_time, module_env::now, autr_point_data::pnode, autr_global_data::probe, rbtree_delete(), rbtree_first(), rbtree_insert(), RBTREE_NULL, autr_point_data::retry_time, and todo_probe().
Referenced by autr_probe_timer(), and todo_probe().
| time_t autr_probe_timer | ( | struct module_env * | env | ) |
Process probe timer.
Add new probes if needed.
| env | module environment with time, with anchors and with the mesh. |
References autr_permit_small_holddown, autr_probe_timer(), probe_anchor(), regional_free_all(), module_env::scratch, todo_probe(), VERB_ALGO, and verbose().
Referenced by autr_probe_timer(), and worker_probe_timer_cb().