Bug 434 - Unbound for Windows should not hardcode the config file
Unbound for Windows should not hardcode the config file
Status: RESOLVED FIXED
Product: unbound
Classification: Unclassified
Component: server
1.4.15
Other Windows
: P5 normal
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-24 21:45 CET by Strainu
Modified: 2012-02-27 14:54 CET (History)
1 user (show)

See Also:


Attachments
Attepted patch (418 bytes, patch)
2012-02-24 22:28 CET, Strainu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Strainu 2012-02-24 21:45:22 CET
Unbound does not work out of the box using the installer on 64 bit Windows: by default, the install location is C:\Program Files (x86)\Unbound, but the program assumes the config file should be in C:\Program Files\Unbound\server.conf. It should assume the config file is in the same folder as the executable (or in the install folder)
Comment 1 Strainu 2012-02-24 22:28:50 CET
Created attachment 198 [details]
Attepted patch

This is just an attept, I haven't tested it in any way.
Comment 2 Strainu 2012-02-24 22:30:23 CET
Do note that there are other hardcoded paths in config:

UNBOUND_ROOTKEY_FILE="C:\\Program Files\\Unbound\\root.key"
UNBOUND_ROOTCERT_FILE="C:\\Program Files\\Unbound\\icannbundle.pem"
Comment 3 Wouter Wijngaards 2012-02-27 09:22:56 CET
Hi Strainu,

They are configured because that is the default.  There is a variety of ways to override this.

At compile time, you can do ./configure --with-conf-file=path --with-run-dir=path --with-share-dir=path --with-rootkey-file=filename --with-rootcert-file=filename

This overrides the entries you name in your patch.

At setup.exe time, an entry is created in the windows registry that notes the location of the config file and the directory where to get the root.key and icannbundle.pem files.  This is in HKLM\Software\Unbound\ the RegStr items InstallLocation and ConfigFile.  If the registry items are set correctly it should run from the programfilesx64 ; is there something wrong here?  What really fails for you?

The installer should have set the registry so that the unbound executables can find the correct files in the programfilesx64 directory.

Also, at runtime you can override the locations with -c configfile options; this is possible in the advanced settings menu of the service control panel (where it gives the commandline options to unbound).  But these options are really meant for the commandline.  Unbound-anchor also has options from the commandline to set the filenames.

Can you say what is failing with the different install directory?  How did you install?

Best regards,
   Wouter
Comment 4 Strainu 2012-02-27 09:49:34 CET
(In reply to comment #3)
> Hi Strainu,
> 
> They are configured because that is the default.  There is a variety of ways to
> override this.

I understand this. However, I believe that the windows installer should be configured in such a way that Unbound can be used after installation without any tweaks. I encountered this problem while testing Unbound for the first time.


> At setup.exe time, an entry is created in the windows registry that notes the
> location of the config file and the directory where to get the root.key and
> icannbundle.pem files.  This is in HKLM\Software\Unbound\ the RegStr items
> InstallLocation and ConfigFile.  If the registry items are set correctly it
> should run from the programfilesx64 ; is there something wrong here?  What
> really fails for you?
> 
> The installer should have set the registry so that the unbound executables can
> find the correct files in the programfilesx64 directory.

I installed Unbound from the installer, without changing any options, on a Win 7 x64. The service is started, but when I try to start unbound-control.exe with any parameters except the location of the configuration file, I get an error:

[1330332223] unbound-control[3628:0] error: Could not open C:\Program Files\Unbo
und\service.conf: No such file or directory
[1330332223] unbound-control[3628:0] fatal error: could not read config file

Checking with regedit, I cannot find the keys you describe or any reference to Unbound except for the Add-Remove program entry.

As far as I know, I have no program preventing writes to the registry.

> 
> Also, at runtime you can override the locations with -c configfile options;
> this is possible in the advanced settings menu of the service control panel
> (where it gives the commandline options to unbound).  But these options are
> really meant for the commandline.  Unbound-anchor also has options from the
> commandline to set the filenames.

The -c option works, but it's not really good for usablity to provide it every time.
Comment 5 Wouter Wijngaards 2012-02-27 10:01:52 CET
Hi Strainu,

So I think it installed correctly, but there is an oversight in unbound-control that makes it not work for you - it simply does not check the registry for the location of the configfile.

I guess the registry entries exist fine and unbound is running, but it is unbound-control that does not check the registry.  This is a bug.

Strange you cannot find registry entries, the install script writes the add/remove software entries via the registry too, so the registry write is working.  Have you tried search for "unbound" ?

Best regards,
   Wouter
Comment 6 Wouter Wijngaards 2012-02-27 14:54:10 CET
Fixed in svn trunk, unbound-control checks registry for configfile location.

Thanks for the report

Best regards,
   Wouter