2020-11-09 13:23:58 +09:00
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2015-12-02 21:20:37 +01:00
# pragma once
resolved: chase DNSKEY/DS RRs when doing look-ups with DNSSEC enabled
This adds initial support for validating RRSIG/DNSKEY/DS chains when
doing lookups. Proof-of-non-existance, or proof-of-unsigned-zones is not
implemented yet.
With this change DnsTransaction objects will generate additional
DnsTransaction objects when looking for DNSKEY or DS RRs to validate an
RRSIG on a response. DnsTransaction objects are thus created for three
reasons now:
1) Because a user asked for something to be resolved, i.e. requested by
a DnsQuery/DnsQueryCandidate object.
2) As result of LLMNR RR probing, requested by a DnsZoneItem.
3) Because another DnsTransaction requires the requested RRs for
validation of its own response.
DnsTransactions are shared between all these users, and are GC
automatically as soon as all of these users don't need a specific
transaction anymore.
To unify the handling of these three reasons for existance for a
DnsTransaction, a new common naming is introduced: each DnsTransaction
now tracks its "owners" via a Set* object named "notify_xyz", containing
all owners to notify on completion.
A new DnsTransaction state is introduced called "VALIDATING" that is
entered after a response has been receieved which needs to be validated,
as long as we are still waiting for the DNSKEY/DS RRs from other
DnsTransactions.
This patch will request the DNSKEY/DS RRs bottom-up, and then validate
them top-down.
Caching of RRs is now only done after verification, so that the cache is
not poisoned with known invalid data.
The "DnsAnswer" object gained a substantial number of new calls, since
we need to add/remove RRs to it dynamically now.
2015-12-09 18:13:16 +01:00
typedef enum DnssecResult DnssecResult ;
2016-01-21 02:21:58 +01:00
typedef enum DnssecVerdict DnssecVerdict ;
2015-12-03 19:51:04 +01:00
2015-12-02 21:20:37 +01:00
# include "dns-domain.h"
# include "resolved-dns-answer.h"
# include "resolved-dns-rr.h"
resolved: chase DNSKEY/DS RRs when doing look-ups with DNSSEC enabled
This adds initial support for validating RRSIG/DNSKEY/DS chains when
doing lookups. Proof-of-non-existance, or proof-of-unsigned-zones is not
implemented yet.
With this change DnsTransaction objects will generate additional
DnsTransaction objects when looking for DNSKEY or DS RRs to validate an
RRSIG on a response. DnsTransaction objects are thus created for three
reasons now:
1) Because a user asked for something to be resolved, i.e. requested by
a DnsQuery/DnsQueryCandidate object.
2) As result of LLMNR RR probing, requested by a DnsZoneItem.
3) Because another DnsTransaction requires the requested RRs for
validation of its own response.
DnsTransactions are shared between all these users, and are GC
automatically as soon as all of these users don't need a specific
transaction anymore.
To unify the handling of these three reasons for existance for a
DnsTransaction, a new common naming is introduced: each DnsTransaction
now tracks its "owners" via a Set* object named "notify_xyz", containing
all owners to notify on completion.
A new DnsTransaction state is introduced called "VALIDATING" that is
entered after a response has been receieved which needs to be validated,
as long as we are still waiting for the DNSKEY/DS RRs from other
DnsTransactions.
This patch will request the DNSKEY/DS RRs bottom-up, and then validate
them top-down.
Caching of RRs is now only done after verification, so that the cache is
not poisoned with known invalid data.
The "DnsAnswer" object gained a substantial number of new calls, since
we need to add/remove RRs to it dynamically now.
2015-12-09 18:13:16 +01:00
enum DnssecResult {
2024-02-24 18:21:24 -07:00
/* These six are returned by dnssec_verify_rrset() */
resolved: chase DNSKEY/DS RRs when doing look-ups with DNSSEC enabled
This adds initial support for validating RRSIG/DNSKEY/DS chains when
doing lookups. Proof-of-non-existance, or proof-of-unsigned-zones is not
implemented yet.
With this change DnsTransaction objects will generate additional
DnsTransaction objects when looking for DNSKEY or DS RRs to validate an
RRSIG on a response. DnsTransaction objects are thus created for three
reasons now:
1) Because a user asked for something to be resolved, i.e. requested by
a DnsQuery/DnsQueryCandidate object.
2) As result of LLMNR RR probing, requested by a DnsZoneItem.
3) Because another DnsTransaction requires the requested RRs for
validation of its own response.
DnsTransactions are shared between all these users, and are GC
automatically as soon as all of these users don't need a specific
transaction anymore.
To unify the handling of these three reasons for existance for a
DnsTransaction, a new common naming is introduced: each DnsTransaction
now tracks its "owners" via a Set* object named "notify_xyz", containing
all owners to notify on completion.
A new DnsTransaction state is introduced called "VALIDATING" that is
entered after a response has been receieved which needs to be validated,
as long as we are still waiting for the DNSKEY/DS RRs from other
DnsTransactions.
This patch will request the DNSKEY/DS RRs bottom-up, and then validate
them top-down.
Caching of RRs is now only done after verification, so that the cache is
not poisoned with known invalid data.
The "DnsAnswer" object gained a substantial number of new calls, since
we need to add/remove RRs to it dynamically now.
2015-12-09 18:13:16 +01:00
DNSSEC_VALIDATED ,
2016-01-07 22:27:33 +01:00
DNSSEC_VALIDATED_WILDCARD , /* Validated via a wildcard RRSIG, further NSEC/NSEC3 checks necessary */
2015-12-02 21:20:37 +01:00
DNSSEC_INVALID ,
2015-12-11 13:55:26 +01:00
DNSSEC_SIGNATURE_EXPIRED ,
DNSSEC_UNSUPPORTED_ALGORITHM ,
2024-02-24 18:21:24 -07:00
DNSSEC_TOO_MANY_VALIDATIONS ,
2015-12-11 13:55:26 +01:00
/* These two are added by dnssec_verify_rrset_search() */
2015-12-02 21:20:37 +01:00
DNSSEC_NO_SIGNATURE ,
DNSSEC_MISSING_KEY ,
2015-12-11 13:55:26 +01:00
2024-01-10 11:34:44 +09:00
/* These five are added by the DnsTransaction logic */
2015-12-11 13:55:26 +01:00
DNSSEC_UNSIGNED ,
resolved: chase DNSKEY/DS RRs when doing look-ups with DNSSEC enabled
This adds initial support for validating RRSIG/DNSKEY/DS chains when
doing lookups. Proof-of-non-existance, or proof-of-unsigned-zones is not
implemented yet.
With this change DnsTransaction objects will generate additional
DnsTransaction objects when looking for DNSKEY or DS RRs to validate an
RRSIG on a response. DnsTransaction objects are thus created for three
reasons now:
1) Because a user asked for something to be resolved, i.e. requested by
a DnsQuery/DnsQueryCandidate object.
2) As result of LLMNR RR probing, requested by a DnsZoneItem.
3) Because another DnsTransaction requires the requested RRs for
validation of its own response.
DnsTransactions are shared between all these users, and are GC
automatically as soon as all of these users don't need a specific
transaction anymore.
To unify the handling of these three reasons for existance for a
DnsTransaction, a new common naming is introduced: each DnsTransaction
now tracks its "owners" via a Set* object named "notify_xyz", containing
all owners to notify on completion.
A new DnsTransaction state is introduced called "VALIDATING" that is
entered after a response has been receieved which needs to be validated,
as long as we are still waiting for the DNSKEY/DS RRs from other
DnsTransactions.
This patch will request the DNSKEY/DS RRs bottom-up, and then validate
them top-down.
Caching of RRs is now only done after verification, so that the cache is
not poisoned with known invalid data.
The "DnsAnswer" object gained a substantial number of new calls, since
we need to add/remove RRs to it dynamically now.
2015-12-09 18:13:16 +01:00
DNSSEC_FAILED_AUXILIARY ,
2015-12-14 21:26:42 +01:00
DNSSEC_NSEC_MISMATCH ,
2015-12-25 15:05:46 +01:00
DNSSEC_INCOMPATIBLE_SERVER ,
2024-01-10 11:34:44 +09:00
DNSSEC_UPSTREAM_FAILURE ,
2015-12-25 15:05:46 +01:00
resolved: chase DNSKEY/DS RRs when doing look-ups with DNSSEC enabled
This adds initial support for validating RRSIG/DNSKEY/DS chains when
doing lookups. Proof-of-non-existance, or proof-of-unsigned-zones is not
implemented yet.
With this change DnsTransaction objects will generate additional
DnsTransaction objects when looking for DNSKEY or DS RRs to validate an
RRSIG on a response. DnsTransaction objects are thus created for three
reasons now:
1) Because a user asked for something to be resolved, i.e. requested by
a DnsQuery/DnsQueryCandidate object.
2) As result of LLMNR RR probing, requested by a DnsZoneItem.
3) Because another DnsTransaction requires the requested RRs for
validation of its own response.
DnsTransactions are shared between all these users, and are GC
automatically as soon as all of these users don't need a specific
transaction anymore.
To unify the handling of these three reasons for existance for a
DnsTransaction, a new common naming is introduced: each DnsTransaction
now tracks its "owners" via a Set* object named "notify_xyz", containing
all owners to notify on completion.
A new DnsTransaction state is introduced called "VALIDATING" that is
entered after a response has been receieved which needs to be validated,
as long as we are still waiting for the DNSKEY/DS RRs from other
DnsTransactions.
This patch will request the DNSKEY/DS RRs bottom-up, and then validate
them top-down.
Caching of RRs is now only done after verification, so that the cache is
not poisoned with known invalid data.
The "DnsAnswer" object gained a substantial number of new calls, since
we need to add/remove RRs to it dynamically now.
2015-12-09 18:13:16 +01:00
_DNSSEC_RESULT_MAX ,
2021-02-09 17:17:47 +01:00
_DNSSEC_RESULT_INVALID = - EINVAL ,
2015-12-02 21:20:37 +01:00
} ;
2016-01-21 02:21:58 +01:00
enum DnssecVerdict {
DNSSEC_SECURE ,
DNSSEC_INSECURE ,
DNSSEC_BOGUS ,
DNSSEC_INDETERMINATE ,
_DNSSEC_VERDICT_MAX ,
2021-02-09 17:17:47 +01:00
_DNSSEC_VERDICT_INVALID = - EINVAL ,
2016-01-21 02:21:58 +01:00
} ;
2015-12-02 21:20:37 +01:00
# define DNSSEC_CANONICAL_HOSTNAME_MAX (DNS_HOSTNAME_MAX + 2)
2015-12-14 21:26:42 +01:00
/* The longest digest we'll ever generate, of all digest algorithms we support */
# define DNSSEC_HASH_SIZE_MAX (MAX(20, 32))
2024-02-24 18:21:24 -07:00
/* The most invalid signatures we will tolerate for a single rrset */
# define DNSSEC_INVALID_MAX 5
/* The total number of signature validations we will tolerate for a single transaction */
# define DNSSEC_VALIDATION_MAX 64
2016-01-04 20:38:21 +01:00
int dnssec_rrsig_match_dnskey ( DnsResourceRecord * rrsig , DnsResourceRecord * dnskey , bool revoked_ok ) ;
2015-12-18 14:37:06 +01:00
int dnssec_key_match_rrsig ( const DnsResourceKey * key , DnsResourceRecord * rrsig ) ;
2015-12-02 21:20:37 +01:00
2016-01-04 20:38:21 +01:00
int dnssec_verify_rrset ( DnsAnswer * answer , const DnsResourceKey * key , DnsResourceRecord * rrsig , DnsResourceRecord * dnskey , usec_t realtime , DnssecResult * result ) ;
2016-01-07 22:27:33 +01:00
int dnssec_verify_rrset_search ( DnsAnswer * answer , const DnsResourceKey * key , DnsAnswer * validated_dnskeys , usec_t realtime , DnssecResult * result , DnsResourceRecord * * rrsig ) ;
2015-12-02 21:20:37 +01:00
2016-01-14 20:11:11 +01:00
int dnssec_verify_dnskey_by_ds ( DnsResourceRecord * dnskey , DnsResourceRecord * ds , bool mask_revoke ) ;
int dnssec_verify_dnskey_by_ds_search ( DnsResourceRecord * dnskey , DnsAnswer * validated_ds ) ;
2015-12-02 21:20:37 +01:00
2015-12-18 14:37:06 +01:00
int dnssec_has_rrsig ( DnsAnswer * a , const DnsResourceKey * key ) ;
2016-01-04 20:38:21 +01:00
uint16_t dnssec_keytag ( DnsResourceRecord * dnskey , bool mask_revoke ) ;
2015-12-02 21:20:37 +01:00
2016-01-03 17:54:01 +01:00
int dnssec_nsec3_hash ( DnsResourceRecord * nsec3 , const char * name , void * ret ) ;
2015-12-14 21:26:42 +01:00
typedef enum DnssecNsecResult {
DNSSEC_NSEC_NO_RR , /* No suitable NSEC/NSEC3 RR found */
2016-01-07 22:27:33 +01:00
DNSSEC_NSEC_CNAME , /* Didn't find what was asked for, but did find CNAME */
2015-12-18 14:37:06 +01:00
DNSSEC_NSEC_UNSUPPORTED_ALGORITHM ,
2015-12-14 21:26:42 +01:00
DNSSEC_NSEC_NXDOMAIN ,
DNSSEC_NSEC_NODATA ,
DNSSEC_NSEC_FOUND ,
2015-12-18 14:37:06 +01:00
DNSSEC_NSEC_OPTOUT ,
2015-12-14 21:26:42 +01:00
} DnssecNsecResult ;
2016-01-07 22:27:33 +01:00
int dnssec_nsec_test ( DnsAnswer * answer , DnsResourceKey * key , DnssecNsecResult * result , bool * authenticated , uint32_t * ttl ) ;
2016-01-13 02:45:28 +01:00
int dnssec_test_positive_wildcard ( DnsAnswer * a , const char * name , const char * source , const char * zone , bool * authenticated ) ;
2015-12-14 21:26:42 +01:00
resolved: chase DNSKEY/DS RRs when doing look-ups with DNSSEC enabled
This adds initial support for validating RRSIG/DNSKEY/DS chains when
doing lookups. Proof-of-non-existance, or proof-of-unsigned-zones is not
implemented yet.
With this change DnsTransaction objects will generate additional
DnsTransaction objects when looking for DNSKEY or DS RRs to validate an
RRSIG on a response. DnsTransaction objects are thus created for three
reasons now:
1) Because a user asked for something to be resolved, i.e. requested by
a DnsQuery/DnsQueryCandidate object.
2) As result of LLMNR RR probing, requested by a DnsZoneItem.
3) Because another DnsTransaction requires the requested RRs for
validation of its own response.
DnsTransactions are shared between all these users, and are GC
automatically as soon as all of these users don't need a specific
transaction anymore.
To unify the handling of these three reasons for existance for a
DnsTransaction, a new common naming is introduced: each DnsTransaction
now tracks its "owners" via a Set* object named "notify_xyz", containing
all owners to notify on completion.
A new DnsTransaction state is introduced called "VALIDATING" that is
entered after a response has been receieved which needs to be validated,
as long as we are still waiting for the DNSKEY/DS RRs from other
DnsTransactions.
This patch will request the DNSKEY/DS RRs bottom-up, and then validate
them top-down.
Caching of RRs is now only done after verification, so that the cache is
not poisoned with known invalid data.
The "DnsAnswer" object gained a substantial number of new calls, since
we need to add/remove RRs to it dynamically now.
2015-12-09 18:13:16 +01:00
const char * dnssec_result_to_string ( DnssecResult m ) _const_ ;
DnssecResult dnssec_result_from_string ( const char * s ) _pure_ ;
2016-01-21 02:21:58 +01:00
const char * dnssec_verdict_to_string ( DnssecVerdict m ) _const_ ;
DnssecVerdict dnssec_verdict_from_string ( const char * s ) _pure_ ;