Commit Graph

174 Commits

Author SHA1 Message Date
Christian Huitema 31eee9c7d1 Intermediate commit of context.h, mdns.[ch] 2017-01-20 19:44:05 -08:00
Willem Toorop 2281accd38 Extra fixes for pedantic warnings 2016-12-08 16:36:23 +01:00
Willem Toorop f31b2fa233 Merge branch 'develop' into release/1.1.0-alpha3 2016-12-08 15:06:25 +01:00
Willem Toorop 473da8966b Library fixed for CFLAGS=-Wextra 2016-12-08 14:05:58 +01:00
Sara Dickinson 576e38977f More logging changes to stubby to correctly report profile, transport and stats for TCP and UDP when used as fallbacks.
Reporting UDP stats every 100 responses or timeouts to give user some indication UDP is being used.
2016-12-05 18:05:04 +00:00
Sara Dickinson a0ae9130cc Fix issue with session re-use making authentication appear to fail 2016-10-21 14:18:24 +01:00
Sara Dickinson fdbefa17ec Add timer for back off on upstream (use 1 hr). Reset as new upstream when re-instated. 2016-08-05 17:25:27 +01:00
Sara Dickinson a1461d51ec Add abbreviated logging mode for daemon 2016-08-05 14:10:55 +01:00
Sara Dickinson 0432fe37c4 Tinker with upstream keepalive 2016-08-04 16:10:23 +01:00
wtoorop 79f92cedd2 Merge pull request #197 from saradickinson/feature/upstream_handling
Feature/upstream handling
2016-07-14 10:58:32 +02:00
Willem Toorop be97bd1d71 Mv getdns_context_set_listen_addresses in the lib
Also, check for request_id +
cancel a reply by specifying NULL as response to getdns_reply
2016-07-13 14:50:44 +02:00
Willem Toorop d0f01b6bc4 Default values for extensions in context 2016-07-07 14:47:38 +02:00
Sara Dickinson 8fa84c836a Initial re-work of stateful transport selection and timeout/error handling. Also update transport test to avoid timeout. 2016-07-04 17:02:14 +01:00
Sara Dickinson 98d636b99d Updates to unit tests and tpkg 2016-05-16 17:56:48 +01:00
Sara Dickinson 5f225d6be3 Add TLS session resumption 2016-05-16 17:41:55 +01:00
Willem Toorop da577a463d set upstream loop to the sync loop for sync reqs
And reset to the async loop when sync request was finished, rescheduling the upstream->event.
Note that finished_event is scheduled against the async loop always.
2016-04-11 14:49:44 +02:00
Willem Toorop b0ecda5d2e No more side effects with synchronous calls
(and upstreams that keep connections open)
2016-03-23 22:13:31 +01:00
Willem Toorop ab742b34b6 Miscelaneous scheduling fixes and improvements 2016-03-17 16:49:05 +01:00
Willem Toorop d938c433ab Set root servers without temporary file 2016-03-14 11:33:06 +01:00
Willem Toorop a83c54387d Reuse sync eventloop per context
So recursive resolution can depend on and continue with outstanding queries it depends on
2016-03-09 11:16:19 +01:00
Willem Toorop 4230961e9f Basic usage of unbound pluggable event loop 2016-03-01 16:29:37 +01:00
Willem Toorop ae2b16665b Setup getdns eventloop in libunbound
When unbound supports this
2016-01-19 16:52:11 +01:00
Willem Toorop 4fd8d3dddd Replace mini_event extension by default_eventloop
* default_eventloop was prototyped in getdns_query and is still in there as my_eventloop
  * It interfaces directly with the scheduling primitives of getdns.
  * It can operate entirely from stack and does not have to do
    any memory allocations or deallocations.

* Adapted configure.ac to allow libunbound to be linked with Windows
  (with the removal of winsock_event.c we have no symbol clashed anymore)

* Added STUB_TCP_WOULDBLOCK return code in stub_resolving helper functions,
  to anticipate dealing with edge triggered event loops (versus level triggered). (i.e. Windows)
2016-01-12 15:52:14 +01:00
Willem Toorop 89b6c04d4f First query append 2015-12-29 17:34:14 +01:00
Willem Toorop 54498cd556 Distinct between suffix and suffixes more clearly 2015-12-29 16:23:04 +01:00
Willem Toorop 5a388386b4 Store suffixes in wireformat 2015-12-29 16:00:15 +01:00
saradickinson b777552f34 Merge pull request #131 from saradickinson/feature/pubkey-pinning
Feature/pubkey pinning
2015-12-24 10:13:53 +00:00
Willem Toorop 8bde787703 Use mkstemp instead of tmpnam to eliminate warning 2015-12-24 10:50:58 +01:00
Daniel Kahn Gillmor d09675539e Provide access to the pinsets during the TLS verification callback
We do this by associating a getdns_upstream object with the SSL object
handled by that upstream.

This allows us to collapse the verification callback code to a single
function.

Note that if we've agreed that fallback is ok, we are now willing to
accept *any* cert verification error, not just HOSTNAME_MISMATCH.
This is fine, because the alternative is falling back to cleartext,
which would be worse.

We also always set SSL_VERIFY_PEER, since we might as well try to do
so; we'll drop the verification error ourselves if we know we're OK
with falling back.
2015-12-23 18:00:43 +00:00
Daniel Kahn Gillmor 4dbe1813e4 added simple sha256 public key pinning linked list to getdns_upstream 2015-12-23 17:59:50 +00:00
Willem Toorop fbae577a54 Setting of root servers
test with

	getdns_query -f yeti.key -R yeti.hints nlnetlabs.nl A +dnssec_return_status

where yeti.key comes from:

	https://raw.githubusercontent.com/BII-Lab/Yeti-Project/master/domain/named.cache

and yeti.hints from:

	https://raw.githubusercontent.com/BII-Lab/Yeti-Project/master/domain/KSK.pub
2015-12-23 17:15:45 +01:00
Willem Toorop 5bbcbb97a1 Merge branch 'develop' into features/conversion_functions 2015-12-22 11:28:27 +01:00
Willem Toorop ee2a1fbfe6 Merge branch 'features/tsig' into develop 2015-12-22 01:08:25 +01:00
Sara Dickinson 746a827baa Implement client side edns-tcp-keepalive 2015-12-21 17:05:56 +00:00
Willem Toorop 98dc4018c3 Setting & getting of tsig info per upstream 2015-12-21 12:22:59 +01:00
Sara Dickinson c5b839bda8 remove STARTTLS 2015-12-18 16:14:54 +00:00
Willem Toorop d67949d1e7 iterators go over const wireformat data 2015-12-07 16:43:41 +01:00
Daniel Kahn Gillmor b3128652f4 add tls_query_padding_blocksize property for getdns_context
This is a parameter to the getdns_context that tells the context how
much to pad queries that go out over TLS.

It is not yet functional in this commit, but the idea is to pad each
outbound query over TLS to a multiple of the requested blocksize.

Because we only have a set amount of pre-allocated space for dynamic
options (MAXIMUM_UPSTREAM_OPTION_SPACE), we limit the maximum
padding blocksize.

This is a simplistic padding policy.  Suggestions for improved padding
policies are welcome!
2015-11-01 15:49:56 +09:00
Daniel Kahn Gillmor df3725e635 added edns_client_subnet_private to getdns_context
https://tools.ietf.org/html/draft-ietf-dnsop-edns-client-subnet-04

Using the above spec, an intermediate resolver may forward a chunk of
the client's IP address to the authoritative resolver.

Setting edns_client_subnet_private to a getdns_context in stub mode
will indicate to the next-hop recursive resolver that the client
wishes to keep their address information private.
2015-11-01 15:49:50 +09:00
Sara Dickinson 28ffb2fdf6 Add ls_authentication to API 2015-10-16 17:00:14 +01:00
Sara Dickinson 6b4ee4ed31 Block authenticated requests on unauthenticated connection 2015-10-16 17:00:14 +01:00
Sara Dickinson af617e92a7 Implement authenticaiton fallback on a given upstream (needs more work). Also need API option to set auth requirement. 2015-10-16 17:00:14 +01:00
Willem Toorop 53e23f1358 Revert "Revert "Merge pull request #112 from saradickinson/features/tls_auth""
This reverts commit 6d29e6044e.
2015-09-04 10:56:30 +02:00
Willem Toorop 6d29e6044e Revert "Merge pull request #112 from saradickinson/features/tls_auth"
This reverts commit d436165a88, reversing
changes made to 7c902bf73c.
2015-08-27 13:31:22 +02:00
Willem Toorop 015e387ea5 Final internal symbols rename to _getdns prefix 2015-08-19 16:33:19 +02:00
Willem Toorop b9e8455e27 Internal symbols always prefixed with _getdns 2015-08-19 16:30:15 +02:00
Willem Toorop 1f638ccd0b Internal getdns_mini_event to _getdns_mini_event 2015-08-19 16:26:39 +02:00
Willem Toorop fcd595298a Rename all priv_getdns internal symbols to _getdns 2015-08-19 16:22:38 +02:00
Willem Toorop 450aabefcc Make util symbols private (i.e. prefix _getdns) 2015-08-19 16:07:01 +02:00
Willem Toorop 6350b4fad4 --without-libunbound option to configure 2015-08-19 10:47:46 +02:00
saradickinson cb1dff1ac7 Add ability to verify server certificate using hostname for TLS/STARTTLS
NOTE: This implementation will only work for OpenSSL v1.0.2 and later.
Doing it for earlier versions is totally insane:

  https://wiki.openssl.org/index.php/Hostname_validation
2015-08-15 14:40:15 +01:00
Daniel Kahn Gillmor 319a20a66c improve documentation
improve the documentation of the getdns_upstream objects.
2015-07-19 12:22:10 +02:00
Willem Toorop 2884abe870 Allow alternative trust anchors + ...
Switch freely between stub and recursive resolving
2015-07-10 00:05:26 +02:00
Willem Toorop f066d5ef73 Merge branch 'features/native-stub-dnssec' into develop
Conflicts:
	configure.ac
	src/stub.c
2015-07-02 10:27:27 +02:00
Willem Toorop 41cf772fb3 Trust anchors in wireformat in context 2015-06-30 14:43:52 +02:00
Sara Dickinson e20d679bc8 Improve TCP close handling and sync connection closing 2015-06-29 09:09:13 +01:00
Sara Dickinson 8819d29535 Implement TCP fallback and hack for lack of sync idle timeout. 2015-06-24 18:49:34 +01:00
Sara Dickinson 635cf9e182 Re-factor of internal handing of transport list. 2015-06-19 18:28:29 +01:00
Sara Dickinson 68dfb15706 Add context idle timeout 2015-06-18 17:11:11 +01:00
Sara Dickinson 8dd8d90e74 Commit addition of transport list to the API.
- set and get functions are added.
- Existing transport functions retained for backwards compatibility.
- Basic combinations work as before, but underlying functional changes and cleanup are not complete yet...
- Context level options for timeouts and max_transactions_per_tcp_connection coming soon...
2015-06-17 17:18:09 +01:00
Sara Dickinson 7905eda8b7 Some clean up of connection handling. Still a problem with STARTTLS fallback that needs fixing. 2015-04-30 12:24:13 +01:00
Sara Dickinson 79b3412fbf Add another transport option as proof of concept for STARTTLS. 2015-04-29 19:20:25 +01:00
Sara Dickinson 3de15ad782 Change internal transport handling to use a list, not a fixed type 2015-04-24 16:29:08 +01:00
Sara Dickinson f2ae55858f First pass at making handshake async. Lots of issues with this code still
- timeouts are not being rescheduled on fallback
- several error cases are not being handled correctly (e.g. 8.8.8.8) and a user callback is not always called
- the fallback mechanism is not generic (specific to tls to tcp)
2015-04-23 17:46:31 +01:00
Willem Toorop 0ba6af3523 upstreams_cleanup from upstreams_dereference 2015-04-18 22:17:28 +02:00
Sara Dickinson 6c7ffc4e4e 1) Fix enum mapping error.
2) Also add detection of TLS 1.2 in openssl during configure and warn that it if not available then TLS will not be available. Using TLS_ONLY in stub mode will then error with BAD_CONTEXT. TLS/TCP will fallback to TCP.

3) Explicitly disallow use of TLS_ONLY in RECURSIVE mode since it isn't supported yet. TLS/TCP will fallback to TCP.

4) Fix for MAC OS X build where openssl not linked correctly
2015-04-17 18:38:13 +01:00
Sara Dickinson ab4fb8d9e9 Enable GETDNS_TRANSPORT_TLS_ONLY_KEEP_CONNECTIONS_OPEN for libunbound. Should only be used in stub mode.
GETDNS_TRANSPORT_TLS_FIRST_AND_FALL_BACK_TO_TCP_KEEP_CONNECTIONS_OPEN still just does TCP.
Also some tidy up of new transport types.
2015-04-17 15:50:08 +01:00
saradickinson 99aa79b48f First pass at TLS implementation - needs work! 2015-04-16 18:05:27 +01:00
Willem Toorop 56bb9dbbdc Pass along a userarg with context update callbacks 2015-04-02 14:42:26 +02:00
Willem Toorop 00f047816d EDNS cookies processing as stub 2015-03-22 10:50:48 -05:00
Willem Toorop 736f5ff157 No executable flags on source files
Thanks Paul Wouters
2015-01-20 12:16:49 +01:00
Willem Toorop 4a3d7fd8b2 Replace ldns_rbtree with getdns_rbtree
As much as possible.
In dnssec ldns_rbtree is inderectly used via the dnssec_zone struct

This change forces use to embed the data in the nodes as getdns_rbtree does not have a data attribute. This is good because lesser allocs and free's and thus slightly faster and less likely to leak memory.
2014-10-23 23:00:30 +02:00
Willem Toorop 6f6b8e65a2 Stub edns0 payload 1232 for IPv6 and 1432 for IPv4 2014-10-23 14:30:23 +02:00
Willem Toorop 484f98daf9 remove ldns_res from context 2014-10-23 14:14:55 +02:00
Willem Toorop fc6e583b4b Stub TCP pipelining
TODO: Resolve issue with timeouts in async pipelining mode.
2014-10-18 14:32:55 +02:00
Willem Toorop 181d8cd3f4 stub tcp lookups
And the foundation for tcp keep connections open
2014-10-18 00:25:41 +02:00
Willem Toorop 623c9b04a5 Retry stub with different upstream after timeout
Backing off the broken upsteams so they are tried again (increasingly less)
2014-10-16 14:24:13 +02:00
Willem Toorop b62e2bb84c Prepare datastructs for tcp stub resolving 2014-10-16 11:28:32 +02:00
Willem Toorop 8f254913f1 Sync functions use the async _loop functions too
So async and sync functions now have the same code path
2014-10-15 12:16:34 +02:00
Willem Toorop 768d8fbf4d _loop version for async funcs
So they can be used by the sync functions with a libmini_event loop
2014-10-14 00:14:25 +02:00
Willem Toorop 1f203485e2 eventloop separate from context & libmini_event 2014-10-08 15:42:33 +02:00
Willem Toorop 54e0b42dcd Timeouts via default mini_event extension 2014-10-06 23:04:12 +02:00
Willem Toorop 648153f98c Timeouts are 64 bits 2014-10-06 16:10:09 +02:00
Willem Toorop 2dcdfaba37 getdns_context_set_upstream_recursive_servers 2014-10-01 23:16:43 +02:00
Willem Toorop 1c6ce72f74 Parse /etc/resolv.conf ourselves
At the ame time IPv6 local-link scope_id support
2014-09-30 15:12:48 +02:00
saradickinson d9addba883 Second pass at implementing per query namespaces! 2014-09-25 15:59:05 +00:00
saradickinson 050506341c First pass of implementing per query namespace lookup for stub resolver. Also a getdns local namespace lookup is now used for all sync calls. 2014-09-25 14:49:18 +00:00
Sara Dickinson f59689cf68 Use ldns as stub resolover for sync queries part 1 2014-09-12 14:15:46 +00:00
Willem Toorop 57b51a5dcc prefer includes local to builddir 2014-05-19 15:50:34 +02:00
Neel Goyal 3f8e8ac098 Possible fix for #21 and tests 2014-03-05 22:13:37 -05:00
Neel Goyal 108f72bc36 Fix for issue #18 - allow destroy in callback 2014-03-04 17:00:18 -05:00
Willem Toorop d2c890ab6a Fill in <organization> place holder.
s/the name of the <organization>/the names of the copyright holders/g
2014-02-25 14:23:19 +01:00
Willem Toorop 8d77505219 s/Versign/Verisign/g in all files 2014-02-25 14:12:33 +01:00
Glen Wiley 6dd03b1cdc fixed spelling of NLnet in licenses, fixed make clean errs in docs 2014-02-24 09:26:20 -05:00
Neel Goyal 80703de636 Begin refactor out extensions into libs. 2014-02-21 12:23:20 -05:00
Neel Goyal 524783804c Fix some issues per code review 2014-02-20 16:17:41 -05:00
Neel Goyal 48fea8d9e0 Add getdns_context_set_return_dnssec_status 2014-02-20 15:42:10 -05:00
Glen Wiley 344893f87f fixed license and copyright notices 2014-02-20 09:12:19 -05:00
Neel Goyal a80d22f07f Add stub for rebuilding unbound ctx. Only allow updates to certain context fields if unbound query hasn't been sent. 2014-02-19 14:56:37 -05:00
Willem Toorop edf1da405f Only set default trust anchor file when it is good 2014-02-12 14:50:00 +01:00