Code Monkey home page Code Monkey logo

hickory-dns's Introduction

minimum rustc: 1.67 Build Status codecov License: MIT License: Apache 2.0 Discord

Hickory DNS

Hickory DNS

A Rust based DNS client, server, and Resolver, built to be safe and secure from the ground up.

This repo consists of multiple crates:

Library Description
Hickory DNS Binaries for running a DNS authoritative server.
Proto hickory-proto Raw DNS library, exposes an unstable API and only for use by the other Hickory DNS libraries, not intended for end-user use.
Client hickory-client Used for sending query, update, and notify messages directly to a DNS server.
Server hickory-server Use to host DNS records, this also has a hickory-dns binary for running in a daemon form.
Resolver hickory-resolver Utilizes the client library to perform DNS resolution. Can be used in place of the standard OS resolution facilities.

NOTICE This project was rebranded from Trust-DNS to Hickory DNS and has been moved to the https://github.com/hickory-dns/hickory-dns organization and repo.

Goals

  • Build a safe and secure DNS server and client with modern features.
  • No panics, all code is guarded
  • Use only safe Rust, and avoid all panics with proper Error handling
  • Use only stable Rust
  • Protect against DDOS attacks (to a degree)
  • Support options for Global Load Balancing functions
  • Make it dead simple to operate

Status

Resolver

The Hickory DNS Resolver is a native Rust implementation for stub resolution in Rust applications. The Resolver supports many common query patterns, all of which can be configured when creating the Resolver. It is capable of using system configuration on Unix and Windows. On Windows there is a known issue that relates to a large set of interfaces being registered for use, so might require ignoring the system configuration.

The Resolver will properly follow CNAME chains as well as SRV record lookups. There is a long term plan to make the Resolver capable of fully recursive queries, but that's not currently possible.

Client

The Hickory DNS Client is intended to be used for operating against a DNS server directly. It can be used for verifying records or updating records for servers that support SIG0 and dynamic update. The Client is also capable of validating DNSSEC. As of now NSEC3 validation is not yet supported, though NSEC is. There are two interfaces that can be used, the async/await compatible AsyncClient and a blocking Client for ease of use. Today, Tokio is required for the executor Runtime.

Unique client side implementations

These are standards supported by the DNS protocol. The client implements them as high level interfaces, which is a bit more rare.

Feature Description
SyncDnssecClient DNSSEC validation
create atomic create of a record, with authenticated request
append verify existence of a record and append to it
compare_and_swap atomic (depends on server) compare and swap
delete_by_rdata delete a specific record
delete_rrset delete an entire record set
delete_all delete all records sets with a given name
notify notify server that it should reload a zone

Server

The server code is complete, the daemon supports IPv4 and IPv6, UDP and TCP. There currently is no way to limit TCP and AXFR operations, so it is still not recommended to put into production as TCP can be used to DOS the service. Zone file parsing is complete and supported. There is currently no forking option, and the server is not yet threaded (although it is implemented with async IO, so threading may not be a huge benefit). There is still a lot of work to do before a server can be trusted with this externally. Running it behind a firewall on a private network would be safe.

Zone signing support is complete, to insert a key store a pem encoded rsa file in the same directory as the initial zone file with the .key suffix. Note: this must be only readable by the current user. If one is not present one will be created and written to the correct location. This also acts as the initial key for dynamic update SIG(0) validation. To get the public key, the DNSKEY record for the zone can be queried. This is needed to provide to other upstream servers to create the DS key. Dynamic DNS is also complete, if enabled, a journal file will be stored next to the zone file with the jrnl suffix. Note: if the key is changed or updated, it is currently the operators responsibility to remove the only public key from the zone, this allows for the DNSKEY to exist for some unspecified period of time during key rotation. Rotating the key currently is not available online and requires a restart of the server process.

DNS-over-TLS and DNS-over-HTTPS on the Server

Support of TLS on the Server is managed through a pkcs12 der file. The documentation is captured in the example test config file, example.toml. A registered certificate to the server can be pinned to the Client with the add_ca() method. Alternatively, as the client uses the rust-native-tls library, it should work with certificate signed by any standard CA.

DNS-over-TLS and DNS-over-HTTPS

DoT and DoH are supported. This is accomplished through the use of one of native-tls, openssl, or rustls (only rustls is currently supported for DoH). The Resolver requires only requires valid DoT or DoH resolvers being registered in order to be used.

To use with the Client, the TlsClientConnection or HttpsClientConnection should be used. Similarly, to use with the tokio AsyncClient the TlsClientStream or HttpsClientStream should be used. ClientAuth, mTLS, is currently not supported, there are some issues still being worked on. TLS is useful for Server authentication and connection privacy.

To enable DoT one of the features dns-over-native-tls, dns-over-openssl, or dns-over-rustls must be enabled, dns-over-https-rustls is used for DoH.

DNSSEC status

Currently the root key is hardcoded into the system. This gives validation of DNSKEY and DS records back to the root. NSEC is implemented, but not NSEC3. Because caching is not yet enabled, it has been noticed that some DNS servers appear to rate limit the connections, validating RRSIG records back to the root can require a significant number of additional queries for those records.

Zones will be automatically resigned on any record updates via dynamic DNS. To enable DNSSEC, one of the features dnssec-openssl or dnssec-ring must be enabled.

RFCs implemented

Basic operations

  • RFC 1035: Base DNS spec (see the Resolver for caching)
  • RFC 2308: Negative Caching of DNS Queries (see the Resolver)
  • RFC 2782: Service location
  • RFC 3596: IPv6
  • RFC 6891: Extension Mechanisms for DNS
  • RFC 6761: Special-Use Domain Names (resolver)
  • RFC 6762: mDNS Multicast DNS (experimental feature: mdns)
  • RFC 6763: DNS-SD Service Discovery (experimental feature: mdns)
  • RFC ANAME: Address-specific DNS aliases (ANAME)

Update operations

Secure DNS operations

  • RFC 3007: Secure Dynamic Update
  • RFC 4034: DNSSEC Resource Records
  • RFC 4035: Protocol Modifications for DNSSEC
  • RFC 4509: SHA-256 in DNSSEC Delegation Signer
  • RFC 5702: SHA-2 Algorithms with RSA in DNSKEY and RRSIG for DNSSEC
  • RFC 6844: DNS Certification Authority Authorization (CAA) Resource Record
  • RFC 6698: The DNS-Based Authentication of Named Entities (DANE) Transport Layer Security (TLS) Protocol: TLSA
  • RFC 6840: Clarifications and Implementation Notes for DNSSEC
  • RFC 6844: DNS Certification Authority Authorization Resource Record
  • RFC 6944: DNSKEY Algorithm Implementation Status
  • RFC 6975: Signaling Cryptographic Algorithm Understanding
  • RFC 7858: DNS over TLS (feature: dns-over-rustls, dns-over-native-tls, or dns-over-openssl)
  • RFC DoH: DNS over HTTPS, DoH (feature: dns-over-https-rustls)

RFCs in progress or not yet implemented

Basic operations

  • RFC 2317: Classless IN-ADDR.ARPA delegation

Update operations

Secure DNS operations

  • RFC 5155: DNSSEC Hashed Authenticated Denial of Existence
  • DNSCrypt: Trusted DNS queries
  • S/MIME: Domain Names For S/MIME

Usage

This assumes that you have Rust stable installed. These presume that the hickory-dns repos have already been synced to the local system:

git clone https://github.com/hickory-dns/hickory-dns.git
cd hickory-dns

Prerequisites

Minimum Rust Version

  • The current minimum rustc version for this project is 1.67
  • OpenSSL development libraries (optional in client and resolver, min version 1.0.2)

Mac OS X: using homebrew

  brew install openssl
  export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
  export OPENSSL_LIB_DIR=`brew --prefix openssl`/lib

Debian-based (includes Ubuntu & Raspbian): using apt-get

  # note for openssl that a minimum version of 1.0.2 is required for TLS,
  #  if this is an issue, TLS can be disabled (on the client), see below.
  $ apt-get install openssl
  $ apt-get install libssl-dev pkg-config

Testing

Hickory DNS uses just for build workflow management. While running cargo test at the project root will work, this is not exhaustive. Install just with cargo install just.

  • Default tests

    These are good for running on local systems. They will create sockets for local tests, but will not attempt to access remote systems. Tests can also be run from the crate directory, i.e. client or server and cargo test

just default
  • Default feature tests

    Hickory DNS has many features, to quickly test with them or without, there are three targets supported, default, no-default-features, all-features:

just all-features
  • Individual feature tests

    Hickory DNS has many features, each individual feature can be tested in dependently, see individual crates for all their features, here is a not necessarily up to date list: dns-over-rustls, dns-over-https-rustls, dns-over-native-tls, dns-over-openssl, dns-dnssec-openssl, dns-dnssec-openssl, dns-dnssec-ring, mdns. Each feature can be tested with itself as the task target for just:

just dns-over-https-rustls
  • Benchmarks

    Waiting on benchmarks to stabilize in mainline Rust.

Building

  • Production build, from the hickory-dns base dir, to get all features, just pass the --all-features flag.
cargo build --release -p hickory-dns

Running

Warning: Hickory DNS is still under development, running in production is not recommended. The server is currently only single-threaded, it is non-blocking so this should allow it to work with most internal loads.

  • Verify the version
./target/release/hickory-dns --version
  • Get help
./target/release/hickory-dns --help
  • Launch hickory-dns server with test config

You may want not passing the -p parameter will run on default DNS ports. For the tls features, there are also port options for those, see hickory-dns --help

./target/release/hickory-dns -c ./tests/test-data/test_configs/example.toml -z ./tests/test-data/test_configs/ -p 24141
  • Query the just launched server with dig
dig @127.0.0.1 -p 24141 www.example.com

Using the hickory-resolver CLI

Available in 0.20

cargo install --bin resolve hickory-util

Or from source, in the hickory-dns directory

cargo install --bin resolve --path util

example:

$ resolve www.example.com.
Querying for www.example.com. A from udp:8.8.8.8:53, tcp:8.8.8.8:53, udp:8.8.4.4:53, tcp:8.8.4.4:53, udp:[2001:4860:4860::8888]:53, tcp:[2001:4860:4860::8888]:53, udp:[2001:4860:4860::8844]:53, tcp:[2001:4860:4860::8844]:53
Success for query name: www.example.com. type: A class: IN
        www.example.com. 21063 IN A 93.184.216.34

Using as a dependency and custom features

The Client has a few features which can be disabled for different reasons when embedding in other software.

  • dnssec-openssl It is a default feature, so default-features will need to be set to false (this will disable all other default features in hickory-dns). Until there are other crypto libraries supported, this will also disable DNSSEC validation. The functions will still exist, but will always return errors on validation. The below example line will disable all default features and enable OpenSSL, remove "openssl" to remove the dependency on OpenSSL.

  • dnssec-ring Ring support can be used for RSA and ED25519 DNSSEC validation.

  • dns-over-native-tls Uses native-tls for DNS-over-TLS implementation, only supported in client and resolver, not server.

  • dns-over-openssl Uses openssl for DNS-over-TLS implementation supported in server and client, resolver does not have default CA chains.

  • dns-over-rustls Uses rustls for DNS-over-TLS implementation, only supported in client and resolver, not server. This is the best option where a pure Rust toolchain is desired. Supported in client, resolver, and server.

  • dns-over-https-rustls Uses rustls for DNS-over-HTTPS (and DNS-over-TLS will be enabled) implementation, only supported in client, resolver, and server. This is the best option where a pure Rust toolchain is desired.

  • mdns EXPERIMENTAL Enables the experimental mDNS features as well as DNS-SD. This currently has known issues.

Using custom features in dependencies:

[dependencies]
  ...
hickory-dns = { version = "*", default-features = false, features = ["dnssec-openssl"] }

Using custom features during build:

$> cargo build --release --features dns-over-rustls
...

FAQ

  • Why are you building another DNS server?

    Because of all the security advisories out there for BIND.
    

    Using Rust semantics it should be possible to develop a high performance and safe DNS Server that is more resilient to attacks.

  • What is the MSRV (minimum stable Rust version) policy?

    Hickory DNS will work to support backward compatibility with three Rust versions.
    

    For example, if 1.50 is the current release, then the MSRV will be 1.47. The version is only increased as necessary, so it's possible that the MSRV is older than this policy states. Additionally, the MSRV is only supported for the no-default-features build due to it being an intractable issue of trying to enforce this policy on dependencies.

Community

For live discussions beyond this repository, please see this Discord.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

hickory-dns's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hickory-dns's Issues

Listen on all addresses

Currently, named doesn't actually listen on all specified addresses. It takes the first address (both v4 and v6), or a default of 0.0.0.0 and ::0. In addition, there's no way to disable IPv4 or IPv6 as even if an IPv4 address is specified the system still will use the default IPv6 address - even if no IPv6 address is set or even if it is explicitly set to the empty list.

This breaks some dual-stack systems as well where IPV6_V6ONLY is by default false, because the v6 socket cannot bind as it conflicts with the v4 socket.

The attached patch is my attempt to fix the issue - I haven't tested every edge case, but it works on my system (debian) with the default configuration (example.toml) under simple tests, and seems sane to me.
0001-Listen-on-all-available-IP-addresses.txt

Changelog persistence for zones

A write-ahead log of the zone records captured as transactional changes, i.e. updates might include multiple updates, a delete and create in one request, this should capture a single update transaction, not both independently.

Relicense under dual MIT/Apache-2.0

This issue was automatically generated. Feel free to close without ceremony if
you do not agree with re-licensing or if it is not possible for other reasons.
Respond to @cmr with any questions or concerns, or pop over to
#rust-offtopic on IRC to discuss.

You're receiving this because someone (perhaps the project maintainer)
published a crates.io package with the license as "MIT" xor "Apache-2.0" and
the repository field pointing here.

TL;DR the Rust ecosystem is largely Apache-2.0. Being available under that
license is good for interoperation. The MIT license as an add-on can be nice
for GPLv2 projects to use your code.

Why?

The MIT license requires reproducing countless copies of the same copyright
header with different names in the copyright field, for every MIT library in
use. The Apache license does not have this drawback. However, this is not the
primary motivation for me creating these issues. The Apache license also has
protections from patent trolls and an explicit contribution licensing clause.
However, the Apache license is incompatible with GPLv2. This is why Rust is
dual-licensed as MIT/Apache (the "primary" license being Apache, MIT only for
GPLv2 compat), and doing so would be wise for this project. This also makes
this crate suitable for inclusion and unrestricted sharing in the Rust
standard distribution and other projects using dual MIT/Apache, such as my
personal ulterior motive, the Robigalia project.

Some ask, "Does this really apply to binary redistributions? Does MIT really
require reproducing the whole thing?" I'm not a lawyer, and I can't give legal
advice, but some Google Android apps include open source attributions using
this interpretation. Others also agree with
it
.
But, again, the copyright notice redistribution is not the primary motivation
for the dual-licensing. It's stronger protections to licensees and better
interoperation with the wider Rust ecosystem.

How?

To do this, get explicit approval from each contributor of copyrightable work
(as not all contributions qualify for copyright, due to not being a "creative
work", e.g. a typo fix) and then add the following to your README:

## License

Licensed under either of

 * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
 * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)

at your option.

### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
additional terms or conditions.

and in your license headers, if you have them, use the following boilerplate
(based on that used in Rust):

// Copyright 2016 trust-dns Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.

It's commonly asked whether license headers are required. I'm not comfortable
making an official recommendation either way, but the Apache license
recommends it in their appendix on how to use the license.

Be sure to add the relevant LICENSE-{MIT,APACHE} files. You can copy these
from the Rust repo for a plain-text
version.

And don't forget to update the license metadata in your Cargo.toml to:

license = "MIT OR Apache-2.0"

I'll be going through projects which agree to be relicensed and have approval
by the necessary contributors and doing this changes, so feel free to leave
the heavy lifting to me!

Contributor checkoff

To agree to relicensing, comment with :

I license past and future contributions under the dual MIT/Apache-2.0 license, allowing licensees to chose either at their option.

Or, if you're a contributor, you can check the box in this repo next to your
name. My scripts will pick this exact phrase up and check your checkbox, but
I'll come through and manually review this issue later as well.

AXFR response ordering incorrect

dig reports an error with since the SOA record is not the first in the response. This will be fixed as I implement the DNSSec RFC's, where canonical ordering is a requirement.

Feature request: RFC 7858, DNS over TLS

I just finished reading your article about this implementation and noticed that you are working on DNSCrypt integration. I thought maybe it would be a better idea to be the first project to put support for RFC 7858 (DNS over TLS) in a production grade client/server.

Upgrade OpenSSL to 0.8.x

Before the upgrade to ring, I'd like to request that trust-dns adopt rust-openssl version 0.8. I found in my use of rust-openssl in rust-ftp that some usage of rust-openssl version 0.7 lead to a memory error that was resolved immediately by the update to 0.8.

For a tiny bit more information, see the issue I opened on hyperium/hyper.

Feature request: Add support for logging DNS queries with dnstap

It would good to have support for generating dnstap (http://dnstap.info/) logs.

As a use case, in our current configuration the pf firewall redirects all outbound DNS requests to approved internal resolvers running Unbound. Each query is logged to dnstap and is ingested by our SIEM platform which alerts upon abnormal requests. dnstap logs also provide very useful data when investigating an incident.

0.5.2 broken on Linux

I discovered after releasing 0.5.2 that there was a bug in the usage of mio on Linux. I'm working on a fix, at the moment. Once that's ready, I'll publish a new version. This is due to the upgrade to the 0.5.0 version of Linux.

License metadata disagrees with comment

In Cargo.toml, there's a fragment:

# license identifiers from http://spdx.org/licenses/. Multiple licenses can
# be separated with a `/`
license = "MIT OR Apache-2.0"

It looks like the comment should say "OR", or the license should use "/"

[Server] ResponseCode for NSEC on non-existent RecordType should be NoError

It appears that NSEC records returned from other servers (google) respond with NoError rather than NxDomain. It's possible that the TRust-DNS server is also responding incorrectly to standard queries on overlapping names, but no matching RecordType as well.

This should be validated in the RFCs. NSEC validation on the clientside is fuctioning appropriately.

Feature request: Add support for sandboxing

It would be useful to have support for sandboxing trust-dns, in particular decoding of requests.

rusty-sandbox offers an abstraction layer over the sandboxing mechanisms provided by several operating systems, and could be incorporated as an optional compile-time feature.

Split trust-dns into multiple crates

move the repo into this format over time:

trust-dns/trust-dns-core/ - record serialization, no networking, etc.
trust-dns/trust-dns-client/ - futures impl of all lookup logic, optionally compile in DNSSec, etc.
trust-dns/trust-dns-server/ - authority implementations, dependency on SQLLite here, etc.
trust-dns/trust-dns-cache/ - LRU caching layer that can wrap the client, aka resolver?

edit: I realized that changing the trust-dns crate name would orphan the existing library in crates.io. My plan right now is to maintain that name for the client library, but fork out the server library.

Move client integration tests back from server/ to client/ after split

To make the dependency chain sane, the integration tests for the client were moved to the server crate. This means that when running tests in the client, the integration tests for the client are not run inside the client crate. They will run in CI, etc., but this isn't a desirable dev experience.

Change return from query to just return RRSets?

While working on the SecureClientFuture interface, I realized that returning Message, makes it difficult to implement cacheing over the current interfaces. I'm considering having query() return only RRSets, instead of Message to make caching wrapper libraries simpler. Similarly, I'm finding that I while I like that the SecureClientFuture interface is just a wrapper of ClientFuture, I may transform the returned RRSets. I was thinking of having it strip all unverified RRSets from the response. But I haven't figured this out yet...

I like that Message is returned today, because it allows consumers to do what they want. For cacheing this isn't great though, because there technically is no Message response from a cache request, it would be built on the stack. Similarly, for a DNSSec request the question is what to do with invalid records.

For example: there may be a set of DNSKEY records that have been validated, and a set that could not be validated. This is a valid situation, IMO, as the invalid DNSKEYs may exist as new which haven't yet been signed, or old keys that are in the process of being removed. Obviously we don't want DNSKEYs used which have not been validated, so I'm considering stripping them from the Message RRSets. This seems hacky though, so I'm considering changing the return from query() entirely to make it simpler for both this case and for caching cases.

Does anyone have any strong concerns in this area?

rustc version 1.11.0 gives: private type in public interface [E0446]

Should building with rustc v 1.11.0 work? If anything newer than 1.0 is needed, I'd appreciate a note in the README.

I'm struggling:

$ git log -n1
commit 764255a8e2c07105f892a8a2498186d404678ddb
Merge: f74d52c 3520d18
Author: Benjamin Fry <[email protected]>
Date:   Thu Nov 3 00:17:52 2016 -0700

$ rustc --version
rustc 1.11.0

$ cargo build
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading futures v0.1.3
 Downloading rusqlite v0.7.3
 ...
   Compiling mio v0.5.1
   Compiling tokio-core v0.1.0
   Compiling docopt v0.6.86
src/client/client_future.rs:61:29: 61:41 error: private type in public interface [E0446]
src/client/client_future.rs:61              stream_handle: StreamHandle,
                                                           ^~~~~~~~~~~~
src/client/client_future.rs:61:29: 61:41 help: run `rustc --explain E0446` to see a detailed explanation
src/client/client_future.rs:80:38: 80:50 error: private type in public interface [E0446]
src/client/client_future.rs:80                       stream_handle: StreamHandle,
                                                                    ^~~~~~~~~~~~
src/client/client_future.rs:80:38: 80:50 help: run `rustc --explain E0446` to see a detailed explanation
error: aborting due to 2 previous errors
error: Could not compile `trust-dns`.

To learn more, run the command again with --verbose.

Crash when creating journal from zone with allow_update=true

2016-09-08T12:50:34.387565536+00:00 INFO named:115 loading zone file: "src/config/test/example.com.zone"`
2016-09-08T12:50:34.416164124+00:00 INFO named:129 enabling journal: "src/config/test/example.com..jrnl"
2016-09-08T12:50:34.417395558+00:00 INFO trust_dns::authority::authority:156 persisting zone to journal at SOA.serial: 199609203
thread '<main>' panicked at 'schema version mismatch, schema_up() resolves this', src/authority/persistence.rs:58
stack backtrace:
   1:     0x55d0d4c23c3f - std::sys::backtrace::tracing::imp::write::h3800f45f421043b8
   2:     0x55d0d4c2699b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::h0ef6c8db532f55dc
   3:     0x55d0d4c26623 - std::panicking::default_hook::hf3839060ccbb8764
   4:     0x55d0d4c1852d - std::panicking::rust_panic_with_hook::h5dd7da6bb3d06020
   5:     0x55d0d48ff737 - std::panicking::begin_panic::h4c14e704ed94392f
                        at src/libstd/panicking.rs:328
   6:     0x55d0d4979704 - trust_dns::authority::persistence::Journal::insert_record::h7a7e1920fda45865
                        at /home/apexo/ext/dev/ext/trust-dns/<std macros>:3
   7:     0x55d0d4979130 - trust_dns::authority::authority::Authority::persist_to_journal::h05d78c5d49a01b1a
                        at src/authority/authority.rs:159
   8:     0x55d0d48d76a6 - named::load_zone::hd2498ba4e50bc526
                        at src/named.rs:138
   9:     0x55d0d48e7b93 - named::main::h1c8ee60b18765fac
                        at src/named.rs:225
  10:     0x55d0d4c26268 - std::panicking::try::call::hbbf4746cba890ca7
  11:     0x55d0d4c30aeb - __rust_try
  12:     0x55d0d4c30a8e - __rust_maybe_catch_panic
  13:     0x55d0d4c25d0e - std::rt::lang_start::hbcefdc316c2fbd45
  14:     0x55d0d48f7a29 - main
  15:     0x7fa51e4992b0 - __libc_start_main
  16:     0x55d0d48d5569 - _start
  17:                0x0 - <unknown>

Build fails with rust 1.12.0-beta.1

Hey,

Since I'm using a macOS beta (Sierra) on my computer, I'm forced to use 1.12.0-beta1.

The build fails with rust 1.12.0:

--- stderr
src/c_helpers.c:4:20: error: incomplete definition of type 'struct ssl_st'
    CRYPTO_add(&ssl->references, 1, CRYPTO_LOCK_SSL);
                ~~~^
/usr/local/include/openssl/crypto.h:166:39: note: expanded from macro 'CRYPTO_add'
#  define CRYPTO_add(a,b,c)       ((*(a))+=(b))
                                      ^
/usr/local/include/openssl/ossl_typ.h:181:16: note: forward declaration of 'struct ssl_st'
typedef struct ssl_st SSL;
               ^
src/c_helpers.c:8:20: error: incomplete definition of type 'struct ssl_ctx_st'
    CRYPTO_add(&ctx->references,1,CRYPTO_LOCK_SSL_CTX);
                ~~~^
/usr/local/include/openssl/crypto.h:166:39: note: expanded from macro 'CRYPTO_add'
#  define CRYPTO_add(a,b,c)       ((*(a))+=(b))
                                      ^
/usr/local/include/openssl/ossl_typ.h:182:16: note: forward declaration of 'struct ssl_ctx_st'
typedef struct ssl_ctx_st SSL_CTX;
               ^
src/c_helpers.c:12:21: error: incomplete definition of type 'struct x509_st'
    CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509);
                ~~~~^
/usr/local/include/openssl/crypto.h:166:39: note: expanded from macro 'CRYPTO_add'
#  define CRYPTO_add(a,b,c)       ((*(a))+=(b))
                                      ^
/usr/local/include/openssl/ossl_typ.h:161:16: note: forward declaration of 'struct x509_st'
typedef struct x509_st X509;
               ^
3 errors generated.
thread 'main' panicked at 'explicit panic', /a/long/cargo/path/gcc-0.3.28/src/lib.rs:840
stack backtrace:
   1:        0x10330eaf9 - std::sys::backtrace::tracing::imp::write::h6f07380f45fe1307
   2:        0x103314c60 - std::panicking::default_hook::_{{closure}}::he6993150602797ff
   3:        0x10331408a - std::panicking::default_hook::h42f7cdc1bed8dd00
   4:        0x103314656 - std::panicking::rust_panic_with_hook::hdcce59947203a4c0
   5:        0x1032f86b4 - std::panicking::begin_panic::h6e522b8d506dc874
   6:        0x10330224e - gcc::fail::h25611a6497098034
   7:        0x103302066 - gcc::run::h0d2d8efda2e0dff3
   8:        0x1032fa161 - gcc::Config::compile::he274dd27a071a635
   9:        0x1032f78e5 - build_script_build::main::hb7741c2c34a9f03d
  10:        0x10331524a - __rust_maybe_catch_panic
  11:        0x103313b5e - std::rt::lang_start::h14913182d401dec2

Edit:

Seems like CRYPTO_LOCK_SSL was removed from openssl. Seems to be an upstream issue with the openssl crate..?

[Server] Add Forwarding Zone support

I'm fairly new to rust, so with the understanding that I could be completely wrong about all of this...

It appears that there isn't any support for forwarding zones. Though a zone file can be declared as a forwarding zone, there isn't actually any support for this behavior in the code - it appears to treat all zones the same for lookup purposes.

It appears like Authority::lookup() and Catalog::find_auth_recurse() would be the primary areas that would need to be modified, along with the requisite configuration changes.

I'm interested in contributing code, and would be willing to try and implement this if I'm not mistaken.

Thanks!

Client fails to verify records with uppercased names

Test case:

#[test]
fn test_dnssec_rollernet_td() {
    use trust_dns::udp::UdpClientConnection;
    use trust_dns::client::Client;
    let c = Client::new(UdpClientConnection::new("8.8.8.8:53".parse().unwrap()).unwrap());
    c.secure_query(
        &Name::parse("rollernet.us.", None).unwrap(),
        DNSClass::IN,
        RecordType::DS,
    ).unwrap();
}

This fails with No DNSKEY proof available error while validating the returned NSEC record, but according to http://dnsviz.net/d/rollernet.us/dnssec/ , the server returns correct RRSIG. From what I can tell, this server returns uppercased names in the record, but all names are converted to lowercase on deserialization, which breaks verification.

Feature request: Add support for local resource records (DNS blackholes / overrides)

It would be nice to have the ability to load lists of local resource records to override any upstream records, without having to specify a complete zone.

Our primary use case for this is being able to "blackhole" requests made to known malicious domains (e.g. malware C&C), or other domains that we wish to block (e.g. advertising content). We achieve this with Unbound by downloading and processing feeds from various threat intelligence sources (e.g. malwaredomains), and having the domains generated into local-data records which Unbound then resolves to 127.0.0.1. An example of local-data being used in this way can be seen here.

An advanced extension to this concept (which I believe is not currently achievable in Unbound) would be to match IP addresses (e.g. resolved from an A record lookup, or received from a client for PTR lookup) and block/replace the request as necessary.

Inconsistent build (server + macOS): ssl linkage error

This is a tracking issue for sporadic linkage errors during the server build on macOS.

= note: "cc" "-m64" "-L" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/secure_client_handle_tests-1186407fd8b3feb4.0.o" "-o" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/secure_client_handle_tests-1186407fd8b3feb4" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps" "-L" "/usr/lib" "-L" "/usr/local/opt/openssl/lib" "-L" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/build/ring-b04a0c9d4dc7829a/out/lib" "-L" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libtrust_dns_server.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libtrust_dns.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libtokio_core-7d79a0061e4987e4.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libscoped_tls-53036341d2dbbe26.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libmio-d8a3ebfe89185cdb.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libslab-69010361762af86e.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/librand-8ea7d489d4a383a0.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libopenssl-c9e7b933bde3d3a6.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libdata_encoding-8503efda09142c21.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libchrono-7342810e34d1c30d.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/librusqlite-a221a739db38f0bf.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libtime-750bfdd52feafcb7.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libbitflags-0e272044714c8076.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libtoml-1a75b37a708f335b.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/librustc_serialize-6b938435173797f7.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/liblazycell-d53b754addaf1d91.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libnix-56d9e0b660233faa.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libring-863fd845bbadbb87.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libfutures-21d097dc8f05f683.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libbitflags-75746cc7f0e9d928.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/liblibsqlite3_sys-02dacca8e9891790.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/liblazy_static-7f1b96a3a3eb529d.rlib" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libtest-f5a209a9.rlib" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libterm-f5a209a9.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libopenssl_sys-6c510e83c5b0b664.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/liberror_chain-5731652bab0d1a8e.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libbacktrace-dffaf784d6265843.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/librustc_demangle-9f84838926c47318.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libdbghelp-72843bd5c387f78b.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libwinapi-0889532d327ff4e2.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libnum-1fa4854b44bb6a54.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libnum_iter-50df698bc905252c.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libnum_integer-52fdddf28cd8e924.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libnet2-755d3e4f87237d0e.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libcfg_if-72c1f992b13d5087.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/liblibc-e1db4c5f3a4f3c2f.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libuntrusted-6d5be7309ea48309.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/liblru_cache-5df7c7dfb11fae93.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/liblinked_hash_map-8bca62f90f0f04c7.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libnum_traits-92bb90166cd1857c.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libvoid-2cc31605fcb01ba1.rlib" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgetopts-f5a209a9.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/liblog-bf16bb9a4912b11d.rlib" "/Users/benjaminfry/Development/rust/trust-dns/target/debug/deps/libkernel32-df86a08647459244.rlib" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-f5a209a9.rlib" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-f5a209a9.rlib" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-f5a209a9.rlib" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librand-f5a209a9.rlib" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcollections-f5a209a9.rlib" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-f5a209a9.rlib" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-f5a209a9.rlib" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-f5a209a9.rlib" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_unicode-f5a209a9.rlib" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-f5a209a9.rlib" "/Users/benjaminfry/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-f5a209a9.rlib" "-l" "c++" "-l" "sqlite3" "-l" "sqlite3" "-l" "sqlite3" "-l" "ssl" "-l" "crypto" "-l" "System" "-l" "pthread" "-l" "c" "-l" "m"
  = note: Undefined symbols for architecture x86_64:
  "_EVP_DigestVerifyFinal", referenced from:
      openssl::sign::Verifier::finish::h2254ce4db54d0d04 in libopenssl-c9e7b933bde3d3a6.rlib(openssl-c9e7b933bde3d3a6.0.o)
  "_EVP_DigestSignFinal", referenced from:
      openssl::sign::Signer::finish::hd5e70040d912dd63 in libopenssl-c9e7b933bde3d3a6.rlib(openssl-c9e7b933bde3d3a6.0.o)
  "_EVP_DigestVerifyInit", referenced from:
      openssl::sign::Verifier::new::hb1fc11f25f026f4f in libopenssl-c9e7b933bde3d3a6.rlib(openssl-c9e7b933bde3d3a6.0.o)
  "_EVP_DigestSignInit", referenced from:
      openssl::sign::Signer::new::h3ca1d35e4b331ef5 in libopenssl-c9e7b933bde3d3a6.rlib(openssl-c9e7b933bde3d3a6.0.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It seems to be a race condition and happens more regularly on TravisCI macOS builds, but I see it regularly on my local machine as well.

There is a linked issue on rust-openssl sfackler/rust-openssl#554

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.