Commit Graph

21 Commits

Author SHA1 Message Date
Hugo Landau ea9853a35b Remove issuewild support from CAA patch 2016-01-31 02:01:34 +00:00
Hugo Landau 4f27c24cf3 Make CAA checking more compliant with the RFC; CAA refactoring
The CAA response checking method has been refactored to have a
easier to follow straight-line control flow. Several bugs in it have
been fixed:

  - Firstly, parameters for issue and issuewild directives were not
    parsed, so any attempt to specify parameters would result in
    a string mismatch with the CA CAA identity (e.g. "letsencrypt.org").
    Moreover, the syntax as specified permits leading and trailing
    whitespace, so a parameter-free record such as
    "  letsencrypt.org ;  " would not be considered a match.

    This has been fixed by stripping whitespace and parameters. The RFC
    does not specify the criticality of parameters, so unknown
    parameters (currently all parameters) are considered noncritical.
    I justify this as follows:

    If someone decides to nominate a CA in a CAA record, they can,
    with trivial research, determine what parameters, if any, that
    CA supports, and presumably in trusting them in the first place
    is able to adequately trust that the CA will continue to support
    those parameters. The risk from other CAs is zero because other CAs
    do not process the parameters because the records in which they
    appear they do not relate to them.

  - Previously, all of the flag bits were considered to effectively mean
    'critical'. However, the RFC specifies that all bits except for the
    actual critical bit (decimal 128) should be ignored. In practice,
    many people have misunderstood the RFC to mean that the critical bit
    is decimal 1, so both bits are interpreted to mean 'critical', but
    this change ignores all of the other bits. This ensures that the
    remaining six bits are reasonably usable for future standards action
    if any need should arise.

  - Previously, existence of an "issue" directive but no "issuewild"
    directive was essentially equivalent to an unsatisfiable "issuewild"
    directive, meaning that no wildcard identifiers could pass the CAA
    check. This is contrary to the RFC, which states that issuewild
    should default to what is specified for "issue" if no issuewild
    directives are specified. (This is somewhat moot since boulder
    doesn't currently support wildcard issuance.)

  - Conversely, existence of an "issuewild" directive but no "issue"
    directive would cause CAA validation for a non-wildcard identifier
    to fail, which was contrary to the RFC. This has been fixed.

  - More generally, existence of any unknown non-critical directive, say
    "foobar", would cause the CAA checking code to act as though an
    unsatisfiable "issue" directive existed, preventing any issuance.
    This has been fixed.

Test coverage for corner cases is enhanced and provides regression
testing for these bugs.

statsd statistics have been added for tracking the relative frequency
of occurrence of different CAA features and outcomes. I added these on
a whim suspecting that they may be of interest.

Fixes #1436.
2016-01-31 01:51:28 +00:00
Roland Shoemaker d5d4795626 Fix mock CAA response in test 2016-01-27 14:15:16 -08:00
Roland Shoemaker b55a0e64ec Add small test 2016-01-26 13:59:25 -08:00
Romain Fliedel 5d9191b537 add test to ensure dns validation succeed when dns reply does not contain authority 2016-01-21 16:17:48 +01:00
Romain Fliedel 3e06307e8a only add soa authority response for nxdomain or not entry
This is more what we expect from a dns server.

dig A nx.google.com @ns2.google.com

; <<>> DiG 9.9.5-3ubuntu0.7-Ubuntu <<>> A nx.google.com @ns2.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 28643
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;nx.google.com.                 IN      A

;; AUTHORITY SECTION:
google.com.             60      IN      SOA     ns4.google.com. dns-admin.google.com. 112672771 900 900 1800 60

;; Query time: 13 msec
;; SERVER: 216.239.34.10#53(216.239.34.10)
;; WHEN: Thu Jan 21 14:44:06 CET 2016
;; MSG SIZE  rcvd: 81

VS

dig A www.google.com @ns2.google.com

; <<>> DiG 9.9.5-3ubuntu0.7-Ubuntu <<>> A www.google.com @ns2.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18684
;; flags: qr aa rd; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;www.google.com.                        IN      A

;; ANSWER SECTION:
www.google.com.         300     IN      A       64.233.184.99
www.google.com.         300     IN      A       64.233.184.105
www.google.com.         300     IN      A       64.233.184.106
www.google.com.         300     IN      A       64.233.184.104
www.google.com.         300     IN      A       64.233.184.147
www.google.com.         300     IN      A       64.233.184.103

;; Query time: 13 msec
;; SERVER: 216.239.34.10#53(216.239.34.10)
;; WHEN: Thu Jan 21 14:44:32 CET 2016
;; MSG SIZE  rcvd: 128
2016-01-21 15:59:02 +01:00
Jacob Hoffman-Andrews d5acf9d2b5 Restore expectedCount. 2016-01-08 16:55:13 -08:00
Jacob Hoffman-Andrews 40167f3da3 Merge remote-tracking branch 'le/master' into dns-errors-fix
Conflicts:
	bdns/dns.go
	bdns/dns_test.go
	mocks/mocks.go
	ra/registration-authority.go
	ra/registration-authority_test.go
2016-01-08 14:07:05 -08:00
Jacob Hoffman-Andrews 78f43d8a4c Add context errors. 2016-01-08 13:04:00 -08:00
Roland Shoemaker a801766f05 Fix silly merge error 2016-01-06 15:30:13 -08:00
Roland Shoemaker b4c761aa5d Merge branch 'master' into dns-meta 2016-01-06 15:09:28 -08:00
Jacob Hoffman-Andrews df4ba7aaa8 Report DNS errors properly.
Previously we would return a detailed errorString, which ProblemDetailsFromDNSError
would turn into a generic, uninformative "Server failure at resolver".

Now we return a new internal dnsError type, which ProblemDetailsFromDNSError can
turn into a more informative message to be shown to the user.
2016-01-04 16:07:02 -08:00
Jeff Hodges 116ce96326 add retries and context deadlines to DNSResolver
This provides a means to add retries to DNS look ups, and, with some
future work, end retries early if our request deadline is blown. That
future work is tagged with #1292.

Updates #1258
2016-01-04 14:59:10 -08:00
Roland Shoemaker bee1f46f28 Add return value names 2016-01-04 14:19:54 -08:00
Roland Shoemaker 4a45263b08 Merge branch 'dns-meta' of github.com:letsencrypt/boulder into dns-meta 2016-01-04 13:43:40 -08:00
Roland Shoemaker 8022d3a8fe Update comment 2016-01-04 13:39:26 -08:00
Jeff Hodges 50a22c83c8 Merge branch 'master' into dns-meta 2016-01-04 12:54:38 -08:00
Roland Shoemaker d18b8a536d Add DNS ValidationRecord metadata 2016-01-04 12:20:45 -08:00
Jeff Hodges 92f1689310 make DNS ProblemDetails more clear
Fixes #1259
2015-12-28 13:09:33 -08:00
Jeff Hodges e36895c9c5 bring RTT metrics inside DNSResolver
This moves the RTT metrics calculation inside of the DNSResolver. This
cleans up code in the RA and VA and makes some adding retries to the
DNSResolver less ugly to do.

Note: this will put `Rate` and `RTT` after the name of DNS query
type (`A`, `MX`, etc.). I think that's fine and desirable. We aren't
using this data in alerts or many dashboards, yet, so a flag day is
okay.

Fixes #1124
2015-12-16 17:41:42 -08:00
Jeff Hodges b31165444f move dns code to dns pkg and rename to bdns
Moves the DNS code from core to dns and renames the dns package to bdns
to be clearer.

Fixes #1260 and will be good to have while we add retries and such.
2015-12-14 11:21:43 -08:00