FIXED: secret.txt opened in text mode on Windows
MaraDNS: A small open-source DNS server | 2020 update: test & release process updated
Brought to you by:
samboy
Originally created by: jojothe
After using Deadwood on Windows successfully for years (and loving it!), I got this error when I installed it on a new machine:
Friday, November 30, 2018 17:12:22 PM: Unable to get 128 bits of entropy; file secret.txt must be
at least 16 bytes (128 bits) long
It turns out mkSecretTxt.exe happened to put a control-Z in the first 16 bytes of secret.txt, and the file is opened in text mode (O_RDONLY), so Windows reads the control-Z as EOF and thinks the file is too short. (I worked around it by re-running mkSecretTxt.exe to get a secret.txt with no control-Z.)
A better fix, in get_entropy_from_seedfile():
seed = open(filename, O_RDONLY|O_BINARY);
Originally posted by: samboy
Thanks for the heads-up; this looks to be a legitimate code with a one-line patch. Not sure when I will have free time to make this so (The problem with working in the private sector is that, even in California, when I am clocked in, anything I do is owned by my employer; when I’m not on the clock, I’m usually taking care of a young child)
Originally posted by: samboy
O_BINARYis a Windows-specific option, so I had to put the code in a#ifdef MINGWblockOriginally posted by: samboy
Looks like that will work, but, yes,
O_BINARYwill not compile in Linux. See https://sourceforge.net/p/mingw/bugs/1396/Originally posted by: samboy
I have fixed the issue and have committed the code. I will close this ticket when I make a new Deadwood tarball (and, yes, Windows binary zipfile) with the updated code.
Originally posted by: samboy
Snapshot Deadwood with this fix made: https://maradns.samiam.org/Deadwood/snap/
Next:
Originally posted by: samboy
The 2019-01-16 snapshot passes all SQA regression tests; no regressions were introduced.
Originally posted by: samboy
I have made a test compile in Windows. The test compile is able to start and resolve domains with a
secret.txtconsisting of nothing but^Z(ASCII code 26); to verify this fixes the bug, Deadwood 3.2.12 is unable to resolve domains with the samesecret.txtfile.Next: Release Deadwood 3.2.14
Ticket changed by: samboy
Originally posted by: samboy
Deadwood 3.2.14 released. No changes except this bugfix. Available for download:
Closing ticket.
Originally posted by: samboy
I will make a MaraDNS 2.0.17 release with Deadwood 3.2.14 once I have a fix for https://github.com/samboy/MaraDNS/issues/52 available.
Also, this is not a security problem because Deadwood refuses to run if it does not have a safe level of entropy (128 bits or more).
Originally posted by: samboy
Locking conversation to avoid spam.