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

plugin/sign: a plugin that signs zone #2993

Merged
merged 4 commits into from Aug 29, 2019
Merged

plugin/sign: a plugin that signs zone #2993

merged 4 commits into from Aug 29, 2019

Conversation

miekg
Copy link
Member

@miekg miekg commented Jul 11, 2019

Sign is a plugin that signs zone data (on disk). The README.md details
what exactly happens to should be accurate related to the code.

There are a couple of things missing, documented in TODO; these mostly
deal with setup and tear down. But also some more important things like
adding NSEC and not signing glue records. Also more tests need be added.

The current test signs db.miek.nl and puts the result in
db.miek.nl.signed in the current directory.

The change to file/* need to be backed out, once some other changes in
another PR are in - these are just here to make things work now.


Pushing this now if someone feels inclined to review as new plugins are
usually a lot of code at once - currently this is still manageable, I
hope.

@corbot corbot bot requested a review from SuperQ July 11, 2019 06:39
@corbot
Copy link

corbot bot commented Jul 11, 2019

Thank you for your contribution. I've just checked the OWNERS files to find a suitable reviewer. This search was successful and I've asked superq (via /OWNERS) for a review.

If you have questions or suggestions for this bot, please file an issue against the miekg/dreck repository.

The bot understands the commands that are listed here.

plugin/file/tree/elem.go Outdated Show resolved Hide resolved
plugin/sign/keys.go Show resolved Hide resolved
plugin/sign/sign.go Show resolved Hide resolved
plugin/sign/sign.go Outdated Show resolved Hide resolved
plugin/sign/TODO Outdated Show resolved Hide resolved
Copy link
Member

@stp-ip stp-ip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still want to go deeper on the code, currently swamped with other stuff, but added a few first thoughts and ideas.

plugin/sign/keys.go Outdated Show resolved Hide resolved
plugin/sign/sign.go Outdated Show resolved Hide resolved
@miekg
Copy link
Member Author

miekg commented Jul 14, 2019

@stp-ip think I fixed your comments. PTAL

plugin/sign/sign.go Outdated Show resolved Hide resolved
plugin/sign/signer.go Outdated Show resolved Hide resolved
plugin/sign/README.md Outdated Show resolved Hide resolved
@miekg
Copy link
Member Author

miekg commented Jul 18, 2019 via email

@miekg miekg force-pushed the dnssec-file branch 4 times, most recently from d5ebc4b to 895c2d3 Compare July 19, 2019 06:53
plugin/sign/sign.go Outdated Show resolved Hide resolved
plugin/sign/sign.go Outdated Show resolved Hide resolved
@miekg miekg force-pushed the dnssec-file branch 3 times, most recently from c6f311e to 12aad48 Compare July 21, 2019 19:16
@codecov-io
Copy link

codecov-io commented Jul 21, 2019

Codecov Report

Merging #2993 into master will decrease coverage by 0.06%.
The diff coverage is 54.24%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2993      +/-   ##
==========================================
- Coverage   55.83%   55.76%   -0.07%     
==========================================
  Files         206      213       +7     
  Lines       10417    10747     +330     
==========================================
+ Hits         5816     5993     +177     
- Misses       4183     4298     +115     
- Partials      418      456      +38
Impacted Files Coverage Δ
plugin/sign/sign.go 0% <0%> (ø)
plugin/sign/dnssec.go 100% <100%> (ø)
plugin/sign/keys.go 40.32% <40.32%> (ø)
plugin/sign/signer.go 51.3% <51.3%> (ø)
plugin/sign/file.go 57.14% <57.14%> (ø)
plugin/sign/setup.go 64.17% <64.17%> (ø)
plugin/sign/nsec.go 72.22% <72.22%> (ø)
plugin/file/reload.go 69.44% <0%> (-5.56%) ⬇️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eec24cb...2779e4e. Read the comment docs.

@miekg
Copy link
Member Author

miekg commented Jul 22, 2019

OK, this should be relatively ready. Code without test is about 600 lines, which is not too bad. The meat of the thing is in signer.go.

I'm running this branch on miek.nl (just for that zone, but I'll add the rest) to see how things go (eyeballing the log). I didn't change the default timers so this will take some while).

@miekg
Copy link
Member Author

miekg commented Jul 22, 2019 via email

@miekg
Copy link
Member Author

miekg commented Jul 26, 2019

Seeing a lot of transfers happing

Jul 26 04:25:18 deb coredns[720]: 2019-07-26T04:25:18.910Z [INFO] plugin/file: Outgoing transfer of 53 records of zone miek.nl. to 37.97.149.87 started
Jul 26 04:27:18 deb coredns[720]: 2019-07-26T04:27:18.944Z [INFO] plugin/file: Outgoing transfer of 53 records of zone miek.nl. to 37.97.149.87 started
Jul 26 04:29:18 deb coredns[720]: 2019-07-26T04:29:18.993Z [INFO] plugin/file: Outgoing transfer of 53 records of zone miek.nl. to 37.97.149.87 started
Jul 26 05:25:46 deb coredns[720]: 2019-07-26T05:25:46.060Z [INFO] plugin/file: Outgoing transfer of 53 records of zone miek.nl. to 37.97.149.87 started
Jul 26 05:27:46 deb coredns[720]: 2019-07-26T05:27:46.136Z [INFO] plugin/file: Outgoing transfer of 53 records of zone miek.nl. to 37.97.149.87 started
Jul 26 05:29:46 deb coredns[720]: 2019-07-26T05:29:46.161Z [INFO] plugin/file: Outgoing transfer of 53 records of zone miek.nl. to 37.97.149.87 started
Jul 26 06:28:38 deb coredns[720]: 2019-07-26T06:28:38.221Z [INFO] plugin/file: Outgoing transfer of 53 records of zone miek.nl. to 37.97.149.87 started
Jul 26 06:30:38 deb coredns[720]: 2019-07-26T06:30:38.257Z [INFO] plugin/file: Outgoing transfer of 53 records of zone miek.nl. to 37.97.149.87 started

@miekg
Copy link
Member Author

miekg commented Aug 3, 2019

after some simplifications I've now moved all my signed zones over:

Aug 03 18:45:58 deb coredns[4637]: 2019-08-03T18:45:58.158Z [INFO] plugin/sign: Skipping signing zone "miek.nl." in "/var/lib/coredns/db.miek.nl.signed", signatures are valid
Aug 03 18:45:58 deb coredns[4637]: 2019-08-03T18:45:58.160Z [INFO] plugin/sign: Skipping signing zone "dnssex.nl." in "/var/lib/coredns/db.dnssex.nl.signed", signatures are valid
Aug 03 18:45:58 deb coredns[4637]: 2019-08-03T18:45:58.161Z [INFO] plugin/sign: Skipping signing zone "atoom.net." in "/var/lib/coredns/db.atoom.net.signed", signatures are valid
Aug 03 18:45:58 deb coredns[4637]: 2019-08-03T18:45:58.161Z [INFO] plugin/sign: Skipping signing zone "coredns.io." in "/var/lib/coredns/db.coredns.io.signed", signatures are valid

We'll see what happens

@miekg miekg force-pushed the dnssec-file branch 2 times, most recently from 3e8c0fe to 03d4a69 Compare August 15, 2019 08:25
@miekg miekg force-pushed the dnssec-file branch 3 times, most recently from 2795789 to 817c79e Compare August 27, 2019 18:33
@miekg
Copy link
Member Author

miekg commented Aug 28, 2019

any problems with merging this? (@stp-ip)

Has been running stable on my server.

(as said, this needs followup PRs to make delegations work)

Copy link
Member

@stp-ip stp-ip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Added a few comments.

Will try to carve out some additional time to do another run over signer.go and test a few more things.

plugin/sign/README.md Outdated Show resolved Hide resolved
plugin/sign/file.go Show resolved Hide resolved
plugin/sign/keys.go Show resolved Hide resolved
plugin/sign/nsec.go Outdated Show resolved Hide resolved
plugin/sign/sign.go Outdated Show resolved Hide resolved
plugin/sign/signer.go Outdated Show resolved Hide resolved
}
}
i++
if i > 100 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why specifically 100 records?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be 1, but the RFC doesn't mandate the SOA being first. 100 seemed like a crazy enough number that makes sense? Open to suggestions.
(I'll add comment on why the current value)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100 seems reasonable high to catch the edge cases of the SOA not being first I agree.
Comment for the reasoning sounds good. 100 were too arbitrary without a comment in my view.

Sign is a plugin that signs zone data (on disk). The README.md details
what exactly happens to should be accurate related to the code.

Signs are signed with a CSK, resigning and first time signing is all
handled by *sign* plugin.

Logging with a test zone looks something like this:

~~~ txt
[INFO] plugin/sign: Signing "miek.nl." because open plugin/sign/testdata/db.miek.nl.signed: no such file or directory
[INFO] plugin/sign: Signed "miek.nl." with key tags "59725" in 11.670985ms, saved in "plugin/sign/testdata/db.miek.nl.signed". Next: 2019-07-20T15:49:06.560Z
[INFO] plugin/file: Successfully reloaded zone "miek.nl." in "plugin/sign/testdata/db.miek.nl.signed" with serial 1563636548
[INFO] plugin/sign: Signing "miek.nl." because resign was: 10m0s ago
[INFO] plugin/sign: Signed "miek.nl." with key tags "59725" in 2.055895ms, saved in "plugin/sign/testdata/db.miek.nl.signed". Next: 2019-07-20T16:09:06.560Z
[INFO] plugin/file: Successfully reloaded zone "miek.nl." in "plugin/sign/testdata/db.miek.nl.signed" with serial 1563637748
~~~

Signed-off-by: Miek Gieben <miek@miek.nl>
Signed-off-by: Miek Gieben <miek@miek.nl>
Signed-off-by: Miek Gieben <miek@miek.nl>
plugin/sign/README.md Outdated Show resolved Hide resolved
@stp-ip
Copy link
Member

stp-ip commented Aug 29, 2019

Did a few more manual tests and another run on the signer.go file. /lgtm

Co-Authored-By: Michael Grosser <development@stp-ip.net>
@miekg
Copy link
Member Author

miekg commented Aug 29, 2019

lgtm at the end of a line isn't detected. But noted and thanks :)

@miekg miekg merged commit b8a0b52 into master Aug 29, 2019
@corbot corbot bot deleted the dnssec-file branch August 29, 2019 14:42
@stp-ip
Copy link
Member

stp-ip commented Aug 29, 2019

Damn that was supposed to have a newline ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants