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

Add signzone command. #8

Open
wants to merge 271 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 92 commits
Commits
Show all changes
271 commits
Select commit Hold shift + click to select a range
05cbde0
Review feedback: Remove redundant dependency.
ximon18 Nov 5, 2024
bf84d57
Review feedback: improved key path construction. Also fixed some key …
ximon18 Nov 5, 2024
7d5c5bc
Review feedback: Remove needless error wrapping.
ximon18 Nov 5, 2024
96a1a28
Review feedback: Import more types.
ximon18 Nov 5, 2024
b9e3c5d
Review feedback: clone() instead of to_owned().
ximon18 Nov 5, 2024
1410ccc
Review feedback: extract key loading to helper function.
ximon18 Nov 5, 2024
91df226
Review feedback: clone() instead of to_owned().
ximon18 Nov 5, 2024
3f39d2f
Review feedback: & instead of .as_path().
ximon18 Nov 5, 2024
c487776
Review feedback: Don't panic on invalid zone content.
ximon18 Nov 5, 2024
3ef74b2
Clippy.
ximon18 Nov 5, 2024
ce3f792
Review feedback: Return crate error type.
ximon18 Nov 5, 2024
f64050c
Typo correction.
ximon18 Nov 5, 2024
c2251db
Review feedback: Use let ... map_err.
ximon18 Nov 5, 2024
bd7f947
Finish incomplete RustDoc comment.
ximon18 Nov 5, 2024
54c8397
Add missing blank line.
ximon18 Nov 5, 2024
52f3902
Cargo fmt.
ximon18 Nov 5, 2024
c97a3aa
Merge branch 'main' into add-ldns-like-sign-zone-support
ximon18 Nov 6, 2024
a433f4c
Update domain and align `-b` output more closely to that of ldns-sign…
ximon18 Nov 6, 2024
b7a7ef3
Even closer -b output to that of ldns-signzone.
ximon18 Nov 6, 2024
16cbd22
Even closer -b output to that of ldns-signzone.
ximon18 Nov 6, 2024
178f554
Even closer -b output to that of ldns-signzone.
ximon18 Nov 6, 2024
3de9a51
Clippy.
ximon18 Nov 6, 2024
e860ec8
Clippy.
ximon18 Nov 6, 2024
0d1c7c3
Missing > bracket in comments.
ximon18 Nov 6, 2024
0d9289e
Prepare to add missing ldns-signzone command line options.
ximon18 Nov 7, 2024
a886428
Caro fmt.
ximon18 Nov 7, 2024
581d4e6
Fix incorrect comment output: {{ was doubled to escape it when using …
ximon18 Nov 7, 2024
1f1b7ef
Add a comment about spacing and compatibility.
ximon18 Nov 7, 2024
fe7dbda
Add inception and expiration command line argument support.
ximon18 Nov 7, 2024
f1e3a46
Fix CLI help text for inception and expiration date, change the value…
ximon18 Nov 7, 2024
6ec558f
Override the default origin command line argument shown value name.
ximon18 Nov 7, 2024
bb97b00
Add long help for timestamp command line arguments indicating the sup…
ximon18 Nov 7, 2024
76df433
Cargo fmt.
ximon18 Nov 7, 2024
4a2bca8
Move long help comments to after help to better match ldns-signzone.
ximon18 Nov 7, 2024
4ff8107
Add '-f' support.
ximon18 Nov 7, 2024
3e11af3
Add '-f' support.
ximon18 Nov 7, 2024
b3e9b36
Update domain.
ximon18 Nov 7, 2024
da4737f
Make -f <zonefile>.signed the default behaviour.
ximon18 Nov 7, 2024
231f0c7
Cleanup imports.
ximon18 Nov 7, 2024
8d6b807
Add support for `-u` including its undocumented +1 behaviour.
ximon18 Nov 7, 2024
44c9a25
Also output DNSKEY RR comments when `-b` is not provided, to match ld…
ximon18 Nov 7, 2024
a82778a
Use new domain key size support to output `size = 256b` or similar in…
ximon18 Nov 8, 2024
df84269
Remove guidance concerning key files in help text which is correct fo…
ximon18 Nov 8, 2024
01dba27
Merge branch 'main' into add-ldns-like-sign-zone-support
ximon18 Nov 11, 2024
edd8638
Update ldns-signzone to use new lexopt parser. Change dnst signzone d…
ximon18 Nov 11, 2024
ead8fc6
Remove wrongly committed sym link.
ximon18 Nov 12, 2024
9cdba55
Merge branch 'main' into add-ldns-like-sign-zone-support
mozzieongit Nov 20, 2024
f46fdd9
Format
mozzieongit Nov 20, 2024
32ca8f7
Fix writing to stdout or file
mozzieongit Nov 21, 2024
907a634
Fix error without keys
mozzieongit Nov 21, 2024
7828d4d
Update Cargo.lock for domain
mozzieongit Nov 21, 2024
adbaf06
Clippy
mozzieongit Nov 21, 2024
9eb17c2
Rename variable diagnostic_comments to extra_comments because comment…
ximon18 Nov 22, 2024
5dfff42
Always output comments for DNSKEY RRs.
ximon18 Nov 22, 2024
ed60fc7
Don't output ; lines if `-b` is not enabled.
ximon18 Nov 22, 2024
bb46747
Support LDNS keys must match zone functionality.
ximon18 Nov 25, 2024
28f7f32
Merge branch 'add-ldns-like-sign-zone-support' of github.com:NLnetLab…
ximon18 Nov 25, 2024
844ca3c
Merge branch 'main' into add-ldns-like-sign-zone-support
ximon18 Nov 25, 2024
342144a
Improve zone writing performance by buffering output.
ximon18 Nov 25, 2024
86b5653
Make LDNS output re-ordering for readability an optional off-by-defau…
ximon18 Nov 25, 2024
02bd14d
Don't over allocate.
ximon18 Nov 25, 2024
a47dd4e
Fix tests.
ximon18 Nov 25, 2024
e2f1d86
Add missing import.
ximon18 Nov 25, 2024
add8bdb
Improved LDNS compatibility: Use DNSKEY RRs that correspond to loaded…
ximon18 Nov 26, 2024
0cc0535
Change 'A' custom dnst option to 'P' because 'A' is needed for an exi…
ximon18 Nov 26, 2024
084d9a4
Remove commented out code.
ximon18 Nov 26, 2024
3d16bb3
Move ? operator to more logical location: attached to the fn call it …
ximon18 Nov 26, 2024
5894db7
Pass an `is_ldns` flag to commands.
ximon18 Nov 26, 2024
6297442
Factor out ANSI colourisation support.
ximon18 Nov 26, 2024
724846a
Add LDNS style warnings about chosen iteration counts.
ximon18 Nov 26, 2024
221bba1
Cargo fmt.
ximon18 Nov 26, 2024
d68c919
Fix lifetime error.
ximon18 Nov 26, 2024
5ec8127
Update help texts to match updated key discovery behaviour.
ximon18 Nov 27, 2024
fd08b03
Removed outdated TODO comment.
ximon18 Nov 27, 2024
b0b4c10
Remove incorrect formatting logic.
ximon18 Nov 27, 2024
8ec7479
Remove unused code.
ximon18 Nov 27, 2024
a7503e4
Remove duplicate comment.
ximon18 Nov 27, 2024
7b2659f
Remove commented out code.
ximon18 Nov 27, 2024
18e4007
Warning and error logging refactoring and cleanup.
ximon18 Nov 27, 2024
aa3c158
Don't error on duplicate records.
ximon18 Nov 27, 2024
071498e
Add ZONEMD support
mozzieongit Nov 26, 2024
38f396f
Add octseq and ring to Cargo.toml
mozzieongit Nov 27, 2024
5c248ed
Use zonemd and multisign aggregated domain branch
mozzieongit Nov 27, 2024
77e62b6
Clippy
mozzieongit Nov 27, 2024
1a47c70
Cargo format
mozzieongit Nov 27, 2024
513ef8b
Fix ZONEMD RRSIG expiration date
mozzieongit Nov 27, 2024
9a0c7b1
Move ZONEMD actions into methods
mozzieongit Nov 27, 2024
9e656d7
Implement ldns compatible ZONEMD option parsing
mozzieongit Nov 27, 2024
d63561e
Make missing key argument a clap parsing error
mozzieongit Nov 27, 2024
20d24be
Add some parsing and zonemd execution tests
mozzieongit Nov 27, 2024
7613599
Clippy
mozzieongit Nov 27, 2024
0c1742b
Use env.in_cwd when reading key files
mozzieongit Nov 27, 2024
c8c8043
Add a zonemd with signing test
mozzieongit Nov 27, 2024
5f22e5f
Minor adjustments to comment output.
ximon18 Nov 28, 2024
d1c39e2
Link to what Bubble Babble is.
ximon18 Nov 28, 2024
e1599cf
Update signzone manuals
mozzieongit Nov 28, 2024
c7ac217
Fix test failing when running past a time second change
mozzieongit Nov 28, 2024
788af68
Fix NSEC3 optout flags-only mixup
mozzieongit Nov 28, 2024
da4f088
Fix test to reflect NSEC3 optout default
mozzieongit Nov 28, 2024
e3d197f
Remove files wrongly commited to git.
ximon18 Nov 28, 2024
544cdd2
Merge branch 'main' into add-ldns-like-sign-zone-support
ximon18 Nov 29, 2024
fd2f485
FIX: In LDNS mode treat 0 dates as not-set like LDNS. (fixes #45)
ximon18 Dec 2, 2024
9f127b7
FIX: In LDNS Mode ignore case of ZoneMD scheme name and algorithm mne…
ximon18 Dec 2, 2024
6064a19
Build against temporary branch of domain that contains all latest cha…
ximon18 Dec 2, 2024
0ad6505
Cargo fmt.
ximon18 Dec 2, 2024
9b3e7e2
Update ZONEMD argument parsing based on the update to use iana macro …
ximon18 Dec 2, 2024
81bbffe
FIX: ZONEMD scheme and algorithm name matching should not be case sen…
ximon18 Dec 2, 2024
295727d
Remove testing code left behind accidentally.
ximon18 Dec 2, 2024
66fce99
Add NSEC3 optout behaviour test
mozzieongit Dec 2, 2024
c23b78f
Extract test file creation boilerplate into function
mozzieongit Dec 2, 2024
0c8a956
Update zonemd and sign expected output
mozzieongit Dec 2, 2024
b634acd
Add test helper functions to filter lines for multiple patterns
mozzieongit Dec 3, 2024
91531c4
Clarify test keys names
mozzieongit Dec 3, 2024
7b2e67a
Add more dnst argument parsing tests
mozzieongit Dec 3, 2024
a246d55
Use LdnsCommand::report_version
mozzieongit Dec 3, 2024
dafbd86
Add more tests
mozzieongit Dec 3, 2024
489d762
- Upgrade to latest `domain` changes.
ximon18 Dec 3, 2024
4ed6478
Clippy.
ximon18 Dec 3, 2024
2c1dfeb
Merge branch 'main' into add-ldns-like-sign-zone-support
ximon18 Dec 3, 2024
5c97fc4
Revert tabbed output changes in preparation to use the PR #446 approa…
ximon18 Dec 3, 2024
924f32a
Remove wrongly committed files.
ximon18 Dec 3, 2024
ff32c80
Remove commented line.
ximon18 Dec 3, 2024
5a57b66
Fix extra newline in line filter
mozzieongit Dec 4, 2024
76e255a
Simplify line filter functions
mozzieongit Dec 4, 2024
c5450e2
Update the ldns-signzone manual page to more closely reflect the impl…
ximon18 Dec 4, 2024
f0d77d6
Strip NSEC(3) and RRSIG RRs from the loaded zone so that we always on…
ximon18 Dec 5, 2024
c769287
Update man pages to match NSEC(3) and RRSIG stripping behaviour.
ximon18 Dec 5, 2024
1db62af
Make it clear that in the LDNS emulation case the stripping of NSEC(3…
ximon18 Dec 5, 2024
f041882
Minor man page tweak.
ximon18 Dec 5, 2024
f81d104
- FIX: Default LDNS KSK selection strategy is NOT to honour the key p…
ximon18 Dec 5, 2024
09e0732
FIX: Incorrect error message from test ldns binary if the given comma…
ximon18 Dec 5, 2024
e2810b2
Add an integration test based on an existing LDNS test.
ximon18 Dec 5, 2024
121505f
Clippy.
ximon18 Dec 5, 2024
16a9f5a
Output the test line that failed, not a line in a helper fn.
ximon18 Dec 5, 2024
5fbfd61
Fix broken nsec3-hash integration test, and update ldns=nsec3-hash to…
ximon18 Dec 5, 2024
f90c096
Cargo fmt.
ximon18 Dec 5, 2024
d355527
Fix behaviour with only KSKs to match LDNS: treat them as ZSKs. Add a…
ximon18 Dec 5, 2024
e403d24
Use updated strategy fn naming.
ximon18 Dec 5, 2024
3f65565
Update to latest `domain` to use new tabbed zonefile formatting to ma…
ximon18 Dec 5, 2024
7a361ca
FIX: Don't print RRSIGs twice.
ximon18 Dec 5, 2024
02276ea
Fix nsec3 tests to match updated default iteration count.
ximon18 Dec 5, 2024
bf46691
Output the test line that failed, not a line in a helper fn.
ximon18 Dec 5, 2024
b52846f
Update to match changes in `SigningKeyUsageStrategy` in latest `domain`.
ximon18 Dec 6, 2024
f56eb7b
Rename and fix the signing key fallback usage strategy.
ximon18 Dec 7, 2024
bdb4f6e
Ignore NSEC3PARAM RRs on loading the zone as a new one should be gene…
ximon18 Dec 7, 2024
43c6f7c
Remove temporary local diagnostics.
ximon18 Dec 7, 2024
ee5e86a
Strip ZONEMD RRs on load so that signing without ZONEMD doesn't leave…
ximon18 Dec 9, 2024
ee3b37e
Document the difference in RRSIG timestamp output format.
ximon18 Dec 9, 2024
6498e30
Document differences in output ordering compared to the original LDNS.
ximon18 Dec 9, 2024
ba0d67a
Re-order dev dependencies alphabetically and use the pretty_assertion…
ximon18 Dec 9, 2024
1c647c8
Check signing mode for when using ZONEMD
mozzieongit Dec 9, 2024
8331b5c
Bump domain to latest.
ximon18 Dec 9, 2024
57aeaa5
FIX: Don't output SOA RRSIG twice when not using -b.
ximon18 Dec 9, 2024
4c69c3a
Bump domain to latest and fix tests to match new tabbed LDNS compatib…
ximon18 Dec 9, 2024
5c9e65f
Bump domain to latest.
ximon18 Dec 9, 2024
320ec01
Cargo fmt.
ximon18 Dec 9, 2024
ac39540
When invoked as LDNS write RRSIG timestamps in RFC 4034 3.2 YYYYMMDDH…
ximon18 Dec 10, 2024
fa8b7ec
Clippy.
ximon18 Dec 10, 2024
06af01c
Print ";\n" lines in -b mode only after each "family". (fixes #44)
ximon18 Dec 10, 2024
211a182
Add placeholder tests for known issues.
ximon18 Dec 10, 2024
db477c7
Move test helper functions to the end.
ximon18 Dec 10, 2024
42abba1
Added a test showing that the RFC 1035 appendix A zone signing exampl…
ximon18 Dec 10, 2024
e1eef5c
Add a placeholder for a test of the RFC 5155 NSEC3 zone signing example.
ximon18 Dec 10, 2024
b724fd7
Use error context to indicate which path could not be loaded.
ximon18 Dec 11, 2024
0ca4502
Use a dedicated flag also available to dnst to select output of YYYYM…
ximon18 Dec 11, 2024
509e2f2
Use actual disk files instead of creating input files on the fly, as …
ximon18 Dec 11, 2024
53d34cb
Update test to follow change to RRSIG timestamp format output.
ximon18 Dec 11, 2024
c18128c
WIP: NSEC3 test to compare our behaviour to the RFC 5155 AppendIx A E…
ximon18 Dec 11, 2024
5f90ee9
WIP: NSEC3 test to compare our behaviour to the RFC 5155 AppendIx A E…
ximon18 Dec 11, 2024
0173ae5
Fix RFC 5155 NSEC3 test by using `-P` instead of `-p`, i.e. ACTUALLY …
ximon18 Dec 11, 2024
7b811de
Split formatting dnst args into their own -h group, and fix missing d…
ximon18 Dec 11, 2024
10de2cd
Simplify the RFC 5155 test and update some comments.
ximon18 Dec 12, 2024
9d29177
Remove almost duplicate comment.
ximon18 Dec 12, 2024
51c8ad4
Remove outdated comment.
ximon18 Dec 12, 2024
8589670
More comment improvements and corrections for the RFC 5155 test.
ximon18 Dec 12, 2024
5634f15
Fix incomplete earlier edits to rfc4035 signed zone test.
ximon18 Dec 12, 2024
1ecac19
Add comment about cause of test failure.
ximon18 Dec 12, 2024
7e0f29f
Remove unnecessary tmp dir support in rfc4035 asnd rfc5155 tests.
ximon18 Dec 12, 2024
a60a4c1
Remove left behind debug.
ximon18 Dec 12, 2024
95c1d95
Add passing test of RFC 8976 A.1 Simple EXAMPLE Zone.
ximon18 Dec 12, 2024
41ba840
Add failing test of RFC 8976 Complex EXAMPLE Zone.
ximon18 Dec 12, 2024
ad3aa13
Add other RFC 8976 test files.
ximon18 Dec 12, 2024
cc0f951
Update to latest domain to get origin detection while zone parsing, a…
ximon18 Dec 12, 2024
ec8f503
Fix default argument values for new formatting options.
ximon18 Dec 13, 2024
f10ae4f
Do emulate LDNS regarding NSEC handling of already hashed input zones…
ximon18 Dec 13, 2024
fcf6a87
Bump domain.
ximon18 Dec 13, 2024
5c3f95b
Update man page to reflect current behaviour.
ximon18 Dec 13, 2024
0cc4bf5
Remove outdated comments.
ximon18 Dec 13, 2024
bc9828e
Adjust the NSEC handling behaviour to more closely match ldns-signzone.
ximon18 Dec 13, 2024
08894f4
Match original ldns-signzone existing NSEC3PARAM RR handling.
ximon18 Dec 13, 2024
b6b90d5
Add a note about some output differences and why they are okay.
ximon18 Dec 13, 2024
023392f
Another comment.
ximon18 Dec 13, 2024
6c8955a
FIX: `-M` should permit the wrong key for the zone to be used.
ximon18 Dec 13, 2024
10756ec
Cargo fmt.
ximon18 Dec 13, 2024
064b78b
More ZONEMD tests from RFC 8976.
ximon18 Dec 13, 2024
d2dac34
Clarify comments on ZONEMD records and placeholders
mozzieongit Dec 13, 2024
ca9e1ed
Speed up ZONEMD RR insertion into SortedRecords
mozzieongit Dec 13, 2024
cbc7f72
Fix HINFO RRSIGs to match when HINFO is parsed and output correctly (…
ximon18 Dec 15, 2024
98fba67
Minor improvements in compatibility of generated zonefile comment for…
ximon18 Dec 16, 2024
3e09526
Update to latest domain.
ximon18 Dec 16, 2024
a9ef10c
Add empty test to not create output file before input file existence …
mozzieongit Dec 18, 2024
6ce07e6
Use new domain support for parallelized sorting to sign zones faster.…
ximon18 Dec 19, 2024
3c92d3b
Cargo fmt.
ximon18 Dec 19, 2024
b8a8d93
Update to latest domain.
ximon18 Dec 19, 2024
045deb6
Update to latest domain.
ximon18 Dec 20, 2024
4ed0ed5
Revert the bidirectional hash map based checking for orphaned NSEC3 h…
ximon18 Dec 27, 2024
7e90b4e
Add a placeholder test to come back to later.
ximon18 Dec 27, 2024
c1a8c4a
Add a test based on the RFC 8976 root-servers.net example.
ximon18 Dec 27, 2024
75425db
Document the difference in stripping of DNSSEC RRs on loading of the …
ximon18 Dec 27, 2024
186046c
Minor consistency improvement in man page text.
ximon18 Dec 27, 2024
82524a6
Update to latest domain.
ximon18 Jan 1, 2025
e5c8602
FIX: NSEC3PARAM TTL should be set per original ldns-signzone behaviou…
ximon18 Jan 1, 2025
3b9e0b9
Add tests showning that glue records are not included in the NSEC(3) …
ximon18 Jan 1, 2025
f3cc24c
Add a comment about a fragile test.
ximon18 Jan 1, 2025
d37a703
Fix brittle test by controlling time.
ximon18 Jan 2, 2025
378d6b5
Bump domain.
ximon18 Jan 6, 2025
12fed25
Bump domain and use the new simpler RRset::sign() API instead of call…
ximon18 Jan 6, 2025
aa1c5e7
Bump domain and adjust code to match.
ximon18 Jan 6, 2025
d71757f
Bump domain.
ximon18 Jan 6, 2025
82ee2e3
Bump domain, allowing us to remove the ugly type signature on the cal…
ximon18 Jan 6, 2025
7a56955
Bump domain and update test TTL values to match. new fixed TTL select…
ximon18 Jan 6, 2025
1c7a5ca
Implement RFC 9077 tests.
ximon18 Jan 7, 2025
dc56a12
Remove wrongly committed file.
ximon18 Jan 7, 2025
5ba1a1a
Cargo fmt.
ximon18 Jan 7, 2025
d27d6d8
Implement test for signed file should not be created if input file do…
ximon18 Jan 7, 2025
20c1856
Remove inapplicable test: we don't support multiple NSEC3 chains at t…
ximon18 Jan 7, 2025
052ced0
Clippy.
ximon18 Jan 7, 2025
70af787
Don't match error text.
ximon18 Jan 7, 2025
831e670
Bump domain and update to follow changes.
ximon18 Jan 8, 2025
0f14526
Bump domain and follow changes.
ximon18 Jan 9, 2025
d49ff2f
Use parallel sort everywhere.
ximon18 Jan 9, 2025
99c4bb9
Bump domain and follow changes.
ximon18 Jan 9, 2025
397d221
Merge branch 'main' into add-ldns-like-sign-zone-support
ximon18 Jan 9, 2025
364ae26
Clippy.
ximon18 Jan 9, 2025
b7a19c8
Bump domain and follow changes.
ximon18 Jan 9, 2025
34ffcfb
Bump domain.
ximon18 Jan 9, 2025
c5429d9
Revert "Bump domain."
ximon18 Jan 9, 2025
42ec90e
Bump domain.
ximon18 Jan 9, 2025
d24f8b8
Bump domain, and update NSEC3 hash capturing to use the newly availab…
ximon18 Jan 9, 2025
f39eeec
Remove comment.
ximon18 Jan 9, 2025
60172c6
Clippy.
ximon18 Jan 9, 2025
ab29d61
Bump domain.
ximon18 Jan 10, 2025
3e0315e
Bump to latest domain and remove unnecessary dependencies, especially…
ximon18 Jan 15, 2025
ac196dd
Bump domain and fix broken tests.
ximon18 Jan 17, 2025
1df5b1b
Fix messed up rebase.
ximon18 Jan 17, 2025
7ea35e0
Bump domain.
ximon18 Jan 21, 2025
259306b
Bump domain and follow changes.
ximon18 Jan 21, 2025
398ad55
Bump domain.
ximon18 Jan 22, 2025
30c4733
Bump domain and follow changes.
ximon18 Jan 30, 2025
16eb9ef
Bump domain and fix broken NSEC3 opt-out related tests.
ximon18 Feb 5, 2025
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
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,28 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [1.78.0, stable, beta, nightly]
env:
VCPKG_ROOT: "${{ github.workspace }}\\vcpkg"
VCPKGRS_TRIPLET: x64-windows-release
# Ensure that OpenSSL is dynamically linked.
VCPKGRS_DYNAMIC: 1
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-get install -y libssl-dev
- 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 Down
105 changes: 98 additions & 7 deletions Cargo.lock

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

14 changes: 12 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,18 @@ name = "ldns"
path = "src/bin/ldns.rs"

[dependencies]
clap = { version = "4.3.4", features = ["derive"] }
domain = { version = "0.10.3", git = "https://github.com/NLnetLabs/domain.git", branch = "initial-nsec3-generation", features = ["unstable-validator", "zonefile"] }
bytes = { version = "1.1", default-features = false }
clap = { version = "4.3.4", features = ["cargo", "derive"] }
domain = { git = "https://github.com/NLnetLabs/domain", branch = "support-zonefile-fmt-with-padding", features = [
"bytes",
"openssl",
"ring",
"unstable-sign",
"unstable-validate",
"unstable-validator",
"unstable-zonetree",
"zonefile",
] }
lexopt = "0.3.0"

[dev-dependencies]
Expand Down
15 changes: 9 additions & 6 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@ use super::error::Error;
#[derive(Clone, Debug, clap::Parser)]
#[command(version, disable_help_subcommand = true)]
pub struct Args {
/// The command that was invoked.
#[command(subcommand)]
pub command: Command,

/// Whether the command was invoked as an LDNS alias or not.
#[clap(skip = false)]
is_ldns: bool,
}

impl Args {
pub fn execute(self, env: impl Env) -> Result<(), Error> {
self.command.execute(env)
pub fn new(command: Command, is_ldns: bool) -> Self {
Self { command, is_ldns }
}
}

impl From<Command> for Args {
fn from(value: Command) -> Self {
Args { command: value }
pub fn execute(self, env: impl Env) -> Result<(), Error> {
self.command.execute(env, self.is_ldns)
}
}
12 changes: 6 additions & 6 deletions src/commands/key2ds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl Key2ds {
let rr = Record::new(owner, class, ttl, ds);

if self.write_to_stdout {
writeln!(env.stdout(), "{}", rr.display_zonefile(false));
writeln!(env.stdout(), "{}", rr.display_zonefile(false, true));
} else {
let owner = owner.fmt_with_dot();
let sec_alg = sec_alg.to_int();
Expand Down Expand Up @@ -210,7 +210,7 @@ impl Key2ds {
let mut out_file =
res.map_err(|e| format!("Could not create file \"{filename}\": {e}"))?;

writeln!(out_file, "{}", rr.display_zonefile(false))
writeln!(out_file, "{}", rr.display_zonefile(false, true))
.map_err(|e| format!("Could not write to file \"{filename}\": {e}"))?;

writeln!(env.stdout(), "{keyname}");
Expand Down Expand Up @@ -436,7 +436,7 @@ mod test {
assert_eq!(res.stderr, "");

let out = std::fs::read_to_string(dir.path().join("Kexample.test.+015+60136.ds")).unwrap();
assert_eq!(out, "example.test. 3600 IN DS 60136 15 2 52BD3BF40C8220BF1A3E2A3751C423BC4B69BCD7F328D38C4CD021A85DE65AD4\n");
assert_eq!(out, "example.test.\t3600\tIN\tDS\t60136\t15\t2\t52BD3BF40C8220BF1A3E2A3751C423BC4B69BCD7F328D38C4CD021A85DE65AD4\n");
}

#[test]
Expand All @@ -450,10 +450,10 @@ mod test {
assert_eq!(res.stderr, "");

let out = std::fs::read_to_string(dir.path().join("Kone.test.+015+38429.ds")).unwrap();
assert_eq!(out, "one.test. 3600 IN DS 38429 15 2 B85F7D27C48A7B84D633C7A41C3022EA0F7FC80896227B61AE7BFC59BF5F0256\n");
assert_eq!(out, "one.test.\t3600\tIN\tDS\t38429\t15\t2\tB85F7D27C48A7B84D633C7A41C3022EA0F7FC80896227B61AE7BFC59BF5F0256\n");

let out = std::fs::read_to_string(dir.path().join("Ktwo.test.+015+00425.ds")).unwrap();
assert_eq!(out, "two.test. 3600 IN DS 425 15 2 AA2030287A7C5C56CB3C0E9C64BE55616729C0C78DE2B83613D03B10C0F1EA93\n");
assert_eq!(out, "two.test.\t3600\tIN\tDS\t425\t15\t2\tAA2030287A7C5C56CB3C0E9C64BE55616729C0C78DE2B83613D03B10C0F1EA93\n");
}

#[test]
Expand All @@ -467,7 +467,7 @@ mod test {
assert_eq!(res.exit_code, 0);
assert_eq!(
res.stdout,
"example.test. 3600 IN DS 60136 15 2 52BD3BF40C8220BF1A3E2A3751C423BC4B69BCD7F328D38C4CD021A85DE65AD4\n"
"example.test.\t3600\tIN\tDS\t60136\t15\t2\t52BD3BF40C8220BF1A3E2A3751C423BC4B69BCD7F328D38C4CD021A85DE65AD4\n"
);
assert_eq!(res.stderr, "");
}
Expand Down
25 changes: 19 additions & 6 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
pub mod help;
pub mod key2ds;
pub mod nsec3hash;
pub mod signzone;

use std::ffi::{OsStr, OsString};
use std::str::FromStr;

use key2ds::Key2ds;
use nsec3hash::Nsec3Hash;
use signzone::SignZone;

use crate::env::Env;
use crate::Args;
Expand All @@ -20,6 +22,10 @@ pub enum Command {
#[command(name = "nsec3-hash")]
Nsec3Hash(self::nsec3hash::Nsec3Hash),

/// Sign the zone with the given key(s)
#[command(name = "signzone")]
SignZone(self::signzone::SignZone),

/// Generate a DS RR from the DNSKEYS in keyfile
///
/// The following file will be created for each key:
Expand All @@ -33,10 +39,11 @@ pub enum Command {
}

impl Command {
pub fn execute(self, env: impl Env) -> Result<(), Error> {
pub fn execute(self, env: impl Env, is_ldns: bool) -> Result<(), Error> {
match self {
Self::Nsec3Hash(nsec3hash) => nsec3hash.execute(env),
Self::Key2ds(key2ds) => key2ds.execute(env),
Self::Nsec3Hash(nsec3hash) => nsec3hash.execute(env),
Self::SignZone(signzone) => signzone.execute(env, is_ldns),
Self::Help(help) => help.execute(),
}
}
Expand All @@ -57,21 +64,27 @@ pub trait LdnsCommand: Into<Command> {

fn parse_ldns_args<I: IntoIterator<Item = OsString>>(args: I) -> Result<Args, Error> {
match Self::parse_ldns(args) {
Ok(c) => Ok(Args::from(c.into())),
Ok(c) => Ok(Args::new(c.into(), true)),
Err(e) => Err(format!("Error: {e}\n\n{}", Self::HELP).into()),
}
}
}

impl From<Key2ds> for Command {
fn from(val: Key2ds) -> Self {
Command::Key2ds(val)
}
}

impl From<Nsec3Hash> for Command {
fn from(val: Nsec3Hash) -> Self {
Command::Nsec3Hash(val)
}
}

impl From<Key2ds> for Command {
fn from(val: Key2ds) -> Self {
Command::Key2ds(val)
impl From<SignZone> for Command {
fn from(val: SignZone) -> Self {
Command::SignZone(val)
}
}

Expand Down
Loading
Loading