Cfengine configuration directory

Cfengine on NT

Relevant classes: cygwin nt

Compiling

Soon there should be pre-compiled cfengine binaries for windows. Until then, or if you want to compile from source anyway, you will first need to get a new install of cygwin from http://sources.redhat.com/cygwin/ (any release since start of 2002 should work - you need the regular expression changes from end of 2001) make sure you get developer tools like gcc and make, as well as the openssl and openssl-devel packages.

Get berkeley db version 3 (I used 3.2.9) from http://www.sleepycat.com/update/index.html and install as usual:

    tar -xzf db-3.2.9.tar.gz
    cd db-3.2.9/build_unix
    ../dist/configure
    make
    make install

Build cfengine. You probably want openssl linked statically - to force it create a local lib directory with a link to just the static library (this is handy for UNIX builds too):

    mkdir lib
    ln -s /usr/lib/libcrypto.a lib
    LIBS=-L`pwd`/lib ./configure --with-berkeleydb=/usr/local/BerkeleyDB.3.2
    make
    make install

Windows File Paths

Warning: Win32 pathname support is still incomplete in cfengine. If works for file copy operations but probably nothing else yet. Support for all operations is forthcoming.

Under windows, cfengine allows you to intermix forward and backward slashes as separators for your file paths. Cfengine also understands win32 style absolute paths (prefixed with a drive letter or UNC style network shares). If a file path begins with a forward slash (/) then it assumed to be an absolute posix path based at the cygwin root. The following are all valid absolute file names under windows:

  • c:\winnt
  • c:/winnt
  • /var/cfengine/inputs
  • //fileserver/share2\dir
These are not valid absolute file names:
Path Problem
\var\cfengine\inputs Paths beginning with a backslash are assumed to be win32 paths. They must begin with a drive letter or double-slash server name

With support for win32 pathname you can easily distribute windows OS files, like Lmhosts, using the SystemRoot environment variable:


copy:
    $(golddir)/win/Lmhosts dest=$(SystemRoot)/system32/drivers/etc/Lmhosts
        server=$(goldhost)
        type=binary

Here is another example to synchronize a local application with a copy on your cfengine server. Note that since the destination of the copy contains a space you must define it as a macro variable where you can use quoted strings.



control:
    customapp_dir = ( "$(SystemDrive)/program files/customapp" )

copy:
    $(golddir)/win/customapp dest=$(customapp_dir)
        server=$(goldhost)
        recurse=1
        backup=false
        type=ctime

cfexecd as a windows service

Under development. Should be able to use cygrunsrv as a wrapper for "cfexecd -g".
Back to documentation