Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading, storing, and generating DNSSEC keys #406

Merged
merged 69 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
5ba8940
[sign] Define 'KeyPair' and impl key export
Oct 2, 2024
4c10381
[sign] Define trait 'Sign'
Oct 2, 2024
f33f775
[sign] Implement parsing from the DNS format
Oct 2, 2024
1d97597
[sign] Provide some error information
Oct 2, 2024
fa306e9
[sign] Move 'KeyPair' to 'generic::SecretKey'
Oct 4, 2024
56dec85
[sign/generic] Add 'PublicKey'
Oct 7, 2024
5f8e28f
[sign] Rewrite the 'ring' module to use the 'Sign' trait
Oct 7, 2024
46b67e9
Implement DNSSEC signing with OpenSSL
Oct 9, 2024
2451e1b
[sign/openssl] Implement key generation
Oct 9, 2024
159a94a
[sign/openssl] Test key generation and import/export
Oct 9, 2024
4fb6084
[sign/openssl] Add support for ECDSA
Oct 9, 2024
6bc9bce
[sign/openssl] satisfy clippy
Oct 9, 2024
be3e169
[sign/openssl] Implement the 'Sign' trait
Oct 9, 2024
836812a
Install OpenSSL in CI builds
Oct 9, 2024
66290a5
Ensure 'openssl' dep supports 3.x.x
Oct 9, 2024
2a1489f
[workflows/ci] Use 'vcpkg' instead of vendoring OpenSSL
Oct 9, 2024
e8d208f
Ensure 'openssl' dep exposes necessary interfaces
Oct 9, 2024
045d52b
[workflows/ci] Record location of 'vcpkg'
Oct 9, 2024
460679b
[workflows/ci] Use a YAML def for 'VCPKG_ROOT'
Oct 9, 2024
21ba8d3
[workflows/ci] Fix a vcpkg triplet to use
Oct 9, 2024
4195dd4
Upgrade openssl to 0.10.57 for bitflags 2.x
Oct 9, 2024
4f4f6ff
[workflows/ci] Use dynamic linking for vcpkg openssl
Oct 9, 2024
608cbea
[workflows/ci] Correctly annotate 'vcpkg'
Oct 9, 2024
632c1b0
[sign/openssl] Implement exporting public keys
Oct 9, 2024
4350d8b
[sign/ring] Implement exporting public keys
Oct 9, 2024
4c46552
[sign/generic] Test (de)serialization for generic secret keys
Oct 9, 2024
fc95523
[sign] Thoroughly test import/export in both backends
Oct 9, 2024
22e00a6
[sign] Remove debugging code and satisfy clippy
Oct 9, 2024
94b3e47
[sign] Account for CR LF in tests
Oct 9, 2024
68a5656
[sign/openssl] Fix bugs in the signing procedure
Oct 11, 2024
a71c339
Refactor the 'sign' module
Oct 15, 2024
824c8e3
Move 'sign' and 'validate' to unstable feature gates
Oct 16, 2024
6d8c29e
[workflows/ci] Document the vcpkg env vars
Oct 16, 2024
82a05aa
Rename public/secret key interfaces to '*Raw*'
Oct 16, 2024
980fe5a
[sign/ring] Store the RNG in an 'Arc'
Oct 16, 2024
35ff06c
[validate] Enhance 'Signature' API
Oct 16, 2024
95cc462
[validate] Add high-level 'Key' type
Oct 16, 2024
3cec8cb
[sign/openssl] Pad ECDSA keys when exporting
Oct 16, 2024
8682b6d
[validate] Implement 'Key::key_tag()'
Oct 16, 2024
57d20d9
[validate] Correct bit offsets for flags
Oct 16, 2024
f37c862
[validate] Implement support for digests
Oct 16, 2024
7f01a5f
[validate] Enhance BIND format conversion for 'Key'
Oct 18, 2024
b4103a3
[sign] Introduce 'SigningKey'
Oct 20, 2024
81720c3
[sign] Handle errors more responsibly
Oct 21, 2024
1e00479
[sign] correct doc link
Oct 21, 2024
d26a433
[sign/openssl] Replace panics with results
Oct 23, 2024
6968cb9
remove 'sign/key'
Oct 23, 2024
99cb9ef
[sign] Introduce 'common' for abstracting backends
Oct 24, 2024
8321d50
[sign/generic] add top-level doc comment
Oct 24, 2024
a25be56
[validate] debug bind format errors
Oct 24, 2024
59650a4
[validate] more debug statements
Oct 24, 2024
0f54a8d
[validate] format DNSKEYs using 'ZonefileFmt'
Oct 24, 2024
5a3de59
Reorganize crate features in 'Cargo.toml'
Oct 25, 2024
12a70af
[sign] Add key generation support for Ring
Oct 25, 2024
2f2fb58
[sign] Make OpenSSL support optional
Oct 25, 2024
a4316b5
[sign] Rename 'generic::SecretKey' to 'KeyBytes'
Oct 29, 2024
e0a4fc0
[sign] Rename 'SecretKey' to 'KeyPair' in all impls
Oct 29, 2024
31462cc
Merge branch 'main' into dnssec-key
Oct 29, 2024
48e178a
[sign] Rename 'KeyBytes' to 'SecretKeyBytes'
Oct 29, 2024
daa96d8
[validate] Rename 'RawPublicKey' to 'PublicKeyBytes'
Oct 29, 2024
221f163
[sign/ring] Remove redundant imports
Oct 29, 2024
61bc3aa
[sign,validate] Add 'display_as_bind()' to key bytes types
Oct 30, 2024
55716a4
[sign,validate] remove unused imports
Oct 30, 2024
7831260
[sign] Document everything
Oct 31, 2024
7c9ee4c
[lib] Rewrite feature flag documentation
Nov 4, 2024
cea9ae3
[workflows/ci] Use 'apt-get' instead of 'apt'
Nov 4, 2024
354bf0a
[sign] Clarify documentation as per @ximon18
Nov 4, 2024
ca10361
[sign] Use 'secrecy' to protect private keys
Nov 4, 2024
01104f3
[sign] Improve documentation and examples
Nov 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,28 @@ jobs:
rust: [1.76.0, stable, beta, nightly]
env:
RUSTFLAGS: "-D warnings"
# We use 'vcpkg' to install OpenSSL on Windows.
ximon18 marked this conversation as resolved.
Show resolved Hide resolved
VCPKG_ROOT: "${{ github.workspace }}\\vcpkg"
VCPKGRS_TRIPLET: x64-windows-release
# Ensure that OpenSSL is dynamically linked.
VCPKGRS_DYNAMIC: 1
bal-e marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Install Rust
uses: hecrj/setup-rust-action@v2
with:
rust-version: ${{ matrix.rust }}
- if: matrix.os == 'ubuntu-latest'
run: sudo apt install libssl-dev
bal-e marked this conversation as resolved.
Show resolved Hide resolved
- if: matrix.os == 'windows-latest'
id: vcpkg
uses: johnwason/vcpkg-action@v6
with:
pkgs: openssl
triplet: ${{ env.VCPKGRS_TRIPLET }}
token: ${{ github.token }}
github-binarycache: true
- if: matrix.rust == 'stable'
run: rustup component add clippy
- if: matrix.rust == 'stable'
Expand All @@ -37,6 +52,8 @@ jobs:
uses: hecrj/setup-rust-action@v2
with:
rust-version: "1.68.2"
- name: Install OpenSSL
run: sudo apt install libssl-dev
bal-e marked this conversation as resolved.
Show resolved Hide resolved
- name: Install nightly Rust
run: rustup install nightly
- name: Check with minimal-versions
Expand Down
66 changes: 66 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 14 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ heapless = { version = "0.8", optional = true }
libc = { version = "0.2.153", default-features = false, optional = true } # 0.2.79 is the first version that has IP_PMTUDISC_OMIT
parking_lot = { version = "0.12", optional = true }
moka = { version = "0.12.3", optional = true, features = ["future"] }
openssl = { version = "0.10.57", optional = true } # 0.10.57 upgrades to 'bitflags' 2.x
bal-e marked this conversation as resolved.
Show resolved Hide resolved
proc-macro2 = { version = "1.0.69", optional = true } # Force proc-macro2 to at least 1.0.69 for minimal-version build
ring = { version = "0.17", optional = true }
rustversion = { version = "1", optional = true }
Expand All @@ -47,24 +48,32 @@ tracing-subscriber = { version = "0.3.18", optional = true, features = ["env-fil

[features]
default = ["std", "rand"]

# Support for libraries
bytes = ["dep:bytes", "octseq/bytes"]
heapless = ["dep:heapless", "octseq/heapless"]
resolv = ["net", "smallvec", "unstable-client-transport"]
resolv-sync = ["resolv", "tokio/rt"]
serde = ["dep:serde", "octseq/serde"]
sign = ["std"]
smallvec = ["dep:smallvec", "octseq/smallvec"]
std = ["dep:hashbrown", "bytes?/std", "octseq/std", "time/std"]

# Cryptographic backends
ring = ["dep:ring"]
openssl = ["dep:openssl"]

# Crate features
resolv = ["net", "smallvec", "unstable-client-transport"]
resolv-sync = ["resolv", "tokio/rt"]
net = ["bytes", "futures-util", "rand", "std", "tokio"]
tsig = ["bytes", "ring", "smallvec"]
validate = ["bytes", "std", "ring"]
zonefile = ["bytes", "serde", "std"]

# Unstable features
unstable-client-transport = ["moka", "net", "tracing"]
unstable-server-transport = ["arc-swap", "chrono/clock", "libc", "net", "siphasher", "tracing"]
unstable-sign = ["std", "unstable-validate"]
unstable-stelline = ["tokio/test-util", "tracing", "tracing-subscriber", "tsig", "unstable-client-transport", "unstable-server-transport", "zonefile"]
unstable-validator = ["validate", "zonefile", "unstable-client-transport"]
unstable-validate = ["bytes", "std", "ring"]
unstable-validator = ["unstable-validate", "zonefile", "unstable-client-transport"]
unstable-xfr = ["net"]
unstable-zonetree = ["futures-util", "parking_lot", "rustversion", "serde", "std", "tokio", "tracing", "unstable-xfr", "zonefile"]

Expand Down
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
#![cfg_attr(not(feature = "resolv"), doc = "* resolv:")]
//! An asynchronous DNS resolver based on the
//! [Tokio](https://tokio.rs/) async runtime.
#![cfg_attr(feature = "sign", doc = "* [sign]:")]
#![cfg_attr(not(feature = "sign"), doc = "* sign:")]
#![cfg_attr(feature = "unstable-sign", doc = "* [sign]:")]
#![cfg_attr(not(feature = "unstable-sign"), doc = "* sign:")]
//! Experimental support for DNSSEC signing.
#![cfg_attr(feature = "tsig", doc = "* [tsig]:")]
#![cfg_attr(not(feature = "tsig"), doc = "* tsig:")]
//! Support for securing DNS transactions with TSIG records.
#![cfg_attr(feature = "validate", doc = "* [validate]:")]
#![cfg_attr(not(feature = "validate"), doc = "* validate:")]
#![cfg_attr(feature = "unstable-validate", doc = "* [validate]:")]
#![cfg_attr(not(feature = "unstable-validate"), doc = "* validate:")]
//! Experimental support for DNSSEC validation.
#![cfg_attr(feature = "unstable-validator", doc = "* [validator]:")]
#![cfg_attr(not(feature = "unstable-validator"), doc = "* validator:")]
Expand Down Expand Up @@ -86,8 +86,8 @@
//! [ring](https://github.com/briansmith/ring) crate.
//! * `serde`: Enables serde serialization for a number of basic types.
//! * `sign`: basic DNSSEC signing support. This will enable the
#![cfg_attr(feature = "sign", doc = " [sign]")]
#![cfg_attr(not(feature = "sign"), doc = " sign")]
#![cfg_attr(feature = "unstable-sign", doc = " [sign]")]
bal-e marked this conversation as resolved.
Show resolved Hide resolved
#![cfg_attr(not(feature = "unstable-sign"), doc = " sign")]
//! module and requires the `std` feature. Note that this will not directly
//! enable actual signing. For that you will also need to pick a crypto
//! module via an additional feature. Currently we only support the `ring`
Expand All @@ -108,8 +108,8 @@
//! module and currently pulls in the
//! `bytes`, `ring`, and `smallvec` features.
//! * `validate`: basic DNSSEC validation support. This feature enables the
#![cfg_attr(feature = "validate", doc = " [validate]")]
#![cfg_attr(not(feature = "validate"), doc = " validate")]
#![cfg_attr(feature = "unstable-validate", doc = " [validate]")]
#![cfg_attr(not(feature = "unstable-validate"), doc = " validate")]
//! module and currently also enables the `std` and `ring`
//! features.
//! * `zonefile`: reading and writing of zonefiles. This feature enables the
Expand Down
Loading
Loading