Menu

#51 FIXED: secret.txt opened in text mode on Windows

closed
nobody
None
2019-02-24
2018-12-01
Anonymous
No

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);

Discussion

  • Anonymous

    Anonymous - 2019-01-05

    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)

     
  • Anonymous

    Anonymous - 2019-01-07

    Originally posted by: samboy

    O_BINARY is a Windows-specific option, so I had to put the code in a #ifdef MINGW block

     
  • Anonymous

    Anonymous - 2019-01-07

    Originally posted by: samboy

    Looks like that will work, but, yes, O_BINARY will not compile in Linux. See https://sourceforge.net/p/mingw/bugs/1396/

     
  • Anonymous

    Anonymous - 2019-01-08

    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.

     
  • Anonymous

    Anonymous - 2019-01-17

    Originally posted by: samboy

    Snapshot Deadwood with this fix made: https://maradns.samiam.org/Deadwood/snap/

    Next:

    • Run automated SQA tests on snapshot to ensure no regressions were introduced
    • Once the SQA suite passes, compile and make Windows binary
    • Make sure Windows does not have Ctrl+Z issue
    • Make Deadwood 3.2.14 release (Source, Windows binary) with updated code
     
  • Anonymous

    Anonymous - 2019-01-18

    Originally posted by: samboy

    The 2019-01-16 snapshot passes all SQA regression tests; no regressions were introduced.

     
  • Anonymous

    Anonymous - 2019-01-19

    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.txt consisting of nothing but ^Z (ASCII code 26); to verify this fixes the bug, Deadwood 3.2.12 is unable to resolve domains with the same secret.txt file.

    Next: Release Deadwood 3.2.14

     
  • Anonymous

    Anonymous - 2019-01-19

    Ticket changed by: samboy

    • status: open --> closed
     
  • Anonymous

    Anonymous - 2019-01-19

    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).

     
  • Anonymous

    Anonymous - 2019-02-24

    Originally posted by: samboy

    Locking conversation to avoid spam.

     

Log in to post a comment.

MongoDB Logo MongoDB