Professional Documents
Culture Documents
http://la-samhna.de/samhain/HOWTO-samhain-on-windo...
Older versions of samhain would need to be built with ./configure --disable-mail (i.e. without support for email logging) because Interix does not provide some of the required functionality to build the email module. This issue should be xed as of samhain version 2.0.7 (not tested). [Based on information kindly provided by Geries Handal].
Cygwin installation
1 of 4
31.10.2012 14:33
http://la-samhna.de/samhain/HOWTO-samhain-on-windo...
When the download is complete you have the Cygwin software in the temporary directory, however, it still needs to be installed. To install, execute the "setup.exe" in "c:\temp\cygwin" Choose the "Install from local directory" option. Choose "C:\Cygwin" as root directory (this will be the Unix '/') Choose the Local Package Directory: "c:\temp\cygwin" Click on 'Default' just after 'All' to change the installation type from 'Default' to 'Install'. Let it install Cygwin (this will take some time so be patient).
Congure:
$ ./configure --enable-xml-log=yes --with-tmp-dir=/usr/local/tmp --with-config-file=/usr/local /etc/samhainrc --with-log-file=/usr/local/log/samhain.log --with-pid-file=/usr/local/var/samhain.pid --with-state-dir=/usr/local/var
In my experience, the paths given in the 'congure' command should refer to the Cygwin lesystem view, i.e. /cygdrive/c/..., otherwise samhain may not work from a pure DOS shell, and may not run as a Windows service [Rainer Wichmann]. Make the binary:
$ make
Install samhain:
$ make install
Now congure the "/usr/local/etc/samhainrc" le. Remember: "C:\" -> "/cygdrive/c/" Initialize the samhain local baseline database:
$ /usr/local/sbin/samhain -t init
Start it up:
$ /usr/local/sbin/samhain -t check
2 of 4
31.10.2012 14:33
http://la-samhna.de/samhain/HOWTO-samhain-on-windo...
srvany.exe First copy these les to the "%winnt%\system32" directory. Files needed to run the 'samhain.exe'. Copy the following .dll from the Cygwin setup (c:\Cygwin\bin) to the "%winnt%\system32" directory: cygwin1.dll cygminires.dll Files needed from c:\Cygwin\bin to create the /etc/passwd and /etc/group les: mkpasswd.exe mkgroup.exe To generate these les on a minimal Cygwin installation execute - on a Windows Command Prompt:
mkdir c:\etc path\to\mkpasswd.exe -l > c:\etc\passwd path\to\mkgroup.exe -l > c:\etc\group
IMPORTANT NOTE: You should re-create these two les, each time the Windows users and groups accounts database changes. Failing to do this might generate critical log messages (depending on your conguration le). Create a directory structure for samhain (following the compilation options you used) - in a DOS box (or via Windows Explorer)
mkdir c:\usr mkdir c:\usr\local mkdir c:\usr\local\sbin mkdir c:\usr\local\var mkdir c:\usr\local\tmp mkdir c:\usr\local\log mkdir c:\usr\local\etc
(this will create a service called "Samhain" that will start the "srvany.exe" process). Now edit the registry to change the startup parameters for the newly created service: regedit HKEY_LOCAL_MACHINE->SYSTEM->CurrentControlSet->Services->Samhain Add a String value (type: REG_SZ called: "Description") under the 'Samhain' key Open the newly created "Description" value and ll in a description for the 'Samhain' service Add a key to specify what le the "srvany.exe" process must start: Edit->New->Key called "Parameters" Under the newly created "Parameters" key, add a new String value called "Application". The value for "Application" should be "c:\usr\local\sbin\samhain.exe". Make sure that in the "samhainrc" le, you have used "/cygdrive/c" to refer to "c:" Initialize the samhain baseline database rst:
c:\usr\local\sbin\samhain -t init
Reboot (it is Windows so ...) It seems that start/stop/restart the service does not work if samhain is congured to run as a daemon, because the Windows service manager cannot track the forked daemon process. Therefore, if you run Samhain as a Windows service, it might be better to congure it as a 'normal' process which does not fork a daemon:
3 of 4 31.10.2012 14:33
http://la-samhna.de/samhain/HOWTO-samhain-on-windo...
Set 'Daemon = no' in the samhainrc conguration le. Edit the key HKEY_LOCAL_MACHINE->SYSTEM->CurrentControlSet->Services->Samhain->Parameters to add a string value named 'AppParameters', with the value '--forever'. [Rainer Wichmann]. Also see http://support.microsoft.com/kb/q137890/ for information regarding the creation of a user-dened service. Note: the rst time I tried to install samhain as an NT service, I rst installed a default Cygwin on the system. This however made things much more complex. I think when there is no Cygwin installed, it is more easy to install Samhain as a service.
Troubleshooting samhain
[Rainer Wichmann] I had some problems at rst getting it to run as a Windows service. Some tips: Running samhain from a pure DOS shell (outside the Cygwin environment) helps to identify problems, in particular if it refuses to start as a Windows service. I found it neccessary to put the cygwin1.dll DLL into the same directory as the samhain.exe executable. Also, you can use the command ldd ./samhain.exe to identify further Cygwinspecic DLL that may be required (if any). Also, I found it neccessary to use Cygwin-style paths (/cygdrive/c/...) in the './congure ..' command when compiling samhain. [Tip from Jorge Morgado] If you, like me, have a Windows server not part of any domain and (for security reasons) you even turn o DNS resolution, you might probably get the following error when initializing the baseline database:
--------sh_unix.c --1487 --------According to uname, your nodename is yourcomputername, but your resolver library cannot resolve this nodename to a FQDN. Rather, it resolves this to yourcomputername. For more information, see the entry about self-resolving under 'Most frequently' in the FAQ that you will find in the docs/ subdirectory ----------------------------------------------
To x this problem open the Registry Editor and create the following entries under the key HKLM\System\CurrentControlSet\Services\Tcpip\Parameters
Name: Domain Type: REG_SZ Data: your.domain.name Name: NV Domain Type: REG_SZ Data: your.domain.name
The NV Domain registry value contains the computer's primary DNS sux while the Domain registry value contains the computer's primary DNS domain. This will make the warning message go away.
4 of 4
31.10.2012 14:33