Sophie

Sophie

distrib > Mandriva > 8.1 > i586 > by-pkgid > dc430da5aacc0cead97c2e2ef0c82561 > files > 35

cfengine-1.6.3-4mdk.i586.rpm

<html lang="en"><head>
<title>GNU cfengine</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name=description content="GNU cfengine">
<meta name=generator content="makeinfo 4.0">
<link href="http://texinfo.org/" rel=generator-home>
</head><body>

<p><hr>
Node:<a name="Top">Top</a>,
Next:<a rel=next href="#Command%20reference">Command reference</a>,
Previous:<a rel=previous href="#(dir)">(dir)</a>,
Up:<a rel=up href="#(dir)">(dir)</a>
<br>

<h1>Cfengine-Reference</h1>

<ul>
<li><a href="#Command%20reference">Command reference</a>: 
<li><a href="#Writing%20scripts%20for%20cfengine">Writing scripts for cfengine</a>: 
<li><a href="#Problem%20solving">Problem solving</a>: 
<li><a href="#Using%20the%20help%20scripts">Using the help scripts</a>: 
<li><a href="#Example%20configuration%20file">Example configuration file</a>: 
<li><a href="#Runtime%20Options">Runtime Options</a>: 
<li><a href="#Network%20protocol%20specs">Network protocol specs</a>: 
<li><a href="#Variable%20Index">Variable Index</a>: 
<li><a href="#Concept%20Index">Concept Index</a>: 
<li><a href="#FAQ%20Index">FAQ Index</a>: 
</ul>

<p><hr>
Node:<a name="Command%20reference">Command reference</a>,
Next:<a rel=next href="#Writing%20scripts%20for%20cfengine">Writing scripts for cfengine</a>,
Previous:<a rel=previous href="#Top">Top</a>,
Up:<a rel=up href="#Top">Top</a>
<br>

<h1>Command reference</h1>

<p>In this section you will find each facet of a cfengine program listed
together with an appropriate explanation.  The commands are presented in
alphabetical order for ease of lookup. Use this section in conjunction
with the example program See <a href="#Example%20configuration%20file">Example configuration file</a>.

<ul>
<li><a href="#acl">acl</a>: 
<li><a href="#binservers">binservers</a>: 
<li><a href="#broadcast">broadcast</a>: 
<li><a href="#control">control</a>: 
<li><a href="#classes">classes</a>: 
<li><a href="#copy">copy</a>: 
<li><a href="#defaultroute">defaultroute</a>: 
<li><a href="#disks">disks</a>: 
<li><a href="#directories">directories</a>: 
<li><a href="#disable">disable</a>: 
<li><a href="#editfiles">editfiles</a>: 
<li><a href="#files">files</a>: 
<li><a href="#filters">filters</a>: 
<li><a href="#groups">groups</a>: 
<li><a href="#homeservers">homeservers</a>: 
<li><a href="#ignore">ignore</a>: 
<li><a href="#import">import</a>: 
<li><a href="#interfaces">interfaces</a>: 
<li><a href="#links">links</a>: 
<li><a href="#mailserver">mailserver</a>: 
<li><a href="#miscmounts">miscmounts</a>: 
<li><a href="#mountables">mountables</a>: 
<li><a href="#processes">processes</a>: 
<li><a href="#required">required</a>: 
<li><a href="#resolve">resolve</a>: 
<li><a href="#shellcommands">shellcommands</a>: 
<li><a href="#tidy">tidy</a>: 
<li><a href="#unmount">unmount</a>: 
</ul>

<p><hr>
Node:<a name="acl">acl</a>,
Next:<a rel=next href="#binservers">binservers</a>,
Previous:<a rel=previous href="#Command%20reference">Command reference</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>acl</h2>

<pre>
   acl:

      <var>class</var>::

         { <var>acl-alias</var>

         <var>action</var>
         }

</pre>

<p>Cfengine's <code>ACL</code> feature is a common interface for managing
filesystem access control lists (ACLs). An access control list is an
extended file permission. It allows you to open or close a file to a
named list of users (without having to create a group for those users);
similarly, it allows you to open or close a file for a list of groups. 
Several operating systems have access control lists, but each typically
has a different syntax and different user interface to this facility,
making it very awkward to use.  This part of a cfengine configuration
simplifies the management of ACLs by providing a more convenient user
interface for controlling them and--as far as possible--a common
syntax.

<p>An ACL may, by its very nature, contain a lot of information. Normally
you would set ACLs in a <code>files</code> command, See <a href="#files">files</a>, or a
<code>copy</code> command, See <a href="#copy">copy</a>. It would be too cumbersome to repeat
all of the information in every command in your configuration, so
cfengine simplifies this by first associating an alias together with a
complex list of ACL information. This alias is then used to represent
the whole bundle of ACL entries in a <code>files</code> or <code>copy</code>
command.  The form of an ACL is similar to the form of an
<code>editfiles</code> command.  It is a bundle of information concerning a
file's permissions.

<pre>
 { <var>acl-alias</var>

  method:<b>overwrite</b><var>/append</var>
  fstype:<var>posix/solaris/dfs/afs/hpux/nt</var>

  <var>acl_type</var>:<var>user/group</var>:<var>permissions</var>
  <var>acl_type</var>:<var>user/group</var>:<var>permissions</var>
  ...
 }

</pre>

<p>The name <var>acl-alias</var> can be any identifier containing alphanumeric
characters and underscores. This is what you will use to refer to the
ACL entries in practice. The method entry tells cfengine how to
interpret the entries: should a file's ACLs be overwritten or only
adjusted?  Since the filesystems from different developers all use
different models for ACLs, you must also tell cfengine what kind of
filesystem the file resides on. Currently only solaris and DCE/DFS ACLs
are implemented.

<p>NOTE: if you set both file permissions and ACLs the file permissions
override the ACLs.

<ul>
<li><a href="#ACEs">ACEs</a>: 
<li><a href="#Solaris%20ACLs">Solaris ACLs</a>: 
<li><a href="#DFS%20ACLs">DFS ACLs</a>: 
<li><a href="#NT%20ACLs">NT ACLs</a>: 
<li><a href="#ACL%20Example">ACL Example</a>: 
</ul>

<p><hr>
Node:<a name="ACEs">ACEs</a>,
Next:<a rel=next href="#Solaris%20ACLs">Solaris ACLs</a>,
Previous:<a rel=previous href="#acl">acl</a>,
Up:<a rel=up href="#acl">acl</a>
<br>

<h3>Access control entries</h3>

<p>An access control list is build of any number of individual access
control entries (ACEs). The ACEs has the following general syntax:

<pre>    <var>acl_type</var>:<var>user/group</var>:<var>permissions</var>
</pre>

<p>The user or group is sometimes referred to as a <em>key</em>.

<p>For an explanation of ACL types and their use, refer to your local
manual page.  However, note that for each type of filesystem, there are
certain entries which must exist in an ACL. If you are creating a new
ACL from scratch, you must specify these.  For example, in solaris ACLs
you must have entries for <code>user</code>, <code>group</code> and <code>other</code>. 
Under DFS you need what DFS calls a <code>user_obj</code>, <code>group_obj</code>
and an <code>other_obj</code>, and in some cases <code>mask_obj</code>. In cfengine
syntax these are called <code>user:*:</code>, <code>other:*:</code> and
<code>mask:*:</code>, as described below.  If you are appending to an existing
entry, you do not have to re-specify these unless you want to change
them.

<p>Cfengine can overwrite (replace) or append to one or more ACL
entries.

<dl>

<br><dt><code>overwrite</code>
<dd><code>method:overwrite</code> is the default. This sets the ACL according to
the specified entries which follow.  The existing ACL will be
overwritten completely.

<br><dt><code>append</code>
<dd><code>method:append</code> adds or modifies one or more specified ACL entries. 
If an entry already exists for the specified type and user/group, the
specified permission bits will be added to the old permissions. If there
is no ACL entry for the given type and user/group, a new entry will be
appended.

</dl>

<p>If the new ACL exactly matches the existing ACL, the ACL is not
replaced.

<p>The individual bits in an ACE may be either added subtracted or
set equal to a specified mask. The <code>+</code> symbol means add,
the <code>-</code> symbol subtract and <code>=</code> means set equal to. 
Here are some examples:
<pre>
  <var>acltype</var>:<var>id/*</var>:<var>mask</var>

  user:mark:+rx,-w
  user:ds:=r
  user:jacobs:noaccess
  user:forgiven:default

  user:*:rw
  group:*:r
  other:*:r

</pre>

<p>The keyword <code>noaccess</code> means set all access bits to zero for that
user, i.e. remove all permissions. The keyword <code>default</code> means
remove the named user from the access crontrol list altogether, so that
the default permissions apply. A star/asterisk in the centre field
indicates that the user or group ID is implicitly specified as of the
owner of the file, or that no ID is applicable at all (as is the case for `other').

<p><hr>
Node:<a name="Solaris%20ACLs">Solaris ACLs</a>,
Next:<a rel=next href="#DFS%20ACLs">DFS ACLs</a>,
Previous:<a rel=previous href="#ACEs">ACEs</a>,
Up:<a rel=up href="#acl">acl</a>
<br>

<h3>Solaris ACLs</h3>

<p>Under Solaris, the ACL type can be one of the following:

<pre>        user
        group
        mask
        other
        default_user
        default_group
        default_mask
        default_other
</pre>

<p>A user or group can be specified to the user, group, default_user and
default_group types. 
Solaris ACL permissions are the normal UNIX permissions bits <code>rwx</code>,
where:

<pre>    <var>
        <b>r</b> - Grants read privileges.
        <b>w</b> - Grants write privileges.
        <b>x</b> - Grants execute privileges.</var>
</pre>

<p><hr>
Node:<a name="DFS%20ACLs">DFS ACLs</a>,
Next:<a rel=next href="#NT%20ACLs">NT ACLs</a>,
Previous:<a rel=previous href="#Solaris%20ACLs">Solaris ACLs</a>,
Up:<a rel=up href="#acl">acl</a>
<br>

<h3>DFS ACLs</h3>

<p>In DCE, the ACL type can be one of the following:

<pre>        other
        mask
        any
        unauthenticated
        user
        group
        foreign_other
        foreign_user
        foreign_group
</pre>

<p>The <code>user</code>, <code>group</code>, <code>foreign_user</code> and <code>foreign_group</code>
 types require that you specify a user or group. The DCE documentation
refers to types <code>user_obj</code>, <code>group_obj</code> and so on. In the
cfengine implementation, the ugly <code>_obj</code> suffix has been dropped to
make these more in keeping with the POSIX names. <code>user_obj::</code>, is
equivalent to <code>user:*:</code> is cfengine. The star/asterisk implies that
the ACL applies to the owner of the file object.

<p>DFS permissions are comprised of the bits
<code>crwxid</code>, where:
<pre>        <b>c</b> - Grants control privileges, to modify an acl.
        <b>r</b> - Grants read  privileges.
        <b>w</b> - Grants write privileges.
        <b>x</b> - Grants execute privileges.
        <b>i</b> - Grants insert privileges.
        <b>d</b> - Grants delete privileges.
</pre>

<p>See the DCE/DFS documentation for more information about this.

<p>It is not possible to set ACLs in foreign cells currently using
cfengine, but you can still have all of your ACL definitions in the same
file. You must however arrange for the file to be executed on the server
for the cell concerned.  Note also that you must perform a DCE login
(normally as user <code>cell_admin</code>) in order to set ACLs on files
which are not owned by the owner of the cfengine-process.  This is
because you must have a valid security ticket.

<p><hr>
Node:<a name="NT%20ACLs">NT ACLs</a>,
Next:<a rel=next href="#ACL%20Example">ACL Example</a>,
Previous:<a rel=previous href="#DFS%20ACLs">DFS ACLs</a>,
Up:<a rel=up href="#acl">acl</a>
<br>

<h3>NT ACLs</h3>

<p>NT ACEs are written as follows:
<pre>       acl_type:user/group:permissions:accesstype
</pre>

<p>The actual change consists of the extra field containing the access
type. A star/asterisk in the field for <var>user/group</var> would
normally imply that the ACL applies to the owner of the file
object. However this functionality is as of today not yet implemented.

<p>In NT, the ACL type can be one of the following:
<pre>           user
           group
</pre>
Both types require that you specify the name of a user or a group.

<p>NT permissions are comprised of the bits <code>rwxdpo</code>, where:
<pre>    r - Read privileges
    w - Write privileges
    x - Execute privileges
    d - Delete privileges
    p - Privileges to change the permissions on the file
    o - Privileges to take ownership of the file
</pre>
In addition to any combination of these bits, the word <code>noaccess</code>
or <code>default</code> can be used as explained in the previous section. NT
comes with some standard, predefined permissions. The standards are only
a predefined combination of the different bits specified above and are
provided with cfengine as well. You can use the standards by setting the
permission to <code>read</code>, <code>change</code> or <code>all</code>. The bit
implementation of each standard is as on NT:
<pre>           read   - rx
           change - rwxd
           all    - rwxdpo
</pre>
where the bits follow the earlier definition. The keywords mentioned
above can only be used alone, and not in combination with <code>+</code>,
<code>-</code>, <code>=</code> and/or other permission bits.

<p>NT defines several different access types, of which only two are used in
connection with the ACL type that is implemented in cfengine for NT. The
access type can be one of the following:
<pre>           allowed
           denied
</pre>
Intuitively, <code>allowed</code> access grants the specified permissions to
the user, whilst <code>denied</code> denies the user the specified
permissions. If no access type is specified, the default is
<code>allowed</code>. This enables cfengine's behaviour as on UNIX systems
without any changes to the configuration file. If the permissions
<code>noaccess</code> or <code>default</code> is used, the access type will be
irrelevant.

<h2>ACL Example</h2>

<p>Here is an example of a configuration file for an NT ACL:

<pre>control:
        actionsequence = ( files )
        domain = ( iu.hioslo.no )

files:
        $(HOME)/tt    acl=acl_alias1    action=fixall

acl:
        { acl_alias1

        method:overwrite
        fstype:nt

        user:gustafb:rwx:allowed
        user:mark:all:allowed
        user:toreo:read:allowed
        user:torej:default:allowed
        user:ds2:+rwx:allowed

        group:dummy:all:denied
        group:iu:read:allowed
        group:root:all:allowed
        group:guest:dpo:denied
        }
</pre>

<p><hr>
Node:<a name="ACL%20Example">ACL Example</a>,
Previous:<a rel=previous href="#NT%20ACLs">NT ACLs</a>,
Up:<a rel=up href="#acl">acl</a>
<br>

<h3>ACL Example</h3>

<p>Here is an example of a configuration file for one Solaris ACL and one DCE/DFS ACL:

<pre>control:
        actionsequence = ( files )
        domain = ( iu.hioslo.no )

files:
        $(HOME)/tt    acl=acl_alias1    action=fixall
        /:/bigfile    acl=acl_alias2    action=fixall

acl:
        { acl_alias1

        method:overwrite
        fstype:posix

        user:*:rwx
        user:mark:=rwx
        user:sowille:=rx
        user:toreo:=rx
        user:torej:default
        user:ds2:+rwx
        group:*:rx
        group:iu:r
        group:root:x
        mask:*:rx
        other:*:rx

        default_user:*:=rw
        default_user:mark:+rwx
        default_user:ds:=rwx
        default_group::=r
        default_group:iu:+r
        default_mask::w
        default_other::rwx
        }

        { acl_alias2

        method:overwrite
        fstype:dfs

        user:*:rwxcid
        group:*:rxd
        other:*:wxir
        mask:*:rxw
        user:/.../iu.hioslo.no/cell_admin:rc
        group:/.../iu.hioslo.no/acct-admin:rwxcid
        user:/.../iu.hioslo.no/root:rx
        }
</pre>

<p><hr>
Node:<a name="binservers">binservers</a>,
Next:<a rel=next href="#broadcast">broadcast</a>,
Previous:<a rel=previous href="#acl">acl</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>binservers</h2>

<p>The <code>binservers</code> declaration need only be used if you are using
cfengine's model for mounting NFS filesystems.  This declaration informs
hosts of which other hosts on the network possess filesystems containing
software (binary files) which client hosts should mount.  This includes
resources like programs in <code>/usr/local</code> and so on.  A host may have
several binary servers, since there may be several machines to which
disks are physically attached.  In most cases, on a well organized
network, there will be only one <em>architecture server</em> per UNIX
platform type, for instance a SunOS server, an ULTRIX server and so on.

<p>Binary servers are defined as follows:

<pre>
binservers:

   physics.sun4::   sunserver sunserver2
   physics.linux::  linuxserver

</pre>

<p>The meaning of this declaration is the following.  All hosts of type
<code>sun4</code> which are members of the group <code>physics</code> should mount
any binaries declared in the <code>mountables</code> resource list which
belong to hosts <code>sunserver</code> or <code>sunserver2</code>.  Similarly all
<code>linux</code> machines should mount binary filesystems in the mountables
list from <code>linuxserver</code>.

<p>Cfengine knows the difference between binaries and home directories in
the <code>mountables</code> list, because home directories match the pattern
given by <code>homepattern</code>.  See <a href="#homepattern">homepattern</a>.  See <a href="#homeservers">homeservers</a>.

<p>Note that every host is a binary server for itself, so that the first
binary server (and that with highest priority) is always the current
host.  This ensures that local filesystems are always used in preference
to NFS mounted filesystems.  This is only relevant in connection with
the variable <code>$(binserver)</code>.

<p><hr>
Node:<a name="broadcast">broadcast</a>,
Next:<a rel=next href="#control">control</a>,
Previous:<a rel=previous href="#binservers">binservers</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>broadcast</h2>

<p>This information is used to configure the network interface for each host.

<p>Every local area network has a convention for determining which internet
address is used for broadcast requests.  Normally this is an address of
the form <code>aaa.bbb.ccc.255</code> or <code>aaa.bbb.ccc.0</code>.  The difference
between these two forms is whether all of the bits in the last number
are ones or zeroes respectively.  You must find out which convention is
used at your establishment and tell cfengine using a declaration of the
form:

<pre>broadcast:

  any::

     ones     # or zeros, or zeroes

</pre>

<p>In most cases you can use the generic class <code>any</code>, since all of the
hosts on the same subnet have to use the same convention.  If your
configuration file encompasses several different subnets with different
conventions then you will need to use a more specific.

<p>Cfengine computes the actual value of the broadcast address using the
value specified above and the netmask See <a href="#netmask">netmask</a>.

<p><hr>
Node:<a name="control">control</a>,
Next:<a rel=next href="#classes">classes</a>,
Previous:<a rel=previous href="#broadcast">broadcast</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>control</h2>

<p>The fundamental piece of any cfengine script or configuration file is
the control section.  If you omit this part of a cfengine script, it
will not do anything! The control section is used to define certain
variables, set default values and define the order in which the various
actions you have defined will be carried out.  Because cfengine is a
declarative or descriptive language, the order in which actions appear
in the file does not necessarily reflect the order in which they are
executed. The syntax of declarations here is:

<pre>  control:

     <var>classes</var>::

        <var>variable</var> = ( <var>list or value</var> )

</pre>

<p>The control section is a sequence of declarations which looks something
like the following example:

<pre>
control:

  site     = ( univ )
  domain   = ( univ.edu )
  sysadm   = ( admin@computing.univ.edu )
  netmask  = ( 255.255.252.0 )
  timezone = ( EDT )
  nfstype  = ( nfs )

  sensiblesize  = ( 1000 )
  sensiblecount = ( 2 )
  editfilesize  = ( 4000 )

  actionsequence =
     (
     links.some
     mountall
     links.others
     files
     )

  myvariable = ( something )
  mymacro    = ( somethingelse )

</pre>

<p>Parentheses are required when making a declaring information in cfengine.

<p>The meaning of each of these lines is described below.

<ul>
<li><a href="#access">access</a>: 
<li><a href="#actionsequence">actionsequence</a>: 
<li><a href="#addclasses">addclasses</a>: 
<li><a href="#addinstallable">addinstallable</a>: 
<li><a href="#BinaryPaddingChar">BinaryPaddingChar</a>: 
<li><a href="#copylinks">copylinks</a>: 
<li><a href="#defaultcopytype">defaultcopytype</a>: 
<li><a href="#deletenonusermail">deletenonusermail</a>: 
<li><a href="#deletenonownermail">deletenonownermail</a>: 
<li><a href="#domain">domain</a>: 
<li><a href="#dryrun">dryrun</a>: 
<li><a href="#editfilesize">editfilesize</a>: 
<li><a href="#excludecopy">excludecopy</a>: 
<li><a href="#excludelinks">excludelinks</a>: 
<li><a href="#ExpireAfter">ExpireAfter</a>: 
<li><a href="#homepattern">homepattern</a>: 
<li><a href="#IfElapsed">IfElapsed</a>: 
<li><a href="#Inform">Inform</a>: 
<li><a href="#interfacename">interfacename</a>: 
<li><a href="#fileextension">fileextension</a>: 
<li><a href="#LockDirectory">LockDirectory</a>: 
<li><a href="#LogDirectory">LogDirectory</a>: 
<li><a href="#linkcopies">linkcopies</a>: 
<li><a href="#moduledirectory">moduledirectory</a>: 
<li><a href="#mountpattern">mountpattern</a>: 
<li><a href="#netmask">netmask</a>: 
<li><a href="#nonalphanumfiles">nonalphanumfiles</a>: 
<li><a href="#nfstype">nfstype</a>: 
<li><a href="#repchar">repchar</a>: 
<li><a href="#repository">repository</a>: 
<li><a href="#secureinput">secureinput</a>: 
<li><a href="#sensiblecount">sensiblecount</a>: 
<li><a href="#sensiblesize">sensiblesize</a>: 
<li><a href="#showactions">showactions</a>: 
<li><a href="#site">site</a>: 
<li><a href="#SplayTime">SplayTime</a>: 
<li><a href="#split">split</a>: 
<li><a href="#suspiciousnames">suspiciousnames</a>: 
<li><a href="#sysadm">sysadm</a>: 
<li><a href="#Syslog">Syslog</a>: 
<li><a href="#timezone">timezone</a>: 
<li><a href="#TimeOut">TimeOut</a>: 
<li><a href="#Verbose">Verbose</a>: 
<li><a href="#Warnings">Warnings</a>: 
<li><a href="#warnnonusermail">warnnonusermail</a>: 
<li><a href="#warnnonownermail">warnnonownermail</a>: 
</ul>

<p><hr>
Node:<a name="access">access</a>,
Next:<a rel=next href="#actionsequence">actionsequence</a>,
Previous:<a rel=previous href="#control">control</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>access</h3>

<p>The <code>access</code> list is a list of users who are to be allowed to
execute a cfengine program.  If the list does not exist then all users
are allowed to run a program.

<pre>   access = ( <var>user1</var> <var>user2</var> ...  )
</pre>

<p>The list may consist of either numerical user identifiers or valid
usernames from the password database.  For example:

<pre>   access = ( mark aurora 22 456 )
</pre>

<p>would restrict a script to users mark, aurora and user id
22 and 456.

<p><hr>
Node:<a name="actionsequence">actionsequence</a>,
Next:<a rel=next href="#addclasses">addclasses</a>,
Previous:<a rel=previous href="#access">access</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>actionsequence</h3>

<p>The action sequence determines the order in which collective actions are
carried out.  Here is an example containing the full list of
possibilities:

<pre>   actionsequence =
      (
      mountall               # mount filesystems in fstab
      mountinfo              # scan mounted filesystems
      checktimezone          # check timezone
      netconfig              # check net interface config
      resolve                # check resolver setup
      unmount                # unmount any filesystems
      shellcommands          # execute shell commands
      editfiles              # edit files
      addmounts              # add new filesystems to system
      directories            # make any directories
      links                  # check and maintain links (single and child)
      simplelinks            # check only single links (separate from childlinks)
      childlinks             # check only childlinks (separate from singlelinks)
      mailcheck              # check mailserver
      mountall               # (again)
      required               # check required filesystems
      tidy                   # tidy files
      disable                # disable files
      files                  # check file permissions
      copy                   # make a copy/image of a master file
      processes              # signal / check processes
      module:name            # execute a user-defined module
      )

</pre>

<p>Here is a more complete description of the meaning of these
keywords.

<dl>

<br><dt><code>addmounts</code>
<dd>causes cfengine to compute which NFS filesystems are missing from the
current host and add them. This includes editing the filesystem table,
creating the mount-directory, if required.  This command relies on
information provided by <code>mountinfo</code>, so it should normally only be
called after <code>mountinfo</code>. If the filesystem already appears
to be in the filesystem table, a warning is issued.

<br><dt><code>checktimezone</code>
<dd>runs a check on the timezone defined for the shell running
cfengine.

<br><dt><code>directories</code>
<dd>executes all the commands defined under the <code>directories</code>
section of the program. It builds new directories.

<br><dt><code>disable</code>
<dd>executes all the commands defined under the <code>disable</code>
section of the program.

<br><dt><code>editfiles</code>
<dd>executes all the commands defined under the <code>editfiles</code>
section of the program.

<br><dt><code>files</code>
<dd>executes all the commands defined under the <code>files</code>
section of the program.

<br><dt><code>links</code>
<dd>executes all the commands defined under the <code>links</code>
section of the program. Here one can also write <code>singlelinks</code>
which checks only single (not multiply linked) objects, or
<code>childlinks</code> which checks the remainder (multiply linked)
objects. In this way one can separate these two actions if
required, though normally this is not necessary.

<br><dt><code>mailcheck</code>
<dd>tests for the presence of the NFS-mounted mail spooling directory on the
current host. The name of the mail spool directory is defined in the
<code>mailserver</code> section of the cfengine program. If the current host
is the same as the mailserver (the host which has the physical spool
directory disk) nothing is done. Otherwise the filesystem table is
edited so as to include the mail directory.

<br><dt><code>module</code>
<dd>Normally cfengine's ability to detect the systems condition is limited
to what it is able to determine while excuting predefined
actions. Classes may be switched on as a result of actions cfengine
takes to correct a problem. To increase the flexibility of cfengine, a
mechanism has been introduced in version 1.5 which allows you to include
a module of your own making in order to define or undefine a number of classes. 
The syntax
<pre>  module:mytests.<var>class1</var>.<var>class2</var>.<var>class3</var>

  "module:mytests.<var>class1</var>.<var>class2</var>.<var>class3</var> arg1 arg2 .."
</pre>
declares a user defined module which can potentially set the classes
<var>class1</var> etc. Classes returned by the module must be declared so
that cfengine knows to pay attention to rules which use these classes
when parsing. Note might actually be preferable to define classes
returned by modules under <code>AddInstallables</code> which is equivalent. If
arguments are passed to the module, the whole string must be quoted like
a shellcommand.  See <a href="cfengine-Tutorial.html#Writing%20plugin%20modules">Writing plugin modules</a>.  Whether or not these
classes become set or not depends on the behaviour of your module. The
classes continue to apply for all actions which occur after the module's
execution. The module must be owned by the user executing cfengine or
root (for security reasons), it must be named
<code>module:<var>module-name</var></code> and must lie in a special directory,
See <a href="#moduledirectory">moduledirectory</a>.

<br><dt><code>mountall</code>
<dd>mounts all filesystems defined in the hosts filesystem table.  This
causes new NFS filesystems added by <code>addmounts</code> and
<code>mailcheck</code> to be actually mounted. This should probably be called
both before <code>mountinfo</code> and after <code>addmounts</code> etc.  A short
timeout is placed on this operation to avoid hanging RPC connections
when parsing NFS mounted file systems.

<br><dt><code>mountinfo</code>
<dd>builds internal information about which filesystems are presently
mounted on the current host.  Cfengine assumes that required-filesystems
which are not found need to be mounted. A short timeout is
placed on this operation to avoid hanging RPC connections
when parsing NFS mounted file systems. If this times out,
no further mount operations are considered reliable and are
summarily cancelled.

<br><dt><code>netconfig</code>
<dd>checks the netmask, hostname, IP address and broadcast
address for the current host. The correct values for
the netmask and broadcast address are set if there is
an error. The defaultroute is also added to the static
routing table. This does not apply to DHCP clients.

<br><dt><code>required</code>
<dd>executes all the commands defined under the <code>required</code>
section of the program. It checks for the absence of
important NFS resources.

<br><dt><code>resolve</code>
<dd>checks and corrects the DNS domain name and the order
of nameservers in the file <code>/etc/resolv.conf</code>.

<br><dt><code>shellcommands</code>
<dd>executes all the commands defined under the <code>shellcommands</code>
section of the program.

<br><dt><code>tidy</code>
<dd>executes all the commands defined under the <code>tidy</code>
section of the program.

<br><dt><code>unmount</code>
<dd>executes all the commands defined under the <code>unmount</code>
section of the program. The filesystem table is edited
so as to remove the unwanted filesystems and the unmount
operation is executed.

<br><dt><code>processes</code>
<dd>executes commands defined under the <code>processes</code> section
of the program.

</dl>

<p>Under normal circumstances this coarse ordering is enough to suit most
purposes.  In some cases you might want to, say, only perform half the
link operations before mounting filesystems and then, say, perform the
remainder.  You can do this (and similar things) by using the idea of
defining and undefining classes. See <a href="cfengine-Tutorial.html#Defining%20classes">Defining classes</a>.

<p>The syntax

<pre>
actionsequence =
   (
   links.firstpass.include
   ...
   links.secondpass
   )
</pre>

<p>means that cfengine first executes <code>links</code> with the classes
<code>firstpass</code> and <code>include</code> <em>defined</em>.  Later it executes
<code>links</code> with <code>secondpass</code> defined.  You can use this method of
adding classes to distinguish more finely the flow of control in
programs.

<p>A note about style: if you define and undefine lots of classes to do
what you want to do, you might stop and ask yourself if your
<code>groups</code> are defined as well as they should be.  See <a href="#groups">groups</a>. 
Programming in cfengine is about doing a lot for only a little
writing.  If you find yourself writing a lot, you are probably not going
about things in the right way.

<p><hr>
Node:<a name="addclasses">addclasses</a>,
Next:<a rel=next href="#addinstallable">addinstallable</a>,
Previous:<a rel=previous href="#actionsequence">actionsequence</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>AddClasses</h3>

<pre>   AddClasses  = ( <var>list of identifiers</var> )
</pre>

<p>The <code>AddClasses</code> directive is used to define a list of class
attributes for the current host.  Normally only the hard classes defined
by the system are `true' for a given host.  It is convenient though to
be able to define classes of your own to label certain actions, mainly
so that they can later be excluded so as to cut short or filter out
certain actions.  This can be done in two ways.  See <a href="#actionsequence">actionsequence</a>.

<p>To define a list of classes for the current session, you write:

<pre>AddClasses = ( exclude shortversion )
</pre>

<p>This is equivalent to (though more permanent than) defining
classes on the command line with the <code>-D</code> option. 
You can now use these to qualify actions.  For example

<pre>
  any.exclude::
      ...
</pre>

<p>Under normal circumstances <code>exclude</code> is always true -- because you
have defined it to be so, but you can <em>undefine</em> it in two ways so
as to prevent the action from being carried out.  One way is to undefine
a class on the command line when you invoke cfengine:

<pre>host#  cfengine -N exclude
</pre>

<p>or

<pre>host#  cfengine -N exclude.shortversion

host#  cfengine -N a.b.c.d
</pre>

<p>These commands run cfengine with the named classes <em>undefined</em>. 
That means that actions labelled with these classes are excluded during
that run.

<p>Another way to restrict classes is to add a list of classes to be
undefined in the actionsequence.  See next section.

<p><hr>
Node:<a name="addinstallable">addinstallable</a>,
Next:<a rel=next href="#BinaryPaddingChar">BinaryPaddingChar</a>,
Previous:<a rel=previous href="#addclasses">addclasses</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>AddInstallable</h3>

<pre>   AddInstallable  = ( <var>list of identifiers</var> )
</pre>

<p>Some actions in your cfengine program will be labelled by classes which
only become defined at run time using a <code>define=</code> option. Cfengine
is not always able to see these classes until it meets them and tries to
save space by only loading actions for classes which is believes will
become defined at some point in the program. This can lead to some
actions being missed if the action is parsed before the place where the
class gets switched on, since cfengine is a one-pass interpreter,.  To
help cfengine determine classes which <em>might become defined</em> during
a run, you can declare them in this list. It does no harm to declare
classes here anyway. 
Here is an example where you need to declare a class because of the ordering
of the actions.

<pre>
control:

    AddInstallable  = ( myclass )

files:

   myclass::

     /tmp/test mode=644 action=fixall

copy:

     /tmp/foo dest=/tmp/test define=myclass

</pre>

<p>If we remove the declaration, then when cfengine meets the files
command, it skips it because it knows nothing about the class
<code>myclass</code>--when the copy command follows, it is too late.  Remember
that imported files are always parsed after the main program so definitions
made in imported files always come later than things in the main program.

<p><hr>
Node:<a name="BinaryPaddingChar">BinaryPaddingChar</a>,
Next:<a rel=next href="#copylinks">copylinks</a>,
Previous:<a rel=previous href="#addinstallable">addinstallable</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>BinaryPaddingChar</h3>

<pre>BinaryPaddingChar = ( \0 )
</pre>
This specifies the type of character used to pad strings of unequal
length in <code>editfiles</code> during binary editing.  The default value is
the space character, since this is normally used to edit filenames
or text messages within program code.

<p><hr>
Node:<a name="copylinks">copylinks</a>,
Next:<a rel=next href="#defaultcopytype">defaultcopytype</a>,
Previous:<a rel=previous href="#BinaryPaddingChar">BinaryPaddingChar</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>CopyLinks</h3>

<p>This list is used to define a global list of names or patterns
which are to be copied rather than linked symbolically. For example

<pre>CopyLinks = ( *.config )
</pre>
The same facility can be specified for each individual
link operation using the <code>copy</code> option See <a href="#links">links</a>. 
Copying is performed using a file age comparison.

<p>Note that all entries defined under a specified class
are valid only as long as that class is defined. For instance
<pre>  <var>class</var>::

      CopyLinks = ( <var>pattern</var> )
</pre>

<p>would define a pattern which was only valid when
<var>class</var> is defined.

<p><hr>
Node:<a name="defaultcopytype">defaultcopytype</a>,
Next:<a rel=next href="#deletenonusermail">deletenonusermail</a>,
Previous:<a rel=previous href="#copylinks">copylinks</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>DefaultCopyType</h3>

<p>This parameter determines the default form of copying for all copy operations
parsed after this variable. The legal values are
<code>ctime</code> (intial default), <code>mtime</code>, <code>checksum</code> and <code>binary</code>. 
e.g.

<pre>
 DefaultCopyType = ( mtime )

</pre>

<p><hr>
Node:<a name="deletenonusermail">deletenonusermail</a>,
Next:<a rel=next href="#deletenonownermail">deletenonownermail</a>,
Previous:<a rel=previous href="#defaultcopytype">defaultcopytype</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>DeleteNonUserMail</h3>

<p>If this parameter is set to true, cfengine will delete mail files on mailservers
which do not have a name belonging to a known user id. This does not
include lock files.

<p><hr>
Node:<a name="deletenonownermail">deletenonownermail</a>,
Next:<a rel=next href="#domain">domain</a>,
Previous:<a rel=previous href="#deletenonusermail">deletenonusermail</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>DeleteNonOwnerMail</h3>

<p>If this parameter is set to true, cfengine will delete files on mailservers
whose names do not correspond to a known user name, but might be owned by a
known user.

<p><hr>
Node:<a name="domain">domain</a>,
Next:<a rel=next href="#dryrun">dryrun</a>,
Previous:<a rel=previous href="#deletenonownermail">deletenonownermail</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>domain</h3>

<pre>  domain = ( <var>domain name</var> )
</pre>

<p>This variable defines the domainname for your site.  You must define it
here, because your system might not know its domainname when you run
cfengine for the first time.  The domainname can be used as a cfengine
variable subsequently by referring to $(domain).  The domainname
variable is used by the action <code>resolve</code>. The domain is also used
implicitly by other matching routines. You should define the domain as
early as possible in your configuration file so as to avoid problems,
especially if you have the strange practice of naming hosts with their
fully qualified host names since groups which use fully qualified names
can fail to be defined if cfengine is not able to figure out the domain name.

<p><hr>
Node:<a name="dryrun">dryrun</a>,
Next:<a rel=next href="#editfilesize">editfilesize</a>,
Previous:<a rel=previous href="#domain">domain</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>DryRun</h3>

<pre>
  DryRun = ( <var>on/</var><b>off</b> )

</pre>

<p>This variable has the same effect as the command line options
<kbd>--dry-run</kbd> or <kbd>-n</kbd>. It tells cfengine to only report
what it should do without actually doing it.
<pre>
 <var>classes</var>::

   DryRun = ( on )

</pre>

<p><hr>
Node:<a name="editfilesize">editfilesize</a>,
Next:<a rel=next href="#excludecopy">excludecopy</a>,
Previous:<a rel=previous href="#dryrun">dryrun</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>editfilesize</h3>

<pre>   EditfileSize  = ( <var>size</var> )
</pre>

<p>This variable is used by cfengine every time it becomes necessary to
edit a file.  Since file editing applies only to text files, the files
are probably going to be relatively small in most cases.  Asking to edit
a very large (perhaps binary) file could therefore be the result of an
error.

<p>A check is therefore made as a security feature.  Cfengine will refuse
to edit a file which is larger than the value of <code>editfilesize</code> in
bytes.  This is to prevent possible accidents from occurring.  The
default value for this variable is 10000 bytes.  If you don't like this
feature, simply set the value to be a very large number or to zero. 
If the value is zero, cfengine will ignore it.

<p><hr>
Node:<a name="excludecopy">excludecopy</a>,
Next:<a rel=next href="#excludelinks">excludelinks</a>,
Previous:<a rel=previous href="#editfilesize">editfilesize</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>ExcludeCopy</h3>

<p>This list is used to define a global list of names or patterns
which are to be excluded from copy operations. For example

<pre> ExcludeCopy = ( *~ *% core )
</pre>
The same facility can be specified for each individual
link operation using the <code>exclude</code> option See <a href="#copy">copy</a>.

<p>Note that all entries defined under a specified class
are valid only as long as that class is defined. For instance
<pre>  <var>class</var>::

      ExcludeCopy = ( <var>pattern</var> )
</pre>

<p>would define a pattern which was only valid when
<var>class</var> is defined.

<p><hr>
Node:<a name="excludelinks">excludelinks</a>,
Next:<a rel=next href="#ExpireAfter">ExpireAfter</a>,
Previous:<a rel=previous href="#excludecopy">excludecopy</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>ExcludeLinks</h3>

<p>This list is used to define a global list of names or patterns
which are to be excluded from linking operations. For example

<pre> ExcludeLinks = ( *~ *% core )
</pre>
The same facility can be specified for each individual
link operation using the <code>exclude</code> option See <a href="#links">links</a>.

<p>Note that all entries defined under a specified class
are valid only as long as that class is defined. For instance
<pre>  <var>class</var>::

      ExcludeLinks = ( <var>pattern</var> )
</pre>

<p>would define a pattern which was only valid when
<var>class</var> is defined.

<p><hr>
Node:<a name="ExpireAfter">ExpireAfter</a>,
Next:<a rel=next href="#homepattern">homepattern</a>,
Previous:<a rel=previous href="#excludelinks">excludelinks</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>ExpireAfter</h3>

<p>This parameter controls the global value of the ExpireAfter parameter. 
See <a href="cfengine-Tutorial.html#Spamming%20and%20security">Spamming and security</a>. This parameter controls the maximum time in
minutes which a cfengine action is allowed to live. After this time
cfengine will try to kill the cfengine which seems to have hung and
attempt to restart the action.

<pre>
 ExpireAfter = ( <var>time-in-minutes</var> )

</pre>

<p>This parameter may also be set per action in the action
sequence by appending a pseudo-class called <code>ExpireAfter<var>time</var></code>. 
For instance,

<pre>
 actionsequence = ( copy.ExpireAfter15 )

</pre>

<p>sets the expiry time parameter to 15 minutes for this copy command.

<p><hr>
Node:<a name="homepattern">homepattern</a>,
Next:<a rel=next href="#IfElapsed">IfElapsed</a>,
Previous:<a rel=previous href="#ExpireAfter">ExpireAfter</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>HomePattern</h3>

<pre>   HomePattern  = ( <var>list of wildcards</var> )
</pre>

<p>The <code>homepattern</code> variable is used by the cfengine model for
mounting nfs filesystems.  See <a href="cfengine-Tutorial.html#NFS%20resources">NFS resources</a>.  It is also used in the evaluation of the
pseudo variable <code>home</code>, See <a href="#files">files</a>, <a href="#tidy">tidy</a>.

<p><code>homepattern</code> is in fact a list and is used like a wildcard or
<em>pattern</em> to determine which filesystems in the list of mountables
are home directories.  See <a href="#mountables">mountables</a>.  This relies on your sticking
to a rigid naming convention as described in the first reference above.

<p>For example, you might wish to mount (or locate directly if you are not
using a separate partition for home directories) your home directories
under <code>mountpattern</code> in directories <code>u1</code>, <code>u2</code> and so on. 
In this case you would define <code>homepattern</code> to match these numbers:

<pre>homepattern = ( u? )
</pre>

<p>Cfengine now regards any directory matching
<code>$(mountpattern)/u?</code> as being a user login directory.

<p>Suppose you want to create mount home directories under
<code>$(mountpattern)/home</code> and make subdirectories for staff and
students.  Then you would be tempted to write:

<pre> HomePattern = ( home/staff home/students )
</pre>

<p>Unfortunately this is not presently possible. (This is, in principle,
a bug which should be fixed in the future.) What you can do instead is
to achieve the same this as follows:

<pre> MountPattern = ( /$(site)/$(host) /$(site)/$(host)/home )
 HomePattern = ( staff students )
</pre>

<p><hr>
Node:<a name="IfElapsed">IfElapsed</a>,
Next:<a rel=next href="#Inform">Inform</a>,
Previous:<a rel=previous href="#homepattern">homepattern</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>IfElapsed</h3>

<p>This parameter controls the global value of the IfElapsed
parameter, See <a href="cfengine-Tutorial.html#Spamming%20and%20security">Spamming and security</a>. This parameter
controls the minimum time which must have elapsed for
an action in the action sequence before which it will be
executed again.

<pre>
 IfElapsed = ( <var>time-in-minutes</var> )

</pre>

<p>This parameter may also be set per action in the action
sequence by appending a pseudo-class called <code>IfElapsed<var>time</var></code>. 
For instance,

<pre>
 ActionSequence = ( copy.IfElapsed15 )

</pre>

<p>sets the elapsed time parameter to 15 minutes for this copy command.

<p><hr>
Node:<a name="Inform">Inform</a>,
Next:<a rel=next href="#interfacename">interfacename</a>,
Previous:<a rel=previous href="#IfElapsed">IfElapsed</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>Inform</h3>

<pre>
  Inform = ( <var>on/</var><b>off</b> )

</pre>

<p>This variable switches on the output level whereby cfengine
reports changes it makes during a run. Normally only
urgent messages or clear errors are printed. Setting
<code>Inform</code> to <code>on</code> makes cfengine report on
all actions not explicitly cancelled with a `silent' option. 
To set this output level one writes:

<pre>
 <var>classes</var>::

   Inform = ( on )

</pre>

<p><hr>
Node:<a name="interfacename">interfacename</a>,
Next:<a rel=next href="#fileextension">fileextension</a>,
Previous:<a rel=previous href="#Inform">Inform</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>InterfaceName</h3>

<p>If you have an operating system which is installed on some
non-standard hardware, you might have to specifically set the
name of the network interface. For example:

<pre>
  control:

    nextstep.some::

       InterfaceName = ( en0 )

    nextstep.others::

       InterfaceName = ( ec0 )

</pre>

<p>It is only necessary to set the interface name in this fashion
if you have an operating system which is running on special
hardware. Most users will not need this. 
The choice set here overrides the system defaults and the
choices made in the <code>cfrc</code> file, See <a href="#cfrc%20resource%20file">cfrc resource file</a>.

<p><hr>
Node:<a name="fileextension">fileextension</a>,
Next:<a rel=next href="#LockDirectory">LockDirectory</a>,
Previous:<a rel=previous href="#interfacename">interfacename</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>FileExtensions</h3>

<p>This list may be used to define a number of extensions
which are regarded as being plain files by the system. 
As part of the general security checking cfengine will
warn about any directories which have names using
these extensions. They may be used to conceal directories.

<pre>
  FileExtensions = ( c o gif jpg html )

</pre>

<p><hr>
Node:<a name="LockDirectory">LockDirectory</a>,
Next:<a rel=next href="#LogDirectory">LogDirectory</a>,
Previous:<a rel=previous href="#fileextension">fileextension</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>LockDirectory</h3>

<p>Specify an alternative directory for keeping cfengine's
lock data. This defaults to <code>/var/run/cfengine</code> or
<code>/etc/cfengine</code>.

<pre>
  LockDirectory = ( /etc/cfengine )

</pre>

<p><hr>
Node:<a name="LogDirectory">LogDirectory</a>,
Next:<a rel=next href="#linkcopies">linkcopies</a>,
Previous:<a rel=previous href="#LockDirectory">LockDirectory</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>LogDirectory</h3>

<p>Specify an alternative directory for keeping cfengine's
log data. This defaults to <code>/var/run/cfengine</code> or
<code>/etc/cfengine</code>.

<pre>
  LogDirectory = ( /etc/cfengine )

</pre>

<p><hr>
Node:<a name="linkcopies">linkcopies</a>,
Next:<a rel=next href="#moduledirectory">moduledirectory</a>,
Previous:<a rel=previous href="#LogDirectory">LogDirectory</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>LinkCopies</h3>

<p>This list is used to define a global list of names or patterns
which are to be linked symbolically rather than copied. For example

<pre>excludelinks = ( *.gif *.jpg )
</pre>
The same facility can be specified for each individual
link operation using the <code>symlink</code> option See <a href="#copy">copy</a>.

<p>Note that all entries defined under a specified class
are valid only as long as that class is defined. For instance
<pre>  <var>class</var>::

      LinkCopies = ( <var>pattern</var> )
</pre>

<p>would define a pattern which was only valid when
<var>class</var> is defined.

<p><hr>
Node:<a name="moduledirectory">moduledirectory</a>,
Next:<a rel=next href="#mountpattern">mountpattern</a>,
Previous:<a rel=previous href="#linkcopies">linkcopies</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>moduledirectory</h3>

<pre>   moduledirectory  = ( <var>directory for plugin modules</var> )
</pre>

<p>This is the directory where cfengine will look for plug-in modules
for the actionsequence, See <a href="#actionsequence">actionsequence</a>. Plugin modules
may be used to activate classes using special algorithms. 
See <a href="cfengine-Tutorial.html#Writing%20plugin%20modules">Writing plugin modules</a>.

<p><hr>
Node:<a name="mountpattern">mountpattern</a>,
Next:<a rel=next href="#netmask">netmask</a>,
Previous:<a rel=previous href="#moduledirectory">moduledirectory</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>mountpattern</h3>

<pre>   mountpattern  = ( <var>mount-point</var> )
</pre>

<p>The <code>mountpattern</code> list is used by the cfengine model for mounting
nfs filesystems.  See <a href="cfengine-Tutorial.html#NFS%20resources">NFS resources</a>.  It is also used in the evaluation of the
pseudo variable <code>home</code>, See <a href="#files">files</a>, <a href="#tidy">tidy</a>.

<p>It is used together with the value of <code>homepattern</code> to locate and
identify what filesystems are local to a given host and which are
mounted over the network.  For this list to make sense you need to
stick to a rigid convention for mounting your filesystems under a single
naming scheme as described in the section mentioned above.  If you
follow the recommended naming scheme then you will want to set the value
of mountpattern to

<pre>mountpattern = ( /$(site)/$(host) )
</pre>

<p>which implies that cfengine will look for local disk partitions under a
unique directory given by the name of the host and site.  Any
filesystems which are physically located on the current host lie in this
directory.  All mounted filesystems should lie elsewhere. If you
insist on keeping mounted file systems in more than one location, you
can make a list like this:

<pre>mountpattern = ( /$(site)/users /$(site)/projects )
</pre>

<p><hr>
Node:<a name="netmask">netmask</a>,
Next:<a rel=next href="#nonalphanumfiles">nonalphanumfiles</a>,
Previous:<a rel=previous href="#mountpattern">mountpattern</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>netmask</h3>

<pre>   netmask = ( <var>aaa.bbb.ccc.ddd</var> )
</pre>

<p>The netmask variable defines the partitioning of the subnet addresses on
your network.  Its value is defined by your network administrator.  On
most systems it is likely to be <code>255.255.255.0</code>.  This is used to
configure the network interface in <code>netconfig</code>. 
See <a href="#actionsequence">actionsequence</a>.

<p>Every host on the internet has its own unique address.  The addresses
are assigned hierarchically.  Each network gets a <em>domain name</em> and
can attach something like 65,000 hosts to that network.  Since this is
usually too many to handle in one go, every such network may be divided
up into subnets.  The administrator of the network can decide how the
division into subnets is made.  The decision is a trade-off between
having many subnets with few hosts, or many hosts on few subnets.  This
choice is made by setting the value of a variable called <code>netmask</code>. 
The netmask looks like an internet address.  It takes the form:

<pre>
   aaa.bbb.ccc.mmm

</pre>

<p>The first two numbers <code>aaa.bbb</code> are the address of the domain.  The
remainder <code>ccc.mmm</code> specifies both the subnet and the hostname. 
The value of <code>netmask</code> tells all hosts on the network: how many of
the bits in the second half label different subnets and how many label
different hosts on each of the subnets?

<p>The most common value for the netmask is <code>255.255.255.0</code>.  It is
most helpful to think of the netmask in terms of bits.  Each base-10
number between 0-255 represents 8 bits which are either set or not set. 
Every bit which is set is a network address and every bit which is zero
is part of a host address.  The first two parts of the address
<code>255.255</code> always takes these values.  If the third number is
<code>255</code>, it means that the domain is divided up into 256 sub networks
and then the remaining bits which are zero can be used to give 255
different host addresses on each of the subnets.

<p>If the value had been <code>255.255.255.254</code>, the network would be
divided up into 2^15 subnets, since fifteen of the sixteen bits
are one.  The remaining bit leaves enough room for two addresses 0 and
1.  One of those is reserved for <em>broadcasts</em> to all hosts, the
other can be an actual host -- there would only be room for one host
per subnet.  This is a stupid example of course, the main point with the
subnet mask is that it can be used to trade subnets for hosts per
subnet.  A value of <code>255.255.254.0</code> would allow 128 different
subnets with 2*256-1 = 511 hosts on each.

<p>We needn't be concerned with the details of the netmask here.  Suffice
it to say that its value is determined for your entire domain by the
network administrator and each host has to be told what the value is.

<p>Each host must also know what convention is used for the <em>broadcast
address</em>.  This is an address which hosts can send to if they wish to
send a message to every other host on their subnet simultaneously.  It is
used a lot by services like NIS to ask if any hosts are willing to
perform a particular service.  There are two main conventions for the
broadcast address: address zero (all host bits are zero) and the highest
address on the subnet (all host bits are ones).  The convention can be
different on every subnet and it is decided by the network
administrator.  When you write a cfengine program you just specify the
convention used on your subnet and cfengine works out the value of the
broadcast address from the netmask and the host address
See <a href="#broadcast">broadcast</a>.  Cfengine works out the value of the broadcast address
using the value of the netmask.

<p><hr>
Node:<a name="nonalphanumfiles">nonalphanumfiles</a>,
Next:<a rel=next href="#nfstype">nfstype</a>,
Previous:<a rel=previous href="#netmask">netmask</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>NonAlphaNumFiles</h3>

<p>If enabled, this option causes cfengine to detect and
disable files which have purely non-alphanumeric
filenames, i.e. files which might be accidental or
deliberately concealed. The files are then marked
with a suffix <code>.cf-nonalpha</code> and are rendered
visible.

<pre>
  NonAlphaNumFiles = ( on )

</pre>

<p>These files can then be tidied by searching for
the suffix. Note that alphanumeric means
ascii codes less than 32 and greater than 126.

<p><hr>
Node:<a name="nfstype">nfstype</a>,
Next:<a rel=next href="#repchar">repchar</a>,
Previous:<a rel=previous href="#nonalphanumfiles">nonalphanumfiles</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>nfstype</h3>

<pre>   nfstype = ( <var>nfs-type</var> )
</pre>

<p>This variable is included only for future expansion.  If you do not
define this variable, its value defaults to "nfs".

<p>At present cfengine operates only with NFS (the network file system). 
When cfengine looks for network file systems to mount, it adds lines in
the filesystem table (<code>/etc/fstab</code>,<code>/etc/checklist</code> etc.)  to
try to mount filesystems of type "nfs".  In principle you might want
to use a completely different system for mounting filesystems over the
network, in which case the `mount type' would not be "nfs" but
something else.

<p>At the time of writing certain institutions are replacing NFS with AFS
(the Andrew filesystem) and DFS (from the distributed computing
environment).  The use of these filesystems really excludes the need to
use the mount protocol at all.  In other words if you are using AFS or
DFS, you don't need to use cfengine's mounting commands at all.

<p><hr>
Node:<a name="repchar">repchar</a>,
Next:<a rel=next href="#repository">repository</a>,
Previous:<a rel=previous href="#nfstype">nfstype</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>RepChar</h3>

<pre>   RepChar  = ( <var>character</var> )
</pre>

<p>The value of this variable determines the characters which is used by
cfengine in creating the unique filenames in the file
repository. Normally, its value is set to <code>_</code> and each <code>/</code> in
the path name of the file is changed to <code>_</code> and stored in the
repository. If you prefer a different character, define it here. Note
that the character can be quoted with either single or double quotes in
order to encompass spaces etc.

<p><hr>
Node:<a name="repository">repository</a>,
Next:<a rel=next href="#secureinput">secureinput</a>,
Previous:<a rel=previous href="#repchar">repchar</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>Repository</h3>

<pre>   Repository  = ( <var>directory</var> )
</pre>

<p>Defines a special directory where all backup and junk
files are collected. Files are assigned a unique filename
which identifies the path from which they originate. 
This affects files saved using <code>disable</code>, <code>copy</code>,
<code>links</code> and <code>editfiles</code> See <a href="cfengine-Tutorial.html#Disabling%20and%20the%20file%20repository">Disabling and the file repository</a>.

<p><hr>
Node:<a name="secureinput">secureinput</a>,
Next:<a rel=next href="#sensiblecount">sensiblecount</a>,
Previous:<a rel=previous href="#repository">repository</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>SecureInput</h3>

<pre>   SecureInput  = ( on )
</pre>

<p>If this is set cfengine will not import
files which are not owned by the uid running the program, or
   which are writable by groups or others.

<p><hr>
Node:<a name="sensiblecount">sensiblecount</a>,
Next:<a rel=next href="#sensiblesize">sensiblesize</a>,
Previous:<a rel=previous href="#secureinput">secureinput</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>SensibleCount</h3>

<pre>   SensibleCount  = ( <var>count</var> )
</pre>

<p>This variable is used by the action <code>required</code>.  It defines for
cfengine what you consider to be the minimum number of files in a
`required' directory.  If you declare a directory as being required,
cfengine will check to see if it exists.  Then, if the directory
contains fewer than the value of <code>sensiblecount</code> files, a warning
is issued.  The default value for this variable is 2.

<p><hr>
Node:<a name="sensiblesize">sensiblesize</a>,
Next:<a rel=next href="#showactions">showactions</a>,
Previous:<a rel=previous href="#sensiblecount">sensiblecount</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>SensibleSize</h3>

<pre>   SensibleSize  = ( <var>size</var> )
</pre>

<p>This variable is used by the action <code>required</code>.  It defines for
cfengine what you consider to be the minimum size for a `required' file. 
If you declare a file as being required, cfengine will check to see if
the file exists.  Of course, the file may exist but be empty, so the
size of the file is also checked against this constant.  If the file is
smaller than the value of <code>sensiblesize</code> a warning is issued.  The
default value for this variable is 1000 bytes.

<p><hr>
Node:<a name="showactions">showactions</a>,
Next:<a rel=next href="#site">site</a>,
Previous:<a rel=previous href="#sensiblesize">sensiblesize</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>ShowActions</h3>

<pre>   ShowActions  = ( <var>on</var> )
</pre>

<p>This causes cfengine to produce detailed output of what action is
being carried out as part of the prefix information during output. 
This is intended only for third party tools which collect and parse
the cfengine output. It will be of little interest to humans.

<p><hr>
Node:<a name="site">site</a>,
Next:<a rel=next href="#SplayTime">SplayTime</a>,
Previous:<a rel=previous href="#showactions">showactions</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>site/faculty</h3>

<pre>  site    = ( <var>sitename</var> )
  faculty = ( <var>facultyname</var> )
</pre>

<p>This variable defines a convenient name for your site configuration.  It
is useful for making generic rules later on, because it means for
instance that you can define the name of a directory to be

<pre>/$(site)/$(host)/local
</pre>

<p>without having to redefine the rule for a specific site.  This is a
handy trick for making generic rules in your files which can be imported
into a configuration for any site.

<p><code>faculty</code> is a synonym for <code>site</code>.  The two names
may be used interchangeably.

<p><hr>
Node:<a name="SplayTime">SplayTime</a>,
Next:<a rel=next href="#split">split</a>,
Previous:<a rel=previous href="#site">site</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>SplayTime</h3>

<pre>  SplayTime = ( <var>time-in-minutes</var> )
</pre>

<p>This variable is used to set the maximum time over
which cfengine will share its load on a server,
See <a href="cfengine-Tutorial.html#Splaying%20host%20times">Splaying host times</a>.

<p><hr>
Node:<a name="split">split</a>,
Next:<a rel=next href="#suspiciousnames">suspiciousnames</a>,
Previous:<a rel=previous href="#SplayTime">SplayTime</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>Split</h3>

<pre>   Split  = ( <var>character</var> )
</pre>

<p>The value of this variable is used to define the list separator in
variables which are expected to be treated as lists. The default value
of this variable is the colon <code>:</code>.  Cfengine treats variables
containing this character as lists to be broken up and iterated over in
the following cases:

<ul>

<li>in the `to' field of a multiple link action,

<li>in the `from' field of a copy action,

<li>in the directory field of a tidy action,

<li>in the directory field of the files action,

<li>in the ignore action.

</ul>

<p>This typically allows communication with PATH-like
environment variables in the shell.

<p><hr>
Node:<a name="suspiciousnames">suspiciousnames</a>,
Next:<a rel=next href="#sysadm">sysadm</a>,
Previous:<a rel=previous href="#split">split</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>suspiciousnames</h3>

<pre>  SuspiciousNames = ( .mo lrk3 )
</pre>

<p>Filenames in this list are treated as suspicious and generate a warning
as cfengine scans directories. This might be used to detect hacked systems
or concealed programs. Checks are only made in directories which cfengine
scans in connection with a command such as files, tidy or copy.

<p><hr>
Node:<a name="sysadm">sysadm</a>,
Next:<a rel=next href="#Syslog">Syslog</a>,
Previous:<a rel=previous href="#suspiciousnames">suspiciousnames</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>sysadm</h3>

<pre>   sysadm = ( <var>mail address</var> )
</pre>

<p>The mail address of your system administrator should be placed here. 
This is used in two instances.  If cfengine is invoked with the option
<code>-a</code>, then it simply prints out this value.  This is a handy
feature for making scripts.  See <a href="#Using%20the%20help%20scripts">Using the help scripts</a>.

<p>The administrators mail address is also written into the personal log
files which cfengine creates for each user after tidying files, so you
should make this an address which users can mail if they have troubles.

<p><hr>
Node:<a name="Syslog">Syslog</a>,
Next:<a rel=next href="#timezone">timezone</a>,
Previous:<a rel=previous href="#sysadm">sysadm</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>Syslog</h3>

<pre>
  Syslog = ( <var>on/</var><b>off</b> )

</pre>

<p>This variable activates syslog logging of cfengine output at
the `inform' level.

<p>To set this output level one writes:

<pre>
 <var>classes</var>::

   Syslog = ( on )

</pre>

<p><hr>
Node:<a name="timezone">timezone</a>,
Next:<a rel=next href="#TimeOut">TimeOut</a>,
Previous:<a rel=previous href="#Syslog">Syslog</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>timezone</h3>

<pre>   timezone = ( <var>3-character timezone</var> )
</pre>

<p>The timezone variable is a list of character strings which define your local
timezone.  Normally you will only need a single timezone, but sometimes
there are several aliases for a given timezone e.g. MET and CET are synonymous. 
Currently only the first three characters of this string are
checked against the timezone which cfengine manages to glean from the
system.  If a mismatch is detected a warning message is printed. 
cfengine does not attempt to configure the timezone.  This feature works
only as a reminder, since the timezone should really be set once and for
all at the time the system is installed.  On some systems you can set
the timezone by editing a file, a procedure which you can automate with
cfengine See <a href="#editfiles">editfiles</a>.

<p>The value of the <code>timezone</code> can be accessed by variable substitution
in the usual way. It expands to the first item in your list.

<pre>shellcommands:

       "echo ${timezone} | mail ${sysadm}"

</pre>

<p><hr>
Node:<a name="TimeOut">TimeOut</a>,
Next:<a rel=next href="#Verbose">Verbose</a>,
Previous:<a rel=previous href="#timezone">timezone</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>TimeOut</h3>

<pre>
  TimeOut = ( 10 )

</pre>

<p>The default timeout for network connections is 10 seconds. This
is too short on some routed networks. It is not permitted to set
this variable smaller than 3 seconds or larger than 60 seconds.

<p><hr>
Node:<a name="Verbose">Verbose</a>,
Next:<a rel=next href="#Warnings">Warnings</a>,
Previous:<a rel=previous href="#TimeOut">TimeOut</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>Verbose</h3>

<pre>
  Verbose = ( <var>on/</var><b>off</b> )

</pre>

<p>This variable switches on the output level whereby cfengine
reports everything it does during a run in great detail. Normally only
urgent messages or clear errors are printed, See <a href="#Inform">Inform</a>. 
This option is almost equivalent to using the <kbd>--verbose</kbd> of <kbd>-v</kbd>
command-line options. The only difference is that system environment reporting
information, which is printed prior to parsing, is not shown. 
To set this output level on selected hosts one writes:

<pre>
 <var>classes</var>::

   Verbose = ( on )

</pre>

<p>For related more limited output, See <a href="#Inform">Inform</a>.

<p><hr>
Node:<a name="Warnings">Warnings</a>,
Next:<a rel=next href="#warnnonusermail">warnnonusermail</a>,
Previous:<a rel=previous href="#Verbose">Verbose</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>Warnings</h3>

<pre>
  Warnings = ( <var>on/</var><b>off</b> )

</pre>

<p>This variable switches on the parser-output level whereby cfengine
reports non-fatal warnings.  This is equivalent to setting the command
line switch <kbd>--no-warn</kbd>, or <kbd>-w</kbd>.  To set this output level on
selected hosts one writes:

<pre>
 <var>classes</var>::

   Warnings = ( on )

</pre>

<p><hr>
Node:<a name="warnnonusermail">warnnonusermail</a>,
Next:<a rel=next href="#warnnonownermail">warnnonownermail</a>,
Previous:<a rel=previous href="#Warnings">Warnings</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>WarnNonUserMail</h3>

<p>If this parameter is set to true, cfengine will warn about mail files on
mailservers which do not have a name belonging to a known user id. This
does not include lock files.

<p><hr>
Node:<a name="warnnonownermail">warnnonownermail</a>,
Previous:<a rel=previous href="#warnnonusermail">warnnonusermail</a>,
Up:<a rel=up href="#control">control</a>
<br>

<h3>WarnNonOwnerMail</h3>

<p>If this parameter is set to true, cfengine will warn about files on
mailservers whose names do not correspond to a known user name, but
might be owned by a known user.

<p><hr>
Node:<a name="classes">classes</a>,
Next:<a rel=next href="#copy">copy</a>,
Previous:<a rel=previous href="#control">control</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>classes</h2>

<p>The <code>classes</code> keyword is an alias for <code>groups</code> as of
version 1.4.0 of cfengine.

<p><hr>
Node:<a name="copy">copy</a>,
Next:<a rel=next href="#defaultroute">defaultroute</a>,
Previous:<a rel=previous href="#classes">classes</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>copy</h2>

<p>Cfengine copies files between locally mounted filesystems and via the
network from registered servers.  The copy algorithm avoids
race-conditions which can occur due to network and system latencies by
copying first to a file called <code><var>file</var>.cfnew</code> on the local
filesystem, and then renaming this quickly into place.  The aim of this
roundabout procedure is to avoid situations where the direct rewriting
of a file is interrupted midway, leaving a partially written file to be
read by other processes.  Cfengine attempts to preserve hard links to
non-directory file-objects, but see the caution below.

<p><em>Caution should be exercised in copying files which change rapidly in size. 
This can lead to file corruption, if the size changes during copying. Cfengine
attempts to prevent this during remote copies.</em>

<p>The syntax summary is:

<pre>
copy:

   <var>class</var>::

      <var>master-file</var>
                        dest=<var>destination-file</var>
                        mode=<var>mode</var>
                        owner=<var>owner</var>
                        group=<var>group</var>
                        action=<var>silent/fix</var>
                        backup=<b>true</b><var>/false</var>
                        repository=<var>backup directory</var>
                        stealth=<var>true/on/<b>false/off</b></var>
                        timestamps=<b>preserve/keep</b>
                        symlink=<var>pattern</var>
                        include=<var>pattern</var>
                        exclude=<var>pattern</var>
                        ignore=<var>pattern</var>
                        filter=<var>filteralias</var>
                        recurse=<var>number/inf/</var><var>0</var>
                        type=<b>ctime</b><var>/mtime/checksum/sum/byte/binary</var>
                        linktype=<b>absolute/symbolic</b><var>/relative/hard/none/copy</var>
                        typecheck=<b>true/on</b>/<var>false/off</var>
                        define=<var>class-list</var>(,:.)
                        elsedefine=<var>class-list</var>(,:.)

                        force=<var>true/on</var>/<b>false/off</b>
                        size=<var>size limits</var>
                        server=<var>server-host</var>
                        secure=<var>true</var>/<b>false</b>
                        purge=<var>true/</var><b>false</b>
                        syslog=<var>true/on</var>/<var>false/off</var>
                        inform=<var>true/on</var>/<var>false/off</var>

</pre>

<dl>

<br><dt><code>dest</code>
<dd>The destination file is the only obligatory item. This must be the name
of an object which matches the type of the master object i.e. if the
master is a plain file, the destination must also be the explicit name
of a plain file. An implicit `copy file to directory' syntax is not
allowed.  Symbolic links are copied as symbolic links, plain files are
copied as plain files and special files are copied as special files. If
the master and image are directories then all of the child files
<em>which are not directories</em> are copied from source to destination.

<br><dt><code>mode, owner, group</code>
<dd>The file mode, owner
and group of the images are specified as in the <code>files</code> function
See <a href="#files">files</a>.

<br><dt><code>action</code>
<dd>The action may take the values <code>warn</code> or
<code>silent</code>. The default action is <code>fix</code>, i.e.  copy files. If <code>warn</code>
is specified, only a warning is issued about files which require
updating. If <code>silent</code> is given, then cfengine will copy the files
but not report the fact.

<br><dt><code>force</code>
<dd>If set to `true', this option causes cfengine to copy files regardless
of whether it is up to date.

<br><dt><code>backup</code>
<dd>If the <code>backup</code> option is set to "false", cfengine
will not make a backup copy of the file before copying.

<br><dt><code>repository</code>
<dd>This allows a local override of the <code>Repository</code> variable, on an item
by item basis. If set to "off" or "none" it cancels the value of a global repository.

<p>Copy makes a literal image of the master file at the destination,
checking whether the master is newer than the image. If the image needs
updating it is copied. Existing files are saved by appending
<code>.cfsaved</code> to the filename.

<br><dt><code>stealth</code>
<dd>If set to `on' causes cfengine to preserve atime and mtime
on source files during <em>local</em>
file copies. File times cannot be preserved on
remote copies. This option should normally only be used
together with a checksum copy, since preserving atime and mtime
implies changing ctime which will force continual copying. 
This is a weakness in the Unix file system. Ctime cannot be
preserved. Before version 1.5.0, there was a typo which
made this option active on many file copies.

<br><dt><code>timestamps</code>
<dd>If this is set to `preserve' or `keep', the times of the source
files are kept by the destination files during copying. This is
like the `p' option of the <code>tar</code> command.

<br><dt><code>recurse</code>
<dd>Specifies the depth of recursion when copying whole file-trees
recursively. The value may be a number or the keyword <code>inf</code>. 
Cfengine crosses device boundaries or mounted filesystems when
descending recursively through file trees. To prevent
this it is simplest to specify a maximum level of recursion.

<br><dt><code>symlink</code>
<dd>This option may be repeated a number of times to specify the
names of files, or wildcards which match files which are to
be symbolically linked instead of copied. A global list of
patterns can also be defined in the control section of the program
See <a href="#linkcopies">linkcopies</a>.

<br><dt><code>ignore</code>
<dd>This works like the global ignore directive but here you may
provide a private list of ignorable directories and files. 
Unlike include, exclude this affects the way cfengine parses
directory trees.

<br><dt><code>include</code>
<dd>This option may be repeated a number of times to specify the names of
files, or wildcards which match files which are to be included in a copy
operation. Specifying one of these automatically excludes everything
else except further include patterns.  A global list of patterns can
also be defined in the control section of the program.

<br><dt><code>exclude</code>
<dd>This option may be repeated a number of times to specify the
names of files, or wildcards which match files which are to
be excluded from a copy operation. A global list of
patterns can also be defined in the control section of the program
`excludes' override `includes'. 
See <a href="#excludelinks">excludelinks</a>.

<br><dt><code>type</code>
<dd>Normally cfengine uses the ctime date-stamps on files to determine
whether a file needs to be copied: a file is only copied if the master
is newer than the copy or if the copy doesn't exist. If the type is set
to <code>checksum</code> or <code>sum</code>, then a secure MD5 checksum is used to
determine whether the source and destination files are identical. If
<code>byte</code> or <code>binary</code> is specified, a byte by byte comparison is
initiated.  An <code>mtime</code> comparison does not take into account
changes of file permissions, only modifications to the contents of the
files.

<br><dt><code>server</code>
<dd>If you want to copy a file remotely from a server, you specify the
name of the server here. This must be the name of a host which is
running the <code>cfd</code> daemon, and you must make sure that you
have defined the variable <code>domain</code> in the control section
of the <code>cfengine.conf</code> file. If you don't define a domain
you will probably receive an error of the form `cfengine: Hey! cannot
stat file'.

<br><dt><code>secure</code>
<dd>Has an effect only when used in conjuction with copy from a remote file
server.  This causes cfengine to use 3DES key encryption and one-time
keys on transferred data.  This provides good enough privacy for the
purposes of system adminstration, but it is not meant to be a
super-secure means of encryption. Generally speaking the only case in
which this function makes sense is in transferring shadow password
files. If you are encrypting the transfer of system binaries, you need
your head examining. When encrypt is specified, an md5 checksum is
always used to verify the file. Note: the encryption keys required to
get files from cfd are those for the user under which cfd is running
(normally root). Cfd will not switch keys for other users, so
encrypted transfer will not work for all users. If a file <em>requires</em>
encrypted transfer (secure flag in cfd) then normal users will not
be able to collect it.

<br><dt><code>size</code>
<dd>With this option you can specify that a file is only to be copied if the
source file meets a size critereon. This could be used to avoid
installing a corrupted file (the copying of an empty password file, for
instance). Sizes are in bytes by default, but may also be quoted in
kilobytes or megabytes using the notation:
<pre>
<var>number</var>bytes
<var>number</var>kbytes
<var>number</var>mbytes

</pre>

<p>Only the first characters of these strings are significant, so they may
be written however is convenient: e.g. <kbd>14kB</kbd>, <kbd>14k</kbd>,
<kbd>14kilobytes</kbd> etc. 
 Examples are:

<pre>
   size=&lt;400  # copy if file size is &lt; 400 bytes
   size=400   # copy if file size is equal to 400 bytes
   size=&gt;400  # copy if file size &gt; 400 bytes

</pre>

<br><dt><code>linktype</code>
<dd>This option determines the type of link used to make links. This only
applies if the file is linked rather than copied because it matches
a pattern set by <code>symlink</code>. The default type is a direct symbolic
link. The values <code>relative</code> or <code>absolute</code> may be used, but
hard links may not be created in place of copied files, since hard links
must normally reside on the same filesystem as their files, and it
is assumed that most links will be between filesystems. If this value
is set to <code>copy</code> or <code>none</code>, symbolic links will be replaced
by actual copies of the files they point to. Note that for directories,
this option is ignored.

<br><dt><code>typecheck</code>
<dd>Switches on/off error messages if source and existing destination files
do not match in type, e.g. if a file would overwrite a directory or link.

<br><dt><code>define</code>
<dd>This option is followed by a list of classes which are to be `switched on'
if and only if the named file was copied.  In multiple (recursive) copy
operations the classes become defined if any of the files in the file
tree were copied. This feature is useful for switching on other actions
which are to be performed after the installation of key files (e.g. 
package installation scripts etc).

<br><dt><code>purge</code>
<dd>If this option is set to true, cfengine will remove files in the
destination directory which are not also in the source directory.  This
allows exact images of filesystems to be mantained. Note that if the
copy command has includes or excludes or ignored files, cfengine will
purge only those files on the client machine which are also on the
server. This means that some files (such as system specific work files)
can be excluded from copies without them being destroyed. 
Note that purging is disallowed if contant with a remote server fails. 
This means that local files will not be destroyed by a denial of service
attack. <em>You should not use this option to synchronize NFS mounted
file systems. If the NFS server goes down, cfengine cannot then tell the
difference between a valid empty directory and a missing NFS file system. 
If you use purge, use a remote copy also.</em>

</dl>

<p>Example:

<pre>
copy:

      /local/etc/aliases dest=/etc/aliases m=644 o=root g=other
      /local/backup-etc  dest=/etc

   solaris::

      /local/etc/nsswitch.conf dest=/etc/nsswitch.conf

</pre>

<p>In the first example, a global aliases file is copied from the master
site file <code>/local/etc/aliases</code> to <code>/etc/aliases</code>, setting the
owner and protection as specified. The file gets installed if
<code>/etc/aliases</code> doesn't exist and updated if <code>/local/etc/aliases</code>
is newer than <code>/etc/aliases</code>. In the second example, <code>backup-etc</code>
is a directory containing master configuration files (for instance, <code>services</code>,
<code>aliases</code>, <code>passwd</code>...). Each of the files in <code>backup-etc</code>
is installed or updated under <code>/etc</code>. Finally, a global
<code>nsswitch.conf</code> file is kept up to date for solaris systems.

<p>The <code>home</code> directive can be used as a destination, in which
case cfengine will copy files to every user on the system. This is
handy for distributing setup files and keeping them updated:

<pre>
copy:

   /local/masterfiles/.cshrc  dest=home/.cshrc mode=0600

</pre>

<p>You can force the copying of files, regardless of the date stamps
by setting the option <code>force=true</code> or <code>force=on</code>. The default
is <code>force=false</code> or <code>force=off</code>.

<ul>
<li><a href="#hard%20links%20in%20copy">hard links in copy</a>: 
<li><a href="#Too%20many%20open%20files">Too many open files</a>: 
</ul>

<p><hr>
Node:<a name="hard%20links%20in%20copy">hard links in copy</a>,
Next:<a rel=next href="#Too%20many%20open%20files">Too many open files</a>,
Previous:<a rel=previous href="#copy">copy</a>,
Up:<a rel=up href="#copy">copy</a>
<br>

<h3>Hard links in copying</h3>

<p>Hard links are not like symbolic links, they are not merely pointers to
other files, but alternative names for the same file. The name of every
file is a hard link, the first so to speak. You can add additional names
which <em>really are</em> the file, they are not just pointers. For the
technically minded, they are not separate inodes, they are additional
directory references to the same inode.  When you perform a copy
operation on multiple files, cfengine attempts to preserve hard links
but this is a difficult task.

<p>Because a hard link just looks like an ordinary file (it cannot be
distingiushed from the original, the way a symbolic link can)
there is a danger that any copy operation will copy two hard links to
the same file as two separate copies of the same file. The difference
is that changes a hard-linked file propagate to the links, whereas
two copies of a file are completely independent thereafter. 
In order to faithfully reproduce all hardlinks to all files, cfengine
needs to examine every file on the same filesystem and check whether
they have the same inode-number. This would be an enourmous overhead, so it
is not done. Instead what happens is that cfengine keeps track of only
the files which it is asked to examine, for each atomic copy-command,
and makes a note of any repeated inodes within this restricted set. 
It does not try to go off, wandering around file systems looking to
other files which might be hardlinks.

<p>To summarize, cfengine preserves hardlinks during copying, only
within the scope of the present search. No backups are made of
hard links, only of the first link or name of the file is backed
up. This is a necessary precaution to avoid dangling references
in the inode table. As a general rule, hard links are to be avoided
because they are difficult to keep track of.

<p><hr>
Node:<a name="Too%20many%20open%20files">Too many open files</a>,
Previous:<a rel=previous href="#hard%20links%20in%20copy">hard links in copy</a>,
Up:<a rel=up href="#copy">copy</a>
<br>

<h3>Too many open files</h3>

<p>In long recursive copies, where you descend into many levels of diretories,
you can quickly run out of file descriptors. The number of file descriptors
is a resource which you can often set in the shell. It is a good idea
to set this limit to a large number on a host which will be copying
a lot of files. For instance, in the C shell you would write,

<pre>
limit descriptors 1024

</pre>

<p>Most systems should have adequate defaults for this parameter, but
on some systems it appears to be set to a low value such as 64, which is
not sufficient for large recursive tree searches.

<p><hr>
Node:<a name="defaultroute">defaultroute</a>,
Next:<a rel=next href="#disks">disks</a>,
Previous:<a rel=previous href="#copy">copy</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>defaultroute</h2>

<p>Dynamical routing is not configurable in cfengine, but for machines with
static routing tables it is useful to check that a default route is
configured to point to the nearest gateway or router.  The syntax for
this statement is simply:

<pre>
defaultroute:

   <var>class</var>::

      my_gateway

</pre>

<p>For example:

<pre>
defaultroute:

  most::

     129.240.22.1


  rest::

     small_gw

</pre>

<p>Gateways and routers usually have internet address <code>aaa.bbb.ccc.1</code>
-- i.e.  the first address on the subnet.  You may use the numerical
form or a hostname for the gateway.

<p><hr>
Node:<a name="disks">disks</a>,
Next:<a rel=next href="#directories">directories</a>,
Previous:<a rel=previous href="#defaultroute">defaultroute</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>disks</h2>

<p>This is a synonyn for <code>required</code>, See <a href="#required">required</a>. 
This action tests for the existence of a file or filesystem.  It should
be called after all NFS filesystems have been mounted.  You may use the
special variable <code>$(binserver)</code> here.

<pre>
  disks:

    /<var>filesystem</var> freespace=<var>size-limit</var> define=<var>class-list</var>(,:.)

</pre>

<p>Files or filesystems which you consider to be essential to the operation
of the system can be declared as `required'.  Cfengine will warn
if such files are not found, or if they look funny.

<p>Suppose you mount your filesystem <code>/usr/local</code> via NFS from some
binary server.  You might want to check that this filesystem is not
empty! This might occur if the filesystem was actually <em>not</em>
mounted as expected, but failed for some reason.  It is therefore not
enough to check whether the directory <code>/usr/local</code> exists, one must
also check whether it contains anything sensible.

<p>Cfengine uses two variables: <code>sensiblesize</code> and
<code>sensiblecount</code> to figure out whether a file or filesystem is
sensible or not.  You can change the default values of these variables
(which are 1000 and 2 respectively) in the <code>control</code> section. 
See <a href="#control">control</a>.

<p>If a file is smaller than <code>sensiblesize</code> or does not exist, it
fails the `required' test.  If a directory does not exist, or contains
fewer than <code>sensiblecount</code> files, then it also fails the test and a
warning is issued.

<pre>
disks:

   any::

      /$(site)/$(binserver)/local

</pre>

<p>If you set the <code>freespace</code> variable to a value (the default units are kilobytes,
but you may specify bytes or megabytes), e.g.

<p><hr>
Node:<a name="directories">directories</a>,
Next:<a rel=next href="#disable">disable</a>,
Previous:<a rel=previous href="#disks">disks</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>directories</h2>

<p>Directories declarations consist of a number of directories to be
created.  Directories and files may also be checked and created using
the <code>touch</code> option in the <code>files</code> actions.  See <a href="#files">files</a>.

<p>The form of a declaration is:

<pre>
  directories:

     <var>classes</var>::

         /<var>directory</var>
                         mode=<var>mode</var>
                         owner=<var>uid</var>
                         group=<var>gid</var>
                         define=<var>classlist</var>
                         syslog=<var>true/on</var>/<var>false/off</var>
                         inform=<var>true/on</var>/<var>false/off</var>

</pre>

<p>For example

<pre>
directories:

  <var>class</var>::

     /usr/local/bin  mode=755 owner=root group=wheel

</pre>

<p>The form of the command is similar to that of <code>files</code> but this
command is only used to create new directories.  Valid options are
<code>mode</code>, <code>owner</code>, <code>group</code> and are described under
<code>files</code> See <a href="#files">files</a>. This interface is only for convenience. 
It is strictly a part of the `files' functionality and is performed
together with other `files' actions at run time.

<p>The creation of a path will fail if one of the links in the path is a
plain file or device node.  A list of classes may optionally be defined
here if a directory is created.

<p><hr>
Node:<a name="disable">disable</a>,
Next:<a rel=next href="#editfiles">editfiles</a>,
Previous:<a rel=previous href="#directories">directories</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>disable</h2>

<p>Disabling a file means renaming it so that it becomes harmless.  This
feature is useful if you want to prevent certain dangerous files from
being around, but you don't want to delete them-- a deleted file cannot
be examined later.  The syntax is

<pre>
 disable:

   <var>class</var>::

      /<var>filename</var>
                      type=<var>plain/file/link/links</var>
                      rotate=<var>empty/truncate/numerical-value</var>
                      size=<var>numerical-value</var>
                      define=<var>classlist</var>
                      syslog=<var>true/on</var>/<var>false/off</var>
                      inform=<var>true/on</var>/<var>false/off</var>
                      repository=<var>destination directory</var>

</pre>

<p>Cfengine renames a given file by appending the name of the file with the
suffix <code>.cfdisabled</code>.  A typical example of a file you would
probably want to disable would be the <code>/etc/hosts.equiv</code> file which
is often found with the <code>+</code> symbol written in it, opening the
system concerned to the entire NIS universe without password protection! 
Here is an example:

<pre>
disable:

      /etc/hosts.equiv
      /etc/nologin
      /usr/lib/sendmail.fc

   sun4::

      /var/spool/cron/at.allow

</pre>

<p>Hint: The last example disables a file which restricts access to the
<code>at</code> utility.  Such a command could be followed by a file action,
See <a href="#files">files</a>,

<pre>files:

   some::

      /var/spool/cron/at.allow =0644 N [root] [wheel] touch

</pre>

<p>which would create an empty security file <code>at.allow</code>. 
See also your system manual pages for the <code>at</code> command if you don't
understand why this could be useful.

<p>Disabling a link deletes the link. If you wish you may use the
optional syntax

<pre>
disable:

    /directory/name type=file

</pre>

<p>to specify that a file object should only be disabled if it is a plain
file. The optional element <code>type=</code> can take the values
<code>plain</code>, <code>file</code>, <code>link</code> or <code>links</code>. If one of
these is specified, cfengine checks the type and only disables
the object if there is a match. This allows you to disable a file
and replace it by a link to another file for instance.

<p>NOTE that if you regularly disable a file which then gets recreated by
some process, the disabled file <code><var>filename</var>.cfdisabled</code> will
be overwritten each time cfengine disables the file and therefore the
contents of the original are lost each time. The <code>rotate</code> facility
was created for just this contingency.

<p>The disable feature can be used to control the size of system log files,
such as <code>/var/adm/messages</code> using a further option <code>rotate</code>. 
If the value rotate is set to 4, say,

<pre>
 disable:

    <var>filename</var>  rotate=4

</pre>

<p>then cfengine renames
the file concerned by appending `.1' to it and a new, empty file is
created in its place with the same owner and permissions. The next time
disable is executed `.1' is renamed to `.2' and the file
is renamed `.1' and a new empty file is created with the same
permissions. Cfengine continues to rotate the files like this
keeping a maximum of four files. This is similar to the behaviour
of syslog.

<p>If you simply want to empty the contents of a log file, without
retaining a copy then you can use <code>rotate=empty</code> or
<code>rotate=truncate</code>. For instance,
to keep control of your World Wide Web server logs:

<pre>disable:

   Sunday|Wednesday::

       /usr/local/httpd/logs/access_log  rotate=empty
</pre>

<p>This keeps a running log which is emptied each Sunday and Wednesday.

<p>The <code>size=</code> option in disable allows you to carry out a disable
operation only if the size of the file is less than, equal to or greater
than some specified size. Sizes are in bytes by default, but
may also be quoted in kilobytes or megabytes using the notation:
<pre>
<var>number</var>bytes
<var>number</var>kbytes
<var>number</var>mbytes

</pre>

<p>Only the first characters of these strings are significant, so they may
be written however is convenient: e.g. <kbd>14kB</kbd>, <kbd>14k</kbd>,
<kbd>14kilobytes</kbd> etc. 
 Examples are:

<pre>
   size=&lt;400  # disable if file size is &lt; 400 bytes
   size=400   # disable if file size is equal to 400 bytes
   size=&gt;400  # disable if file size &gt; 400 bytes

</pre>

<p>This options works with <code>rotate</code> or normal disabling; it is just
an extra condition which must be satisfied.

<p>If a disable command results in action being taken by cfengine, an optional
list of classes becomes can be switched on with the aid of a statement
<code>define=<var>classlist</var></code> in order to trigger knock-on actions.

<p>The <code>repository</code> declaration allows a local override of the
<code>Repository</code> variable, on an item by item basis. If set to "off" or
"none" it cancels the value of a global repository and leaves the disabled
file in the same directory.

<p><hr>
Node:<a name="editfiles">editfiles</a>,
Next:<a rel=next href="#files">files</a>,
Previous:<a rel=previous href="#disable">disable</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>editfiles</h2>

<p>Performs ascii (line-based) editing on text-files or limited binary
editing of files. 
If editing a file which has hard links to it, be aware that
editing the file will destroy the hard link references. This is also the
case with shell commands. You should avoid hard links whenever possible. 
The form of an editing command is
<code>editfiles</code> can also search directories recursively through directories
and edit all files matching a pattern, using <code>Include</code>, <code>Exclude</code>, and
<code>Ignore</code> (see Recursive File Sweeps in the tutorial).

<pre>
editfiles:

   <var>class</var>::

      { <var>file-to-be-edited</var>

      <var>action</var> "<var>quoted-string...</var>"
      }

      { <var>directory-to-be-edited</var>

      Recurse "inf"
      Filter  "filteralias"
      Include ".cshrc"
      Ignore  "bin"
      Ignore  ".netscape"
      <var>action</var> "<var>quoted-string...</var>"
      }

</pre>

<p>Here are some examples:

<pre>editfiles:

   sun4::

      { /etc/netmasks

      DeleteLinesContaining "255.255.254.0"
      AppendIfNoSuchLine "128.39  255.255.255.0"
      }

   PrintServers::
      { /etc/hosts.lpd

      AppendIfNoSuchLine "tor"
      AppendIfNoSuchLine "odin"
      AppendIfNoSuchLine "borg"
      }

</pre>

<p>The first of these affects the file <code>/etc/netmasks</code> on all SunOS 4
systems, deleting any lines containing the string "255.255.254.0" and
Appending a single line to the file containing "128.39 255.255.255.0"
if none exists already.  The second affects only hosts in the class
`PrintServers' and adds the names of three hosts: tor, odin and borg to
the file <code>/etc/hosts.lpd</code> which specifies that they are allowed to
connect to the printer services on any host in the class `PrintServers'.

<p>Note that single or double quotes may be used to enclose strings
in cfengine. If you use single quotes, your strings may contain
double quotes and vice-versa. Otherwise a double quoted string
may not currently contain double quotes and likewise for
single quoted strings.

<p>As of version 1.3.0, you can use the <code>home</code> directive in
edit filenames, enabling you to edit files for every user
on the system, provided they exist. For example, to edit
every user's login files, you would write

<pre>
  { home/.cshrc

   AppendIfNoSuchLine "setenv PRINTER default-printer"
   AppendIfNoSuchLine "set path = ( $path /new/directory )"
  }

</pre>

<p>If a user does not possess the named file, cfengine just skips
that user. A new file is not created.

<p>The meanings of the file-editing actions should be self-explanatory. 
Commands containing the word 'comment' are used to `comment out' certain
lines in a file rather than deleting them.  <code>Hash</code> implies a shell
comment of the type

<pre># comment
</pre>

<p><code>Slash</code> implies a comment of the C++ type:

<pre>// comment
</pre>

<p><code>Percent</code> implies a comment of the type:

<pre>% comment
</pre>

<p>More general comment types may be defined using the
<code>SetCommentStart</code>, <code>SetCommentEnd</code> and
<code>CommentLinesMatching</code>, <code>CommentLinesStarting</code>
functions.

<p>A special group of editing commands is based on the GNU Regular
Expression package. These use GNU regular expressions to search line by
line through text and perform various editing functions.  Some of these
commands are based on the concept of a file pointer. The pointer starts
at line one of the file and can be reset by 'locating' a certain line,
or by using the reset-pointer commands. The current position of the
pointer is used by commands such as <code>InsertLine</code> to allow a
flexible way of editing the middle of files.

<p>A simple decision mechanism is incorporated to allow certain editing
actions to be excluded. For instance, to insert a number of lines
in a file once only, you could write:

<pre>
   { <var>file</var>

    LocateLineMatching "<var>insert point...</var>"
    IncrementPointer   "1"

    BeginGroupIfNoMatch "# cfengine - 2/Jan/95"

      InsertLine "# cfengine - 2/Jan/95"
      InsertLine "/local/bin/start-xdm"

    EndGroup
   }

</pre>

<p>Since the first inserted line matches the predicate on subsequent calls,
the grouped lines will only be carried out once.

<p>The full list of editing actions is given below in alphabetical order. 
Note that some commands refer to regular expressions and some refer to
'literal strings' (i.e. any string which is not a regular
expression). Variable substitution is performed on all strings.  Be
aware that symbols such as <code>.</code>, <code>*</code> and so on are
meta-characters in regular expressions and a backslash must be used to
make them literal.  The regular expression matching functions are
POSIX extended regular expressions. 
See <a href="cfengine-Tutorial.html#Regular%20expressions">Regular expressions</a>.

<dl>

<br><dt><code>AbortAtLineMatching <var>quoted-regex</var></code>
<dd>This command sets the value of a regular expression. In all editing
operations (except <code>FixEndOfLine</code> and <code>GotoLastLine</code>) which involve multiple
replacements and searches, this expression marks a boundary
beyond which cfengine will cease to look any further. In other
words, if cfengine encounters a line matching this regular
expression, it aborts the current action. BE CAREFUL with this
feature: once set, the string remains set for the remainder of
the current file. It might therefore interact in unsuspected ways
with other search parameters. Editing actions are always aborted
as soon as the abort expression is matched. 
Use <code>UnsetAbort</code> to unset the feature.

<br><dt><code>Append <var>quoted-string</var></code>
<dd>Add a line containing the quoted string to the end of the file. 
This should be used in conjunction with the
decision structures <code>BeginGroupIfNoLineMatching</code> and
<code>BreakIfLineMatches</code>.

<br><dt><code>AppendIfNoSuchLine <var>quoted-string</var></code>
<dd>Add a line containing the quoted string to the end of the file
if the file doesn't contain the exact line already.

<br><dt><code>AppendIfNoLineMatching  <var>quoted-regex</var></code>
<dd>A new version of the older <code>AppendIfNoSuchLine</code>
which uses a regular expression instead of a literal
string. The line which gets appended must be set
previously using <code>SetLine</code>.

<br><dt><code>AppendToLineIfNotContains <var>quoted-string</var></code>
<dd>This commands looks for an exact match of the quoted string
in the current line. If the quoted string is not contained
in the line, it is appended. This may be used for adding
entries to a list, See <a href="#FAQS%20and%20Tips">FAQS and Tips</a>.

<br><dt><code>AutoCreate</code>
<dd>If this command is listed anywhere in the file action list, cfengine
will create the named file if it doesn't exist. Normally cfengine
issues an error if the named file does not exist. New files are
created with mode 644, read access for everyone and write access
for the cfengine user (normally root). Note that if you set this,
BeginGroupIfFileIsNewer will always be true.

<br><dt><code>AutomountDirectResources <var>quoted-string</var></code>
<dd>This command is designed to assist with automounter configuration for
users wishing to use the automounter for NFS filesystems, but still use
the cfengine mount model. 
Applied to the current file, it is equivalent to saying: for each of the
mountable resources in the list See <a href="#mountables">mountables</a>, append if not found a
line for a direct automount map command, to the current file.  The
string which follows can be used to specify any special mount options
e.g. <code>"-nosuid"</code> for non setuid mounting (of all the
mountables). Note that this is added to the current file and not to a
file named <code>/etc/auto_direct</code>.

<br><dt><code>Backup <var>quoted-string</var></code>
<dd>Set to true or false, on or off to set inform level for this file. 
Default is on.

<br><dt><code>Repository <var>quoted string</var></code>
<dd>This allows a local override of the <code>Repository</code> variable, on an item
by item basis. If set to "off" or "none" it cancels the value of a global repository.

<br><dt><code>BeginGroupIfFileExists <var>quoted-string</var></code>
<dd>The lines following, up to the first <code>EndGroup</code>
are executed if the quoted filename exists (can be statted). 
Files which are not readable by the running process are
for all intents and purposes non-existent.

<br><dt><code>BeginGroupIfFileIsNewer <var>quoted-string</var></code>
<dd>The lines following, up to the first <code>EndGroup</code>
are executed if the quoted filename is newer than the file being
edited.

<br><dt><code>BeginGroupIfNoLineContaining <var>quoted-string</var></code>
<dd>The lines following, up to the first <code>EndGroup</code>
are executed if the quoted string does not appear in
any line in the file.

<br><dt><code>BeginGroupIfNoLineMatching <var>quoted-regex</var></code>
<dd>The lines following, up to the first <code>EndGroup</code>
are executed if the quoted regular expression
does not match any line in the file.

<br><dt><code>BeginGroupIfNoMatch <var>quoted-regex</var></code>
<dd>The lines following, up to the first <code>EndGroup</code>
are executed if the quoted regular expression does
not match the current line.

<br><dt><code>BeginGroupIfNoSuchLine <var>quoted-string</var></code>
<dd>The lines following, up to the first <code>EndGroup</code>
are executed if the quoted literal string
does not match any line in the file.

<br><dt><code>BreakIfLineMatches  <var>quoted-regex</var></code>
<dd>Terminates further editing of the current
file if the current line matches the quoted
regular expression.

<br><dt><code>CatchAbort</code>
<dd>Edit actions which abort on failure (such as <code>LocateLineMatching</code>)
will jump to the first instance of this marker instead of completely
aborting an edit if this keyword occurs in an editing script. 
You can catch the exceptions thrown by the following commands:
<code>CommentNLines</code>,<code>CommentToLineMatching</code>,<code>DeleteNLines</code>,<code>DeleteToLineMatching</code>,
<code>HashCommentToLineMatching</code>,<code>IncrementPointer</code>,
<code>LocateLineMatching</code>,<code>PercentCommentToLineMatching</code>,
<code>RunScriptIf(No)LineMatching</code>,<code>UnCommentNLines</code>.

<br><dt><code>CommentLinesMatching  <var>quoted-regex</var></code>
<dd>Use the current value of the comment delimiters
set using <code>SetCommentStart</code> and <code>SetCommentEnd</code> to comment
out lines matching the given regular expression in quotes.

<br><dt><code>CommentLinesStarting  <var>quoted-string</var></code>
<dd>Use the current value of the comment delimiters
set using <code>SetCommentStart</code> and <code>SetCommentEnd</code> to comment
out lines starting with the quoted literal string.

<br><dt><code>CommentNLines <var>quoted-string</var></code>
<dd>Comments up to N lines from the current file, starting from the
location of the current line pointer. If the end of the file is reached
and less than N lines are deleted, a warning is issued, but
editing continues. The current value of the comment delimiters is
used to determine the method of commenting, (see <code>SetCommentStart</code>). 
After the operation the pointer points to the line after the
commented lines.

<br><dt><code>CommentToLineMatching  <var>quoted-regex</var></code>
<dd>Use the current value of the comment delimiters set using
<code>SetCommentStart</code> and <code>SetCommentEnd</code> to comment out lines
from the current position in a file to a line matching the given regular
expression in quotes.

<br><dt><code>DefineClasses "<var>class1</var>:<var>class2</var>:..."</code>
<dd>Activate the following colon, comma or dot-separated list of classes if
and only if the file is edited.

<br><dt><code>DeleteLinesAfterThisMatching <var>quoted-regex</var></code>
<dd>
<br><dt><code>DeleteLinesContaining <var>quoted-string</var></code>
<dd>Delete all lines containing the exact string quoted.

<br><dt><code>DeleteLinesMatching <var>quoted-regex</var></code>
<dd>Delete all lines matching the quoted regular expression.

<br><dt><code>DeleteLinesStarting <var>quoted-string</var></code>
<dd>Delete all lines beginning with the exact string quoted.

<br><dt><code>DeleteNLines <var>quoted-string</var></code>
<dd>Deletes up to N lines from the current file, starting from the
location of the current line pointer. If the end of the file is reached
and less than N lines are deleted, a warning is issued, but
editing continues.

<br><dt><code>DeleteToLineMatching <var>quoted-regex</var></code>
<dd>Delete lines from the current position, up to
but not including a line matching the regular expression
in the quoted string. If no line matches the
given expression, a warning is only printed in
verbose mode, but all edits are immediately
abandoned.

<br><dt><code>EmptyEntireFilePlease</code>
<dd>Deletes all lines from the current file.

<br><dt><code>ElseDefineClasses</code>
<dd>See <code>DefineClasses</code>

<br><dt><code>EndGroup</code>
<dd>Terminates a begin-end conditional structure.

<br><dt><code>EndLoop</code>
<dd>Terminates a loop. See <code>ForEachLineIn</code>

<br><dt><code>Filter <var>filteralias</var></code>
<dd>Name a fiter for pruning file searches.

<br><dt><code>FixEndOfLine</code>
<dd>The quoted string which follows may be either <code>dos</code>
or <code>unix</code> to fix the end of line character conventions
to match these systems. This command should be executed
last of all, since cfengine appends new lines with the conventions
of the system on which is was complied during edit operations.

<br><dt><code>ForEachLineIn <var>quoted-filename</var></code>
<dd>This marks the beginning of a for-loop which reads successive
lines from a named file. The result is like using <code>SetLine</code>
for each line in the file. Nested loops are not permitted.

<br><dt><code>GotoLastLine</code>
<dd>Moves the file pointer to the last line in
the current file.

<br><dt><code>HashCommentLinesContaining <var>quoted-string</var></code>
<dd>Add a <code>#</code> to the start of any line containing the quoted string.

<br><dt><code>HashCommentLinesMatching <var>quoted-regex</var></code>
<dd>Add a <code>#</code> to the start of any line exactly matching the quoted regular expression.

<br><dt><code>HashCommentLinesStarting <var>quoted-string</var></code>
<dd>Add a <code>#</code> to the start of any line starting with the quoted string.

<br><dt><code>IncrementPointer <var>quoted-number</var></code>
<dd>Increments the value (in lines) of the file pointer
by the number of lines specified in the quoted
string (as a denary number). e.g. <code>"4"</code>. 
Negative values are equivalent to decrementing the
pointer. If a request is made to increment/decrement
outside of the file boundaries the pointer `bumps'
into the boundary and remains there, i.e. either at
start of file or end of file.

<br><dt><code>Inform <var>quoted-string</var></code>
<dd>Set to true or false, on or off to set inform level for this file. 
Default is off.

<br><dt><code>InsertFile <var>quoted-string</var></code>
<dd>Inserts the named file after the current line position
in the file. This should be used in conjunction
with a begin-end construction in order to avoid
including the file every time cfengine is run. 
If the file does not exist, or cannot be opened,
there is only a warning issued in verbose mode. 
Note if the file is empty, or if the current line
pointer is not set, the file is inserted at the start
of the file.

<br><dt><code>InsertLine <var>quoted-string</var></code>
<dd>Inserts the quoted string as a line at the current
position in the file. After the insert, the file
pointer is incremented by one so that subsequent
inserted lines are placed after the first. 
This should probably be used in conjunction with the
conditional begin-end tests to avoid lines being
inserted on every run.

<br><dt><code>LocateLineMatching <var>quoted-string</var></code>
<dd>Moves the current-position pointer to the start
of the line matching the quoted regular expression. 
If there is no match, a warning is only issued in
verbose mode, but all editing is immediately
aborted. See also <code>WarnIfNoLineMatching</code>
so that you can get an explicit warning, even
out of verbose mode.

<br><dt><code>PercentCommentLinesContaining <var>quoted-string</var></code>
<dd>Add a <code>%</code> to the start of any line containing the quoted string.

<br><dt><code>PercentCommentLinesMatching <var>quoted-regex</var></code>
<dd>Add a <code>%</code> to the start of any line exactly matching the quoted regular.

<br><dt><code>PercentCommentLinesStarting <var>quoted-string</var></code>
<dd>Add a <code>%</code> to the start of any line starting with the quoted string.

<br><dt><code>Prepend <var>quoted-string</var></code>
<dd>Add a line containing the quoted string to the start of the file. 
This should be used in conjunction with the
decision structures <code>BeginGroupIfNoLineMatching</code> and
<code>BreakIfLineMatches</code>.

<br><dt><code>PrependIfNoLineMatching <var>quoted-regex</var></code>
<dd>A new version of the older <code>PrependIfNoSuchLine</code>
with uses a regular expression instead of a literal string. 
The string prepended is the one set using <code>SetLine</code>.

<br><dt><code>PrependIfNoSuchLine <var>quoted-string</var></code>
<dd>Add a line containing the quoted string to the start of the file
if the file doesn't contain the exact line already.

<br><dt><code>Recurse <var>digit/inf</var></code>
<dd>For recursive descents when editing whole file trees.

<br><dt><code>ReplaceLineWith <var>quoted-string</var></code>
<dd>Replace the line at the current position with the
text in the quoted string. The file pointer remains
pointing to this line after the change.

<br><dt><code>ReplaceAll <var>quoted-regex</var> With <var>quoted-string</var></code>
<dd>Replace all instances of strings matching the regular expression in the
first quotes with the exact string in the second set of quotes,
throughout the current file. Note that cfengine matches on a left to
right basis, with the first match taking precedence, so if your regular
expression matches text ambiguously it is the first occurrence which is
replaced. For example, if you replace <code>cf.*</code> with <code>CFENGINE</code>
and cfengine encounters a line <code>hello cfengine cfengine</code>, then this
will be replaced with <code>hello CFENGINE</code> even though two possible
strings match the regular expression. On the other hand if the
expression is not ambiguous, say replacing <code>cfengine</code> with
<code>CFENGINE</code>, then the result would be <code>hello CFENGINE CFENGINE</code>.

<br><dt><code>ReplaceLinesMatchingField <var>quoted-number</var></code>
<dd>This command replaces any lines in the current file with the current line
set by <code>SetLine</code> or <code>ForEachLineIn</code>, if the lines
are split into fields (e.g. the password file) separated by the
<code>SplitOn</code> character (':' by default), and the corresponding
fields match.

<p>The idea behind this command was to be able to override global
passwords (from a file which gets distributed) by new passwords
in a local file. Rather than maintaining the files separately,
this simply overrides the entries with the new ones See <a href="#FAQS%20and%20Tips">FAQS and Tips</a>.

<br><dt><code>ResetSearch <var>quoted-string</var></code>
<dd>Sets the current-position pointer to the line number
in the quoted string. <code>EOF</code> indicates the end of
the file.

<br><dt><code>RunScript <var>quoted-string</var></code>
<dd>Executes the named script command. Before executing the script any edits
are saved to disk. After the script has executed,
cfengine reloads the file for any further editing
operations. The script (which may be any executable
program) is appended with two arguments: the name of the
file which is being edited and the system hard class
(e.g. sun4, ultrix etc.) of the system executing
the script.

<p>CAUTION: cfengine knows nothing about
the success or failure of anything that is done during the
execution of user scripts. This feature is to be
used at the users own peril!

<br><dt><code>RunScriptIfLineMatching <var>quoted-string</var></code>
<dd>Executes the script named with the <code>SetScript</code>
command only if the current file contains a line matching
the quoted regular expression.

<p>CAUTION: cfengine knows nothing about
the success or failure of anything that is done during the
execution of user scripts. This feature is to be
used at the users own peril!

<br><dt><code>RunScriptIfNoLineMatching <var>quoted-regex</var></code>
<dd>Executes the script named with the <code>SetScript</code>
command if the current file contains no line matching
the quoted regular expression.

<p>CAUTION: cfengine knows nothing about
the success or failure of anything that is done during the
execution of user scripts. This feature is to be
used at the users own peril!

<br><dt><code>SetCommentStart <var>quoted-string</var></code>
<dd>Specify which string should be used for starting
a comment using the commands <code>CommentLineMatching</code>
and <code>CommentLineStarting</code>. The default is the hash
symbol <code>#</code> followed by a single space.

<br><dt><code>SetCommentEnd  <var>quoted-string</var></code>
<dd>Specify which string should be used for ending
a comment using the commands <code>CommentLineMatching</code>
and <code>CommentLineStarting</code>. The default is the empty
string. For example, you could make C style comments
by setting CommentStart to <code>/*</code> and comment
end to <code>*/</code>.

<br><dt><code>SetLine <var>quoted-string</var></code>
<dd>
Sets a current line value which can be appended using
<code>AppendIfNoLineMatching</code> using a regular expression.

<br><dt><code>SetScript <var>quoted-string</var></code>
<dd>Sets the name of a user-supplied script
for editing the current file.

<br><dt><code>SlashCommentLinesContaining <var>quoted-string</var></code>
<dd>Add a <code>//</code> to the start of any line containing the quoted string.

<br><dt><code>SlashCommentLinesMatching <var>quoted-regex</var></code>
<dd>Add a <code>//</code> to the start of any line exactly matching the quoted regular expression.

<br><dt><code>SlashCommentLinesStarting <var>quoted-string</var></code>
<dd>Add a <code>//</code> to the start of any line starting with the quoted string.

<br><dt><code>SplitOn <var>quoted-string</var></code>
<dd>This defines a single character which is to be interpreted as a
field separator for editing files with columns. The default value
for this is <code>:</code>, as is used in the password and group files. 
It is used in conjunction with <code>ReplaceLinesMatchingField</code>.

<br><dt><code>Syslog <var>quoted-string</var></code>
<dd>Set to true or false, on or off to set inform level for this file. 
Default is off.

<br><dt><code>Umask <var>quote mode</var></code>
<dd>Set local umask for file creation and script execution.

<br><dt><code>UnCommentLinesContaining  <var>quoted-string</var></code>
<dd>Uncomment all lines in file containing the quoted string as a
substring. The comment delimiters are assumed to be those
set using SetCommentStart and SetCommentEnd.

<br><dt><code>UnCommentLinesMatching  <var>quoted-regex</var></code>
<dd>Uncomment all lines in file matching the quoted regular expression.  The
comment delimiters are assumed to be those set using SetCommentStart and
SetCommentEnd.

<br><dt><code>UnCommentNLines <var>quoted-string</var></code>
<dd>Uncomments N lines starting from the current position, using
the currently defined method for commenting. Note that the
comment start and end symbols are removed independently, i.e. 
they are not matched, so that a comment may be spread over
several lines. e.g. If using C style <code>/*</code> and <code>*/</code>
comments, the command <code>UnCommentNLines "3"</code> would
uncomment
<pre> /* 1 */
 /* 2 */
 /* 3 */
</pre>

<p>and also
<pre> /* 1
    2
    3 */
</pre>

<br><dt><code>UnsetAbort  <var>quoted-string</var></code>
<dd>Switches off the feature <code>AbortAtLineMatching</code>.

<br><dt><code>WarnIfLineContaining <var>quoted-string</var></code>
<dd>Issue a warning if the quoted string is found as a
substring of one or more lines in the file.

<br><dt><code>WarnIfLineMatching <var>quoted-regex</var></code>
<dd>Issue a warning if the quoted regular expression
matches one or more lines in the file.

<br><dt><code>WarnIfLineStarting <var>quoted-string</var></code>
<dd>Issue a warning if the quoted string matches the start
of one or more lines in the file.

<br><dt><code>WarnIfNoLineContaining <var>quoted-string</var></code>
<dd>Issue a warning if the quoted string is not contained
in one or more lines in the file.

<br><dt><code>WarnIfNoLineMatching <var>reg-ex</var></code>
<dd>Issue a warning if the quoted regular expression does not match
one or more lines in the file.

<br><dt><code>WarnIfNoLineStarting <var>quoted-string</var></code>
<dd>Issue a warning if the quoted string is not found
at the start of one or more lines in the file.

<br><dt><code>WarnIfNoSuchLine <var>quoted-regex</var></code>
<dd>Issue a warning if the quoted regular expression does not
match one or more lines in the file.

</dl>

<p>A limited number of operations can also be performed on purely binary files, e.g. 
compiled programs, in order to search for strings or viral code, or to modify
strings within a program. Binary mode is a mutually exclusive, separate mode to normal
editing. The limit on the size of binary files is set by <code>editbinaryfilesize</code>
in <code>control</code>.
<dl>

<br><dt><code>ReplaceAll <var>regex</var> With <var>literal</var></code>
<dd>
Replaces occurrences of the matched regular expression with\
the provided literal text, only if the length of the literal substitute
is less than or equal to the length of the located string. If the
replacement string is shorter, it is padded with ascii spaces (character 32) by default. 
The padding character can be changed by setting <code>BinaryPaddingChar</code> in <code>control</code>. 
Padding with a null byte would lead to corruption of text within a program.

<br><dt><code>WarnIfContainsString <var>regex/literal</var></code>
<dd>Yields a warning if the literal string or regular expression matches. 
Cfengine first attempts a literal match and then a regular expression
match.

<br><dt><code>WarnIfContainsFile <var>filename</var></code>
<dd>Yields a warning if the contents of the named file exactly match
part of the file which is being edited. This can be used to search for
binary data which cannot be typed directly into the cfengine program,
e.g. virus signatures.

</dl>

<p>It is suggested that you use these editing functions with
caution. Although all possible safeguards have been incorporated into
them, it is still possible through carelessness to do damage to
important files on your system. Always test editing programs carefully
before committing them to your global site configuration.

<p><hr>
Node:<a name="files">files</a>,
Next:<a rel=next href="#filters">filters</a>,
Previous:<a rel=previous href="#editfiles">editfiles</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>files</h2>

<p>The <code>files</code> facility allows you to touch (create), check for the
existence, owner and permissions of files, change the permissions and
test for setuid root programs.

<ul>
<li><a href="#Syntax">Syntax</a>: 
<li><a href="#Recursion">Recursion</a>: 
<li><a href="#Directory%20permissions">Directory permissions</a>: 
<li><a href="#home%20directive">home directive</a>: 
<li><a href="#Owner%20and%20group%20wildcards">Owner and group wildcards</a>: 
<li><a href="#Files%20linkchildren">Files linkchildren</a>: 
<li><a href="#touch">touch</a>: 
<li><a href="#create">create</a>: 
</ul>

<p><hr>
Node:<a name="Syntax">Syntax</a>,
Next:<a rel=next href="#Recursion">Recursion</a>,
Previous:<a rel=previous href="#files">files</a>,
Up:<a rel=up href="#files">files</a>
<br>

<h3>Syntax</h3>

<p>A files-statement can have several options.  We can begin by examining
the form of the statement in pseudo-code:

<pre>  files:

     <var>classes</var>::

        /<var>file-object</var>
                          mode=<var>mode</var>
                          owner=<var>uid-list</var>
                          group=<var>gid-list</var>
                          action=<var>fixall/other-options</var>/<b>warnall</b>
                          links=<b>false/stop</b><var>/traverse/follow/tidy</var>

                          ignore=<var>pattern</var>
                          include=<var>pattern</var>
                          exclude=<var>pattern</var>
                          filter=<var>filter alias</var>

                          define=<var>classlist</var>
                          elsedefine=<var>classlist</var>

                          checksum=<var>md5</var>
                          flags=<var>BSD flags</var>
                          syslog=<var>true/on</var>/<var>false/off</var>
                          inform=<var>true/on</var>/<var>false/off</var>

</pre>

<p>An example would be the following:

<pre>   any::

      /var/spool/printQ  mode=0775  r=0 o=daemon g=daemon  act=fixdirs

</pre>

<p>The meaning of these item is sketched out below and becomes clearer on
looking at a number of examples.  Note that, each of the options below
can be written in either upper or lower case and abbreviated by any
unique abbreviation. 
A file object is interpreted as a directory if you write it in the
following form: <code>/directory-path/.</code>. i.e. a trailing dot signifies
a directory. This then becomes the same as the <code>directory</code> command.

<dl>

<br><dt><code><var>/directory</var></code>
<dd>This is the only obligatory part of a file action.  This is a directory
at which a file search should begin.  This may be a single file or a
directory.  The recursion specifier may be used to force cfengine to
descend into subdirectories in a controlled fashion, starting from this
point, checking files there also.  The wildcard <code>home</code> may also be
used.  See <a href="#home%20directive">home directive</a>.

<br><dt><code>mode=<var>modestring</var></code>
<dd>Specifies what the allowed permissions for files are.  If cfengine finds
that a file's mode is incorrect, the value of the <code>action</code>
option determines what will be done about it.  The modestring should
consist of either a three digit octal numbers with <code>+</code>, <code>-</code> or
<code>=</code> symbols, or a text string like that used by the command
<code>chmod</code>.  For instance: <code>mode=u=rwx,og+rx</code> would mean set the
read/write and execute flags for the user (file owner) and add the
read/execute flags for others and group bits.  An example of the
numerical form might be <code>-002</code> which would mean that the
read-for-others flag should either not be set or should be unset,
depending on the action you choose.  <code>+2000</code> would mean that the
setuid flag should be present or set, depending on the action. 
<code>+2000,-002</code> would be a combination of these.  The <code>=</code> sign
sets to an absolute value, so <code>=755</code> would set the file mode to
mode 755.

<br><dt><code>flags=<var>BSD flags</var></code>
<dd>The free BSD Unices have additional filesystem flags which can be seton
files.  Refer to the BSD <code>chflags</code> documentation for this.  For
example,
<pre>
   /tmp/flags.01  mode=0600 owner=0 group=0
                  flags=uappnd,uchg,uunlnk,nodump,opaque,sappnd,schg,sunlnk
                  action=touch

</pre>

<br><dt><code>recurse=<var>number/inf</var></code>
<dd>This specifier tells cfengine whether or not to recurse into
subdirectories.  If the value is zero, only the named file or directory
is affected.  If the value is 1, it will open at most one level of
subdirectory and affect the files within this scope.  If the value is
<code>inf</code> then cfengine opens all subdirectories and files beginning
from the specified filename.See <a href="#Recursion">Recursion</a>.

<br><dt><code>owner=<var>owner list</var></code>
<dd>This is a list of allowed owners, or uids by number, separated by
commas.  For example <code>root,2,3,sysadm</code>.  In cases where you ask
cfengine to fix the ownership automatically, the owner will be set to
the first owner in the list if and only if it is not one of the named
uids in the list.

<br><dt><code>group=<var>group list</var></code>
<dd>This is a list of allowed groups, or gids by number, separated by
commas.  For example <code>wheel,2,3,sysadm</code>.  In cases where you ask
cfengine to fix the ownership automatically, the group will be set to
the first group in the list if and only if it is not one of the named
gids in the list.

<br><dt><code>action=<var>action</var></code>
<dd>The action is one of the following keywords.
<pre>warnall warndirs warnplain
 fixall fixdirs fixplain
touch linkchildren create compress alert
</pre>

<p>The upper line results only in warnings being issued.  The actions
beginning `fix' prompt cfengine to fix encountered problems without
bothering the user.  No message is issued unless in verbose mode.  The
special features on the third line will be explained separately.  Alert
is like <code>-print</code> in the find command, it triggers on the existence
of files which have not been ignored, excluded or filtered. This should
normally be used together <code>filter</code>, in order to locate files of particular types.

<br><dt><code>include=<var>wildcard/pattern</var></code>
<dd>You can include this option several times to specify specific patterns
which are to be included in the search. Once you specify one
pattern you exclude all files not matching at least one of the
patterns. The case be useful for restricting a search, or for
modifying the permissions of only certain files.

<br><dt><code>exclude=<var>wildcard/pattern</var></code>
<dd>You can include this option several times to specify specific patterns
which are to be excluded from the search. This overrides any patterns
given in the <code>include=</code> list.

<br><dt><code>ignore</code>
<dd>This works like the global ignore directive but here you may
provide a private list of ignorable directories and files. 
Unlike include, exclude this affects the way cfengine parses
directory trees.

<br><dt><code>links=<var>stop/traverse/tidy</var></code>
<dd>Normally cfengine does not descend into subdirectories which are pointed
to by symbolic links.  If you wish to force it to do so (without using
the <code>-l</code> command line option) you may give this option the value
<code>true</code>, or <code>traverse</code>, or <code>follow</code>.  To specify no
recursion you set the value <code>false</code> or <code>stop</code>. 
Note that the value set here in the cfengine program <em>always
overrides</em> the value set by the <code>-l</code> command line option, so you
can protect certain actions from this command line option by specifying
a negative value here.  If you specify no value here, the behaviour is
determined by what you specify on the command line.

<p>The value <code>links=tidy</code> has the same effect as the <code>-L</code> command
line option except that here it may be specified per item rather than
globally.  Setting this value causes links which point to non-existent
files to be deleted.

<p>If the warn directive is used (for directories, plain files or both)
then only a warning message is issued if the file being tested does not
match the specification given.  If the fix directives are used then
cfengine does not issue a warning, it simply fixes the value silently. 
Non-existent files are created by the <code>touch</code> command.  A
directory may be touched (created) by writing the filename
<code>/a/b/c/.</code> with a dot as the last character.  (This may also be
achieved with the <code>directories</code> directive, See <a href="#directories">directories</a>.)

<br><dt><code>define=<var>classlist</var></code>
<dd>If a file operation results in action being taken to fix a file,
the colon, comma or dot separated list of classes becomes defined. 
Warnings do not activate the classes.

<br><dt><code>checksum=md5</code>
<dd>If set this option causes cfengine to add a checksum for the
named file to a database. Changes in the value of this checksum
are then warned as a security issue. This should normally only
be used to monitor binary files which one would not expect to
change often. Note also that the use of this option can mean
a significant performance penalty. The variable <code>ChecksumDatabase</code>
should be set in <code>control:</code> to the filename of a database file
which is used to cache checksum values. Note that it is also
possible to use a database file for cfd's remote copying by checksum. 
If you use the same file for both purposes you risk losing warnings. 
Security warning messages are issued only once and the value in the database is then
changed to the new value of the file automatically i.e. the behaviour is similar to
that of setuid root program detection, See <a href="cfengine-Tutorial.html#Checksum%20Databases">Checksum Databases</a>.

</dl>

<p>The default values are <code>mode=+000</code>, <code>recurse=0</code>,
<code>action=warnall</code> and any owner or group is acceptable.  The default
for <code>links</code> is to not traverse links unless the <code>-l</code> option is
set on the command line.

<p><hr>
Node:<a name="Recursion">Recursion</a>,
Next:<a rel=next href="#Directory%20permissions">Directory permissions</a>,
Previous:<a rel=previous href="#Syntax">Syntax</a>,
Up:<a rel=up href="#files">files</a>
<br>

<h3>Recursion</h3>

<p>The recursion specifier tells cfengine what to do, starting from
<code>/directory name</code>.  A value of <code>r=0</code> means `no recursion' and
any checking is limited only to the named file or directory.  A value of
<code>r=inf</code> implies unlimited recursion.  Cfengine then descends into
all subdirectories checking or setting the permissions of files until it
`bottoms out' at a plain file.  A value such as <code>R=4</code> means descend
recursively into subdirectories, but no more than four levels.  This is
a useful safety net in preventing unforeseen accidents.  A recursive
search also bottoms out on device boundaries and symbolic links
(provided the <kbd>-l</kbd> option is not used).

<p><hr>
Node:<a name="Directory%20permissions">Directory permissions</a>,
Next:<a rel=next href="#home%20directive">home directive</a>,
Previous:<a rel=previous href="#Recursion">Recursion</a>,
Up:<a rel=up href="#files">files</a>
<br>

<h3>Directory permissions</h3>

<p>When you specify the permissions for a whole file tree, using the
recursion specifier it is awkward to have to remember that directories
must be executable.  cfengine will do this for you automatically.  If
you specify that a file tree is to have a read flag set, cfengine will
ensure that the corresponding execute flag is also set for directories
which live in the tree.  So the command

<pre>files:

  myclass::

      /dir  mode=a+rw r=inf fixall

</pre>

<p>would set all plain files to mode 644 and all directories to 755, that
is read/write for everyone on plain files and read/write/execute for
everyone on directories.

<p><hr>
Node:<a name="home%20directive">home directive</a>,
Next:<a rel=next href="#Owner%20and%20group%20wildcards">Owner and group wildcards</a>,
Previous:<a rel=previous href="#Directory%20permissions">Directory permissions</a>,
Up:<a rel=up href="#files">files</a>
<br>

<h3><code>home</code> directive</h3>

<p>If you want to check the files of all the users who have their login
areas on the current host, you can use a wildcard directive <code>home</code>
instead of a directory name.  In this case the file action iterates over
all home directories physically on the current host.  The home
directories are, of course, located by searching for files which match

<pre>$(mountpattern)/$(homepattern)
</pre>

<p>i.e.  the values which are specified in the <code>control</code> part of the
program.  For example the following line is a very useful service to
ignorant users.

<pre>files:

  any::

    home mode=o-w r=inf act=fixall

</pre>

<p>It ensures automatically that no user has files which can be written to
by other arbitrary users.

<p>As a corollary to this, you may write something like
<pre>
  any::

     home/www mode=a+r fixall

</pre>

<p>to specify a special subdirectory of every users' home directory.  This
statement would check that all of the files in users' world wide web
directories were readable for everyone.

<p><hr>
Node:<a name="Owner%20and%20group%20wildcards">Owner and group wildcards</a>,
Next:<a rel=next href="#Files%20linkchildren">Files linkchildren</a>,
Previous:<a rel=previous href="#home%20directive">home directive</a>,
Up:<a rel=up href="#files">files</a>
<br>

<h3>Owner and group wildcards</h3>

<p>If you do not want to explicitly state the owner or group of a file you
may simply omit the group or owner options.

<pre>
  /<var>file-object</var> m=0664 r=inf

</pre>
This example generate a warning if any files under the named directory
do not have permission read/write for all users.

<p><hr>
Node:<a name="Files%20linkchildren">Files linkchildren</a>,
Next:<a rel=next href="#touch">touch</a>,
Previous:<a rel=previous href="#Owner%20and%20group%20wildcards">Owner and group wildcards</a>,
Up:<a rel=up href="#files">files</a>
<br>

<h3>Files linkchildren</h3>

<p>The <code>linkchildren</code> facility is almost identical to that already
described under <code>links</code>.  See <a href="#Link%20Children">Link Children</a>.  The only
difference here is that the ownership and permissions on the links are
set all in one operation.  For example:

<pre><var>myclass</var>::

   /local/lib/emacs m=0770 o=me g=mygroup act=linkchildren

</pre>

<p><hr>
Node:<a name="touch">touch</a>,
Next:<a rel=next href="#create">create</a>,
Previous:<a rel=previous href="#Files%20linkchildren">Files linkchildren</a>,
Up:<a rel=up href="#files">files</a>
<br>

<h3>touch</h3>

<p>The <code>touch</code> facility creates a new file with the
specified permissions and ownership, or corrects the
permissions and ownership of an existing file, in addition
to updating the time stamps.

<pre><var>myclass</var>::

   /<var>newfile</var> mode=0644 action=touch

</pre>

<p><hr>
Node:<a name="create">create</a>,
Previous:<a rel=previous href="#touch">touch</a>,
Up:<a rel=up href="#files">files</a>
<br>

<h3>create</h3>

<p>This is like <code>touch</code> except that an existing
file's time stamps, permissions and ownership will not be modified
if the file already exists. If the file does not exist, the
attributes are set to the values specified, or to the default
values of <code>0644</code>.

<p><hr>
Node:<a name="filters">filters</a>,
Next:<a rel=next href="#groups">groups</a>,
Previous:<a rel=previous href="#files">files</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>filters</h2>

<p>A filter is a way of selecting or pruning during a search over
files or processes. Since filter rules could apply to several objects, cfengine
allows you to define filter conditions as separate objects to be
applied in different contexts.

<p>Filter objects can be used in <code>copy</code>, <code>editfiles</code>,
<code>files</code>, <code>tidy</code> and <code>processes</code>. In most cases one
writes
<pre>.. filter=&lt;i&gt;filteralias&lt;/i&gt;
</pre>
in the appropriate command. The exception is <code>editfiles</code>, where the syntax
is
<pre>{
..
Filter "filteralias"
..
}
</pre>
Example:

<pre>
files:

 /tmp filter=testfilteralias action=alert r=inf

</pre>

<p>Filters are defined in a separate section. Filters for files
and processes are defined together. They differ only in the
criteria they contain. Here is are examples of file filters:
<pre>Filters:

  { filteralias1

  Owner:     "mark|cell|motd"
  Group:     "ecg|mark"
  Mode:      "700"

  FromCtime: "date(2000,1,1,0,0,0)"    # absolute date
  ToCtime:   "now"

  FromMtime: "tminus(1,0,0,2,30,0)"    # relative "ago" from now
  ToMtime:   "inf"                     # end of time

  FromAtime: "date(1997,2,22,0,0,0)"
  ToAtime:   "inf"

  FromSize:  "10000"                   # File size interval
  ToSize:    "10mb"

  ExecRegex: "/usr/bin/file(.*ascii.*)"# Result from "files" command

  Type:      "dir|link"                # reg|link|dir|socket|fifo|door|char|block

  NameRegex: ".*.asc"                  # regex matching file name

  IsSymLinkTo: "/dev/null"             # True if file is a link to object name regex

  Result:    "Type"                    # Result which shouldbe returned

  }

 #########################################

  { testfilteralias2

  ExecProgram: "/bin/ls $(this)"       # True if the program returns true. $(this) is the current object
  }

 #########################################

  { testfilteralias3

  Owner: "mark"
  }
</pre>

<p>Filters are evaluated like classes. In fact, the filtering works by evaluating
the class attributes for each file.

<p>File filters:

<dl>
<dt><code>Owner:</code>
<dd> and Group can use numerical id's or
names, or <code>"none"</code> for users or groups which are undefined in
the system passwd/group file.

<br><dt><code></code>
<dd>Mode: applies only to file objects. It shares syntax with
the <code>mode=</code> strings in the files command. This test returns
true if the bits which are specified as `should be set' are indeed
set, and those which are specified as `should not be set' are not set.

<br><dt><code>Atime:,Ctime:,Mtime:</code>
<dd>apply only to file objects. 
These specify ranges From and To. If the file's time stamps
lie in the specified range, this returns true. Times are
specfied by a six component vector
<pre>(year,month,day,hour,minutes,seconds)
</pre>
This may be evaluated as two functions: date() or tminus()
which give absolute times and times relative to the current time respectively. 
In addition, the words now and inf may be used. 
e.g.

<pre>  FromCtime: "date(2000,1,1,0,0,0)"   # absolute date
  ToCtime:   "now"

  FromMtime: "tminus(1,0,0,2,30,0)"     # relative "ago" from now
  ToMtime:   "inf"                     # end of time
</pre>

<br><dt><code>Type:</code>
<dd>applies only to file objects may be a list of file types
which are to be matched. The list should be separated by the OR symbol
`|', since these types are mutually exclusive. The possible values are
currently
<pre>reg|link|dir|socket|fifo|door|char|block
</pre>
<br><dt><code>ExecRegex:</code>
<dd>matches the test string against the output of the specified command. 
<br><dt><code>NameRegex:</code>
<dd>matches the name of the file with a regular expression. 
<br><dt><code>IsSymLinkTo:</code>
<dd>applies only when the file object $(this) is a symbolic link. It is true
if the regular expression matches the contents of the link. 
<br><dt><code>ExecProgram:</code>
<dd>matches if the command returns successfully (with return code 0). 
Note that this feature introduces an implicit dependency on the command being
called. This might be exploitable as a security weakness by advanced intruders. 
<br><dt><code>Result:</code>
<dd>specifies the way in which the above elements are combined
into a single filter. 
</dl>

<p>Process filters:

<dl>
<dt><code>PID:</code>
<dd> process ID (quoted regex)
<br><dt><code>PPID:</code>
<dd> parent process ID (quoted regex)
<br><dt><code>PGID:</code>
<dd> process group ID (quoted regex)
<br><dt><code>RSize:</code>
<dd> resident size (quoted regex)
<br><dt><code>VSize:</code>
<dd> virtual memory size (quoted regex)
<br><dt><code>Status:</code>
<dd> status (quoted regex)
<br><dt><code>Command:</code>
<dd> CMD or COMMAND fields (quoted regex)
<br><dt><code>(From/To)TTime:</code>
<dd> Total elasped time in TIME field (accumulated time)
<br><dt><code>(From/To)STime:</code>
<dd>Starting time for process in STIME or START field (accumulated time)
<br><dt><code>TTY:</code>
<dd>terminal type, or none (quoted regex)
<br><dt><code>Priority:</code>
<dd>PRI or NI field (quoted regex)
<br><dt><code>Threads:</code>
<dd>NLWP field for SVR4 (quoted regex)
<br><dt><code>Result:</code>
<dd>logical combination of above returned by filter (quoted regex)
</dl>
Examples: processes started between 18th Nov 2000 and now.
<pre>  { filteralias

  FromSTime: "date(2000,11,18,0,0,0)"
  ToSTime:   "now"
  }
</pre>
All processes which have accumulated between 1 and 20 hours of CPU time.
<pre>  { filteralias

  FromTTime:  "accumulated(0,0,0,1,0,0)"
  ToTTime:    "accumulated(0,0,0,20,0,0)"
  }
</pre>

<ul>
<li><a href="#Complete%20filter%20examples">Complete filter examples</a>: 
</ul>

<p><hr>
Node:<a name="Complete%20filter%20examples">Complete filter examples</a>,
Previous:<a rel=previous href="#filters">filters</a>,
Up:<a rel=up href="#filters">filters</a>
<br>

<h3>Complete filter examples</h3>

<p>Here is an example filter to search for all files which are either directories or links,
or any kind of file owned by mark, in group cfengine.
<pre>
control:

 actionsequence = ( files )

files:

 /tmp       filter=testfilteralias action=alert r=inf
 /cfengine  filter=testfilteralias action=fixall r=inf mode=644

filters:

  { testfilteralias

  Owner:     "mark"
  Group:     "cfengine"
  Type:      "dir|link"

  Result:    "Type|(Owner.Group)"  # Both owner AND group required correct
  }

</pre>
Find all ELF executables using data from the Unix <code>file</code> command. 
Caution, this takes a long time if used indescriminately.
<pre>
control:

 actionsequence = ( files )

files:

 /tmp       filter=testfilteralias action=alert r=inf
 /cfengine  filter=testfilteralias action=fixall r=inf mode=644

filters:

  { testfilteralias

  ExecRegex: "/bin/file (.*ELF.*)"

  Result: "ExecRegex"
  }
</pre>
Here is an example which warns of any process coupled to a terminal
started in November:

<pre>control:

 actionsequence = ( processes )

filters:

  { filteralias
  FromSTime: "date(2000,11,0,0,0,0)"
  ToSTime:   "date(2000,11,30,0,0,0)"
  TTY: ".*pt.*"
  Result: "TTY.STime"
  }

processes:

 "." filter=filteralias action=warn

</pre>

<p><hr>
Node:<a name="groups">groups</a>,
Next:<a rel=next href="#homeservers">homeservers</a>,
Previous:<a rel=previous href="#filters">filters</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>groups/classes</h2>

<p>The <code>groups</code> action (equivalently referred to as <code>classes</code> as
of version 1.4.0) is used to define classes which stand for groups of
hosts.  If you use the NIS (network information service) facility for
defining <em>netgroups</em> then this idea will already be familiar to you
and you can probably use your already-defined netgroups in cfengine.

<p>To define a group, you simply make a list and assign it a name.  Here is
an example of the syntax:

<pre>
groups:

   science = ( saga tor odin )

   packages = ( saga )

   AllHomeServers   = ( saga )
   AllBinaryServers = ( saga )

   OIH_servers = ( saga )
   OIH_clients = ( tor odin )

   notthis = ( !this )

</pre>

<p>To include a list of hosts from a NIS netgroup, you use the <code>+</code> symbol, or
the <code>+@</code> construction.  For example:

<pre>
groups:

   science = ( +science-allhosts )

   physics = ( +physics-allhosts )

   physics_theory = ( +@physics-theory-sun4 dirac feynman schwinger )

</pre>

<p>Using an enormous netgroup does not use up any space.  A group
declaration results in the storage of only the class name regardless of
how many hosts are in the list.  The rule is that the left hand side of
the assignment becomes defined (true) if the list on the right hand side
includes the host which is parsing the file -- i.e.  <code>$(host)</code>.

<p>In some cases your netgroups will not correspond exactly to the list you
want, but it might be more convenient to use a netgroup <em>except</em>
for certain hosts.  You can `undefine' or remove hosts from the netgroup
list by using the minus `-' symbol.  For example:

<pre>
group = ( +mynetgroup -specialhost -otherhost )

</pre>

<p>which means, of course, all hosts in netgroup <code>mynetgroup</code> except
for <code>specialhost</code> and <code>otherhost</code>.  Finally, you may also
subtract two netgroups in the following manner.

<pre>group = ( +bignetgroup -smallnetgroup )
</pre>

<p>The `minus' command effectively eliminates its members from
<code>bignetgroup</code> if they exist within that group.  If none of the
hosts in <code>smallnetgroup</code> exist in <code>bignetgroup</code> then the
command has no effect.

<p>Groups may now contain previously defined cfengine groups too. This
allows one class to inherit the attributes of another class, for instance:

<pre>
  AllSun4Hosts   = ( sonny sunny solar stella )
  AllUltrixHosts = ( ully olly wally golly )

  AllBSD = ( AllSun4Hosts AllUltrixHosts )

</pre>

<p>The classes on the right hand side are effectively ORed together into
the left hand side.  This enables complex classes to be constructed from
several other basic classes, e.g.

<pre>
  SpecialTimes = ( Hr00 Monday Day1 )

</pre>

<p>which evaluates to true every day when it between 00:00 hours and 00:59,
all day Monday and all day on the first day of every month.

<p>Finally, you can define groups (strictly classes) by the result of a shell
command. A shell command or program is deemed to be `true' if it
exits with a status of zero, i.e. it calls <code>exit(0)</code>. Any other
value is taken to be false. You can include shell commands as the members
of groups in order to define classes based on the outcomes of your
own scripts by enclosing the script in single or double quotes:

<pre>
   have_cc = ( '/bin/test -f /usr/ucb/cc' )

</pre>

<p>The class <code>have_cc</code> will then be defined if the shell command returns
true. Of course, you can put any script or program in the single quotes as
long as they adhere to the convention that zero exit status means true. 
If you have several members which are shell commands, then the effect is
to make the class the logical OR of the scripts' results.

<p>As of version 1.4.0, you may use the synonym <code>classes</code> for <code>groups</code>.

<p><hr>
Node:<a name="homeservers">homeservers</a>,
Next:<a rel=next href="#ignore">ignore</a>,
Previous:<a rel=previous href="#groups">groups</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>homeservers</h2>

<p>The <code>homeservers</code> declaration need only be used if you are using
cfengine's model for mounting NFS filesystems.  This declaration informs
hosts of which other hosts on the network possess filesystems containing
home directories (login areas) which client hosts should mount.

<p>A sample homeserver declaration looks like this:

<pre>
homeservers:

   Physics::  einstein
   Math::     riemann euler

</pre>

<p>The meaning of this declaration is the following.  Any host which finds
itself to be a member of the classes on the left hand side of the
assignment need to mount all home directory resources from the hosts on
the right hand side of the assignment.  The pattern variable
<code>homepattern</code> is used to determine which resources are home
directories in the list of <code>mountables</code>.  See <a href="#mountables">mountables</a>.

<p>Let us consider an example in which <code>homepattern</code> is set to the
wildcard value <code>home?</code> and the mountables list is given by

<pre>mountables:

   einstein:/mysite/einstein/home1
   einstein:/mysite/einstein/home2
   riemann:/mysite/riemann/local
   euler:/mysite/euler/home1

</pre>

<p>Any host in the group <code>Physics</code> would now want to mount all home
directories from the host <code>einstein</code>.  There are two of these. 
Both the filesystems listed for <code>einstein</code> match the
<code>homepattern</code> variable since they end in <code>home?</code>.  cfengine
would therefore take this to mean that all hosts in <code>Physics</code>
should mount both of these filesystems.

<p>Hosts in <code>Math</code>, on the other hand, should mount only
homedirectories from the hosts <code>riemann</code> and <code>euler</code>.  There
is only a single filesystem on <code>riemann</code> and it does not match
<code>homepattern</code>, so it is not mounted.  On <code>euler</code> there is a
match, so this filesystem will be added to the appropriate hosts.

<p><em>Cfengine picks out home directory resources from the
<code>mountables</code> list by trying to match the <code>homepattern</code>
variable, starting from the end of the directory name.  You do not
therefore have to use the designation <code>/site/host/home?</code>  but this
is a simple choice and is highly recommended.</em>

<p><hr>
Node:<a name="ignore">ignore</a>,
Next:<a rel=next href="#import">import</a>,
Previous:<a rel=previous href="#homeservers">homeservers</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>ignore</h2>

<p>When you specify a recursive search as part of a <code>files</code>,
<code>tidy</code> or <code>copy</code> action, you would sometimes like to exclude
certain directories from the list of sub directories.  In most cases you
will want to do this on a per-command basis (see the pages for these
actions separately), but you can also make a global ignore list.  This
can be accomplished by adding the directory to the ignore-list.  The syntax
is

<pre>
  ignore:

     <var>wildcards/directories/filenames</var>

</pre>

<p>For example:

<pre>
ignore:

   any::

      #
      # Prevent tidying .X11 directories in /tmp where
      # window managers write semaphores
      #

      .X11

      #
      # Don't tidy emacs locks
      #

      !*
      /local/lib/gnu/emacs/lock/
      /local/tmp
      /local/bin/top
      /local/lib/tex/fonts
      /local/etc
      /local/www
      /local/mutils/etc/finger.log


</pre>

<p>None of the above directories will be checked or entered during
recursive descents unless a specific command is initiated to search
those directories with their names as the top of the search tree.

<p>A handy tip if you are tidying <code>/tmp</code> recursively is to include the
directory <code>.X11</code> here.  This directory is used by the X-windows
system and deleting it while a window manager has an open session can
cause the user some trouble.

<p>Ignore refers to all recursive searches in tidy, files, copy and links.

<p><hr>
Node:<a name="import">import</a>,
Next:<a rel=next href="#interfaces">interfaces</a>,
Previous:<a rel=previous href="#ignore">ignore</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>import</h2>

<p>To break up a large configuration file into smaller files you can use
the include directive.  This conditionally reads in files if the class
on the left hand side of the assignment matches the host parsing the
file.  This enables also a variety of cfengine configuration scripts to
read in a standard set of default settings.  The syntax of the statement
is:

<pre>
import:

   any::

      cf.global_classes


   linux::

      cf.linux_classes


</pre>

<p>Note that, if you define variables in an imported file they will not be
defined for operations in their parent files. This because cfengine reads in all the
import files after the main file has been parsed--not at the place where you
call import in your script. This means that variables or macros defined in
imported files are only defined after the main program. Variables from earlier
files are inherited by later includes, but not <em>vice-versa</em>.

<p><hr>
Node:<a name="interfaces">interfaces</a>,
Next:<a rel=next href="#links">links</a>,
Previous:<a rel=previous href="#import">import</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>interfaces</h2>

<pre>
 interfaces:

   <var>classes</var>::

     <var>interfacename</var> netmask=<var>netmask</var> broadcast=<var>broadcast</var>

</pre>

<p>If you have more than one network interface, or you do not wish to use the
default interface name, this section may be used to define further
interfaces to be checked. This feature can replace the older method
of setting netmask and broadcast address in <code>control:</code>. If the <code>netmask</code>
variable is not set, cfengine ignores the default interface configuration. 
Example:

<pre>
  interfaces:

    "le1" netmask=255.255.255.0 broadcast=ones
    "le2" netmask=255.255.255.0 broadcast=ones

</pre>

<p><hr>
Node:<a name="links">links</a>,
Next:<a rel=next href="#mailserver">mailserver</a>,
Previous:<a rel=previous href="#interfaces">interfaces</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>links</h2>

<p>The symbolic links function is one of the greatest plusses in cfengine
as a system administration tool.  It allows you to do two things: check
single links for correctness and consistency (or make them if they do
not exist), and check or make links to every file in a designated
directory.  This latter feature is called multiple linking or linking
children.  The <code>linkchildren</code> feature is also available from the
<code>files</code> action  See <a href="#files">files</a>. The syntax of a link item is:

<pre>
  <var>from-link</var> -&gt;[!] <var>to-object</var>
 <var>or</var>
  <var>from-link</var> +&gt;[!] <var>to-object</var>

            type=<b>symbolic/absolute/abs</b>/<var>hard/relative/rel</var>
            copy=<var>pattern</var>
            recurse=<var>number/inf/</var><b>0</b>
            copytype=<var>checksum/</var><b>ctime</b>
            include=<var>pattern</var>
            exclude=<var>pattern</var>
            ignore=<var>pattern</var>
            action=<var>silent</var>
            deadlinks=<b>kill</b>/<var>force</var>
            define=<var>classlist</var>
            nofile=<b>kill</b>/<var>force</var>
            syslog=<var>true/on</var>/<var>false/off</var>
            inform=<var>true/on</var>/<var>false/off</var>

</pre>

<p><em>The special variable <code>$(binserver)</code> can be used in <code>links</code>.</em>

<ul>
<li><a href="#Single%20links">Single links</a>: 
<li><a href="#Multiple%20Links">Multiple Links</a>: 
<li><a href="#Link%20Children">Link Children</a>: 
<li><a href="#Relative%20and%20absolute%20links">Relative and absolute links</a>: 
<li><a href="#Hard%20links">Hard links</a>: 
</ul>

<p><hr>
Node:<a name="Single%20links">Single links</a>,
Next:<a rel=next href="#Multiple%20Links">Multiple Links</a>,
Previous:<a rel=previous href="#links">links</a>,
Up:<a rel=up href="#links">links</a>
<br>

<h3>Single links</h3>

<p>To define a single link, you create an entry of the following
form:

<pre>
links:

  <var>class</var>::

     <var>linkname</var> -&gt; <var>object_to_link_to</var>
     <var>linkname</var> -&gt; ./<var>relative_link</var>
     <var>linkname</var> -&gt; ../<var>relative_link</var>

</pre>

<p>If links exists and point to their intended destinations then no
action is taken.  If a link exists but points incorrectly then a
warning is issued, unless the pling operator <code>!</code> is given, in
which case the correct value is forced. 
If the link exists and points to a file which does
not exist a warning is issued unless the command line option <code>-L</code>
is used, in which case the link is deleted.  See <a href="#Runtime%20Options">Runtime Options</a>.

<p>Here is an example of some valid link statements.

<pre>
links:

  Physics.sun4::

   /usr/local       -&gt; /$(site)/$(host)/local
   /home            -&gt; /$(site)/$(host)/u1
   /etc/sendmail.cf -&gt; /usr/local/mail/etc/global-sendmail.cf

   /usr/lib/sendmail -&gt;! /local/lib/sendmail

</pre>

<p>cfengine makes any directories which are required leading up to the link
name on the left hand side of the arrow automatically. In the last
example the `pling' forces cfengine to make the link even if a file for
link exists previously. Plain files are saved by appending
<code>.cfsaved</code> to the filename, or by moving to a repository, whereas
old links are removed.  The same effect can be enforced globally using
the <code>-E</code> option, but only if the program is run interactively. (In
this case a prompt is issued to make sure that you wish to use such a
big hammer on your system!)

<p>The link operation accepts a number of parameters

<dl>

<br><dt><code>type=<var>hard/relative/absolute</var></code>
<dd>If the link type is hard, a hard link is created See <a href="#Hard%20links">Hard links</a>. 
Symbolic links may specify two special types. If <code>relative</code>
is selected, and the `to' object is an absolute path name,
the link name will be rewritten as a pathname relative
to the source file, using <code>.</code> and <code>..</code> to move relative
to the current directory. For instance, a link from <code>/usr/local/file</code>
to <code>/usr/file</code> would be linked as <code>./../file</code>. 
If the `to' object is already relative,
this has no effect.

<p>If <code>absolute</code> is specified, cfengine
will try to resolve the true path location of the `to' object,
expanding any symbolic links or dots in the path name, up to
a maximum of four levels of symbolic links.

<br><dt><code>copy=<var>pattern</var></code>
<dd>This option can be repeated any number of times to build up a list of
filenames or wildcards which are to be copied rather than linked
symbolically. The copy is made on an age-comparison basis. A global
variable may also be set to invoke this feature See <a href="#copylinks">copylinks</a>. 
Directories cannot be copied in this way.

<br><dt><code>copytype=<var>checksum/ctime</var></code>
<dd>This specifies the basis for deciding whether to update a file
which is to be copied instead of linked See <a href="#copy">copy</a>.

<br><dt><code>nofile=<b>kill</b>/<var>force</var></code>
<dd>This decides what happens to links which point to non-existent
files. The default action is to remove such links, or refuse to
create them. By setting the <var>force</var> option you can force
cfengine to make symbolic links to files which do not exist. 
This is useful for setting up links to filesystems which
are not permanently mounted.

<br><dt><code>exclude=<var>pattern</var></code>
<dd>This option can be repeated any number of times to build up a list of
filenames or wildcards which are to be excluded from the linking
process. A global variable may also be set to invoke this feature
See <a href="#excludelinks">excludelinks</a>.

<br><dt><code>ignore</code>
<dd>This works like the global ignore directive but here you may
provide a private list of ignorable directories and files. 
Unlike include, exclude this affects the way cfengine parses
directory trees.

<br><dt><code>recurse=<var>number/</var>inf</code>
<dd>This option can only be used with multiple link operations See <a href="#Multiple%20Links">Multiple Links</a>. 
If this option is specified, cfengine links only non-directory
objects. Directories are instead created and links within those
directories are also created. The value of this option specifies the
maximum number of levels to which cfengine should recursively descend a
link tree. <code>inf</code> means infinite recursion. Cfengine also ignores
files and directories in the ignore list See <a href="#ignore">ignore</a>.

<br><dt><code>define=<var>classlist</var></code>
<dd>If a link is created or replaced, the colon, comma or dot separated
list of classes becomes defined.

</dl>

<p>The final feature of the links facility is connected to the use of the
cfengine model for mounting NFS filesystems.  In particular it concerns
the variable <code>$(binserver)</code>.  The easiest way to understand this
feature is to illustrate a couple of examples.  Consider the following:

<pre>links:

   any::

      /local -&gt; /${site}/${binserver}/local

</pre>

<p>The result of this command is quite different depending on which host is
executing it.  The variable <code>$(site)</code> clearly has a fixed value,
but the variable <code>$(binserver)</code> might expand to any valid binary
server for the host executing the program.  See <a href="#binservers">binservers</a>.  The
procedure cfengine adopts is to go through its list of mountables,
keeping only those mountable resources which belong to defined binary
servers for the current host.  It then attempts to match a filesystem by
substituting <code>$(binserver)</code> with each of its valid binservers in
turn and it matches the first one binary server which yields an existing
file.

<p>Note that every host is a binary server for itself, so that the value of
<code>$(binserver)</code> which has absolute priority is alway the same as the
value of <code>$(host)</code>.  This ensures that the link will always be made
to a local filesystem if the rules of the model are upheld.

<p><hr>
Node:<a name="Multiple%20Links">Multiple Links</a>,
Next:<a rel=next href="#Link%20Children">Link Children</a>,
Previous:<a rel=previous href="#Single%20links">Single links</a>,
Up:<a rel=up href="#links">links</a>
<br>

<h3>Multiple Links</h3>

<p>With the link symbol <code>+&gt;</code>, you opt to link all of the files in a
directory to corresponding files in another directory.  This procedure is
sometimes useful for installing software.  In the example

<pre>
links:

  myclass::

     /usr/local/bin +&gt;  /usr/local/lib/perl/bin
     /opt           +&gt;! /local

</pre>

<p>every file in the directory <code>/usr/local/lib/perl/bin</code> is linked
symbolically to a corresponding file in <code>/usr/local/bin</code>. The
`pling' character forces cfengine to replace old links or plain files
already existing. Old links are removed, whereas old files are saved
by appending <code>.cfsaved</code> to the filename See <a href="#repository">repository</a>.

<p>Each time cfengine runs it goes through all of the files in the
directory concerned and checks the appropriate link accordingly.  If new
files appear, new links will be added.  If a file disappears but the
link to it remains, a warning will be issued, unless the <code>-L</code>
command line option is used, in which case the link is deleted. 
See <a href="#Runtime%20Options">Runtime Options</a>.

<p><hr>
Node:<a name="Link%20Children">Link Children</a>,
Next:<a rel=next href="#Relative%20and%20absolute%20links">Relative and absolute links</a>,
Previous:<a rel=previous href="#Multiple%20Links">Multiple Links</a>,
Up:<a rel=up href="#links">links</a>
<br>

<h3>Link Children</h3>

<p>The linkchildren directive is a closely related to the cfengine model
for NFS filesystems.  It is a way of making links which embodies a
rudimentary kind of `intelligence'.

<p>Consider the following:

<pre>links:

   any::

      /usr/local/lib/emacs +&gt; linkchildren

</pre>

<p>The word <code>linkchildren</code> automatically tells cfengine that it should
look for an appropriate file to link to on a binary server for the
current host.  The exact meaning of the above statement is as follows. 
cfengine begins searching though the list of mountable resources,
discarding any filesystems which do not belong to valid binary servers. 
It looks for a filesystem ending in `emacs' (the last link of the left
hand side).  If all is well, these file systems are already mounted and
they can be searched.  If no resource is found ending in `emacs', we go
to the next link <code>lib</code> and look for a filesystem ending in `lib'. 
If this is not found we go to <code>local</code> and so on.  When a match is
made, cfengine then tries to locate the file by checking whether it
exists relative to the matched filesystem.  For example, suppose `local'
matched with <code>host:/site/host/local</code>.  It would then try to locate
<code>host:/site/host/local/lib/emacs</code> and link all of the children
therein to the local file directory <code>/usr/local/lib/emacs</code>.

<p>Here is another example which makes reference to the cfengine model for
mounting NFS filesystems.  Suppose you have a host with some spare disk
space.  You want to mount <code>/usr/local</code> from the binary architecture
server, but you also want to use the disk you have locally.  The
following lines

<pre>links:

   electron::

      /$(site)/electron/local +&gt; linkchildren

   any::

      /usr/local              -&gt; /$(site)/$(binserver)/local

</pre>

<p>have the effect of creating a directory <code>/$(site)/electron/local</code>
and filling it with links to all of the files and directories on the
binary server's mounted filesystem.  It results in an exact copy (by
linkage) on the local disk, but does not use up your local disk space. 
The space you have remaining could, for example, be used for software
with a special license for that host.  The second link links
<code>/usr/local</code> to the `nearest' binary server.  But the nearest
binary server is always <code>$(host)</code> which means this evaluates to a
file which now exists because of the first command, so on the host
`electron' the directory <code>/usr/local</code> ends up being a link to
<code>/$(site)/electron/local</code> which is full of links to the binary
server.

<p>If you've caught your breath after that mouthful you probably have mixed
feelings about creating a bunch of links in this way.  What happens if
the files they point to are removed? Then you are left with a lot of
useless links.  Actually this is no problem for cfengine, since you can
ask cfengine to simply remove links which point to non-existent files
See <a href="#files">files</a>.  Nevertheless, this feature clearly requires some caution
and is mainly a spice for advanced users of the cfengine model.

<p><hr>
Node:<a name="Relative%20and%20absolute%20links">Relative and absolute links</a>,
Next:<a rel=next href="#Hard%20links">Hard links</a>,
Previous:<a rel=previous href="#Link%20Children">Link Children</a>,
Up:<a rel=up href="#links">links</a>
<br>

<h3>Relative and absolute links</h3>

<p>When specifying symbolic linking, you can ask cfengine
to change the link type to be either relative to the
source or to be an absolute path. What this means is the
following. Consider the following link:
<pre>
   /var/tmp/cfengine -&gt; /local/cfengine

</pre>

<p>If we add the option <code>type=relative</code>, then instead
of creating a link which points to <code>/local/cfengine</code>,
the link is created pointing to the location

<pre>  ./../../local/cfengine
</pre>

<p>In other words, the link is relative to the calling
directory <code>/var/tmp</code>.

<p>If a link is specified as being absolute with the option
<code>type=absolute</code>, then cfengine attempts to resolve
to value of the link so as to be the true path of the
target. If the target name contains a symbolic link, then
this is expanded as far as possible to give the true
path to the file. For example, if <code>/local</code> is
really a link to <code>/site/myhost/local</code> then the link
would point to <code>/site/myhost/local/cfengine</code>.

<p><hr>
Node:<a name="Hard%20links">Hard links</a>,
Previous:<a rel=previous href="#Relative%20and%20absolute%20links">Relative and absolute links</a>,
Up:<a rel=up href="#links">links</a>
<br>

<h3>Hard Links</h3>

<p>Cfengine will also allow you to create hard links to regular files.  A
hard link is in every way identical to the original file, it merely has
a different name (technically, it is a duplicate inode). To create a
hard link you use the link-option <code>type=hard</code>. For example:

<pre>
links:

   /<var>directory</var>/<var>newname</var> -&gt; /<var>directory</var>/<var>othername</var> type=hard

</pre>

<p>Cfengine will not create hard links to directories or other special files. 
This is always a slightly dubious practice and is best avoided anyway. 
POSIX says that the hard link can be on a different device to the file
it points to, but both BSD and System 5 restrict hard links to be on
the same device as their predecessors. Cfengine has no policy on this,
but--in the theoretical case in which the hard link and the predecessor
were on different file systems--it becomes near impossible to determine
with certainly between a hard link and a very similar regular file, and thus
cfengine issues a warning in verbose mode about this eventuality. 
Provided both link and predecessor are on the same filesystem cfengine
determines the status of hard links by comparing the device and inode
numbers of the file pointed to.

<p><hr>
Node:<a name="mailserver">mailserver</a>,
Next:<a rel=next href="#miscmounts">miscmounts</a>,
Previous:<a rel=previous href="#links">links</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>mailserver</h2>

<p>The <code>mailserver</code> declaration need only be used if you are using
cfengine's model for mounting NFS filesystems.  This declaration informs
hosts of which NFS filesystem contains mail for its users.  All hosts
apart from the mail-host itself must then mount the mail spool directory
across the network.  The declaration looks like this:

<pre>
mailserver:

   <var>class</var>::      mailhost:/var/spool/mail

</pre>

<p>The result of the <code>mailcheck</code> command in the action-sequence is now
to mount the filesystem <code>/var/spool/mail</code> on the host
<code>mailhost</code>.  This action is carried out on any machine which does
not already have that filesystem mounted.

<p>The mail spool directory is mounted, by default, onto the official mail
spool directory for the system which is parsing the program.  In other
words, on an HPUX system, the spool directory is mounted on
<code>/usr/mail</code> by default, whereas on a Sun system it would be mounted
on <code>/var/spool/mail</code>.  The default location can be changed by using
the resource file.  See <a href="#cfrc%20resource%20file">cfrc resource file</a>.

<p><hr>
Node:<a name="miscmounts">miscmounts</a>,
Next:<a rel=next href="#mountables">mountables</a>,
Previous:<a rel=previous href="#mailserver">mailserver</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>miscmounts</h2>

<p>If you do not use the cfengine model for statically mounting NFS
filesystems (or if there are filesystems which do not naturally fall
into the bounds of that model) then you can still statically mount
miscellaneous filesystems using a statement of the form:

<pre>
miscmounts:

   <var>class</var>::

      <var>infohost</var>:<var>source-directory</var> <var>destination</var> <var>mode</var>

      <var>infohost</var>:<var>source-directory</var> <var>destination</var> mode=<var>mode</var>

</pre>

<p>For example
<pre>
   physics::

    # old syntax

      libraryserver:/$(site)/libraryserver/data1
                          /$(site)/libraryserver/data1 ro

    # consistent syntax

      libraryserver:/$(site)/libraryserver/data2
                          /$(site)/libraryserver/data2 mode=ro

      host:/foo /foo mode=rw,bg,hard,intr

</pre>

<p>This statement would mount the directory
<code>/$(site)/libraryserver/data</code> physically attached to host
libraryserver onto a directory of the same name on all hosts in the
group <code>physics</code>.  The modes <code>ro</code> and <code>rw</code> signify
read-only and read-write respectively. 
If no mode is given, read-write is assumed.

<p><hr>
Node:<a name="mountables">mountables</a>,
Next:<a rel=next href="#processes">processes</a>,
Previous:<a rel=previous href="#miscmounts">miscmounts</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>mountables</h2>

<p>The <code>mountables</code> declaration need only be used if you are using
cfengine's model for mounting NFS filesystems.  This declaration informs
hosts of what filesystem resources are available for mounting.  This
list is used in conjunction with <code>binservers</code> and
<code>homeservers</code> to determine which filesystems a given host should
mount, according to the cfengine model.

<p>The syntax of the list is:

<pre>
mountables:

   <var>class</var>::

   server:/site/server/u1
   server:/site/server/local
   linuxhost:/site/linuxhost/local
   linuxhost:/site/linuxhost/u1


</pre>

<p>Notice that binary and home-directory filesystems are mixed freely here. 
Cfengine determines which of the entries are homedirectories using the
<code>homepattern</code> variable.

<p>Every time you add a disk or a mountable partition to your network, you
should add the partition to the list of mountables.

<p><em>NOTE: This list is read in order, top down.  Cfengine looks for
the first filesystem matching a given binary server when expanding the
variable <code>$(binserver)</code>, so sometimes the ordering of filesystems
matters.</em>

<p>This list can be accessed in editfiles, to allow straightforward
configuration of the automounter, using the command <code>AutomountDirectResources</code>.

<p><hr>
Node:<a name="processes">processes</a>,
Next:<a rel=next href="#required">required</a>,
Previous:<a rel=previous href="#mountables">mountables</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>processes</h2>

<p>Using the processes facility, you can test for the existence of
processes, signal (kill) processes and optionally restart them
again. Cfengine opens a pipe from the system ps command and searches
through the output from this command using regular expressions to match
the lines of output from <code>ps</code>.  The regular expression does not
have to be an exact match, only a substring of the process line.  The
form of a process command is

<pre>processes:

    <var>"quoted regular expression"</var>

                        restart <var>"shell command"</var>
                        useshell=<b>true</b>/<var>false/dumb</var>
                        owner=<var>restart-uid</var>
                        group=<var>restart-gid</var>
                        chroot=<var>directory</var>
                        chdir=<var>directory</var>
                        umask=<var>mask</var>

                        signal=<var>signal name</var>
                        matches=<var>number</var>
                        define=<var>classlist</var>
                        action=<b>signal</b><var>/do/warn/bymatch</var>
                        include=<var>literal</var>
                        exclude=<var>literal</var>
                        syslog=<var>true/on</var>/<var>false/off</var>
                        inform=<var>true/on</var>/<var>false/off</var>

    SetOptionString <var>"quoted option string"</var>

</pre>

<p>By default, the options sent to ps are "-aux" for BSD systems and "-ef"
for system 5.  You can use the <code>SetOptionString</code> command to redefine
the option string. Cfengine assumes only that the first identifiable number
on each line is the process identifier for the processes, so you must not
choose options for ps which change this basic requirement (this is not a
problem in practice). Cfengine reads the output of the ps-command normally only
once, and searches through it in memory. The process table is only
re-consulted if <code>SetOptionString</code> is called. The options have the
following meanings:

<dl>

<br><dt><code>signal=<var>signal name</var></code>
<dd>This option defines the name of a signal which is to be sent to all processes
matching the quoted regular expression. If this option is omitted, no signal
is sent. The signal names have the usual
meanings. The full list, with largely standardized meanings, is

<pre>   hup       1   hang-up
   int       2   interrupt
   quit      3   quit
   ill       4   illegal instruction
   trap      5   trace trap
   iot       6   iot instruction
   emt       7   emt instruction
   fpe       8   floating point exception
   kill      9   kill signal
   bus      10   bus error
   segv     11   segmentation fault
   sys      12   bad argument to system call
   pipe     13   write to non existent pipe
   alrm     14   alarm clock
   term     15   software termination signal
   urg      16   urgent condition on I/O channel
   stop     17   stop signal (not from tty)
   tstp     18   stop from tty
   cont     19   continue
   chld     20   to parent on child exit/stop
   gttin    21   to readers pgrp upon background tty read
   gttou    22   like TTIN for output if (tp-&gt;t_local&amp;LTOSTOP)
   io       23   input/output possible signal
   xcpu     24   exceeded CPU time limit
   xfsz     25   exceeded file size limit
   vtalrm   26   virtual time alarm
   prof     27   profiling time alarm
   winch    28   window changed
   lost     29   resource lost (eg, record-lock lost)
   usr1     30   user defined signal 1
   usr2     31   user defined signal 2

</pre>

<p>Note that cfengine will not attempt to signal or restart processes 0 to 3
on any system since such an attempt could bring down the system. The only
exception is that the hangup (hup) signal may be sent to process 1
(init) which normally forces init to reread its terminal configuration
files.

<br><dt><code>restart <var>"shell command"</var></code>
<dd>
Note the syntax: there is no equals sign here.  If the keyword `restart'
appears, then the next quoted string is interpreted as a shell command
which is to be executed after any signals have been sent.  This command
is only issued if the number of processes matching the specified regular
expression is zero, or if the signal sent was signal 9 (sigkill) or 15
(sigterm) , i.e.  the normal termination signals.  This could be used to
restart a daemon for instance. Cfengine executes this command and
<em>waits</em> for its completion so you should normally only use this
feature to execute non-blocking commands, such as daemons which
dissociate themselves from the I/O stream and place themselves in the
background. Some unices leave a hanging pipe on restart (they never
manage to detect the end of file condition). This occurs on POSIX.1 and
SVR4 popen calls which use wait4. For some reason they fail to find and
end-of-file for an exiting child process and go into a deadlock trying
to read from an already dead process. This leaves a zombie behind (the
parent daemon process which forked and was supposed to exit) though the
child continues.  A way around this is to use a wrapper script which
prints the line "cfengine-die" to STDOUT after restarting the
process. This causes cfengine to close the pipe forcibly and continue. 
Cfengine places a timeout on the restart process and attempts to
clean up zombies, but you should be aware of this possibility.

<br><dt><code>owner=,group=</code>
<dd>Sets the process uid and gid (setuid,gid) for processes which are
restarted. This applies only to cfengine run by root.

<br><dt><code>chroot</code>
<dd>Changes the process root directory of the restarted process, creating
a `sandbox' which the process cannot escape from. Best used together with
a change of owner, since a root process can break out of such a confinement
in principle.

<br><dt><code>chdir</code>
<dd>Change the current working directory of the restarted process.

<br><dt><code>useshell=<var>true/false/dumb</var></code>
<dd>When restarting processes, cfengine normally uses a shell to
interpret and execute the restart command. This has inherent
security problems associated with it. If you set this option to
true, cfengine executes restart commands without using a shell. 
This is recommended, but it does mean that you cannot use any
shell operators or features in the restart command-line.

<p>Some programs (like cron) do not handle I/O properly when they fork
their daemon parts, this causes a zombie process and normally
hangs cfengine. By choosing the value `dumb' for this, cfengine
ignores all output from a program and does not use a startup shell. 
This prevents programs like cron from hanging cfengine.

<br><dt><code>matches=<var>number</var></code>
<dd>This option may be used to set a maximum, minimum or exact number of
matches. If cfengine doesn't find a number of matches to the regular
expression which is in accordance with this value it signals a warning. 
The <code>&lt;</code>, <code>&gt;</code> symbols are used  to specify upper and lower
limits. For example,

<pre>  matches=&lt;6  # warn number of matches is greater than or equal to 6
  matches=1   # warn if not exactly 1 matching process
  matches=&gt;2  # warn if there are less than or equal to 2 matching processes
</pre>

<br><dt><code>include=<var>literal</var></code>
<dd>Items listed as includes provide an extra level of selection after the
regular expression matches have been expanded. If you include one
include option, then only lines containing one or more of the literal
strings or wildcards will be matched.

<br><dt><code>exclude=<var>literal</var></code>
<dd>Process lines containing literal strings or wildcards in exclude
statements are not matched. Excludes are processed after regular
expression matching and after includes.

<br><dt><code>define=<var>classlist</var></code>
<dd>The colon, command or dot separated list of classes becomes activated if the
number of regular expression matches is non zero.

<br><dt><code>action=<var>signal/do/warn</var></code>
<dd>The default value of this option is to silently send a signal
(if one was defined using the <code>signal</code> option) to matching
processes. This is equivalent to setting the value of this
parameter to <code>signal</code> or <code>do</code>. If you set this option
to <code>warn</code>, cfengine sends no signal, but prints a message
detailing the processes which match the regular expression. 
If the option is set to <code>bymatch</code>, then signals are only sent
to the processes if the matches criteria fail.

</dl>

<p>Here is an example script which sends the hang-up signal to cron,
forcing it to reread its crontab files:

<pre>
processes:

   "cron" signal=hup

</pre>

<p>Here is a second example which may be used to restart the nameservice
on a solaris system:

<pre>
processes:

   solaris::

       "named" signal=kill restart "/usr/sbin/in.named"

</pre>

<p>A more complex match could be used to look for processes belonging to
a particular user. Here is a script which kills ftp related processes
belonging to a particular user who is known to spend the whole day
FTP-ing files:

<pre>
control:

    actionsequence = ( processes )

  #
  # Set a kill signal here for convenience
  #

    sig = ( kill )

  #
  # Better not find that dumpster here!
  #

    matches = ( 1 )

processes:

   #
   #  Look for Johnny Mnemonic trying to dump his head, user = jmnemon
   #

   ".*jmnemon.*ftp.*" signal=$(sig) matches=&lt;$(matches) action=$(do)

   # No mercy!

</pre>

<p>The regular expression <code>.*</code> matches any number of characters, so this
command searches for a line containing both the username and something to
do with ftp and sends these processes the kill signal. 
Further examples may be found in the FAQ section See <a href="#FAQS%20and%20Tips">FAQS and Tips</a>.

<p>You can arrange for signals to be sent, only if the number of matches
fails the test. The <code>action=bymatch</code> option is used for this. 
For instance, to kill process `XXX' only if the number
of matches is greater than 20, one would write:

<pre>
processes:

"XXX" matches=&lt;20  action=bymatch signal=kill

</pre>

<p>See also filters See <a href="#filters">filters</a>, for more complex searches.

<p><hr>
Node:<a name="required">required</a>,
Next:<a rel=next href="#resolve">resolve</a>,
Previous:<a rel=previous href="#processes">processes</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>required</h2>

<p>This is a synonym for disks, See <a href="#disks">disks</a>. 
This action tests for the existence of a file or filesystem.  It should
be called after all NFS filesystems have been mounted.  You may use the
special variable <code>$(binserver)</code> here.

<pre>
  required:

    /<var>filesystem</var> freespace=<var>size-limit</var> define=<var>class-list</var>(,:.)

</pre>

<p>Files or filesystems which you consider to be essential to the operation
of the system can be declared as `required'.  Cfengine will warn
if such files are not found, or if they look funny.

<p>Suppose you mount your filesystem <code>/usr/local</code> via NFS from some
binary server.  You might want to check that this filesystem is not
empty! This might occur if the filesystem was actually <em>not</em>
mounted as expected, but failed for some reason.  It is therefore not
enough to check whether the directory <code>/usr/local</code> exists, one must
also check whether it contains anything sensible.

<p>Cfengine uses two variables: <code>sensiblesize</code> and
<code>sensiblecount</code> to figure out whether a file or filesystem is
sensible or not.  You can change the default values of these variables
(which are 1000 and 2 respectively) in the <code>control</code> section. 
See <a href="#control">control</a>.

<p>If a file is smaller than <code>sensiblesize</code> or does not exist, it
fails the `required' test.  If a directory does not exist, or contains
fewer than <code>sensiblecount</code> files, then it also fails the test and a
warning is issued.

<pre>
required:

   any::

      /$(site)/$(binserver)/local

</pre>

<p>If you set the <code>freespace</code> variable to a value (the default units are kilobytes,
but you may specify bytes or megabytes), e.g.

<pre>
required:

  /site/host/home1 freespace=50mb define=dotidy

</pre>

<p>then cfengine will warn when the filesystem concerned has less than this
amount of free space. By adding a <code>define</code> tag, you can switch on
any number of classes if this happens. This allows you to activate special
measures for dealing with a filesystem which is in danger of becoming
full.

<p><hr>
Node:<a name="resolve">resolve</a>,
Next:<a rel=next href="#shellcommands">shellcommands</a>,
Previous:<a rel=previous href="#required">required</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>resolve</h2>

<p>The file <code>/etc/resolv.conf</code> specifies the default nameserver for
each host, as well as the local domain name.  This file can also contain
other information, but these are the only two things cfengine currently
cares about.  In specifying nameservers you should use the dotted
numerical form of the IP addresses since your system may not understand
the text form if it is not correctly configured.  You may list as many
nameservers as you wish, with the default server at the top of the list. 
The resolver normally ignores entries if you add more than three.  The
statement:

<pre>
resolve:

  mygroup::

     129.240.22.35
     129.240.22.222
     129.240.2.3

</pre>

<p>declares a list of nameservers for hosts in the group or class
<code>mygroup</code>.  When you add the <code>resolve</code> command to the
<code>actionsequence</code>, this declaration together with the <code>domain</code>
variable (set here to <code>uio.no</code>) results in a
<code>/etc/resolv.conf</code> file of the form:

<pre>
domain uio.no
nameserver 129.240.22.35
nameserver 129.240.22.222
nameserver 129.240.2.3

</pre>

<p>Note that the <code>resolve</code> action does not delete anything from the
file <code>/etc/resolv.conf</code>.  It adds nameservers which do not
previously exist and reorders the lines of servers which do exist.

<p>As of version 1.3.11, you may use a quoted string to add non-nameserver
lines to this file. For example:

<pre>
resolve:

  mygroup::

     129.240.22.35
     129.240.22.222
     "# Comment line"
     "order bind, files"

</pre>

<p>If the line begins with a non-numeric character, the word `nameserver'
is not added to the line.

<p><hr>
Node:<a name="shellcommands">shellcommands</a>,
Next:<a rel=next href="#tidy">tidy</a>,
Previous:<a rel=previous href="#resolve">resolve</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>shellcommands</h2>

<p>Cfengine focuses on fairly simple minded tasks in order to be as general
as possible.  In many cases you will therefore want to write a script to
do something special on your system.  You can still take advantage of
the classes you have defined by executing these scripts or shell
commands from this section.

<p>The syntax is simply to quote the command you wish to be executed.

<pre>shellcommands:

  "<var>command-string</var>"

          timeout=<var>seconds</var>
          useshell=<b>true</b><var>/false</var>
          umask=<var>octal number</var>
          owner=<var>uid</var>
          group=<var>gid</var>
          define=<var>class-list</var>
          background=<b>false</b><var>/true</var>
          chdir=<var>directory</var>
          chroot=<var>directory</var>
          preview=<var>true</var>/<b>false</b>

</pre>

<p>The user and group ID's of the process can be set to restrict the
permissions of the shellcommand to another user only if cfengine is
executed by root. If you set the optional timeout string, then cfengine
will abort the shellcommand if it exceeds the specified time-limit in
seconds. This can be useful for avoiding situations caused by hung
network connections etc.

<p>Variable substitution works within the strings.  Here are some examples.

<pre>
shellcommands:

   sun4::

       "/usr/lib/find/updatedb"

   AllHomeServers.Sunday::

       "/dir/noseyparker /$(site)/$(host)/u1 $(sysadm) nomail"

   AllBinaryServers.sun4.Saturday::

      "/usr/etc/catman -w -M /usr/local/man"
      "/usr/etc/catman -w -M /usr/local/X11R5/man"
      "/usr/etc/catman -w -M /usr/man"
      "/usr/etc/catman -w -M /usr/local/gnu/man"

</pre>

<p>If you need to write more advanced scripts, which make detailed use of the
classes defined by cfengine, use the <code>$(allclasses)</code> variable to send
a complete list of classes to your script in the format

<pre>
CFALLCLASSES=class1:class2:class3...

</pre>

<p>This variable is kept up-to-date at any given time with only the classes
which are defined.  The command line option <code>-u</code> or
<code>--use-env</code> can be used to define an environment variable which
will be inherited by all scripts and contains the same information. 
This is not the standard approach, since some systems cannot
cope with this rapid change of environment and generate a Bus Error.

<p>Commands can be iterated over variable lists, provided there is
at least one space between each variable. For example:

<pre>
control:

      actionsequence =
         (
         shellcommands
         )

 var1 = ( a:b:c )
 var2 = ( x:y:z )

shellcommands:

   "/bin/echo $(var1) $(var2)"

</pre>

<p>This iterates over all values of the list variables. See <a href="cfengine-Tutorial.html#Iterating%20over%20lists">Iterating over lists</a>. 
If you are iterating over a list, the timeout applies to each separate
iteration, not to the sum of all the iterations.

<p>The <code>chroot</code> option changes the process root directory of the
command, creating a `sandbox' which the process cannot escape from. Best
used together with a change of owner, since a root process can break out
of such a confinement in principle. The <code>chdir</code> option changes the
current working directory of the restarted process.

<p>The <code>preview</code> option means that the shellcommand will also be executed during
the <code>--dry-run</code> (<code>-n</code>) options. This allows cfengine to be more aware
of the results of scripts which define classes. This option should be used
with care. 
Scripts should conform to the protocol of not executing unnecessary commands
when the classes <code>opt_dry_run</code> is defined.

<p><hr>
Node:<a name="tidy">tidy</a>,
Next:<a rel=next href="#unmount">unmount</a>,
Previous:<a rel=previous href="#shellcommands">shellcommands</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>tidy</h2>

<p>The tidy function is used to delete (remove permanently) unwanted files
from a system.  It is useful for tidying up in <code>/tmp</code> or cleaning
out <code>core</code> files from users' home directories.  The form of an
entry is:

<pre>tidy:

  <var>class</var>::

      <var>/directory</var>
                       pattern=<var>wildcard</var>
                       recurse=<var>number/inf</var>
                       age=<var>days</var>
                       size=<var>number/empty</var>
                       type=<var>ctime/mtime/</var><b>atime</b>
                       dirlinks=<var>keep/tidy/delete</var>
                       rmdirs=<var>true/<b>false</b>/all/sub</var>
                       links=<b>stop/keep</b><var>/traverse/tidy</var>

                       define=<var>classlist</var>
                       elsedefine=<var>classlist</var>

                       syslog=<var>true/on</var>/<var>false/off</var>
                       inform=<var>true/on</var>/<var>false/off</var>

                       filter=<var>filter alias</var>
                       include=<var>pattern</var>
                       exclude=<var>pattern</var>

</pre>

<p>Note that, each of the options below
can be written in either upper or lower case and abbreviated by any
unique abbreviation.

<dl>

<br><dt><code><var>/directory</var></code>
<dd>This is the directory name to directories which mark the start of a
search for files matching certain wildcards.  The wildcard <code>home</code>
may be used instead of an explicit directory, in which case cfengine
iterates over all home directories.  It is compulsory to specify a
directory.

<br><dt><code>pattern=<var>wildcard</var></code>
<dd>A wildcard or filename to match the files you wish to be deleted.  The
pattern may contain the special symbols <code>?</code> which matches a single
character and <code>*</code> which matches any number of characters as in the
shell.

<br><dt><code>recurse=<var>number/inf</var></code>
<dd>This specifier tells cfengine whether or not to recurse into
subdirectories.  If the value is zero, only the named file or directory
is affected.  If the value is 1, it will open at most one level of
subdirectory and affect the files within this scope.  If the value is
<code>inf</code> then cfengine opens all subdirectories and files beginning
from the specified filename. See <a href="#Recursion">Recursion</a>.

<br><dt><code>age=<var>days</var></code>
<dd>The age of a file in days represents a minimum <em>access</em> time
elapsed before the file will be deleted.  In other word a file will be
deleted if it has not been accessed for <var>days</var> days.

<br><dt><code>links=<var>stop/traverse/tidy</var></code>
<dd>Normally cfengine does not descend into subdirectories which are pointed
to by symbolic links.  If you wish to force it to do so (without using
the <code>-l</code> command line option) you may give this option the value
<code>true</code>, or <code>traverse</code>, or <code>follow</code>.  To specify no
recursion you set the value <code>false</code> or <code>stop</code>. 
Note that the value set here in the cfengine program <em>always
overrides</em> the value set by the <code>-l</code> command line option, so you
can protect certain actions from this command line option by specifying
a negative value here.  If you specify no value here, the behaviour is
determined by what you specify on the command line.

<p>The value <code>links=tidy</code> has the same effect as the <code>-L</code> command
line option except that here it may be specified per item rather than
globally.  Setting this value causes links which point to non-existent
files to be deleted. This feature will not work on commands with the
<code>home</code> wildcard feature.  If you want to clean up old links you
should either user a <code>files</code> command or the command line option
which sets the tidy feature globally.

<br><dt><code>size=<var>number/empty</var></code>
<dd>The value of this parameter decides the size of files to be deleted. 
Files larger than this value will be deleted if they also are older than
the time specified in <code>age</code>. The default size is zero so that any
file which gets matched by another critereon is deleted. However, if you
want to single out only totally empty files, the <code>empty</code> may be used. 
With this option only empty files, nevery files with anything in them,
 will be deleted, if older than <code>age</code>. By default, the filesizes
are in kilobytes, but kilobytes and megabytes may also be specified by
appending b,k,m to the numbers. Only the first character after the
number is significant so you may write the numbers however it might be
convenient, e.g. <kbd>14k</kbd>, <kbd>14kB</kbd>, <kbd>14kilobytes</kbd>, the same as
for <code>disable</code>.

<br><dt><code>type=<var>ctime/mtime/atime</var></code>
<dd>This value is used to set the type of time comparison made using
<code>age</code>. The default is to compare access times (atime) or
the last time the file was read. A comparison by modification
time (mtime) uses the last time the contents of the file was
changed. The ctime parameter is the last time the contents, owner
or permissions of the file were changed.

<br><dt><code>dirlinks=<var>keep/tidy/delete</var></code>
<dd>This value is used to decide whether cfengine will delete
links which point to directories. The default value is to keep
the links. Note that, if the travlinks option is switched on,
cfengine will not tidy or delete links which point to directories,
instead it follows them into the subdirectory. This is a supplement
to the <code>rmdirs</code> option. You need both to make links
to directories disappear.

<br><dt><code>rmdirs=<var>true/false/all/sub</var></code>
<dd>Normally cfengine will not delete directories. If this option is
set to `true' then cfengine will delete any directories which
are <em>empty</em>. Non-empty directories will not be touched and no
message will be given unless in verbose mode. Note that this
option overrides the above option <code>dirlinks</code>, so that even
links which point to empty directories will be removed. 
If this is set to `sub' then the topmost directory will not
be removed, only sub-directories.

<br><dt><code>define=<var>classlist</var></code>
<dd>The colon, comma or dot separated list of classes becomes defined
if any file matching the specified pattern is deleted.

</dl>
Take a look at the following example:

<pre>tidy:

   AllHomeServers::

       home     pattern=core   R=inf age=0
       home     pattern=*~     R=inf age=7
       home     pattern=#*     R=inf age=30


   any::

       /tmp/    pat=*            R=inf   age=1
       /        pat=core         R=2     age=0
       /etc     pat=hosts.equiv  r=0     age=0

</pre>

<p>In the first example, all hosts in the group <code>AllHomeServers</code>
iterate a search over all user home directories looking for `core' files
(older than zero days) and <code>emacs</code> backup files <code>*~</code>,
<code>#*</code> older than seven days.

<p>The default values for these options are the empty string for the
wildcard pattern, zero for the recursion and a specification of the age
is compulsory.

<p>When cfengine tidies users' home directories, it keeps a log of all the
files it deletes each time it is run.  This means that, in case of
accidents, the user can see that the file has been deleted and restore
it from backup.  The log file is called <code>.cfengine.rm</code> and it is
placed in the home directory of each user.  The file is owned by root,
but is readable to the user concerned.

<p><hr>
Node:<a name="unmount">unmount</a>,
Previous:<a rel=previous href="#tidy">tidy</a>,
Up:<a rel=up href="#Command%20reference">Command reference</a>
<br>

<h2>unmount</h2>

<p>The unmount function unmounts non-required filesystems and removes the
appropriate entry from the filesystem table (<code>/etc/fstab</code> or
equivalent).  The syntax is simply

<pre>unmount:

   <var>class</var>::

      <var>mounthost</var>:<var>filesystem</var>

        deletedir=<var><b>true</b>/false</var>
        deletefstab=<var><b>true</b>/false</var>
        force=<var>true/<b>false</b></var>

</pre>

<p>The options allow you to temporarily unmount a directory without actually
removing it from the filesystem table. The option <code>force</code> is not currently
implemented and will likely have to be system dependent. 
For example:

<pre>unmount:

   physics::

      libraryserver:/$(site)/libraryserver/data

</pre>

<p>If the device is busy then the actual unmount will not take place until
it becomes free, or the machine is rebooted.  This feature should work
on AIX systems, in spite of these machines inherent peculiarities in the
form of the filesystem table.

<p>Some users do not mount filesystems on a directory of the same name as the
source directory. This can lead to confusion. 
Note, if you have problems removing a mounted filesystem, try using
the mountpoint of the filesystem, rather than the name of the filesystem itself,
in the unmount command.

<p><hr>
Node:<a name="Writing%20scripts%20for%20cfengine">Writing scripts for cfengine</a>,
Next:<a rel=next href="#Problem%20solving">Problem solving</a>,
Previous:<a rel=previous href="#Command%20reference">Command reference</a>,
Up:<a rel=up href="#Top">Top</a>
<br>

<h1>Cfengine script gallery</h1>

<p>Here is a gallery of simple-minded scripts to give you ideas for making your
own.  The absence of explicit testing in cfengine programs also
makes these scripts transparent while offering a higher level of
checking for no cost to the programmer.  Similar shell scripts with this
property would be complex indeed.

<ul>
<li><a href="#Old%20files">Old files</a>: 
<li><a href="#Sharing%20files">Sharing files</a>: 
<li><a href="#Disk%20clearing">Disk clearing</a>: 
<li><a href="#Script%20for%20making%20links">Script for making links</a>: 
<li><a href="#Ftp%20server">Ftp server</a>: 
</ul>

<p><hr>
Node:<a name="Old%20files">Old files</a>,
Next:<a rel=next href="#Sharing%20files">Sharing files</a>,
Previous:<a rel=previous href="#Writing%20scripts%20for%20cfengine">Writing scripts for cfengine</a>,
Up:<a rel=up href="#Writing%20scripts%20for%20cfengine">Writing scripts for cfengine</a>
<br>

<h2>User scripts for tidying old files</h2>

<p>Here is an example script for tidying old files in your own login area. 
If you want a long diagnostic, add the option <code>-v</code> to the first
line of the script, before <code>-f</code>.

<pre>#!/usr/local/bin/cfengine -f
#
# Tidy
#

control:

   actionsequence =
      (
      tidy
      )


tidy:

      $(HOME)        pat=core   r=inf  age=0
      $(HOME)        pat=*~     r=inf  age=1
      $(HOME)        pat=#*     r=inf  age=7
      $(HOME)/code   pat=*.o    r=inf  age=7
      $(HOME)/tex    pat=*.dvi  r=inf  age=7
      $(HOME)/tex    pat=*.log  r=inf  age=7
      $(HOME)/tex    pat=*.aux  r=inf  age=7

      $(HOME)/ftp    pat=*.zip  r=inf  age=7

</pre>

<p><hr>
Node:<a name="Sharing%20files">Sharing files</a>,
Next:<a rel=next href="#Disk%20clearing">Disk clearing</a>,
Previous:<a rel=previous href="#Old%20files">Old files</a>,
Up:<a rel=up href="#Writing%20scripts%20for%20cfengine">Writing scripts for cfengine</a>
<br>

<h2>Controlled opening of files for friends and colleagues</h2>

<pre>#!/local/gnu/bin/cfengine -f
#
# Open my shared directory for others in my group
#
#


control:

  actionsequence =
     (
     files
     )

  gr = ( myshare )


files:

      $(HOME)       mode=0755 action=fixdirs r=0
      $(HOME)/share mode=0664 action=fixall  r=inf group=$(gr)

</pre>

<p>In this example, first your home directory is opened for the world, then
all files in the subdirectory <code>share</code> and subdirectories are
opened to the group <code>myshare</code>.  This script could be made to run
from a login/logout script of some kind (either <code>.login</code> or
<code>.xsession</code>) so that any new files would automatically be
controlled.

<p><hr>
Node:<a name="Disk%20clearing">Disk clearing</a>,
Next:<a rel=next href="#Script%20for%20making%20links">Script for making links</a>,
Previous:<a rel=previous href="#Sharing%20files">Sharing files</a>,
Up:<a rel=up href="#Writing%20scripts%20for%20cfengine">Writing scripts for cfengine</a>
<br>

<h2>Root script for emergency disk clearing</h2>

<p>A straightforward script could be used to clear space in cases where the
disk hits the overflow level.  This script tidies the whole system, not
just the affected disk.

<pre>#!/local/gnu/bin/cfengine -f
#
# Emergency tidyup!
#
# (Users read their cfengine.rm files to see what got deleted!)
#

control:

site = ( mysite )

mountpattern = ( $(site)/$(host) )
homepattern   = ( u? )

actionsequence =
   (
   tidy
   )


tidy:

      home            pattern=core   R=inf   age=0
      home            pattern=*~     R=inf   age=0
      home            pattern=*.dvi  R=inf   age=1
      home            pattern=*.o    R=inf   age=0
      /tmp            pattern=*      R=inf   age=0  # could be risky
      /usr/tmp        pattern=*      R=inf   age=0  #      "

ignore:

     .X11

</pre>

<p><hr>
Node:<a name="Script%20for%20making%20links">Script for making links</a>,
Next:<a rel=next href="#Ftp%20server">Ftp server</a>,
Previous:<a rel=previous href="#Disk%20clearing">Disk clearing</a>,
Up:<a rel=up href="#Writing%20scripts%20for%20cfengine">Writing scripts for cfengine</a>
<br>

<h2>Script for making links</h2>

<p>The following script could be used as part of a software installation procedure. 
Note that the link types can be made relative to the from-link by using
<code>type=relative</code> See <a href="#links">links</a>.

<pre>#!/tmp/cfengine -v -f
#
# Simple example script to make links
#

control:

  actionsequence = ( links )

links:

 host::

   /usr/local/bin                  +&gt; /usr/local/lib/soft/bin
   /usr/local/X11/lib/app-defaults +&gt; /usr/local/lib/soft/app-defaults

</pre>

<p>It makes links from every binary file in the packages `bin' directory to
the more standard binary directory <code>/usr/local/bin</code>.  This avoids
having to place another search directory into the users' <code>path</code>
variable.  The second statement links the package's application defaults
files (for the X-windows system) to a directory in the
<code>XAPPLRESDIR</code> search path.

<p>This script provides only one way of making the necessary files available
to users.  It is not the only solution to the problem.

<p><hr>
Node:<a name="Ftp%20server">Ftp server</a>,
Previous:<a rel=previous href="#Script%20for%20making%20links">Script for making links</a>,
Up:<a rel=up href="#Writing%20scripts%20for%20cfengine">Writing scripts for cfengine</a>
<br>

<h2>Ftp server</h2>

<p>This script carries out the necessary for setting up a safe anonymous
ftp server on a sun workstation running SunOS4.1.

<pre>#!/local/gnu/bin/cfengine -f
##############################################################
#
# Cfengine script to set up an outgoing ftp server under
# SunOS 4.1.*.  Suitable for anonymous access.
#
###############################################################

control:

 addclasses = ( local global )

 actionsequence =
    (
    editfiles.global
    directories
    shellcommands
    files
    editfiles.local
    )

 ftp_root = ( /oih/saga/local/ftp )   # macro for convenience
 ftp_id   = ( 99 )                    # uid/gid for ftp

################################################################

editfiles:

 # Note the file /etc/ftpusers can contain a list of users
 # who can NOT use ftp to access files.

 global::

 { /etc/passwd

 AppendIfNoSuchLine "ftp:*:$(ftp_id):$(ftp_id): <em>(line continues)</em>
Anonymous ftp:$(ftp_root):/usr/ucb/ftp"
 }

 { /etc/group

 AppendIfNoSuchLine "ftp:*:$(ftp_id):"
 }

################################################################

directories:

  $(ftp_root)           mode=0555 owner=ftp
  $(ftp_root)/pub       mode=0555 owner=ftp
  $(ftp_root)/bin       mode=0555 owner=root
  $(ftp_root)/usr       mode=0555 owner=root
  $(ftp_root)/dev       mode=0555 owner=root
  $(ftp_root)/etc       mode=0555 owner=root
  $(ftp_root)/dev       mode=0555 owner=root
  $(ftp_root)/usr/lib   mode=0555 owner=root

###############################################################

shellcommands:

  "/bin/cp /bin/ls $(ftp_root)/bin/ls"
  "/bin/cp /lib/libc.so.1.8* $(ftp_root)/usr/lib"
  "/bin/cp /usr/lib/ld.so  $(ftp_root)/usr/lib"
  "/bin/cp /usr/lib/libdl.so.1.0 $(ftp_root)/usr/lib/libdl.so.1.0"
  "/usr/etc/mknod $(ftp_root)/dev/zero c 3 12 &gt; /dev/null 2&gt;&amp;1"

##########################################################################

files:

 $(ftp_root)/bin/ls     mode=111 owner=root action=fixall
 $(ftp_root)/usr/lib    mode=555 owner=root action=fixall r=1
 $(ftp_root)/etc/passwd mode=444 owner=root action=touch
 $(ftp_root)/etc/group  mode=444 owner=root action=touch
 $(ftp_root)/pub        mode=644 owner=root action=fixall

################################################################

editfiles:

 local::

 { $(ftp_root)/etc/passwd

 AppendIfNoSuchLine "ftp:*:$(ftp_id):$(ftp_id): <em>(line continues)</em>
Anonymous ftp:$(ftp_root):/usr/ucb/ftp"
 }

 { $(ftp_root)/etc/group

 AppendIfNoSuchLine "ftp:*:$(ftp_id):"
 }

</pre>

<p><hr>
Node:<a name="Problem%20solving">Problem solving</a>,
Next:<a rel=next href="#Using%20the%20help%20scripts">Using the help scripts</a>,
Previous:<a rel=previous href="#Writing%20scripts%20for%20cfengine">Writing scripts for cfengine</a>,
Up:<a rel=up href="#Top">Top</a>
<br>

<h1>Problem solving, bugs, FAQs and tips</h1>

<ul>
<li><a href="#cf.preconf%20bootstrap%20file">cf.preconf bootstrap file</a>: 
<li><a href="#cfrc%20resource%20file">cfrc resource file</a>: 
<li><a href="#Problems%20with%20compilation%20and%20installation">Problems with compilation and installation</a>: 
<li><a href="#Bug%20reports%20and%20suggestions">Bug reports and suggestions</a>: 
<li><a href="#FAQS%20and%20Tips">FAQS and Tips</a>: 
</ul>

<p><hr>
Node:<a name="cf.preconf%20bootstrap%20file">cf.preconf bootstrap file</a>,
Next:<a rel=next href="#cfrc%20resource%20file">cfrc resource file</a>,
Previous:<a rel=previous href="#Problem%20solving">Problem solving</a>,
Up:<a rel=up href="#Problem%20solving">Problem solving</a>
<br>

<h2><code>cf.preconf</code> bootstrap file</h2>

<p>In some cases you will want to run cfengine on a system to configure it
from scratch.  If the system is in a very bad way, it might not even be
able to parse the cfengine configuration file, perhaps because the
network was not properly configured or the DNS (Domain Name Service) was
out of action.  To help prevent this situation, cfengine looks for a
script called <code>cf.preconf</code> which gets executed prior to parsing and
can be used to perform any emergency tests.  This file needs only
contain enough to get the system to parse the configuration files.

<p><code>cf.preconf</code> may be any script in any language.  It need not exist
at all! It is fed one argument by cfengine, namely the system hard-class
for the current system (e.g.  <code>ultrix</code>).  Here is an example:

<pre>#!/bin/sh
#
# cf.preconf is an emergency/bootstrap file to get things going
# in case cfengine is unable to parse its config file
#

backupdir=/iu/nexus/local/iu/etc

 #
 # If these files don't exist, you might not be able to parse cfengine.conf
 #

if [ ! -s /etc/resolv.conf ]; then

 echo Patching basics resolv.conf file
 cat &gt; /etc/resolv.conf &lt;&lt; XX
domain iu.hioslo.no
nameserver 128.39.89.10
XX

fi

#
# SVR4
#

if [ "$1" = "solaris" ]; then

  if [ ! -s "/etc/passwd" ]; then

  echo Patching missing passwd file
    /bin/cp $backupdir/passwd /etc/passwd
  fi

  if [ ! -s "/etc/shadow" ]; then

   echo Patching missing passwd file
   /bin/cp $backupdir/shadow /etc/shadow
  fi
fi

#
# BSD 4.3
#

if [ "$1" = "linux" ]; then

   if [ ! -s "/etc/passwd"  ]
   then

    echo Patching missing passwd file
    /bin/cp $backupdir/passwd.linux /etc/passwd
   fi
fi




</pre>

<p><hr>
Node:<a name="cfrc%20resource%20file">cfrc resource file</a>,
Next:<a rel=next href="#Problems%20with%20compilation%20and%20installation">Problems with compilation and installation</a>,
Previous:<a rel=previous href="#cf.preconf%20bootstrap%20file">cf.preconf bootstrap file</a>,
Up:<a rel=up href="#Problem%20solving">Problem solving</a>
<br>

<h2><code>cfrc</code> resource file</h2>

<p>If, for some reason you are not satisfied with the defaults which
cfengine uses, then you can change them by making an entry in the
resource file.  The default values are defined in the source code file
<code>classes.c</code> in the distribution.  The format of the resource file
is:

<pre>hardclass.variable: value
</pre>

<p>For example, you might want to forget about where your HPUX system
mounts its mail directory and mount it under <code>/usr/spool/mail</code>.  In
this case you would add the line:

<pre>hpux.maildir: /usr/spool/mail
</pre>

<p>To redefine the filesystem table for GNU/linux, you would write:
<pre>linux.fstab: /etc/linuxfstab
</pre>

<p>The full list of re-definable resources is:

<pre>   mountcomm       # command used to mount filesystems
   unmountcomm     # command used to unmount filesystems
   ethernet        # name of the ethernet device
   mountopts       # options to above mount command
   fstab           # the name of the filesystemtable
   maildir         # the location of the mail directory
   netstat         # the full path to netstat and options
   pscomm          # the path to the system's ps command
   psopts          # the options used by ps (default aux/ef)
</pre>

<p>You should never need to redefine resources unless you decide to do something
non-standard.  Interested readers are referred to the values in <code>classes.c</code>.

<p>Cfengine is easily extensible so as to support a variety of
architectures.  You can even add your own.  To do so you need, first of
all, to define a new class for the operating system concerned.  The file
<em>classes.c</em> has been separated off from the remainder of the source
code so that you can easily see which data structures need to be
extended.

<p>To make life as straightforward as possible, three unused classes have
been defined.  They are called (unremarkably) <em>unused1</em>,
<em>unused2</em> and <em>unused3</em>.  If you add any further classes, it
will be necessary to increase the constant <em>clssattr</em> defined in
<em>cf.defs.h</em> by one for every new addition.  You do not need to
change <em>clssattr</em> if you simple replace one of the unused classes
by a real class.

<p>To see fully the impact of what you need to do, you should make a search
for the strings <em>unused?</em> in all of the source files.  Certain
special cases need to be handled for each operating system.  For
example, the form of the filesystem table is quite radically different
on some systems such as AIX.  One thing you must do is to fill in the
default values for the new operating system in the file
<em>classes.c</em>.

<p>If you fill in the details for a new operating system before it finds
its way into a new release, you might consider sending the details to
the bug list in the next paragraph.

<p><hr>
Node:<a name="Problems%20with%20compilation%20and%20installation">Problems with compilation and installation</a>,
Next:<a rel=next href="#Bug%20reports%20and%20suggestions">Bug reports and suggestions</a>,
Previous:<a rel=previous href="#cfrc%20resource%20file">cfrc resource file</a>,
Up:<a rel=up href="#Problem%20solving">Problem solving</a>
<br>

<h2>Problems with compilation and installation</h2>

<p>Although every effort has been made to make the compilation of cfengine
trouble free, you might still encounter some problems where non-standard
features are concerned. The differences between systems is still a major
headache.

<p>Earlier versions of the GNU/Linux operating system do not have support
for some of the facilities which cfengine uses.  In particular, the
ability to use NIS netgroups is absent from earlier versions.  During
the installation procedure, the <code>configure</code> script tests for this
possibility and advises you if the facility cannot be used.  You can
still use cfengine in this case but netgroups will not be expanded. 
Another problem with GNU/Linux concerns a special socket call to the
TCP/IP network interface.  This is a command which configures the static
routing table and appears to be absent from all versions of Linux and
newer IRIX versions.  There are also problems with NetBSD.  These
features are undocumented and will be fixed as soon as they have been
understood! If you are running in verbose mode a warning message is
printed, otherwise cfengine will ignore attempts to set a default route
on the system.

<p>A number of users have experienced a problem using flex and bison
in place of lex and yacc. There appears to be a bug in one of these
programs which causes cfengine to compile correctly but misinterpret
its configuration files, generating an error of the form

<pre>cfengine:10:action contains invalid statement
</pre>

<p>for every line! The cure is to collect the latest versions
of flex and bison from your nearest GNU site.

<p>On really old systems, the configure program is not able to guess
what kind of system you are working on. This is true of SunOS
versions 4.0.* and also of BSD 4.3 systems. In such cases, you might
be able to compile cfengine by using the autoconf option `host'
to specify the host-type.

<pre>
configure --host=sparc-sun-sunos4.0

</pre>

<p>Some other systems which will compile if forced are:
<pre>m68k-hp-bsd4.3
?-?-bsd4.3
romp-ibm-aos
?-?-aos
</pre>

<p>On some systems, problems arise when using flex. Flex might
generate a lexer file lex.yy.c which defines malloc or some other
function to be of a type which conflicts with the system definition. 
If you obtain such a culture crash, edit the lexer file manually
and simply delete the offending definitions, then run make again.

<p>As of version 1.4.0 cfengine tries to link in features based on
the Berkeley database library <code>libdb</code> and the TCP wrappers
library <code>libwrap</code>. 
If you want to use these facilities, you will have to collect them
and install them before compiling cfengine. 
Some problems have been experienced with the linux version of
TCP wrappers. If you experience compilation problems, the
best thing to do is to edit <code>src/conf.h</code>
after configuration and remove the line beginning <code>#define HAVE_LIBWRAP</code>.

<p>Newer solaris systems have ACLs. The ACL features only matured in version
2.5 of solaris however, and there have been some problems with the
partial implementation in 2.4. If you obtain error messages about unknown
ACL functions, edit the <code>config.cache</code> file in the cfengine root
directory and set the value:
<pre>ac_cv_header_sys_acl_h=${ac_cv_header_sys_acl_h='no'}
</pre>

<p>If you use the DCE (Distributed computing environment) cfengine will try to
compile the ACL extension for DFS. This requires the DCE library to be present
on the system on which you are compiling. On some systems it also requires
thread libraries to be present. Unfortunately, the autoconf program
which generates the Makefiles cannot detect shared libraries, only archive
libraries. This means that you need to edit the <code>config.cache</code> file
to compile in this support. Set the following values:
<pre>ac_cv_lib_dce_main=${ac_cv_lib_dce_main='yes'}
ac_cv_lib_dce_main=${ac_cv_lib_thread_main='yes'}
</pre>

<p>Finally, although the autoconfiguration program appends the same
libraries to each executable, the following libraries are required
only by the following programs.
<pre>
 cfengine   -ldce -lthread -lm

 cfd        -ldb -lpthread

</pre>

<p><hr>
Node:<a name="Bug%20reports%20and%20suggestions">Bug reports and suggestions</a>,
Next:<a rel=next href="#FAQS%20and%20Tips">FAQS and Tips</a>,
Previous:<a rel=previous href="#Problems%20with%20compilation%20and%20installation">Problems with compilation and installation</a>,
Up:<a rel=up href="#Problem%20solving">Problem solving</a>
<br>

<h2>Bug reports and suggestions</h2>

<p>If you experience a problem with cfengine, find a bug or have another
suggestion which you wish to air, you can send your thoughts to the
special mail address <a href="mailto:bug-cfengine@gnu.org">bug-cfengine@gnu.org</a>.

<p>Always think a bit before sending a message to the list. This helps
to keep down the traffic improves the signal to noise ratio of your
thoughts! Try to solve the problem yourself first and look particularly
to see whether your system is clean or whether you have installed
software or patches which might conflict with cfengine (I can't really
imagine how this would happen--but it might). Always be clear
about what type of operating system you are running and whether or not
it is a complete installation.

<p>Some vendors have begun the practice of distributing systems without key
programs like the C compiler, lex and yacc. If you have this problem,
you can pick up GNU replacements gcc, flex and bison from any GNU site.

<p><hr>
Node:<a name="FAQS%20and%20Tips">FAQS and Tips</a>,
Previous:<a rel=previous href="#Bug%20reports%20and%20suggestions">Bug reports and suggestions</a>,
Up:<a rel=up href="#Problem%20solving">Problem solving</a>
<br>

<h2>FAQs and Tips</h2>

<p>Here is a problem solver: an encyclopaedia of suggestions and uses for
cfengine as accumulated over the years. If you have a contribution
to make, please send it to <a href="mailto:help-cfengine@gnu.org">help-cfengine@gnu.org</a>. Format
your submission like this:

<dl>

<br><dt><em>Q:</em>
<dd><em>How do I do....</em>

<br><dt><em>A:</em>
<dd>Very well thank-you....

</dl>
The table below is updated as the tips occur to me, or as others
contribute their own. Please note that any focusing on particular
operating systems is purely a matter of personal usage/experience and
should not be interpreted as a reflection of how many `bugs' these
systems may or may not contain.

<ul>
<li><a href="#General">General</a>: 
<li><a href="#AIX">AIX</a>: 
<li><a href="#BSDI">BSDI</a>: 
<li><a href="#HPUX">HPUX</a>: 
<li><a href="#IRIX">IRIX</a>: 
<li><a href="#LINUX">LINUX</a>: 
<li><a href="#OSF">OSF</a>: 
<li><a href="#SUN%20(4.1.*)">SUN (4.1.*)</a>: 
<li><a href="#SOLARIS%202">SOLARIS 2</a>: 
<li><a href="#FreeBSD">FreeBSD</a>: 
</ul>

<p><hr>
Node:<a name="General">General</a>,
Next:<a rel=next href="#AIX">AIX</a>,
Previous:<a rel=previous href="#FAQS%20and%20Tips">FAQS and Tips</a>,
Up:<a rel=up href="#FAQS%20and%20Tips">FAQS and Tips</a>
<br>

<h3>General</h3>

<dl>

<br><dt><em>Q:</em>
<dd>How can I check to see what cfengine will do without
going through the whole program using <code>-n</code>?

<br><dt><em>A:</em>
<dd>Run cfengine with options:

<pre>
  cfengine -p -d3

</pre>

<p>This just parses the file and dumps the contents of the
parser to the output.

<br><dt><em>Q:</em>
<dd><em>Why doesn't cfengine have classes for each hour, instead
of just for days?</em>

<br><dt><em>A:</em>
<dd>It does from version 1.3.20 and upward. The hours are denoted in
24 hour clock notation by <code>Hr00</code>--<code>Hr23</code>. Other time
classes are also possible See <a href="cfengine-Tutorial.html#Using%20cfengine%20as%20a%20front-end%20for%20cron">Using cfengine as a front-end for cron</a>.

<br><dt><em>Q:</em>
<dd><em>How can I replace the stupid version of sendmail
my vendor ships with my OS with, say, Berkeley sendmail?</em>

<br><dt><em>A:</em>
<dd>First of all, compile your new sendmail in a filesystem
which is held separate from the OS, for example
<code>/local/mail</code>. You can keep all the files
under this new file tree. Now you need to replace
<code>/usr/lib/sendmail</code> with the new version and
<code>/etc/sendmail.cf</code> or <code>/etc/mail/sendmail</code>
with the new files, so that the system can find them.

<pre>
   links:
      /usr/lib/sendmail -&gt;! /local/mail/bin/sendmail
      /etc/sendmail.cf  -&gt;! /local/mail/etc/sendmail.cf

</pre>

</dl>

<dl>

<br><dt><em>Q:</em>
<dd><em>How can I prevent big log-files like <code>/var/adm/wtmpx</code>
and <code>httpd/access_log</code> from filling up my partitions?</em>

<br><dt><em>A:</em>
<dd>Add a line to disable the files once a week. That way
you still get a chance to look at them, but you keep the size
down:

<pre>
   disable::

      Sunday::

         #
         # Do this to throw away old entries
         #

         /var/adm/wtmpx rotate=truncate

         #
         # Or this to keep the last lot
         #

         /var/adm/wtmpx rotate=1

</pre>

<p>An alternative to using <code>disable</code> would be to use <code>tidy</code>,
but then you lose the file once and for all. Note though, that <code>wtmpx</code>
gets updated all the time, so an age <code>age=0</code> is necessary to have any
effect at all. Some daemons, like <code>httpd</code>, lose their ability to
write to a log file if you rename and create a new file. The <code>rotate</code>
feature in cfengine preserves the open file handle, fixing this problem.

</dl>

<dl>

<br><dt><em>Q:</em>
<dd><em>How can I fix exports in cfengine?</em>

<br><dt><em>A:</em>
<dd>This is a complicated matter. There are lots of ways to
do it. The key is either to edit the file <code>/etc/exports</code>
(<code>/etc/dfs/dfstab</code> in solaris), or to execute an export
(share) command directly from <code>shellcommands</code>. Under Solaris
2 this is quite easy owing to the fact that the file <code>dfstab</code>
is just a script itself, rather than a configuration file
like the old <code>/etc/exports</code> file. Since
editing is limited and you need to specify a list of hosts
which might change in time, one of the following is probably
the best bet:

<pre>
shellcommands:

   solaris::

      "/usr/sbin/share -F nfs -o rw=<var>netgroup</var> /var/mail"

</pre>

<p>On non-solaris systems:

<pre>
editfiles:

   { /etc/exports

   AppendIfNoSuchLine "/<var>site</var>/<var>host</var>/<var>fs</var> -access=<var>netgroup</var>"
   }

</pre>

<br><dt><em>Q:</em>
<dd><em>How can I distribute key setup files to users and keep
them up to date?</em>

<br><dt><em>A:</em>
<dd>The copy facility will distribute to all users if you
use the <code>home</code> directive. For instance, to copy
a basic <code>.cshrc</code> file or <code>.xsession</code>, you could
write

<pre>
copy:

   /local/masterfiles/.cshrc     dest=home/.cshrc
   /local/masterfiles/.xsession  dest=home/.xsession

</pre>

<br><dt><em>Q:</em>
<dd><em>Some users set up their own IRC listen services called
"eggdrop" which fill up the disk with all kinds of garbage. 
How can I kill all these processes?</em>

<br><dt><em>A:</em>
<dd>
<pre>
processes:

  #
  # Most users
  #

  "eggdrop"  signal=kill

  #
  # One wise-guy has renamed the daemon!
  #

  ".*wiseguy.*myegg.*"  signal=kill

</pre>

<br><dt><em>Q:</em>
<dd><em>My license server keeps crashing! 
How can I check that it's ok?</em>
<br><dt><em>A:</em>
<dd>
<pre>
processes:

  #
  # BSD - often need long descriptive lines
  #       to find this daemon
  #

  SetOptionString "-ax"

  # Exactly one should be running

  "lmgrd" matches=1

</pre>

<br><dt><em>Q:</em>
<dd><em>I want to use cfengine to keep DNS tables up to date, using
editfiles. How can I make cfengine automatically restart
the name server after the edits?</em>

<br><dt><em>A:</em>
<dd>This can be done in two ways. Probably, you need to
update a serial number as well as restarting the daemon. 
You might use a Makefile to simplify this.

<pre>
control:

  actionsequence = ( editfiles control )

  solaris::
           named = ( /usr/sbin/in.named)
  linux:
  freebsd:
           named = ( /usr/sbin/named )
  sun4:
           named = ( /usr/etc/named )

editfiles:

 # edit files here

shellcommands:

   #
   # If you use make to sort out the details
   #

  "/local/gnu/bin/make -f /local/named/Makefile &gt; /dev/null"

</pre>

<p>Or if you need to explicitly restart the name daemon, you could
supplement the above with an explicit restart command (this means
you lose the cache),

<pre>
processes:

  "named" signal=kill restart "$(named)"

</pre>

<br><dt><em>Q:</em>
<dd><em>How can I edit all users' login files?</em>

<br><dt><em>A:</em>
<dd>You can use the 'home' pseudo-variable to iterate over all users'
homedirectories:

<pre>
editfiles:

    { home/.cshrc

    # Local fixes

    AppendIfNoSuchLine "alias lp  special-print-command"

    # Security

    DeleteLinesMatching "xhost +"
    }

</pre>

<br><dt><em>Q:</em>
<dd>How can I kill all processes except for root processes?

<br><dt><em>A:</em>
<dd>The following regular expression matches lines which do not
contain the string root:

<pre>
processes:

 "\(root\)\{0\}"  signal=term # or kill

</pre>

<br><dt><em>Q:</em>
<dd>How can I make cfengine distribute my <code>/etc/motd</code> file?

<br><dt><em>A:</em>
<dd>You will need a master file which contains the text you want to put on
your servers. Let us define a variable `masterfile' which contains
this. This master file needs to be available on all hosts on a common
NFS filesystem, for instance.  (This will change when remote copying is
implemented in cfengine.) Now you can do something like the following
script. Note that we define a version number for motd which just
prevents cfengine from editing the file every single time.  You have to
change this version number yourself in the config file to force an
update. If you don't care about this, just leave out the Begin..End
parentheses.

<pre>
control:

masterfile = ( /usr/local/admin/motd-master )

editfiles:

  any::

     { /etc/motd

     BeginGroupIfFileIsNewer "$(masterfile)"
       EmptyEntireFilePlease
       InsertFile "$(masterfile)"
       PrependIfNoSuchLine "This system is running $(class):$(arch)"
       AppendIfNoSuchLine "$(motd_version)"
     EndGroup
     }

</pre>

<p>Note that, if you want special messages added just for, say, linux, then
you can single out linux using a special class, or add a special edit
after this one.

<p>Note, if you want to keep the first kernel line in this file, you
can change this to:

<pre>editfiles:

   any::

   { /etc/motd

   BeginGroupIfFileIsNewer "$(masterfile)"
     IncrementPointer "1"
     DeleteLinesAfterThisMatching ".*"
     InsertFile "$(masterfile)"
     AppendIfNoSuchLine "$(motd_version)"
   EndGroup
   }

</pre>

<br><dt><em>bug-cfengine exchange: (Reply courtesy of David Masterson).</em>
<dd>
<em>I like cfengine a lot and it helps me very much, but I am a little
concerned about security. I'm using cfengine to keep some files like
/etc/hosts /etc/printcap /etc/mount etc. up to date. So cfengine is
started by root in a cron job and reads its cfengine.conf file and all
the other information from a filesystem which is common to all the
systems.  If now somebody manage to alter the cfengine.conf file he can
do everything he wants.  Wouldn't it be a good idea to make the
cfengine.conf file something like a pgp signed messages, so that
cfengine can test if this file was created by the right person? Or are
there other tips to make it more secure?</em>

<p>I'm not sure, but I think you're over-reacting or you need to be more specific
about where you think the holes are in Cfengine's security.  If you follow the
tips of any standard systems administrator using cfengine or not, there should
be few issues concerning security (ie. if security broke, there would be
little chance that cfengine could do anything about it anyway).

<p>Ask yourself some of the standard questions with respect to security on UNIX:

<ul>
<li>Who owns your script files? 
<li>Who can update those script files? 
<li>If those script files are updated by the wrong person, has your security
  been purposely broken or does it just have a hole in it? 
</ul>

<p>If you're still worried about the security of your script (be it a cfengine
script or not), you could always adjust your cron script to "decrypt" the
script file before executing it (see crypt(1)).

<p>Personally, I think if you've set the permissions on your script files
properly, then, if someone breaks into those scripts, they've already broken
into your system to a point where they could do what they wanted anyway.

<br><dt><em>Q:</em>
<dd>How can I distribute password files in cfengine, but keep certain passwords
different on some machines, like I can with NIS?

<br><dt><em>A:</em>
<dd>If you keep a file with special local passwords, you can override the password
file using <code>editfiles</code>. First you use <code>copy</code> to get the distributed
file, then you edit the file like this:
<pre>
  editfiles:

    { /etc/passwd

    SplitOn ":"


    ForEachLineIn "/usr/local/etc/passwd.local"

       ReplaceLinesMatchingField "1"

    EndLoop
    }

</pre>

<p>This means, if the first field of each line in the files
matches in both files (and both files have the same column format)
then replace the line in <code>/etc/passwd</code> with the line from
<code>/usr/local/etc/passwd.local</code>.

<br><dt><em>Q:</em>
<dd>How can I add entries to a list, like in the fiel <code>/etc/group</code>?

<br><dt><em>A:</em>
<dd>Okay, suppose you wanted to make sure that a special user was in the
group <code>adm</code>, you would use a construction like this:
<pre>  control:

      person = ( <var>new-user</var> )


  editfiles:

   { /etc/group

   BeginGroupIfNoLineMatching "adm.*$(person).*"
     LocateLineMatching "adm.*"
     AppendToLineIfNotContains ",$(person)"
   EndGroup
   }

</pre>

<br><dt><em>Q:</em>
<dd>How can I take backups with cfengine?

<br><dt><em>A:</em>
<dd>If you have a spare disk partition, you could make a mirror of the
most important files. You would use something like this:

<pre>
 control:

      excludecopy = ( *.mp3 *.o *.dvi *.ps *.zip *tar* *.lnk
                       core a.out *.au *.wav .* *.exe *.tgz )

 copy:

   BackupHost.Hr21::

     /site/host/home dest=/site/host/backup2/u1 r=inf size=&lt;4mb backup=false action=silent

</pre>

<p>for each partition you want to back up.

<br><dt><em>Q:</em>
<dd>I am using SAMBA and have windows file system data on my unix machine. When I
try to make a backup by remote copying files, cfengine goes into a recursive
loop when it meets short cuts.

<br><dt><em>A:</em>
<dd>Short cuts do not seem to respect the unix file protocols. They look like
directories to cfengine and this causes it problems since they do not parse
like directories. Add <code>*.lnk</code> to the list of files to be excluded during
the copy.

<br><dt><em>Q:</em>
<dd>Is it possible to force shellcommands to change its working directory? 
separating the commands with ";" seems to be not possible. shellscripts
should not be used for this purpose.

<br><dt><em>A:</em>
<dd>(By Rolf Ebert, ebert@pe-muc.de )

<p>I, too, have the need to pass variables to shellcommands and the
shellcommands must be executed in a given directory.  Here is how most
of my shellcommands look like:

<pre>      # generate MMC configs
       '$(shell) "PUBLIC=$(public); export PUBLIC; cd $(public)/mmc/config; ./blinksrv.x.cfm.in &gt; blinksrv.x.cfm"'
</pre>

<p><code>$(shell)</code> is defined as '/bin/sh -c'.  The actual script to be executed
is `blinksrv.x.cfm.in' which is located in `$(public)/mmc/config'.  It
generates a file in the same directory.  As an input parameter the
script needs the environment variable `PUBLIC'.

<br><dt><em>Q: Using cfengine with the AFS.</em>
<dd>We use AFS, therefore our directory structures look like this:
<code>/afs/btv.ibm.com/system/current/rs_aix43/...</code> and so on. 
I want to build a cf file that can pull what AFS calls the "sysname"
into the equation so I can have one cf file that can get data from the
proper rs_aix directory depending on what level of AIX, or SUN for that
matter,  it happens to run on.  If I use cfengine's class structure I
would have to have a cf file for each AIX/SUN level rather than one that
can handle them all.  That is why I want exec to work. 
Can anyone offer an answer to this type of scenario?

<br><dt><em>A: Courtesy of Jeff Blaine</em>
<dd>
We reference @sys all the time in our cfengine files.  It expands to the
current machine's AFS sysname on the fly.  It's part of AFS, use it!

<pre>control:
  #
  # ... stuff deleted ...
  #
  rcf_repos = ( /afs/whatever/our_admin_area/config )
  #
  # ... stuff deleted ...
  #

copy:

  # ... stuff deleted ...
  #
  #  SunOS 4 and IRIX automountd startup file to define /net -hosts
  #
  (sun4|irix|irix64)::
      $(rcf_repos)/@sys/etc/auto.master dest=/etc/auto.master mode=444 \
owner=root group=1 type=checksum
  #
  # ... stuff deleted ...
</pre>

<pre>
</pre>

</dl>

<p><hr>
Node:<a name="AIX">AIX</a>,
Next:<a rel=next href="#BSDI">BSDI</a>,
Previous:<a rel=previous href="#General">General</a>,
Up:<a rel=up href="#FAQS%20and%20Tips">FAQS and Tips</a>
<br>

<h3>AIX</h3>

<dl>

<br><dt><em>Q:</em>
<dd><em>Hints about AIX?</em>

<br><dt><em>A:</em>
<dd>Send then to <a href="mailto:bug-cfengine@gnu.org">bug-cfengine@gnu.org</a>.

<br><dt><em>Q: I get the error</em>
<dd>
<pre>ld: 0711-317 ERROR: Undefined symbol: .pthread_sigmask
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_init
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock
</pre>

<p>on AIX 4.2

<br><dt><em>A:</em>
<dd>Only AIX 4.3 supports POSIX threads fully. You should compile without
thread support.

<br><dt><em>Q:</em>
<dd>One of our Sysadmins has noted a limitation with line length under
AIX. I'm not sure how easy it is to fix but it might be worth noting it
somewhere in the cfengine docs.  It appears that on the AIX machines the
maximum line length we can use for cfengine files is defined by the
constant YYLMAX which is set to be 200.  On the Suns this constant is
set to be the same as BUFSIZ which is currently set to be 1024.  This
manifested itself by very unusual behavior as cfengine variables began
to be overwritten when line lengths in the config file exceeded 200
bytes.  Peter can attest to this.  Be forewarned "keep line lengths in
cfengine less than 200 if you want them to work on AIX machines" Moral
of the story "AIX users beware" Do you think we could just recompile
cfengine and use larger buffer sizes all over, I don't know if this
constant is all that should be tweaked or if it is somehow tied into the
lexx implementation also, since lexx is used to create the parser for
the config files.

<br><dt><em>A:</em>
<dd>This is a problem with lex and yacc, not with cfengine. The variable
BUFSIZ is a system quantity, not related to cfengine's internal
variable bufsize. I would recommend getting bison and flex and
doing away with the old lex and yacc from the system. 
Michael Lachowski reports that this is also a problem with HPUX 10's
lex/yacc.

</dl>

<p><hr>
Node:<a name="BSDI">BSDI</a>,
Next:<a rel=next href="#HPUX">HPUX</a>,
Previous:<a rel=previous href="#AIX">AIX</a>,
Up:<a rel=up href="#FAQS%20and%20Tips">FAQS and Tips</a>
<br>

<h3>BSDI</h3>

<dl>
<dt><em>Q:</em>
<dd>The following error occurs while compiling:

<pre>
% ./configure
loading cache ./config.cache
checking host system type... i386-pc-bsdi3.1
checking target system type... i386-pc-bsdi3.1
checking build system type... i386-pc-bsdi3.1
expr: syntax error, last argument was `'
test: syntax error: Undefined error: 0
expr: syntax error, last argument was `'
test: syntax error: Undefined error: 0
expr: syntax error, last argument was `'
test: syntax error: Undefined error: 0
checking whether make sets ${MAKE}... (cached) yes
checking for gcc... (cached) gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
...

</pre>

<br><dt><em>A:</em>
<dd>
<pre>
  To correct this for BSDI I replaced the following script fragment from
configure:

-------------------------------------------------------------------------
#
# Add to the default list of places in LDFLAGS to compensate for
# ... the configure default value of LIBS on some systems
#
for x in /usr/local/gnu/lib /usr/local/gnulib /usr/local/lib /usr/lib /lib
do
  if test -d "$x"; then
    y=`expr match "$LDFLAGS" ".*-L$x"`
    if test $y -eq 0; then
      LDFLAGS="$LDFLAGS -L$x"
    fi
  fi
done

#
# Add to the default list of places in CPPFLAGS to match LDFLAGS above
#
for x in /usr/include /usr/local/gnu/include /usr/local/include
do
  if test -d "$x"; then
    y=`expr match "$CPPFLAGS" ".*-I$x"`
    if test $y -eq 0; then
      CPPFLAGS="$CPPFLAGS -I$x"
    fi
  fi
done
------------------------------------------------------------------------

   With this script fragment, which successfully executed:

------------------------------------------------------------------------

#
# Add to the default list of places in LDFLAGS to compensate for
# ... the configure default value of LIBS on some systems
#
for x in /usr/local/gnu/lib /usr/local/gnulib /usr/local/lib /usr/lib /lib
do
  if test -d "$x"; then
    case $LDFLAGS in
    .*-L$x)
      LDFLAGS="$LDFLAGS -L$x"
      ;;
    esac
  fi
done

#
# Add to the default list of places in CPPFLAGS to match LDFLAGS above
#
for x in /usr/include /usr/local/gnu/include /usr/local/include
do
  if test -d "$x"; then
    case $CPPFLAGS in
    .*-I$x)
      CPPFLAGS="$CPPFLAGS -I$x"
      ;;
    esac
  fi
done
-----------------------------------------------------------------------

   I have not completed compiling, installing, testing yet, but presume I
should be fine from here. Thanks for the help.

-Jeff
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Jeff Reed
    Berkeley Software Design, Inc.
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</pre>
</dl>

<p><hr>
Node:<a name="HPUX">HPUX</a>,
Next:<a rel=next href="#IRIX">IRIX</a>,
Previous:<a rel=previous href="#BSDI">BSDI</a>,
Up:<a rel=up href="#FAQS%20and%20Tips">FAQS and Tips</a>
<br>

<h3>HPUX</h3>

<dl>

<br><dt><em>Q:</em>
<dd>Problems with line length in lex/yacc.

<br><dt><em>A:</em>
<dd>See the FAQ for AIX.

<br><dt><em>Q:</em>
<dd><em>What is the difference between the classes <code>hpux</code>
and <code>hpux10</code>?</em>

<br><dt><em>A:</em>
<dd>In version 10 of HPUX, the file structure is reorganized
to look more like SVR4. If you have an HPUX-10 system,
the appropriate hardclass is <code>hpux10</code> rather than
<code>hpux</code>.

<br><dt><em>Q:</em>
<dd><em>I set up the new sendmail but the configuration
file doesn't work.</em>

<br><dt><em>A:</em>
<dd>There could be a frozen configuration file around. 
Try:

<pre>disable:

   hpux::

      /usr/lib/sendmail.fc

</pre>

<br><dt><em>Q:</em>
<dd><em>Why don't groups work in HPUX?</em>

<br><dt><em>A:</em>
<dd>HPUX uses the file <code>/etc/logingroup</code> not <code>/etc/group</code>. Make
a link if you need to:

<pre>links:

  hpux::

     /etc/logingroup -&gt; /etc/group

</pre>

<br><dt><em></em>
<dd>To encourage some cross-fertilization, here's a sanitized sendmail
configuration script that I created for HPUX and HPUX10. 
(From David Masterson, posted to gnu.cfengine.help). David's script
is nice since sendmail was the inspiration for cfengine's name.

<pre>#!/usr/local/bin/cfengine -f
####################################################
#
# File:		sendmail.conf
#
# Description: 	CFEngine script to setup the sendmail.cf.
#
####################################################

control:

	access = ( root )

#	Postmaster
	sysadm = ( myPostmaster )

#	NIS domain and group server
	site = ( myserver )

#	DNS domain
	domain = ( myDNSdomain )

#	our gateway host
	gtwyhost = ( mygateway )

#	sendmail.cf can be big
	editfilesize = ( 1000000 )

	actionsequence =
		(
		copy
		files
		editfiles
		shellcommands
		)

#	disable unwanted classes with "--undefine" option
	addclasses = ( maildom mailhst )

################
#	bindir - location of sendmail
#	libdir - location of current mail files
#	cfgdir - location of initial mail files
#	etcdir - location of hosts.smtp
#	own    - who should own result files
#	grp    - what group should result files be in
################
    hpux::
	bindir = ( /usr/lib )
	libdir = ( /usr/lib )
	cfgdir = ( /etc/newconfig )
	etcdir = ( /etc )
	own = ( root )
	grp = ( sys )

    hpux10::
	bindir = ( /usr/sbin )
	libdir = ( /etc/mail )
	cfgdir = ( /usr/newconfig/etc/mail )
	etcdir = ( /etc )
	own = ( root )
	grp = ( sys )

#	disable with "--no-copy" option
copy:

	$(cfgdir)/sendmail.cf dest=$(libdir)/sendmail.cf type=checksum
		mode=0644 owner=$(own) group=$(grp) force=true

#	checks for other important files
files:

	$(libdir)/aliases mode=444 owner=$(own) group=$(grp) action=touch
	$(libdir)/rev-aliases mode=444 owner=$(own) group=$(grp) action=touch
	$(etcdir)/hosts.smtp mode=444 owner=$(own) group=$(grp) action=touch

#	disable with "--no-edit" option
editfiles:

    any::

#	setup general part of sendmail.cf
	{ $(libdir)/sendmail.cf

	SetCommentStart '#'
	SetCommentEnd ''
	ResetSearch "1"
	UnCommentLinesMatching "#OP.*"	# activate Postmaster
	ResetSearch "1"
	UnCommentLinesMatching "#DY.*"
	ResetSearch "1"
	LocateLineMatching "DY.*"
	ReplaceLineWith "DY$(site).$(domain)"	# set site hiding
	ResetSearch "1"
	UnCommentLinesMatching "#DS.*"
	ResetSearch "1"
	LocateLineMatching "DS.*"
	ReplaceLineWith "DS$(gtwyhost)"	# all-knowing SMTP host
	# Ruleset 0 setups
	ResetSearch "1"
	UnCommentLinesMatching "#R.*user@domain to SMTP relay.*"
	ResetSearch "1"
	LocateLineMatching "# try to connect to any host for user@domain"
	IncrementPointer "1"
	CommentNLines "1"
	}

#	add Postmaster alias
	{ $(libdir)/aliases

	SetLine "Postmaster: $(sysadm)"
	AppendIfNoLineMatching "Postmaster.*"
	}

#	setup processing of local domain hosts
    maildom::

	{ $(libdir)/sendmail.cf

	SetCommentStart '#'
	SetCommentEnd ''
	ResetSearch "1"
	LocateLineMatching "DL.*"
	ReplaceLineWith "DL$(domain)"
	# Ruleset 0 setups
	ResetSearch "1"
	LocateLineMatching "# connect to hosts in local domain"
	IncrementPointer "1"
	UnCommentNLines "1"
	}

#	setup processing via class S
    mailhst::

	{ $(libdir)/sendmail.cf

	SetCommentStart '#'
	SetCommentEnd ''
	ResetSearch "1"
	UnCommentLinesMatching "#FS.*"
	# Ruleset 0 setups
	ResetSearch "1"
	LocateLineMatching "# connect to hosts in class S"
	IncrementPointer "1"
	UnCommentNLines "1"
	}

#	setup of list of hosts for class S
	{ $(etcdir)/hosts.smtp

	EmptyEntireFilePlease
	Append "localhost1"
	Append "localhost2"
	}

#	disable with "--no-commands" option
shellcommands:

	"$(bindir)/sendmail -bk"
	"$(bindir)/sendmail -bi"
	"$(bindir)/sendmail -bz"
	"$(bindir)/sendmail -bd"

################
# End of File
################
</pre>

</dl>

<p><hr>
Node:<a name="IRIX">IRIX</a>,
Next:<a rel=next href="#LINUX">LINUX</a>,
Previous:<a rel=previous href="#HPUX">HPUX</a>,
Up:<a rel=up href="#FAQS%20and%20Tips">FAQS and Tips</a>
<br>

<h3>IRIX</h3>

<dl>

<br><dt><em>Q:</em>
<dd><em>Hints about IRIX?</em>

<br><dt><em>A:</em>
<dd>Send them to <a href="mailto:bug-cfengine@gnu.org">bug-cfengine@gnu.org</a>.

</dl>

<p><hr>
Node:<a name="LINUX">LINUX</a>,
Next:<a rel=next href="#OSF">OSF</a>,
Previous:<a rel=previous href="#IRIX">IRIX</a>,
Up:<a rel=up href="#FAQS%20and%20Tips">FAQS and Tips</a>
<br>

<h3>LINUX</h3>

<dl>

<br><dt><em>Q:</em>
<dd>When I try to compile <code>cfd</code> I get this error
<pre> /usr/lib/libwrap.a(options.o): In function `twist_option':
 options.o(.text+0x5f7): undefined reference to `deny_severity'
 /usr/lib/libwrap.a(options.o): In function `severity_option':
 options.o(.text+0x808): undefined reference to `deny_severity'
 options.o(.text+0x81c): undefined reference to `deny_severity'
 options.o(.text+0x821): undefined reference to `deny_severity'
 options.o(.text+0x826): undefined reference to `deny_severity'
 options.o(.text+0x82b): undefined reference to `allow_severity'
 make[1]: *** [cfd] Error 1

</pre>

<br><dt><em>A:</em>
<dd>There seems to be a problem with the distributed version of
the TCP wrappers library. Edit the <code>src/conf.h</code> file
and comment out the <code>#define HAVE_LIBWRAP 1</code> line. 
This means that you will not be able to use TCP wrappers
security however. You might prefer to collect and compile
a new version of TCP wrappers.

<br><dt><em>Q:</em>
<dd><em>Linux insists on rebuilding the message of the day file
each time it boots, but that means I keep losing the
messages I leave there.</em>

<br><dt><em>A:</em>
<dd>Add the following to your configuration files to comment out the
offending lines in the startup scripts:

<pre>editfiles:

   linux::

    { /etc/rc.d/rc.S

    HashCommentLinesContaining "motd"
    }

</pre>

</dl>

<p><hr>
Node:<a name="OSF">OSF</a>,
Next:<a rel=next href="#SUN%20(4.1.*)">SUN (4.1.*)</a>,
Previous:<a rel=previous href="#LINUX">LINUX</a>,
Up:<a rel=up href="#FAQS%20and%20Tips">FAQS and Tips</a>
<br>

<h3>OSF</h3>

<dl>

<br><dt><em>Q:</em>
<dd>Hints about OSF/1?

<br><dt><em>A:</em>
<dd>Send them to <a href="mailto:bug-cfengine@gnu.org">bug-cfengine@gnu.org</a>.

</dl>

<p><hr>
Node:<a name="SUN%20(4.1.*)">SUN (4.1.*)</a>,
Next:<a rel=next href="#SOLARIS%202">SOLARIS 2</a>,
Previous:<a rel=previous href="#OSF">OSF</a>,
Up:<a rel=up href="#FAQS%20and%20Tips">FAQS and Tips</a>
<br>

<h3>SUNOS (4.1.*)</h3>

<dl>

<br><dt><em>Q:</em>
<dd><em>How can I delete the <code>+</code> sign from the <code>/etc/hosts.equiv</code>
file to improve security?</em>

<br><dt><em>A:</em>
<dd>Use editfiles to delete it:

<pre>editfiles:

   sun4::

      { /etc/hosts.equiv

      DeleteLinesMatching "+"
      }

</pre>

</dl>

<p><hr>
Node:<a name="SOLARIS%202">SOLARIS 2</a>,
Next:<a rel=next href="#FreeBSD">FreeBSD</a>,
Previous:<a rel=previous href="#SUN%20(4.1.*)">SUN (4.1.*)</a>,
Up:<a rel=up href="#FAQS%20and%20Tips">FAQS and Tips</a>
<br>

<h3>SOLARIS 2</h3>

<dl>

<br><dt><em>Q:</em>
<dd><em>I keep getting a `bad address' error when cfengine tries
to reset the netmask and broadcast address.</em>

<br><dt><em>A:</em>
<dd>This is a bug in the sockets library on solaris. It is
supposed to be fixed in solaris 2.5.

</dl>

<dl>

<br><dt><em>Q:</em>
<dd><em>How can I add my own file `rc.local' to the startup bootfiles automatically?</em>

<br><dt><em>A:</em>
<dd>For example, create a file called <code>/local/etc/rc.local</code> which
looks something like this:

<pre>#
# rc.local
#
PATH=/local/gnu/bin:/bin:/usr/bin:/usr/sbin; export PATH

#!/bin/sh

if [ "`hostname`" = "net-server" ]; then

   echo Starting WWW server
   /local/httpd_1.4/httpd -d /local/httpd_1.4

   echo Starting GNU finger server
   /local/etc/fingerd

fi

echo Starting ypbind
/usr/lib/netsvc/yp/ypbind

echo Adding a default route and flushing table

route -f add default my-gateway 1

echo Starting xdm

/local/bin/start-xdm

</pre>

<p>Now add an entry to your <code>cfengine.conf</code> file like this

<pre>
   solaris::

      { /etc/rc3.d/S99rc-local

      AutoCreate
      AppendIfNoSuchLine "exec sh /local/etc/rc.local"
      }

</pre>

</dl>

<dl>

<br><dt><em>Q:</em>
<dd><em>The solaris installation program creates <code>/tmp</code> without
the sticky bit set, so that any user can delete any files in <code>/tmp</code>. 
It also means that a race condition can occur in the kernel which
can give away root access to any user!</em>

<br><dt><em>A:</em>
<dd>
Add the following line to the configuration immediately!

<pre>
files:

   /tmp mode=1777 action=fixdirs

</pre>

<br><dt><em>Q:</em>
<dd><em>The ftp program will not allow me to log in to my own account!</em>

<br><dt><em>A:</em>
<dd>The problem is that your shell is not in the system file <code>/etc/shells</code>. 
Add a line something like this:

<pre>
editfiles:

   { /etc/shells

   AppendIfNoSuchLine "/local/bin/tcsh"
   }

</pre>

<br><dt><em>Q:</em>
<dd><em><code>tcsh</code> prints an error message on startup and will not read my
<code>.cshrc</code> file.</em>

<br><dt><em>A:</em>
<dd>The problem is the central login file distributed with solaris. <code>tcsh</code>
can't understand it. Add a line

<pre>
disable:

    /etc/.login type=file

</pre>

<p>You might want to replace this with a link to your own file.

<br><dt><em>Q:</em>
<dd><em>Why does solaris fill up the routing table with hundreds of addresses
under the loop-back interface? (see netstat -r)</em>

<br><dt><em>A:</em>
<dd>First of all, get the latest patches for solaris, there are bugs in
the kernel of solaris 2.4 which makes this worse. Second, make
sure you have a file <code>/etc/defaultrouter</code> with the IP
address of your local gateway, if you don't intend to run your
system as a router. For instance:

<pre>files:

  solaris::

     /etc/defaultrouter o=root g=other m=644 act=touch

editfiles:

   solaris::

      { /etc/defaultrouter

      AppendIfNoSuchLine "xxx.xxx.xxx.1"
      }

</pre>

<p>where <code>xxx.xxx.xxx.1</code> is the IP address of your gateway.

<br><dt><em>Q:</em>
<dd>When trying to boot the system, solaris fails with the
error message: <em>fork: rescource temporarily unavailable/vfork failed</em>. 
The system then claims that there is something wrong with one of
the file systems.

<br><dt><em>A:</em>
<dd>The file <code>/etc/system</code> has probably been corrupted. If this
file does not exist, solaris establish the kernel properly
and will not fork any processes. Things usually die early
on in the boot process. This causes the side effect that the
first fork the system needs to perform (to check the disk file
systems) fails and misinterprets the reason for failure of the
command. This makes it look as though something is wrong with
the disks. Add a line:

<pre>
files:

   /etc/system o=root g=root m=0644 action=touch

</pre>

<br><dt><em>Q:</em>
<dd>
I am currently involved with setting up machines with jumpstart. 
Jumpstart as you may know allows handsfree installation of solaris.  One
of the things it allows you to do is specify a "finish" script.  I am
running cfengine from this script to do the bulk of the configuration. 
During jumpstart, the root of the machine you are installing is actually
under "/a".  This leads to problems with cfengine with LOCKFILEDIR and
LOGFILEDIR at the very least. It would cause problems with all
assumptions cfengine makes about system files too.  What would be
execeedingly nice would be a command line option to redefine where root
is assumed to be.  I realize this would be pretty hairy with respect to
mounting through cfengine, but it would be very useful.  For file
editing and such a root prefix macro woudlprobably work ok.  Let me know
what you think.

<br><dt><em>A:</em>
<dd>
Define the filenames

<pre> $(root)/filename
</pre>

<p>and set <code>$(root)</code> to <code>""</code> or <code>"/a"</code> depending on context? 
That way you could the above without screwing up other things which
might be needed. You can switch off the locks with <code>-K</code>. And you
could override the <code>vfstab</code> location for solaris in the resource file.

<pre>

</pre>

</dl>

<p><hr>
Node:<a name="FreeBSD">FreeBSD</a>,
Previous:<a rel=previous href="#SOLARIS%202">SOLARIS 2</a>,
Up:<a rel=up href="#FAQS%20and%20Tips">FAQS and Tips</a>
<br>

<h3>FreeBSD</h3>

<dl>

<br><dt><em>Q:</em>
<dd><em>How can I stop my FreeBSD system from running the <code>/etc/daily</code> script
which mails me every single day, week and month?</em>

<br><dt><em>A:</em>
<dd>Add an editfiles command

<pre>

 freebsd::

   { /etc/crontab

   HashCommentLinesContaining "daily"
   HashCommentLinesContaining "weekly"
   HashCommentLinesContaining "monthly"
   }
</pre>

<br><dt><em>Q:</em>
<dd>Why don't filesystems get mounted in the freebsd version of cfengine?

<br><dt><em>A:</em>
<dd>Cfengine fixes the <code>/etc/fstab</code> file, but has to choose between
one of two courses of action when mounting, owing to a bug in
the mount command on FreeBSD machines. Cfengine mounts filesystems
each time it runs. On all other supported systems this causes no
problems,: once a filesystem is mounted it will not be mounted again. 
Under FreeBSD however, a filesystem gets mounted again each time
mount is run, leading to multiple mount information in the mount table. 
This causes cfengine to warn the filesystem is mounted many times,
and could eventually result in a problem for the FreeBSD machine. 
The policy is therefore to use mount options which do not cause this
behaviour, but an unfortunate side-effect is that newly defined
filesystems do not get mounted. You can override the mount options
if you want to force multiple mounting.

</dl>

<p><hr>
Node:<a name="Using%20the%20help%20scripts">Using the help scripts</a>,
Next:<a rel=next href="#Example%20configuration%20file">Example configuration file</a>,
Previous:<a rel=previous href="#Problem%20solving">Problem solving</a>,
Up:<a rel=up href="#Top">Top</a>
<br>

<h1>Using the help scripts</h1>

<p>The following Perl scripts are included as examples and helpful tools in
your system administration package.  If you do not have Perl, you should
get it -- it is a very useful language for system administration.

<ul>
<li><a href="#cfwrap">cfwrap</a>: 
<li><a href="#cfmail">cfmail</a>: 
</ul>

<p><hr>
Node:<a name="cfwrap">cfwrap</a>,
Next:<a rel=next href="#cfmail">cfmail</a>,
Previous:<a rel=previous href="#Using%20the%20help%20scripts">Using the help scripts</a>,
Up:<a rel=up href="#Using%20the%20help%20scripts">Using the help scripts</a>
<br>

<h2>cfwrap</h2>

<p>It is useful to run cfengine on a daily basis from a <code>cron</code>
script. 
Use a line like the following one to start cfengine each night.  (Note the
curiosities of older BSD cronfiles).
<pre>0 0 * * * /usr/local/lib/cfengine-3.0/bin/cfwrap cfdaily
</pre>

<p>where <em>cfdaily</em> is a script which looks something like

<pre>#!/bin/sh

CFINPUTS=/usr/lib/cfengine/inputs

/usr/local/bin/cfengine
</pre>

<p>You will need to include full path names to the scripts in the cron file. 
The syntax for using <code>cfwrap</code> is as follows.

<pre>host% cfwrap mycommand

host% cfwrap cfengine

host% cfwrap script_which_sets_CFINPUTS_and_calls_cfengine
</pre>

<p>When you run cfengine it normally only generates output if something is
wrong which needs your attention.  If you are running cfengine as a
<code>cron</code> job then the results of each job are normally mailed back to
you -- or to root.  But this causes problems in a networked
environment, since mail to root is usually redirected to some central
place which local system administrators cannot access.  Moreover, you
have no way of knowing which host sent the information.  The solution is
to use a script as a wrapper.  The script simply executes some command
and collects the output from that command into a file which then gets
mailed to some address.

<p>The address to be mailed to is obtained directly from cfengine by
calling it with the <em>-a</em> switch.  The name of the host running
cfengine is prepended to the file before it is sent making it easy to
see where each message originated.  This is also transferred to the
subject header of the mail message.  <code>cfwrap</code> calls <code>cfmail</code>
in order to mail the result of the command back to the system
administrator.

<p><hr>
Node:<a name="cfmail">cfmail</a>,
Previous:<a rel=previous href="#cfwrap">cfwrap</a>,
Up:<a rel=up href="#Using%20the%20help%20scripts">Using the help scripts</a>
<br>

<h2>cfmail</h2>

<p>Because there are no standard mail-agents except for <em>sendmail</em>,
the wrapper script <em>cfwrap</em> calls its own simple mail agent
<em>cfmail</em> to send the message.  Note that the <em>flags</em> variable
in the script <em>cfmail</em> arranges for the mail message to be sent
with a return address other than "root".  This means that if the
recipient of the mail should decide to hit `r' for `reply' to reply to
the message, you have a chance of getting to see the message before it
vanishes along with the rest of the mail to <em>root</em> into the same
black hole that swallows up all those credit cards, house-keys and odd
socks that disappear on a daily basis.

<p>You might have to tweak the scripts slightly to tailor them to your own needs. 
They are used as follows:

<pre>host% echo test ....  | cfmail -s "Test message" mark
</pre>

<p><hr>
Node:<a name="Example%20configuration%20file">Example configuration file</a>,
Next:<a rel=next href="#Runtime%20Options">Runtime Options</a>,
Previous:<a rel=previous href="#Using%20the%20help%20scripts">Using the help scripts</a>,
Up:<a rel=up href="#Top">Top</a>
<br>

<h1>Example configuration files</h1>

<p>Here is a sample from a large configuration file, just to give you
some ideas. The file is broken up into manageable pieces for
convenience.

<ul>
<li><a href="#cfengine.conf">cfengine.conf</a>: 
<li><a href="#cf.groups">cf.groups</a>: 
<li><a href="#cf.main">cf.main</a>: 
<li><a href="#cf.site">cf.site</a>: 
<li><a href="#cf.motd">cf.motd</a>: 
<li><a href="#cf.users">cf.users</a>: 
<li><a href="#cf.solaris">cf.solaris</a>: 
<li><a href="#cf.linux">cf.linux</a>: 
<li><a href="#cf.freebsd">cf.freebsd</a>: 
<li><a href="#cfd.conf">cfd.conf</a>: 
</ul>

<p><hr>
Node:<a name="cfengine.conf">cfengine.conf</a>,
Next:<a rel=next href="#cf.groups">cf.groups</a>,
Previous:<a rel=previous href="#Example%20configuration%20file">Example configuration file</a>,
Up:<a rel=up href="#Example%20configuration%20file">Example configuration file</a>
<br>

<h2>cfengine.conf</h2>

<pre>#####################################################################
#
#  CFENGINE CONFIGURATION FOR site = iu.hioslo.no
#
#  This file is for root only.
#
######################################################################

###
#
# BEGIN cfengine.conf
#
###

import:

   #
   # Split things up to keep things tidy
   #

   any::
                    cf.groups
                    cf.main
                    cf.site
                    cf.motd

   hpux::           cf.hpux
   linux::          cf.linux
   solaris::        cf.solaris
   sun4::           cf.sun4
   ultrix::         cf.ultrix
   freebsd::        cf.freebsd

   #
   # Do you want to do this ?
   #

   AllHomeServers:: cf.users


###
#
# END cfengine.conf
#
###
</pre>

<p><hr>
Node:<a name="cf.groups">cf.groups</a>,
Next:<a rel=next href="#cf.main">cf.main</a>,
Previous:<a rel=previous href="#cfengine.conf">cfengine.conf</a>,
Up:<a rel=up href="#Example%20configuration%20file">Example configuration file</a>
<br>

<h2>cf.groups</h2>

<pre>##############################################################
#
# cf.groups - for iu.hioslo.no
#
# This file contains  all group/class definitions
#
#################################################################

###
#
# BEGIN cf.groups
#
###

groups:

   #
   # Define some groups
   #

   iu = ( nexus ferengi regula borg dax lore axis worf daystrom voyager
          aud1 aud2 aud3 aud4 bajor ds9 takpah takpeh nostromo galron
          thistledown rama chaos pc-steinarj pc-hildeh way jart kosh )

   diskless   = ( regula ferengi lore )

   standalone = ( nexus axis dax borg worf daystrom voyager
                  aud1 aud2 aud3 aud4 bajor ds9 takpah takpeh
                  nostromo galron thistledown rama pc-torejo
                  pc-steinarj pc-hildeh )

   AllHomeServers   = ( nexus )
   AllBinaryServers = ( nexus borg )

   XBootServer  = ( nexus )
   WWWServers   = ( nexus )
   FTPserver    = ( nexus )
   NameServers  = ( nexus )
   PasswdServer = ( nexus )
   BackupHost   = ( nexus )

   MailHub      = ( nexus )
   MailClients  = ( iu -nexus )

###
#
# END cf.groups
#
###

</pre>

<p><hr>
Node:<a name="cf.main">cf.main</a>,
Next:<a rel=next href="#cf.site">cf.site</a>,
Previous:<a rel=previous href="#cf.groups">cf.groups</a>,
Up:<a rel=up href="#Example%20configuration%20file">Example configuration file</a>
<br>

<h2>cf.main</h2>

<pre>##############################################################
#
# cf.main - for iu.hioslo.no
#
# This file contains generic config stuff
#
#################################################################

###
#
# BEGIN cf.main
#
###

control:

   access    = ( root )        # Only root should run this

   site      = ( iu )
   domain    = ( iu.hioslo.no )
   sysadm    = ( drift@iu.hioslo.no )

   repository = ( /var/spool/cfengine )

   netmask   = ( 255.255.255.0 )
   timezone  = ( MET )
   nfstype   = ( nfs )

   sensiblesize  = ( 1000 )
   sensiblecount = ( 2 )
   editfilesize  = ( 20000 )

   mountpattern = ( /$(site)/$(host) )
   homepattern  = ( u? )

   #
   # If we undefine this with cfengine -N longjob
   # then we switch off all jobs labelled with this class
   #

   addclasses = ( longjob )

   #
   # Macros &amp; constants are inherited downwards in imports
   # but are not passed up to parent files. Good idea to
   # define them all here
   #

   masterfiles = ( /iu/nexus/local/iu )
   main_server = ( nexus )
   cfbin       = ( /iu/nexus/local/gnu/lib/cfengine/bin )
   gnu         = ( /local/gnu )
   ftp         = ( /local/iu/ftp )
   nisslave    = ( dax )
   nisfiles    = ( /iu/nexus/local/iu/etc )

   #
   # The action sequence for daily (full) runs and
   # for hourly updates (called with -DHourly)
   #

   Hr00::

      actionsequence =
         (
         copy
         mountall
         mountinfo
         checktimezone
         netconfig
         resolve
         unmount
         shellcommands
         addmounts
         links.Prepare
         files.Prepare
         directories
         links.Rest
         mailcheck
         mountall
         required
         tidy
         disable
         editfiles
         files.Rest
         processes
         )

   !Hr00::

      actionsequence =
         (
         resolve
         shellcommands
         copy
         editfiles
         processes
	 links
         )

   force::

      actionsequence =
         (
         files.Prepare.Rest
         tidy
         )

######################################################################

homeservers:

   iu:: nexus

binservers:

   iu.solaris::                 nexus
   iu.linux::                   borg

mailserver:

   any:: nexus:/var/mail

mountables:

   any::
         nexus:/iu/nexus/u1
         nexus:/iu/nexus/u2
         nexus:/iu/nexus/u3
         nexus:/iu/nexus/u4
         nexus:/iu/nexus/u5
         nexus:/iu/nexus/u6
         nexus:/iu/nexus/ua
         nexus:/iu/nexus/ud
         nexus:/iu/nexus/local
         nexus:/opt/NeWSprint
         nexus:/opt/AcroRead
         borg:/iu/borg/local
         dax:/iu/dax/local

miscmounts:

   linux||freebsd::   nexus:/iu/nexus/local /iu/nexus/local ro

######################################################################

broadcast:

  ones

defaultroute:

   cadeler30-gw

######################################################################

resolve:

      128.39.89.10  # nexus
      158.36.85.10  # samson.hioslo.no
      129.241.1.99

######################################################################

tidy:

   #
   # Some global tidy-ups
   #

      /tmp/                    pat=*             r=inf     A=1
      /var/tmp                 pat=*             r=inf     A=1
      /                        pat=core          r=1       A=0
      /etc                     pat=core          r=1       A=0

######################################################################

ignore:                       # Don't check or tidy these directories

      /local/lib/gnu/emacs/lock/
      /local/tmp
      ftp
      projects
      /local/bin/top
      /local/lib/tex/fonts
      /local/iu/etc
      /local/etc
      /local/iu/httpd/conf
      /usr/tmp/locktelelogic
      /usr/tmp/lockIDE
      RootMailLog

      #
      # Emacs lock files etc
      #

      !*
      /local/lib/xemacs

      #
      # X11 keeps X server data in /tmp/.X11
      # better not delete this!
      #

      .X11

      #
      # Some users like to give a file or two 777 protection here
      # so netsurfers can update a log or counter when running as
      # `nobody'
      #

      www

#####################################################################

disable:

   /etc/hosts.equiv
   /etc/nologin
   /usr/lib/sendmail.fc


###
#
# END cf.main
#
###

</pre>

<p><hr>
Node:<a name="cf.site">cf.site</a>,
Next:<a rel=next href="#cf.motd">cf.motd</a>,
Previous:<a rel=previous href="#cf.main">cf.main</a>,
Up:<a rel=up href="#Example%20configuration%20file">Example configuration file</a>
<br>

<h2>cf.site</h2>

<pre>##############################################################
#
# cf.site - for iu.hioslo.no
#
# This file contains site specific data
#
#################################################################

###
#
# BEGIN cf.site
#
###

links:

   Prepare::

      /local     -&gt; /$(site)/$(binserver)/local
      /usr/local -&gt; /local

   dax::

      /iu/dax/local             +&gt; /iu/nexus/local
      /projects                 -&gt; /iu/dax/local/projects
      /iu/nexus/u1/sowille/data -&gt; /iu/dax/scratch/data

   XBootServer::

      #
      # Set up a /local/tftpboot area where all X terminal
      # stuff will be kept.
      #

      /tftpboot                  -&gt; /local/tftpboot
      /local/tftpboot/td/configs -&gt; /local/tftpboot/td/examples/configs
      /etc/bootptab              -&gt; /tftpboot/bootptab
      /tftpboot/usr/lib/X11/td   -&gt; /tftpboot/td

   NameServers::

      /etc/named.boot -&gt; /local/iu/named/named.boot

   MailHub::

      /etc/mail/sendmail.cf -&gt;! /iu/nexus/local/mail/sendmail.cf

   MailClients.solaris::

      /etc/mail/sendmail.cf -&gt;! /iu/nexus/local/mail/client.cf

   nexus::

	/local/bin +&gt; /local/latex/bin

#############################################################

disable:

  #
  # We run Berkeley sendmail and the config files are
  # all under /iu/nexus/local/lib/mail
  #

    /etc/aliases

 WWWServers.Sunday::

   #
   # Disabling these log files weekly prevents them from
   # growing so enormous that they fill the disk!
   #

   /local/iu/httpd/logs/access_log   rotate=empty
   /local/iu/httpd/logs/agent_log    rotate=empty
   /local/iu/httpd/logs/error_log    rotate=empty
   /local/iu/httpd/logs/referer_log  rotate=empty

   #
   # CERT warning, security fix
   #

  any::

    /usr/lib/expreserve

  FTPserver.Sunday.Hr00::

   /local/iu/xferlog rotate=3

#################################################################

files:

  Prepare::

      /etc/motd              m=0644 r=0 o=root act=touch
      /.cshrc                m=0644 r=0 o=root act=touch

   PasswdServer::

      /local/iu/etc/passwd m=0644 o=root g=other action=fixplain
      /local/iu/etc/shadow m=0644 o=root g=other action=fixplain

   WWWServers.Rest::

      /local/iu/www                           m=775        g=www act=fixall r=inf
      /local/iu/httpd/conf                    m=664 o=root g=www act=fixall r=inf
      /local/iu/www/cgi-bin-public/count_file m=777 o=root g=www act=fixplain

   FTPserver::

      #
      # Make sure anonymous ftp areas have the correct
      # protection, or logins won't be able to read
      # files - or perhaps a security risk. This is
      # solaris 2 specific...
      #

      $(ftp)/pub        mode=755 o=ftp  g=ftp  r=inf act=fixall
      $(ftp)/Obin       mode=111 o=root g=other      act=fixall
      $(ftp)/etc        mode=111 o=root g=other      act=fixdirs
      $(ftp)/usr/bin/ls mode=111 o=root g=other      act=fixall
      $(ftp)/dev        mode=555 o=root g=other      act=fixall
      $(ftp)/usr        mode=555 o=root g=other      act=fixdirs

   Prepare::

      /etc/shells mode=0644 action=touch

   AllBinaryServers.Rest.longjob::

     /local mode=-0002 r=inf owner=root,bin group=0,1,2,3,4,5,6,7,staff
            links=tidy action=fixall

     /local/iu/RootMailLog  m=0666 action=touch

   dax.Rest::

    /iu/dax/scratch        r=0 o=root mode=1777 action=fixall
    /iu/dax/local/projects r=0 o=root mode=755  action=fixdirs

   nexus::

    /local/mail/sendmail.cf o=root m=444 act=fixplain

    /iu/nexus/ua/robot/.rhosts o=robot m=600 act=touch

    /local/iu/named/pz         o=root  m=644 act=fixall r=1

    /local/latex/lib/tex/texmf/fonts  owner=root
                                      mode=1666
                                      recurse=inf
                                      action=fixall

#################################################################

tidy:

      #
      # Make sure the file repository doesn't fill up
      #

      /var/spool/cfengine pattern=*    age=3

      /var                pattern=core age=0  r=inf
      /var/spool/mqueue   pattern=*    age=14 type=mtime

   BackupHost::

      # Here we tidy old backup tar files from the backup area
      # A special tmp area gets cleared every 4 days. The files
      # are created by Audun's backup help script (see shellcommands)

      /iu/nexus/backup1      pat=*  age=7

#################################################################

shellcommands:

   PasswdServer::

      # Build and install the BSD compatible passwd file
      # from the master passwd/shadow file on solaris

      "/local/iu/bin/BuildPasswdFiles"
      "/local/iu/bin/BuildGroupFiles"

  BackupHost.Sunday.Hr00|BackupHost.Wednesday.Hr00::

      #
      # Make a system backup of /iu/nexus/u? with Audun's script
      #

      "$(cfbin)/cfbackup -p -f /iu/nexus/backup1 -s /iu/nexus/ud"
      "$(cfbin)/cfbackup -p -f /iu/nexus/backup1 -s /iu/nexus/ua"
      "$(cfbin)/cfbackup -p -f /iu/nexus/backup1 -s /iu/nexus/u1"
      "$(cfbin)/cfbackup -p -f /iu/nexus/backup1 -s /iu/nexus/u2"
      "$(cfbin)/cfbackup -p -f /iu/nexus/backup2 -s /iu/nexus/u3"
      "$(cfbin)/cfbackup -p -f /iu/nexus/backup2 -s /iu/nexus/u4"
      "$(cfbin)/cfbackup -p -f /iu/nexus/backup2 -s /iu/nexus/u5"
      "$(cfbin)/cfbackup -p -f /iu/nexus/backup2 -s /iu/nexus/u6"

  nexus.Sunday.longjob.Hr00::

      #
      # See how much rubbish users have accumulated each Sunday
      #

      "$(cfbin)/noseyparker /iu/nexus/u1 $(sysadm) "
      "$(cfbin)/noseyparker /iu/nexus/u2 $(sysadm) "
      "$(cfbin)/noseyparker /iu/nexus/u3 $(sysadm) "
      "$(cfbin)/noseyparker /iu/nexus/u4 $(sysadm) "
      "$(cfbin)/noseyparker /iu/nexus/u5 $(sysadm) "
      "$(cfbin)/noseyparker /iu/nexus/u6 $(sysadm) "
      "$(cfbin)/noseyparker /iu/nexus/ua $(sysadm) nomail"
      "$(cfbin)/noseyparker /iu/nexus/ud $(sysadm) nomail"

   nexus.longjob.Hr00::

      #
      # Update the GNU find/locate database each night
      #

      "$(gnu)/lib/locate/updatedb"
      "/local/iu/bin/newhomepage.sh"

###############################################################

editfiles:

    #
    # cfengine installs itself as a cron job - sneaky! :)
    #

    { /var/spool/cron/crontabs/root

    AppendIfNoSuchLine "0 * * * * $(cfbin)/cfwrap $(cfbin)/cfhourly"
    }

   FTPserver::

      { /etc/shells

      AppendIfNoSuchLine "/bin/tcsh"
      AppendIfNoSuchLine "/local/gnu/bin/bash"
      }


   XBootServer::

      { /etc/inetd.conf

      AppendIfNoSuchLine
          "bootp dgram udp wait root /local/bin/bootpd bootpd -i -d"
      }

   nexus::

      { /iu/nexus/ua/robot/.rhosts

      AppendIfNoSuchLine "borg"
      AppendIfNoSuchLine "borg.iu.hioslo.no"
      AppendIfNoSuchLine "aud4"
      AppendIfNoSuchLine "aud4.iu.hioslo.no"
      }

   dax::

      { /etc/system

      AppendIfNoSuchLine "set pt_cnt=128"
      }


######################################################################

required:

   #
   # Any host must have a /local, /usr/local fs. Check that
   # it exists and looks sensible. (i.e. not empty)
   #

   /$(site)/$(binserver)/local


######################################################################

copy:

   #
   # NIS seems broken at IU, so here we use NFS to fudge
   # a file distribution as a temporary solution. Actually
   # this makes the system work faster without NIS!
   #

      $(nisfiles)/services dest=/etc/services o=root g=other mode=0644
      $(nisfiles)/hosts.deny dest=/etc/hosts.deny o=root mode=0644

   !debian::

      $(nisfiles)/hosts    dest=/etc/hosts o=root g=other mode=0644

   PasswdServer::

      /etc/passwd dest=$(nisfiles)/passwd o=root g=other mode=0644
      /etc/shadow dest=$(nisfiles)/shadow o=root g=other mode=0644

   nexus::

      /local/iu/etc/dfstab dest=/etc/dfs/dfstab  o=root  mode=0744

   solaris.!PasswdServer::

      $(nisfiles)/passwd dest=/etc/passwd o=root g=other mode=0644
      $(nisfiles)/shadow dest=/etc/shadow o=root g=other mode=0600
      $(nisfiles)/group.solaris dest=/etc/group o=root g=other mode=0644

   linux::

      $(nisfiles)/passwd.linux dest=/etc/passwd o=root g=other mode=0644
      $(nisfiles)/group.linux dest=/etc/group o=root g=other mode=0644

###############################################################

processes:

      "eggdrop"                           signal=kill
      "irc"                               signal=kill
      "ping"                              signal=kill
      "NetXRay"                           signal=kill
      "netxray"                           signal=kill
      "ypserv"                            signal=kill
      "ypbind"                            signal=kill
      "rarpd"                             signal=kill
      "rpc.boot"                          signal=kill
      "README"                            signal=kill # You don't sh README !

   !XBootServer::

      "bootp"                             signal=kill

   #
   # These processes are not killed every hour, but once a day
   # when cfengine runs at night. Note that there are often
   # hanging pine and elm processes. These programs crash and
   # go berserk, using hundreds of hours of CPU time.
   #

   Hr00::

      "cron"                 signal=hup  # HUP these to update their config
      "inetd"                signal=hup

      "/local/sdt/sdt/bin"   signal=term # For those elektro dudes who forget
                                         # to log out
      "netscape"             signal=kill
      "pine"                 signal=kill
      "elm"                  signal=kill


###
#
# END cf.site
#
###

</pre>

<p><hr>
Node:<a name="cf.motd">cf.motd</a>,
Next:<a rel=next href="#cf.users">cf.users</a>,
Previous:<a rel=previous href="#cf.site">cf.site</a>,
Up:<a rel=up href="#Example%20configuration%20file">Example configuration file</a>
<br>

<h2>cf.motd</h2>

<pre>
##################################################################
#
# cf.motd
#
# This file is used to set the message of the day file on
# each host
#
##################################################################

 #####
 #
 # BEGIN cf.motd
 #
 #####


control:

   #
   # This points to the file containing general text
   #

   masterfile      = ( /iu/nexus/local/iu/etc/motd-master )
   local_message   = ( /etc/motd.local )

editfiles:

      { /etc/motd

      BeginGroupIfFileIsNewer "$(masterfile)"
        EmptyEntireFilePlease
        InsertFile "$(masterfile)"
        InsertFile "$(local_message)"
        PrependIfNoSuchLine "This system is running $(class):$(arch)"
      EndGroup
      }

 #####
 #
 # BEGIN cf.motd
 #
 #####

</pre>

<p><hr>
Node:<a name="cf.users">cf.users</a>,
Next:<a rel=next href="#cf.solaris">cf.solaris</a>,
Previous:<a rel=previous href="#cf.motd">cf.motd</a>,
Up:<a rel=up href="#Example%20configuration%20file">Example configuration file</a>
<br>

<h2>cf.users</h2>

<p>Whether or not you perform any special services for users, with or
without their consent is entirely a matter of local policy. In a school
or college situation, users are often uncooperative and some are even
irresponsible.  This file shows you what you could do in an environment
with inexperienced users, but please don't feel as though you have to be
this totalitarian.

<pre>#################################################################
#
# cf.users - for iu.hioslo.no
#
# This file contains user specific actions
#
#################################################################

###
#
# BEGIN cf.users
#
###

ignore:

    robot

tidy:

   longjob::

     #
     # Some users just don't understand what they are doing
     # and this is safest, allbeit totalitarian
     #

     home                 pat=.rhosts                      age=0

     #
     # Tidy up users' home dirs
     #

     home                 pat=core             r=inf       age=0
     home                 pat=a.out            r=inf       age=1
     home                 p=*%                 r=inf       age=2
     home                 p=*~                 r=inf       age=2
     home                 p=#*                 r=inf       age=1
     home                 p=*.dvi              r=inf       age=14   type=ctime
     home                 p=*.log              r=inf       age=2
     home                 p=Log.*              r=inf       age=3
     home                 p=CKP                r=inf       age=1
     home                 p=BAK                r=inf       age=1
     home                 p=log                r=inf       age=0
     home                 p=*.o                r=inf       age=0
     home                 p=*.aux              r=inf       age=3
     home                 p=*.zip              r=inf       age=7
     home/.deleted        p=*                  r=inf       age=0
     home/.wastebacket    p=*                  r=inf       age=14
     home/www             p=*~                 r=inf       age=1

     #
     # Clear the big cache files netscape creates
     #

     home/.netscape-cache  p=cache????*         r=inf       age=0
     home/.MCOM-cache      p=cache????*         r=inf       age=0
     home/.netscape/cache  p=*                  r=inf       age=0


#################################################################

files:

   AllHomeServers.longjob.rest::

     #
     # Check users files are not writable to the world
     # and there are no stale links (pointing nowhere)
     #

     home mode=o-w recurse=inf action=fixall # links=tidy

     home/.xsession mode=755 action=fixall
     home/.cshrc    mode=755 action=fixall

#################################################################

copy:

   Hr00.longjob::

   #
   # Make sure each user has an up to date standard
   # setup.  Cshrc just sources in a big standard file
   # which is kept in ~user/../.setupfiles/cshrc
   # to reduce disk wastage
   #

   $(masterfiles)/lib/Cshrc   dest=home/.cshrc
   $(masterfiles)/lib/tkgrc   dest=home/.tkgrc
   $(masterfiles)/lib/fvwm2rc dest=home/.fvwm2rc


###
#
# END cf.users
#
###
</pre>

<p><hr>
Node:<a name="cf.solaris">cf.solaris</a>,
Next:<a rel=next href="#cf.linux">cf.linux</a>,
Previous:<a rel=previous href="#cf.users">cf.users</a>,
Up:<a rel=up href="#Example%20configuration%20file">Example configuration file</a>
<br>

<h2>cf.solaris</h2>

<pre>#################################################################
#
# cf.solaris - for iu.hioslo.no
#
# This file contains solaris specific patches
#
#################################################################

###
#
# BEGIN cf.solaris
#
###

directories:

     #
     # httpd/netscape want this to exist for some bizarre reason
     #

      /usr/lib/X11/nls

################################################################

tidy:

     /var/log  pattern=syslog.* age=0

   MailHub::

     /var/mail pattern=lp       age=0

#################################################################

files:

  #
  # If this doesn't exist fork will not work and the
  # system will not even be able to run the /etc/rc
  # scripts at boottime
  #

  /etc/system     o=root g=root m=644 action=touch

  /var/log/syslog o=root        m=666 action=touch

#############################################################

copy:

   #
   # Some standard setup files, can't link because
   # machine won't boot if their not on / partition.
   #

   /local/bin/tcsh dest=/bin/tcsh mode=755

   /local/iu/etc/nsswitch.standalone dest=/etc/nsswitch.conf

  #
  # Our named server uses a newer BIND
  # Put this here so that it will be preserved under
  # solaris reinstallation
  #

  NameServers::

   /local/iu/sbin/in.named         dest=/usr/sbin/in.named         mode=555
   /local/iu/sbin/in.named.reload  dest=/usr/sbin/in.named.reload  mode=555
   /local/iu/sbin/in.named.restart dest=/usr/sbin/in.named.restart mode=555
   /local/iu/sbin/in.ndc           dest=/usr/sbin/in.ndc           mode=555
   /local/iu/sbin/named-xfer       dest=/usr/sbin/named-xfer       mode=555
   /local/iu/lib/nslookup.help     dest=/usr/lib/nslookup.help     mode=444

  any::
   /local/iu/lib/libresolv.a        dest=/usr/lib/libresolv.a      mode=444
   /local/iu/lib/libresolv.so.2     dest=/usr/lib/libresolv.so.2   mode=444
   /local/bin/nslookup              dest=/usr/sbin/nslookup        mode=444

##############################################################

editfiles:

      { /etc/netmasks

      AppendIfNoSuchLine "128.39  255.255.255.0"
      }

      { /etc/defaultrouter

      AppendIfNoSuchLine "128.39.89.1"
      }

      { /usr/openwin/lib/app-defaults/XConsole

      AppendIfNoSuchLine "XConsole.autoRaise: on"
      }

   #
   # CERT security patch for vold vulnerability
   #

   { /etc/rmmount.conf

   HashCommentLinesContaining "action cdrom"
   HashCommentLinesContaining "action floppy"
   }

##############################################################

disable:

    /etc/.login  type=file
    /etc/aliases

   #
   # These files are ENORMOUS, don't let them fill the disk
   #

   Wednesday::

      /var/lp/logs/lpsched rotate=empty

      /var/adm/wtmpx       rotate=empty
      /var/adm/wtmp        rotate=empty

##############################################################

files:

    /etc/passwd        m=0644 o=root g=other action=fixplain
    /etc/shadow        m=0600 o=root g=other action=fixplain
    /etc/defaultrouter m=0644 o=root g=other action=touch
    /var/adm/wtmpx     m=0664 o=adm  g=adm   action=touch
    /var/adm/wtmp      m=0644 o=root g=adm   action=touch
    /var/adm/utmp      m=0644 o=root g=adm   action=fixplain
    /var/adm/utmpx     m=0664 o=adm  g=adm   action=fixplain

    /tmp m=1777                              action=fixdirs

##############################################################

disable:

   #
   # CERT security patch
   #

   /usr/openwin/bin/kcms_calibrate
   /usr/openwin/bin/kcms_configure
   /usr/bin/admintool

################################################################

shellcommands:

   AllBinaryServers.Saturday.longjob.Hr00::

      #
      # Make sure the man -k / apropos data are up to date
      #

      "/usr/bin/catman  -M /local/man"
      "/usr/bin/catman  -M /local/X11R5/man"
      "/usr/bin/catman  -M /usr/man"
      "/usr/bin/catman  -M /local/gnu/man"
      "/usr/bin/catman  -M /usr/openwin/share/man"
      "/usr/bin/catman  -M /local/X11R5/man"
      "/usr/bin/catman  -M /usr/share/man"

################################################################

editfiles:


      #
      # A painless way to add an rc.local script to the rc files
      # under solaris without having to fight though inittab
      #

      { /etc/rc3.d/S15nfs.server

      AppendIfNoSuchLine "sh /local/iu/etc/rc.local"
      }

      #
      # umask defined when inetd starts is inherited by all subprocesses
      # including ftpd which saves with mode 666 (!) unless we do this
      #

      { /etc/rc2.d/S72inetsvc

      PrependIfNoSuchLine "umask 022"
      }


###
#
# END cf.solaris
#
###

</pre>

<p><hr>
Node:<a name="cf.linux">cf.linux</a>,
Next:<a rel=next href="#cf.freebsd">cf.freebsd</a>,
Previous:<a rel=previous href="#cf.solaris">cf.solaris</a>,
Up:<a rel=up href="#Example%20configuration%20file">Example configuration file</a>
<br>

<h2>cf.linux</h2>

<pre>#################################################################
#
# cf.linux - for iu.hioslo.no
#
# This file contains debian linux specific patches
#
#################################################################

###
#
# BEGIN cf.linux
#
###

files:

      /etc/printcap m=644 o=root action=fixplain

     #
     # Cert advisories
     #

      /bin/mount         m=755 o=root action=fixall
      /bin/umount        m=755 o=root action=fixall

#######################################################################

  disable:

     #
     # Cert advisories
     #

      /sbin/dip-3.3.7n

########################################################################

links:

    /local/bin/tcsh   -&gt;  /bin/tcsh

    /local/lib/mail   -&gt;  /$(site)/$(main_server)/local/lib/mail

########################################################################

editfiles:

  #
  # Samba default mode needs to be set...
  #

   { /etc/smb.conf

   ReplaceAll "700" With "644"
   }

  #
  # Linux date is very stupid and needs a very careful
  # TZ definition, otherwise it loses
  #

   { /etc/csh.cshrc

   AppendIfNoSuchLine "setenv TZ 'MET-1MET DST-2,M3.5.0/2,M10.5.0/3'"
   }

  #
  # resolv+ ordering
  #

   { /etc/host.conf

   PrependIfNoSuchLine "order bind"
   }


  #
  # Should have been configured already (!)
  #

   { /etc/ld.so.conf

   AppendIfNoSuchLine "/usr/X11R6/lib"
   }

  #
  # Kill annoying messages
  #

   { /etc/cron.daily/standard

   HashCommentLinesContaining "security"
   }

#########################################################################

shellcommands:

  Hr00::

     #
     # Find/locate database
     #

     "/usr/bin/updatedb"

###
#
# END cf.linux
#
###


</pre>

<p><hr>
Node:<a name="cf.freebsd">cf.freebsd</a>,
Next:<a rel=next href="#cfd.conf">cfd.conf</a>,
Previous:<a rel=previous href="#cf.linux">cf.linux</a>,
Up:<a rel=up href="#Example%20configuration%20file">Example configuration file</a>
<br>

<h2>cf.freebsd / cf.netbsd</h2>

<p>FreeBSD, OpenBSD and NetBSD are sufficiently similar to have a single
file for all.

<pre>#################################################################
#
# cf.bsd - for iu.hioslo.no
#
# This file contains bsd specific patches
#
#################################################################

###
#
# BEGIN cf.bsd
#
###

links:

    /usr/spool        -&gt;  /var/spool
    /local/bin/tcsh   -&gt;  /bin/tcsh
    /local/bin/perl   -&gt;  /usr/bin/perl
    /usr/lib/sendmail -&gt;  /usr/sbin/sendmail

#################################################################

files:

   /usr/tmp mode=1777 owner=root action=fixall

#################################################################

editfiles:

   #
   # Comment out all lines to shut up this annoying cfengine-like
   # script, which sends mail every day!!!
   #

   { /etc/crontab

   HashCommentLinesContaining "daily"
   HashCommentLinesContaining "weekly"
   HashCommentLinesContaining "monthly"
   }

#################################################################

copy:

      $(masterfiles)/etc/printcap.client      dest=/etc/printcap mode=0644

#########################################################################

shellcommands:

  Hr00::

    "/usr/libexec/locate.updatedb"
    "/usr/bin/makewhatis /usr/share/man:/usr/X11R6/man"

###
#
# END cf.bsd
#
###


</pre>

<p><hr>
Node:<a name="cfd.conf">cfd.conf</a>,
Previous:<a rel=previous href="#cf.freebsd">cf.freebsd</a>,
Up:<a rel=up href="#Example%20configuration%20file">Example configuration file</a>
<br>

<h2>cfd.conf</h2>

<pre>#########################################################
#
# This is a cfd config file
#
# The access control here follows after any tcpd
# control in /etc/hosts.allow and /etc/hosts.deny
#
#########################################################

 #
 # Could import cf.groups here and use a structure like
 # in cfengine.conf, cf.main, cf.groups
 #

control:

  public = ( /usr/local/publicfiles )

  almost_public = ( /usr/local/almostpublicfiles )

  cfrunCommand = ( /iu/nexus/ud/mark/comp/Tests/cfrun-command )

  MaxConnections = ( 10 )

#########################################################

admit:   # or grant:

     $(public) *

     $(almost_public) *.iu.hioslo.no *.gnu.ai.mit.edu

     /etc/passwd *.iu.hioslo.no

     #
     # Who can exec cfengine remotely?
     #

     $(cfrunCommand) *.iu.hioslo.no

#########################################################

deny:

     $(public)/special *.moneyworld.com


</pre>

<p><hr>
Node:<a name="Runtime%20Options">Runtime Options</a>,
Next:<a rel=next href="#Network%20protocol%20specs">Network protocol specs</a>,
Previous:<a rel=previous href="#Example%20configuration%20file">Example configuration file</a>,
Up:<a rel=up href="#Top">Top</a>
<br>

<h1>Runtime Options</h1>

<p>Note that GNU long options are available with the syntax
<code>--longoption</code>.  The long names are given in brackets.

<dl>

<br><dt><code>-a</code>
<dd>(<code>--sysadm</code>) Print only the name of the system administrator then quit.

<br><dt><code>-A</code>
<dd>(<code>--auto</code>) Can be used to signify an automatic run of cfengine, as opposed
to a manual run. The distinction is not predetermined. Use of this option
currently causes cfengine to ignore locks. This option is reserved for future
development.

<br><dt><code>-b</code>
<dd>(<code>--force-net-copy</code>) Normally cfengine detects attempts to copy
from a server via the network, if they loop back to the localhost. 
It then avoids using the network to make the copy. This option forces
cfengine to copy using the network. (Yes, someone thinks this is useful!)

<br><dt><code>-c</code>
<dd>(<code>--no-check-files</code>) Do not check file systems for ownership / permissions etc.

<br><dt><code>-C</code>
<dd>(<code>--no-check-mounts</code>) Check mount points for consistency.  If this
option is specified then directories which lie in the "mount point"
area are checked to see whether there is anything mounted on them. 
Normally this is <em>off</em> since not all machines use mounted file
systems in the same way.  e.g.  HPUX does not generally operate with
partitions, but nevertheless one might wish to mimick a partition-like
environment there, but it would be irritating to be informed that
nothing was mounted on the mount point.

<br><dt><code>-d</code>
<dd>(<code>--debug</code>) Enable debugging output.  Normally you will want to
send this to a file using the shell script command or a pipe. 
 -d1 shows only parsing output.  -d2 shows only
runtime action output.  -d0 shows both levels. Debugging ouput is
intended mainly for the author's convenience and is not a supported
feature. The details of this output may change at any time.

<br><dt><code>-D</code>
<dd>(<code>--define</code>) Define a compound class symbol of the form
<em>alpha.beta.gamma</em>.

<br><dt><code>-e</code>
<dd>(<code>--no-edits</code>) Suppress file editing.

<br><dt><code>-E</code>
<dd>(<code>--enforce-links</code>) Globally force links to be created where plain
files or links already exist. Since this option
is a big hammer, you have to use it in interactive mode and
answer a yes/no query before cfengine will run like this.

<br><dt><code>-f</code>
<dd>(<code>--file</code>) Parse filename after this switch.  By default cfengine
looks for a file called <em>cfengine.conf</em> in the current directory.

<br><dt><code>-h</code>
<dd>(<code>--help</code>) Help information.  Display version banner and options
summary.

<br><dt><code>-H</code>
<dd>(<code>--no-hard-classes</code>). Prevents cfengine from generating any internal
class name information. Can be used for emulation purposes.

<br><dt><code>-i</code>
<dd>(<code>--no-ifconfig</code>) Do not attempt to configure the local area
network interface.

<br><dt><code>-I</code>
<dd>(<code>--inform</code>) Switches on the inform output level, whereby cfengine
reports everything it changes..

<br><dt><code>-k</code>
<dd>(<code>--no-copy</code>) Do not copy/image any files.

<br><dt><code>-K</code>
<dd>(<code>--no-lock</code>) Ignore locks when running.

<br><dt><code>-l</code>
<dd>(<code>--traverse-links</code>) Normally cfengine does not follow symbolic
links when recursively parsing directories.  This option will force it
to do so.

<br><dt><code>-L</code>
<dd>(<code>--delete-stale-links</code>) Delete links which do not point to
existing files (except in user home directories, which are not touched).

<br><dt><code>-m</code>
<dd>(<code>--no-mount</code>) Do not attempt to mount file systems or edit the
filesystem table.

<br><dt><code>-M</code>
<dd>(<code>--no-modules</code>)
Ignore modules in actionsequence.

<br><dt><code>-n</code>
<dd>(<code>--recon</code>,<code>--dry-run</code>,<code>--just-print</code>) No action.  Only
print what has to be done without actually doing it.

<br><dt><code>-N</code>
<dd>(<code>--negate</code>,<code>--undefine</code>) Cancel a set of classes,
or undefine (set value to <em>false</em>) a compound class of the form
<em>alpha.beta.gamma</em>.

<br><dt><code>-p</code>
<dd>(<code>--parse-only</code>) Parse file and then stop.  Used for checking the
syntax of a program.  You do not have to be superuser to use this
option.

<br><dt><code>-q</code>
<dd>(<code>--no-splay</code>) Switch off host splaying (sleeping).

<br><dt><code>-s</code>
<dd>(<code>--no-commands</code>) Do not execute scripts or shell commands.

<br><dt><code>-S</code>
<dd>(<code>--silent</code>) Silence run time warnings.

<br><dt><code>-t</code>
<dd>(<code>--no-tidy</code>) Do not tidy file systems.

<br><dt><code>-u</code>
<dd>(<code>--use-env</code>) Causes cfengine to generate an environment variable
<code>CFALLCLASSES</code> which can be read by child processes (scripts). This
variable contains a summary of all the currently defined classes at any
given time. This option causes some system 5 systems to generate a Bus
Error or segmentation fault. The same information is available from the
cfengine internal variable <code>$(allclasses)</code> and can be passed as a
parameter to scripts.

<br><dt><code>-U</code>
<dd>(<code>--underscore-classes</code>). When this option is set, cfengine adds
an underscore to the beginning of the hard system classes (like <code>_sun4</code>, <code>_linux</code>
etc. The longer compound classes are not underscored, since these are already
complex and would unlikely result in collisions.) This can be used to avoid naming conflicts if you are so
unjudicious as to name a host by the name of a hard class. Other classes
are not affected.

<br><dt><code>-v</code>
<dd>(<code>--verbose</code>) Verbose mode.  Prints detailed information about
actions and state.

<br><dt><code>-V</code>
<dd>(<code>--version</code>) Print only the version string and then quit.

<br><dt><code>-x</code>
<dd>(<code>--no-preconf</code>) Do not execute the <code>cf.preconf</code> net
configuration file.

<br><dt><code>-X</code>
<dd>(<code>--no-links</code>) Do not execute the <code>links</code> section of a
program.

<br><dt><code>-w</code>
<dd>(<code>--no-warn</code>,<code>--quiet</code>) Do not print warning
messages.

</dl>

<p><hr>
Node:<a name="Network%20protocol%20specs">Network protocol specs</a>,
Next:<a rel=next href="#Variable%20Index">Variable Index</a>,
Previous:<a rel=previous href="#Runtime%20Options">Runtime Options</a>,
Up:<a rel=up href="#Top">Top</a>
<br>

<h1>Cfengine network protocol specs</h1>

<p>Cfengine uses a simple protocol for communicating via a streams-based
tcp connection. This section documents the protocol for anyone who
might want to create their own clients or server components to
interface with cfengine. Several transfers use a standard buffer
size of 4096 bytes. The get-file service uses a character based
read interface in which the buffer size is not directly relevant; the
size of the get-file buffer is dictated by client-side disk blocksizes.

<p>Each new connection to the remote server daemon must
begin with a verification or `login' string whereby the client
identifies itself to the server. This information is used to verify the
connection by using a reverse DNS lookup and then a double-reverse
lookup. This is the basis of hostname authentication.

<p>The various services are listed below:

<dl>

<br><dt><em>Stat file</em>
<dd>
<pre>  AUTH client-name server-name
  SYNCH long-time-string STAT filename

  reply with OK: &lt;stat-reply-string&gt;
</pre>

<br><dt><em>Get file</em>
<dd>
<pre>   AUTH client-name server-name
   GET filename

   reply with &lt;stream&gt;, break on zero chars received
   or BAD: &lt;message&gt;
</pre>

<br><dt><em>Opendir</em>
<dd>Recursive parsing of directory trees poses a technical problem. If
cfengine keeps a connection open and send buffers on a need-to-know
basis, then the number of daemon connections will mount up and overload
the server.  If cfengine caches the entire directory on the client side,
allowing the server connection to be severed, then the caching could
easily fill the memory of the client. The policy chosen is to attempt to
cache all names client-side, in spite of the possible memory
problem. The reason for this choice is that, even on large filesystems
(max size of paritions with 32 bit pointers is 4GB), the sum memory used
by every filename is only of the order of a few megabytes, and this is
within reasonable modern memory limits. It is assumed that, even 64 bit
users will not create filesystems which are much large than this.

<pre>    AUTH client-name server-name
    OPENDIR dir-name

    reply with &lt;stream&gt;, break on zero chars received
</pre>
In the future it might be useful to stat the file automatically here
and cache the value client-side.

<br><dt><em>Exec</em>
<dd>
<pre>       AUTH client-name server-name
       EXEC option-string
       CLASSES stream terminated with --- (CFD_TERMINATE)

       reply with &lt;stream&gt;, break on zero chars received
</pre>

<br><dt><em>Checksum verification</em>
<dd>
<pre>       MD5 filename 16 byte sequence

       reply with CFD_TRUE for no match (copy) or CFD_FALSE for match (no copy)
</pre>

<br><dt><em>Reply formatting</em>
<dd>The format of reply messages, except for stream data, is
<pre>
  OK: <var>message</var>

  BAD: <var>message</var>

</pre>
A return prefix of `BAD' implies a failure server-side and the
client-side wrapper functions return -1 in this case.

<p>The server daemon currently runs single threaded for all requests except
GetFile. Since cfd uses heavyweight processes for general applicablity
this avoids unnecessary forking and context switching which would
download the server. An upper limit on the number of forks which may be
performed is set in the config file. This is mananged using the SIGCHLD
signal and a pair of arrays in the master processes (This approach is
used to avoid shared memory and semaphore usage which is not portable
to many older BSD derivative systems).

</dl>

<p><hr>
Node:<a name="Variable%20Index">Variable Index</a>,
Next:<a rel=next href="#Concept%20Index">Concept Index</a>,
Previous:<a rel=previous href="#Network%20protocol%20specs">Network protocol specs</a>,
Up:<a rel=up href="#Top">Top</a>
<br>

<h1>Variable Index</h1>

<ul compact>
<li><code>+</code>: <a href="#groups">groups</a>
<li><code>-a option</code>: <a href="#cfwrap">cfwrap</a>
<li><code>-D option</code>: <a href="#addclasses">addclasses</a>
<li><code>-l</code>: <a href="#tidy">tidy</a>
<li><code>-L</code>: <a href="#Single%20links">Single links</a>
<li><code>-l</code>: <a href="#Syntax">Syntax</a>
<li><code>-N option</code>: <a href="#addclasses">addclasses</a>
<li><code>-x option</code>: <a href="#cf.preconf%20bootstrap%20file">cf.preconf bootstrap file</a>
<li><code>.cfengine.rm</code>: <a href="#tidy">tidy</a>
<li><code>/etc/host.conf</code>: <a href="#cf.preconf%20bootstrap%20file">cf.preconf bootstrap file</a>
<li><code>a=</code>: <a href="#tidy">tidy</a>, <a href="#Syntax">Syntax</a>
<li><code>action</code>: <a href="#Syntax">Syntax</a>
<li><code>actionsequence</code>: <a href="#actionsequence">actionsequence</a>, <a href="#control">control</a>
<li><code>AddClasses</code>: <a href="#addclasses">addclasses</a>
<li><code>AddInstallable</code>: <a href="#addinstallable">addinstallable</a>
<li><code>addmounts</code>: <a href="#actionsequence">actionsequence</a>
<li><code>age</code>: <a href="#tidy">tidy</a>
<li><code>backup=</code>: <a href="#copy">copy</a>
<li><code>binserver</code>: <a href="#Link%20Children">Link Children</a>, <a href="#Single%20links">Single links</a>
<li><code>binservers</code>: <a href="#binservers">binservers</a>
<li><code>broadcast</code>: <a href="#broadcast">broadcast</a>
<li><code>cf.preconf</code>: <a href="#cf.preconf%20bootstrap%20file">cf.preconf bootstrap file</a>
<li><code>CFALLCLASSES</code>: <a href="#Runtime%20Options">Runtime Options</a>
<li><code>cfrc</code>: <a href="#cfrc%20resource%20file">cfrc resource file</a>
<li><code>checktimezone</code>: <a href="#actionsequence">actionsequence</a>
<li><code>childlinks</code>: <a href="#actionsequence">actionsequence</a>
<li><code>control</code>: <a href="#control">control</a>
<li><code>create</code>: <a href="#create">create</a>
<li><code>directories</code>: <a href="#actionsequence">actionsequence</a>
<li><code>disable</code>: <a href="#disable">disable</a>, <a href="#actionsequence">actionsequence</a>
<li><code>domain</code>: <a href="#domain">domain</a>, <a href="#control">control</a>
<li><code>DryRun</code>: <a href="#dryrun">dryrun</a>
<li><code>editfiles</code>: <a href="#actionsequence">actionsequence</a>
<li><code>editfilesize</code>: <a href="#editfilesize">editfilesize</a>, <a href="#control">control</a>
<li><code>empty</code>: <a href="#disable">disable</a>
<li><code>exclude=</code>: <a href="#Syntax">Syntax</a>
<li><code>FileExtensions</code>: <a href="#fileextension">fileextension</a>
<li><code>files</code>: <a href="#files">files</a>, <a href="#actionsequence">actionsequence</a>
<li><code>filter</code>: <a href="#filters">filters</a>
<li><code>force=</code>: <a href="#copy">copy</a>
<li><code>freespace=</code>: <a href="#required">required</a>, <a href="#disks">disks</a>
<li><code>g=</code>: <a href="#Syntax">Syntax</a>
<li><code>group</code>: <a href="#Syntax">Syntax</a>
<li><code>groups</code>: <a href="#groups">groups</a>
<li><code>home</code>: <a href="#Syntax">Syntax</a>
<li><code>homepattern</code>: <a href="#mountables">mountables</a>
<li><code>HomePattern</code>: <a href="#homepattern">homepattern</a>
<li><code>homeservers</code>: <a href="#homeservers">homeservers</a>
<li><code>import</code>: <a href="#import">import</a>
<li><code>include=</code>: <a href="#Syntax">Syntax</a>
<li><code>interface configuration</code>: <a href="#interfaces">interfaces</a>
<li><code>InterfaceName</code>: <a href="#interfacename">interfacename</a>
<li><code>l=</code>: <a href="#Syntax">Syntax</a>
<li><code>link</code>: <a href="#Syntax">Syntax</a>
<li><code>linkchildren</code>: <a href="#Link%20Children">Link Children</a>, <a href="#Files%20linkchildren">Files linkchildren</a>
<li><code>links</code>: <a href="#links">links</a>, <a href="#actionsequence">actionsequence</a>
<li><code>m=</code>: <a href="#Syntax">Syntax</a>
<li><code>mailcheck</code>: <a href="#mailserver">mailserver</a>, <a href="#actionsequence">actionsequence</a>
<li><code>mailserver</code>: <a href="#mailserver">mailserver</a>
<li><code>miscmounts</code>: <a href="#miscmounts">miscmounts</a>
<li><code>mode</code>: <a href="#Syntax">Syntax</a>
<li><code>module:</code>: <a href="#actionsequence">actionsequence</a>
<li><code>moduledirectory</code>: <a href="#moduledirectory">moduledirectory</a>
<li><code>mountables</code>: <a href="#mountables">mountables</a>, <a href="#homeservers">homeservers</a>
<li><code>mountall</code>: <a href="#actionsequence">actionsequence</a>
<li><code>mountinfo</code>: <a href="#actionsequence">actionsequence</a>
<li><code>mountpattern</code>: <a href="#mountpattern">mountpattern</a>
<li><code>netconfig</code>: <a href="#actionsequence">actionsequence</a>
<li><code>netmask</code>: <a href="#netmask">netmask</a>, <a href="#control">control</a>
<li><code>nfstype</code>: <a href="#nfstype">nfstype</a>, <a href="#control">control</a>
<li><code>o=</code>: <a href="#Syntax">Syntax</a>
<li><code>ones</code>: <a href="#broadcast">broadcast</a>
<li><code>owner</code>: <a href="#Syntax">Syntax</a>
<li><code>p=</code>: <a href="#tidy">tidy</a>
<li><code>pattern</code>: <a href="#tidy">tidy</a>
<li><code>processes</code>: <a href="#actionsequence">actionsequence</a>
<li><code>purge=</code>: <a href="#copy">copy</a>
<li><code>r=</code>: <a href="#tidy">tidy</a>, <a href="#Syntax">Syntax</a>
<li><code>recurse</code>: <a href="#tidy">tidy</a>, <a href="#Syntax">Syntax</a>
<li><code>RepChar</code>: <a href="#repchar">repchar</a>
<li><code>required</code>: <a href="#actionsequence">actionsequence</a>
<li><code>resolve</code>: <a href="#resolve">resolve</a>, <a href="#actionsequence">actionsequence</a>
<li><code>Restricting access</code>: <a href="#access">access</a>
<li><code>rotate=</code>: <a href="#disable">disable</a>
<li><code>SecureInput</code>: <a href="#secureinput">secureinput</a>
<li><code>SensibleCount</code>: <a href="#sensiblecount">sensiblecount</a>
<li><code>sensiblecount</code>: <a href="#control">control</a>
<li><code>SensibleSize</code>: <a href="#sensiblesize">sensiblesize</a>
<li><code>sensiblesize</code>: <a href="#control">control</a>
<li><code>shellcommands</code>: <a href="#actionsequence">actionsequence</a>
<li><code>ShowActions</code>: <a href="#showactions">showactions</a>
<li><code>singlelinks</code>: <a href="#actionsequence">actionsequence</a>
<li><code>site</code>: <a href="#site">site</a>, <a href="#control">control</a>
<li><code>split</code>: <a href="#split">split</a>
<li><code>SuspiciousNames</code>: <a href="#suspiciousnames">suspiciousnames</a>
<li><code>sysadm</code>: <a href="#sysadm">sysadm</a>, <a href="#control">control</a>
<li><code>tidy</code>: <a href="#tidy">tidy</a>, <a href="#actionsequence">actionsequence</a>
<li><code>timezone</code>: <a href="#control">control</a>
<li><code>touch</code>: <a href="#touch">touch</a>
<li><code>truncate</code>: <a href="#disable">disable</a>
<li><code>type=</code>: <a href="#Hard%20links">Hard links</a>, <a href="#disable">disable</a>
<li><code>unmount</code>: <a href="#unmount">unmount</a>, <a href="#actionsequence">actionsequence</a>
<li><code>Wildcards</code>: <a href="#tidy">tidy</a>
<li><code>zeroes</code>: <a href="#broadcast">broadcast</a>
<li><code>zeros</code>: <a href="#broadcast">broadcast</a>
</ul>
<p><hr>
Node:<a name="Concept%20Index">Concept Index</a>,
Next:<a rel=next href="#FAQ%20Index">FAQ Index</a>,
Previous:<a rel=previous href="#Variable%20Index">Variable Index</a>,
Up:<a rel=up href="#Top">Top</a>
<br>

<h1>Concept Index</h1>

<ul compact>
<li>: <a href="#processes">processes</a>
<li><code>+</code> symbol in <code>/etc/hosts.equiv</code>: <a href="#SUN%20(4.1.*)">SUN (4.1.*)</a>
<li><code>--dry-run</code> option: <a href="#shellcommands">shellcommands</a>
<li>-a option: <a href="#cfwrap">cfwrap</a>
<li>-D option: <a href="#addclasses">addclasses</a>
<li>-l option: <a href="#tidy">tidy</a>
<li><code>-L</code> option: <a href="#Single%20links">Single links</a>
<li>-l option: <a href="#Syntax">Syntax</a>
<li>-x option: <a href="#cf.preconf%20bootstrap%20file">cf.preconf bootstrap file</a>
<li><code>.cfdisabled</code>: <a href="#disable">disable</a>
<li>.cfengine.rm: <a href="#tidy">tidy</a>
<li><code>.cfnew</code> files: <a href="#copy">copy</a>
<li><code>.cfsaved</code> files: <a href="#Multiple%20Links">Multiple Links</a>
<li><code>.cshrc</code>, distributing: <a href="#General">General</a>
<li>.X11 directory: <a href="#ignore">ignore</a>
<li><code>.xsession</code>, distributing: <a href="#General">General</a>
<li><code>/etc/defaultroute</code>: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>/etc/host.conf: <a href="#cf.preconf%20bootstrap%20file">cf.preconf bootstrap file</a>
<li><code>/etc/hosts.equiv</code>: <a href="#disable">disable</a>
<li><code>/etc/shells</code>: <a href="#SOLARIS%202">SOLARIS 2</a>
<li><code>/tmp</code> under solaris: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Absolute links: <a href="#Single%20links">Single links</a>
<li>Access control: <a href="#access">access</a>
<li>Access control lists: <a href="#acl">acl</a>
<li>ACL key: <a href="#ACEs">ACEs</a>
<li>ACLs: <a href="#acl">acl</a>
<li>action sequence: <a href="#actionsequence">actionsequence</a>
<li>Adding defined classes: <a href="#addclasses">addclasses</a>
<li>Adding new classes: <a href="#cfrc%20resource%20file">cfrc resource file</a>
<li>AFS: <a href="#nfstype">nfstype</a>
<li>AFS and cfengine: <a href="#General">General</a>
<li>allclasses variable: <a href="#shellcommands">shellcommands</a>
<li>Andrew filesystem: <a href="#nfstype">nfstype</a>
<li><code>AppendToLineIfNotContains</code>, example: <a href="#General">General</a>
<li>atime tidies: <a href="#tidy">tidy</a>
<li><code>AutoCreate</code>: <a href="#editfiles">editfiles</a>
<li>automounter: <a href="#editfiles">editfiles</a>
<li>awk, editing: <a href="#editfiles">editfiles</a>
<li>Backup of files in copy: <a href="#copy">copy</a>
<li>Backups, with copy: <a href="#General">General</a>
<li>Bad address error in solaris: <a href="#SOLARIS%202">SOLARIS 2</a>
<li><code>BeginGroupIfFileExists</code>: <a href="#editfiles">editfiles</a>
<li><code>BeginGroupIfFileIsNewer</code>: <a href="#editfiles">editfiles</a>
<li>Berkeley database library: <a href="#Problems%20with%20compilation%20and%20installation">Problems with compilation and installation</a>
<li>Berkeley sendmail: <a href="#General">General</a>
<li>Binary servers and links: <a href="#Link%20Children">Link Children</a>, <a href="#Single%20links">Single links</a>
<li>Binary servers, defining: <a href="#binservers">binservers</a>
<li>Binary servers, priority: <a href="#Single%20links">Single links</a>, <a href="#binservers">binservers</a>
<li>Bootstrap file: <a href="#cf.preconf%20bootstrap%20file">cf.preconf bootstrap file</a>
<li>Broadcast address: <a href="#broadcast">broadcast</a>
<li>Broadcast with solaris 2.4: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Bugs, reporting: <a href="#Bug%20reports%20and%20suggestions">Bug reports and suggestions</a>
<li>CatchAbort: <a href="#editfiles">editfiles</a>
<li>cd in shellcommands: <a href="#General">General</a>
<li><code>cf.groups</code>: <a href="#cf.groups">cf.groups</a>
<li><code>cf.main</code>: <a href="#cf.main">cf.main</a>
<li><code>cf.motd</code>: <a href="#cf.motd">cf.motd</a>
<li>cf.preconf bootstrap file: <a href="#cf.preconf%20bootstrap%20file">cf.preconf bootstrap file</a>
<li><code>cf.site</code>: <a href="#cfd.conf">cfd.conf</a>, <a href="#cf.site">cf.site</a>
<li>CFALLCLASSES: <a href="#shellcommands">shellcommands</a>
<li>Cfengine security worries: <a href="#General">General</a>
<li><code>cfengine.conf</code>: <a href="#cfengine.conf">cfengine.conf</a>
<li>cfrc resource file: <a href="#cfrc%20resource%20file">cfrc resource file</a>
<li>cfwrap, wrapper script: <a href="#cfwrap">cfwrap</a>
<li>Class decided by shell command: <a href="#groups">groups</a>
<li>Class dependencies: <a href="#groups">groups</a>
<li>Class information, passing to scripts: <a href="#shellcommands">shellcommands</a>
<li><code>classes</code>: <a href="#groups">groups</a>, <a href="#classes">classes</a>
<li>Classes, adding and defining: <a href="#addclasses">addclasses</a>
<li>control section: <a href="#control">control</a>
<li>Controlling log-files: <a href="#General">General</a>
<li>Controlling the size of log files: <a href="#disable">disable</a>
<li>copy: <a href="#General">General</a>, <a href="#copy">copy</a>
<li>Copy, exact filetree images: <a href="#copy">copy</a>
<li>Copying files: <a href="#copy">copy</a>
<li>Creating files: <a href="#create">create</a>
<li>cron script to start cfengine: <a href="#cfwrap">cfwrap</a>
<li>ctime tidies: <a href="#tidy">tidy</a>
<li><code>db</code> library: <a href="#Problems%20with%20compilation%20and%20installation">Problems with compilation and installation</a>
<li>DCE key: <a href="#DFS%20ACLs">DFS ACLs</a>
<li>Deadlock: <a href="#cf.preconf%20bootstrap%20file">cf.preconf bootstrap file</a>
<li>Deadlock zombie bug in restart: <a href="#processes">processes</a>
<li>Declaring classes: <a href="#addinstallable">addinstallable</a>
<li>Decrementing line pointer in editfiles: <a href="#editfiles">editfiles</a>
<li>Default route, cannot set: <a href="#Problems%20with%20compilation%20and%20installation">Problems with compilation and installation</a>
<li><code>defaultroute</code>: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Defining a binary server: <a href="#binservers">binservers</a>
<li>Defining a home server: <a href="#homeservers">homeservers</a>
<li>Defining a mail server: <a href="#mailserver">mailserver</a>
<li>Defining a mountable: <a href="#mountables">mountables</a>
<li>Defining before use: <a href="#addinstallable">addinstallable</a>
<li>Defining classes: <a href="#classes">classes</a>, <a href="#addclasses">addclasses</a>
<li>Defining groups: <a href="#groups">groups</a>
<li>Deleting directories: <a href="#tidy">tidy</a>
<li>Deleting files: <a href="#tidy">tidy</a>
<li>Deleting stale links: <a href="#tidy">tidy</a>, <a href="#Syntax">Syntax</a>
<li>Dependencies: <a href="#groups">groups</a>
<li>Device boundaries: <a href="#copy">copy</a>
<li>Device boundaries and files: <a href="#Recursion">Recursion</a>
<li>DFS: <a href="#nfstype">nfstype</a>
<li>DHCP: <a href="#actionsequence">actionsequence</a>
<li>Directories, deleting: <a href="#tidy">tidy</a>
<li>Directories, hidden: <a href="#fileextension">fileextension</a>
<li>Directories, making: <a href="#directories">directories</a>
<li>Directory for cfengine modules: <a href="#moduledirectory">moduledirectory</a>
<li>Directory permissions: <a href="#Directory%20permissions">Directory permissions</a>
<li>disable, problems with logging afterwards: <a href="#General">General</a>
<li>disable, trimming log files: <a href="#General">General</a>
<li>Disabling file types: <a href="#disable">disable</a>
<li>Disabling files: <a href="#disable">disable</a>
<li>disks actions: <a href="#disks">disks</a>
<li>Distributing files: <a href="#General">General</a>
<li>Distributing user files: <a href="#General">General</a>
<li>DNS: <a href="#resolve">resolve</a>
<li>domain: <a href="#domain">domain</a>
<li>Domain name: <a href="#netmask">netmask</a>
<li>Double quotes: <a href="#editfiles">editfiles</a>
<li>DryRun: <a href="#dryrun">dryrun</a>
<li>Dual homed hosts: <a href="#interfaces">interfaces</a>
<li>Editing users login files: <a href="#General">General</a>
<li>Empty files: <a href="#tidy">tidy</a>
<li>Environment variable CFALLCLASSES: <a href="#Runtime%20Options">Runtime Options</a>
<li>Example configuration files: <a href="#Example%20configuration%20file">Example configuration file</a>
<li>Excluding classes: <a href="#addclasses">addclasses</a>
<li>Excluding files from a file sweep: <a href="#Syntax">Syntax</a>
<li>exports, fixing: <a href="#General">General</a>
<li>FAQs: <a href="#FAQS%20and%20Tips">FAQS and Tips</a>
<li>Field separator in editfiles: <a href="#editfiles">editfiles</a>
<li>File images (copy): <a href="#copy">copy</a>
<li>File management: <a href="#files">files</a>
<li>File sizes, specifying: <a href="#tidy">tidy</a>
<li>File tree images: <a href="#copy">copy</a>
<li>Files, breaking up into several: <a href="#import">import</a>
<li>Files, checking permissions: <a href="#files">files</a>
<li>Files, home wildcard: <a href="#home%20directive">home directive</a>
<li>Files, importing: <a href="#import">import</a>
<li>Files, ownership: <a href="#Owner%20and%20group%20wildcards">Owner and group wildcards</a>
<li>Files, recursion: <a href="#Recursion">Recursion</a>
<li>Files, setting owner: <a href="#files">files</a>
<li>Files, syntax: <a href="#Syntax">Syntax</a>
<li>Flex and bison problem: <a href="#Problems%20with%20compilation%20and%20installation">Problems with compilation and installation</a>
<li>Force copying: <a href="#copy">copy</a>
<li>Fork error in solaris: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>FreeBSD mount problem: <a href="#FreeBSD">FreeBSD</a>
<li>freespace=: <a href="#required">required</a>, <a href="#disks">disks</a>
<li>Frequently asked questions: <a href="#FAQS%20and%20Tips">FAQS and Tips</a>
<li>Frozen configuration files: <a href="#HPUX">HPUX</a>
<li>ftp and alternative shells: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>ftp login problems: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Full disk warnings: <a href="#required">required</a>, <a href="#disks">disks</a>
<li>Group dependencies: <a href="#groups">groups</a>
<li>Group field, editing: <a href="#editfiles">editfiles</a>
<li><code>groups</code>: <a href="#groups">groups</a>
<li>groups: <a href="#classes">classes</a>
<li>Groups, defining: <a href="#groups">groups</a>
<li>Hardlinks: <a href="#Hard%20links">Hard links</a>
<li>Help scripts: <a href="#Using%20the%20help%20scripts">Using the help scripts</a>
<li>Hints and Tips: <a href="#FAQS%20and%20Tips">FAQS and Tips</a>
<li>home directive: <a href="#home%20directive">home directive</a>
<li>Home path: <a href="#homepattern">homepattern</a>
<li>Home servers, defining: <a href="#homeservers">homeservers</a>
<li>home wildcard: <a href="#Syntax">Syntax</a>
<li>Homepattern variable.: <a href="#mountables">mountables</a>
<li><code>hosts.equiv</code>: <a href="#SUN%20(4.1.*)">SUN (4.1.*)</a>
<li>Hour classes: <a href="#General">General</a>
<li>How can I make cfengine distribute my <code>/etc/motd</code> file?: <a href="#General">General</a>
<li>httpd problem with logging: <a href="#General">General</a>
<li>Hung machine: <a href="#cf.preconf%20bootstrap%20file">cf.preconf bootstrap file</a>
<li>ignore command: <a href="#ignore">ignore</a>
<li>Import files, variables in: <a href="#import">import</a>
<li>Importing files: <a href="#import">import</a>
<li>Incrementing line pointer in editfiles: <a href="#editfiles">editfiles</a>
<li>Interface name, redefining by class: <a href="#interfacename">interfacename</a>
<li>InterfaceName: <a href="#interfacename">interfacename</a>
<li>Internal classes, switching off: <a href="#Runtime%20Options">Runtime Options</a>
<li>Internet address: <a href="#netmask">netmask</a>
<li>IP address: <a href="#netmask">netmask</a>
<li>Iterating over lists in shellcommands: <a href="#shellcommands">shellcommands</a>
<li>Iteration over lists: <a href="#split">split</a>
<li>Key, ACL: <a href="#DFS%20ACLs">DFS ACLs</a>
<li>Kill processes not owned by root: <a href="#General">General</a>
<li>Killing processes: <a href="#General">General</a>
<li>Kilobyte, filesize unit: <a href="#tidy">tidy</a>
<li>lex and yacc problems: <a href="#AIX">AIX</a>
<li>Linkchildren: <a href="#Link%20Children">Link Children</a>, <a href="#Files%20linkchildren">Files linkchildren</a>
<li>Links and binary servers: <a href="#Link%20Children">Link Children</a>, <a href="#Single%20links">Single links</a>
<li>Links, absolute: <a href="#Single%20links">Single links</a>
<li>Links, deleting stale: <a href="#tidy">tidy</a>, <a href="#Syntax">Syntax</a>
<li>Links, forcing for non-existent files: <a href="#Single%20links">Single links</a>
<li>Links, making: <a href="#links">links</a>
<li>Links, multiple: <a href="#Multiple%20Links">Multiple Links</a>
<li>Links, removing dead: <a href="#Single%20links">Single links</a>
<li>Links, single: <a href="#Single%20links">Single links</a>
<li>Links, traversing in searches: <a href="#tidy">tidy</a>, <a href="#Syntax">Syntax</a>
<li>Linux, installing: <a href="#Problems%20with%20compilation%20and%20installation">Problems with compilation and installation</a>
<li>Local disk space, make use of: <a href="#Link%20Children">Link Children</a>
<li>Local startup file for solaris: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Log files, controlling the size of: <a href="#disable">disable</a>
<li>Log-files, preventing overflow: <a href="#General">General</a>
<li>Login files, editing for all users: <a href="#General">General</a>
<li>Mail agent: <a href="#cfmail">cfmail</a>
<li>Mail from scripts: <a href="#cfmail">cfmail</a>
<li>Mail server, defining: <a href="#mailserver">mailserver</a>
<li>Making backups: <a href="#General">General</a>
<li>Making directories: <a href="#directories">directories</a>
<li>Making links: <a href="#links">links</a>
<li>Making paths: <a href="#directories">directories</a>
<li>Making use of local disk space: <a href="#Link%20Children">Link Children</a>
<li>Master files, updating from: <a href="#General">General</a>
<li>Megabytes, filesize unit: <a href="#tidy">tidy</a>
<li>Message of the day files: <a href="#General">General</a>
<li>Miscellaneous mount operations: <a href="#miscmounts">miscmounts</a>
<li>Module directory: <a href="#moduledirectory">moduledirectory</a>
<li>Modules, user defined: <a href="#actionsequence">actionsequence</a>
<li>Mount paths: <a href="#mountpattern">mountpattern</a>
<li>Mountable resources, defining: <a href="#mountables">mountables</a>, <a href="#homeservers">homeservers</a>
<li>Mounted filesystems: <a href="#copy">copy</a>
<li>Mounting filesystems.: <a href="#miscmounts">miscmounts</a>
<li>mtime tidies: <a href="#tidy">tidy</a>
<li>Multiple links: <a href="#Multiple%20Links">Multiple Links</a>
<li>Negating classes: <a href="#actionsequence">actionsequence</a>
<li>Negating entries from netgroups: <a href="#groups">groups</a>
<li>Netgroups: <a href="#groups">groups</a>
<li>Netgroups and Linux: <a href="#Problems%20with%20compilation%20and%20installation">Problems with compilation and installation</a>
<li>Netgroups, negating entries: <a href="#groups">groups</a>
<li>Netmask: <a href="#netmask">netmask</a>
<li>netmask: <a href="#netmask">netmask</a>
<li>Netmask with solaris 2.4: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Network interfaces, several: <a href="#interfaces">interfaces</a>
<li>New systems, support for: <a href="#cfrc%20resource%20file">cfrc resource file</a>
<li>nfs: <a href="#nfstype">nfstype</a>
<li>NFS mount model and automounter: <a href="#editfiles">editfiles</a>
<li>nfstype: <a href="#nfstype">nfstype</a>
<li>NIS, netgroup support: <a href="#groups">groups</a>
<li>NT, ACL: <a href="#NT%20ACLs">NT ACLs</a>
<li>ones: <a href="#broadcast">broadcast</a>
<li>Ownership of files: <a href="#Owner%20and%20group%20wildcards">Owner and group wildcards</a>
<li>Password file, editing: <a href="#editfiles">editfiles</a>
<li>Path to home directories: <a href="#homepattern">homepattern</a>
<li>Path to mounted filesystems: <a href="#mountpattern">mountpattern</a>
<li>Paths, making: <a href="#directories">directories</a>
<li>Pattern matching in file sweeps: <a href="#Syntax">Syntax</a>
<li>Permissions, directories: <a href="#Directory%20permissions">Directory permissions</a>
<li>Preserving file times in copy: <a href="#copy">copy</a>
<li>Previewing shellcommands: <a href="#shellcommands">shellcommands</a>
<li>Processes, 0 to 3: <a href="#processes">processes</a>
<li>Processes, check if running: <a href="#General">General</a>
<li>Processes, checking existence of: <a href="#processes">processes</a>
<li>Processes, counting: <a href="#processes">processes</a>
<li>Processes, killing: <a href="#General">General</a>
<li>Processes, signalling: <a href="#processes">processes</a>
<li>Quoted strings: <a href="#editfiles">editfiles</a>
<li><code>rc.local</code> in solaris: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Recursion in files: <a href="#Recursion">Recursion</a>
<li>Relative links: <a href="#Single%20links">Single links</a>
<li>Removing directories: <a href="#tidy">tidy</a>
<li>Removing entries from netgroups: <a href="#groups">groups</a>
<li>Renaming files: <a href="#disable">disable</a>
<li>Replacing file by link: <a href="#disable">disable</a>
<li>Reporting bugs: <a href="#Bug%20reports%20and%20suggestions">Bug reports and suggestions</a>
<li>Repository filenames, changing: <a href="#repchar">repchar</a>
<li>resolv.conf: <a href="#resolve">resolve</a>
<li>Resolver configuration: <a href="#resolve">resolve</a>
<li>Resource file: <a href="#cfrc%20resource%20file">cfrc resource file</a>
<li>Restart zombie deadlock bug: <a href="#processes">processes</a>
<li>Restricting the size of files to be edited: <a href="#editfilesize">editfilesize</a>
<li>rmdirs: <a href="#tidy">tidy</a>
<li>Rotating log files: <a href="#disable">disable</a>
<li>routed: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Running cfengine, cron script: <a href="#cfwrap">cfwrap</a>
<li>Scripts and class information: <a href="#shellcommands">shellcommands</a>
<li>Scripts, examples: <a href="#Writing%20scripts%20for%20cfengine">Writing scripts for cfengine</a>
<li>Scripts, writing: <a href="#Writing%20scripts%20for%20cfengine">Writing scripts for cfengine</a>
<li>Search patterns in <code>files</code>: <a href="#Syntax">Syntax</a>
<li>Searching for home directories: <a href="#homepattern">homepattern</a>
<li>Searching, advanced: <a href="#filters">filters</a>
<li>Secure input: <a href="#secureinput">secureinput</a>
<li>Security under solaris: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Security with NIS: <a href="#SUN%20(4.1.*)">SUN (4.1.*)</a>
<li>sed, editing: <a href="#editfiles">editfiles</a>
<li>Selecting files in searches: <a href="#filters">filters</a>
<li>sendmail: <a href="#HPUX">HPUX</a>, <a href="#General">General</a>
<li>Sendmail configuration: <a href="#HPUX">HPUX</a>
<li><code>sendmail.fc</code>: <a href="#HPUX">HPUX</a>
<li>Sensible file sizes: <a href="#sensiblesize">sensiblesize</a>
<li>Sensible limits on files in a directory: <a href="#sensiblecount">sensiblecount</a>
<li>Setting uid on restarted processes: <a href="#processes">processes</a>
<li>Setting working directory in shellcommands: <a href="#General">General</a>
<li>Several files: <a href="#import">import</a>
<li>sharing filesystems: <a href="#General">General</a>
<li>Shell command to decide class: <a href="#groups">groups</a>
<li>Single links: <a href="#Single%20links">Single links</a>
<li>Single quotes: <a href="#editfiles">editfiles</a>
<li>site: <a href="#site">site</a>
<li>size field in disable: <a href="#disable">disable</a>
<li>Solaris and tcsh: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Solaris routing bug: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Solaris, <code>/tmp</code>: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Solaris, security: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Specifying file sizes: <a href="#tidy">tidy</a>
<li>split: <a href="#split">split</a>
<li>SplitOn: <a href="#editfiles">editfiles</a>
<li>Starting cfengine, cron script: <a href="#cfwrap">cfwrap</a>
<li>Subnet mask: <a href="#netmask">netmask</a>
<li>Support for new systems: <a href="#cfrc%20resource%20file">cfrc resource file</a>
<li>suspiciousnames: <a href="#suspiciousnames">suspiciousnames</a>
<li>Switching off backup in copy: <a href="#copy">copy</a>
<li>Switching off internal classes: <a href="#Runtime%20Options">Runtime Options</a>
<li>Symbolic links, absolute: <a href="#Single%20links">Single links</a>
<li>Symbolic links, relative: <a href="#Single%20links">Single links</a>
<li>sysadm: <a href="#sysadm">sysadm</a>
<li>TCP wrappers: <a href="#Problems%20with%20compilation%20and%20installation">Problems with compilation and installation</a>
<li>tcsh and solaris: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Tidy by ctime, mtime, atime: <a href="#tidy">tidy</a>
<li>Tidying empty files: <a href="#tidy">tidy</a>
<li>Tidying files: <a href="#tidy">tidy</a>
<li>Time classes, hours: <a href="#General">General</a>
<li><code>timeout=</code> in shellcommands: <a href="#shellcommands">shellcommands</a>
<li>Timeouts during iterations: <a href="#shellcommands">shellcommands</a>
<li>Tips using cfengine: <a href="#FAQS%20and%20Tips">FAQS and Tips</a>
<li>Too many open files error: <a href="#Too%20many%20open%20files">Too many open files</a>
<li>Touching files: <a href="#touch">touch</a>
<li>Tree copying, exact: <a href="#copy">copy</a>
<li>Truncating log files: <a href="#disable">disable</a>
<li>umask: <a href="#shellcommands">shellcommands</a>, <a href="#processes">processes</a>, <a href="#editfiles">editfiles</a>
<li>Unmounting filesystems: <a href="#unmount">unmount</a>
<li>Updating files from master source: <a href="#General">General</a>
<li>Variables in import files: <a href="#import">import</a>
<li>Warning about full disks: <a href="#required">required</a>, <a href="#disks">disks</a>
<li>Wildcard home: <a href="#Syntax">Syntax</a>
<li>Wildcards in homepattern: <a href="#homepattern">homepattern</a>
<li>Working directory in shellcommands: <a href="#General">General</a>
<li>Wrapper script: <a href="#cfwrap">cfwrap</a>
<li>wtmpx: <a href="#General">General</a>
<li>WWW server logs: <a href="#disable">disable</a>
<li>xdev (File system boundaries): <a href="#Recursion">Recursion</a>
<li>yacc problems: <a href="#AIX">AIX</a>
<li>zeros: <a href="#broadcast">broadcast</a>
</ul>
<p><hr>
Node:<a name="FAQ%20Index">FAQ Index</a>,
Previous:<a rel=previous href="#Concept%20Index">Concept Index</a>,
Up:<a rel=up href="#Top">Top</a>
<br>

<h1>FAQ Index</h1>

<ul compact>
<li><code>/etc/system</code> missing in solaris.: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Action contains invalid statement problem: <a href="#Problems%20with%20compilation%20and%20installation">Problems with compilation and installation</a>
<li>AFS help: <a href="#General">General</a>
<li>Bad address error in solaris: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>BSDI configuration problems: <a href="#BSDI">BSDI</a>
<li>cfd fails to compile: <a href="#LINUX">LINUX</a>
<li>Cfengine security worries: <a href="#General">General</a>
<li>Changing repository name conventions: <a href="#repchar">repchar</a>
<li>Configure problem, BSDI: <a href="#BSDI">BSDI</a>
<li>copy doesn't always copy files: <a href="#copy">copy</a>
<li>ctime copy doesn't always copy files: <a href="#copy">copy</a>
<li>Daily mail in FreeBSD: <a href="#FreeBSD">FreeBSD</a>
<li>Difference between hpux and hpux10: <a href="#HPUX">HPUX</a>
<li>Distribute key set up files to users: <a href="#General">General</a>
<li>Edit all users login files: <a href="#General">General</a>
<li>Edit and restart DNS: <a href="#General">General</a>
<li>Fix exports in cfengine: <a href="#General">General</a>
<li>Fixing /tmp permissions in solaris: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Fork: resource unavailable in solaris: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>FreeBSD daily mail: <a href="#FreeBSD">FreeBSD</a>
<li>FreeBSD mount doesn't work: <a href="#FreeBSD">FreeBSD</a>
<li>Frozen configuration files: <a href="#HPUX">HPUX</a>
<li>ftp, can't log in: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Groups in hpux: <a href="#HPUX">HPUX</a>
<li>Hanging commands, timeouts: <a href="#shellcommands">shellcommands</a>
<li>Hey! Cannot stat file error: <a href="#copy">copy</a>
<li>How can I add users to the <code>/etc/group</code> file?: <a href="#General">General</a>
<li>How can I avoid hanging shellcommands?: <a href="#shellcommands">shellcommands</a>
<li>How can I make cfengine distribute my <code>/etc/motd</code> file?: <a href="#General">General</a>
<li>How can I override passwords locally?: <a href="#General">General</a>
<li>How can I set a timeout for a shell command?: <a href="#shellcommands">shellcommands</a>
<li>How do I configure sendmail?: <a href="#HPUX">HPUX</a>
<li>How do I set a working directory for a shell command?: <a href="#General">General</a>
<li>How to create files while editing: <a href="#editfiles">editfiles</a>
<li>Iterating over lists: <a href="#split">split</a>
<li>Kill all processes except root: <a href="#General">General</a>
<li>Kill user processes: <a href="#General">General</a>
<li>Killing "eggdrop": <a href="#General">General</a>
<li>Lex and yacc in AIX/HPUX: <a href="#AIX">AIX</a>
<li>libwrap problem under compilation: <a href="#LINUX">LINUX</a>
<li>License server crashes: <a href="#General">General</a>
<li>Line length bug in AIX/HPUX: <a href="#AIX">AIX</a>
<li>Message of the day files: <a href="#General">General</a>
<li>Message of the day in linux: <a href="#LINUX">LINUX</a>
<li>motd in linux: <a href="#LINUX">LINUX</a>
<li>Mount filesystems fails in solaris: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Prevent big log-files: <a href="#General">General</a>
<li>rc.local in solaris: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Remote copy problems, can't stat: <a href="#copy">copy</a>
<li>Replace the stupid version of sendmail..?: <a href="#General">General</a>
<li>Routing problem in solaris: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Solaris /tmp sticky bit: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Sticky bit in solaris /tmp: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>tcsh and solaris error: <a href="#SOLARIS%202">SOLARIS 2</a>
<li>Too many open files error: <a href="#Too%20many%20open%20files">Too many open files</a>
<li>Why can't I set a default route?: <a href="#Problems%20with%20compilation%20and%20installation">Problems with compilation and installation</a>
<li>Why doesn't cfengine have classes for each hour..?: <a href="#General">General</a>
</ul>

<h1>Table of Contents</h1>
<ul>
<li><a href="#Top">Cfengine-Reference</a>
<li><a href="#Command%20reference">Command reference</a>
<ul>
<li><a href="#acl">acl</a>
<ul>
<li><a href="#ACEs">Access control entries</a>
<li><a href="#Solaris%20ACLs">Solaris ACLs</a>
<li><a href="#DFS%20ACLs">DFS ACLs</a>
<li><a href="#NT%20ACLs">NT ACLs</a>
</ul>
<li><a href="#NT%20ACLs">ACL Example</a>
<ul>
<li><a href="#ACL%20Example">ACL Example</a>
</ul>
<li><a href="#binservers">binservers</a>
<li><a href="#broadcast">broadcast</a>
<li><a href="#control">control</a>
<ul>
<li><a href="#access">access</a>
<li><a href="#actionsequence">actionsequence</a>
<li><a href="#addclasses">AddClasses</a>
<li><a href="#addinstallable">AddInstallable</a>
<li><a href="#BinaryPaddingChar">BinaryPaddingChar</a>
<li><a href="#copylinks">CopyLinks</a>
<li><a href="#defaultcopytype">DefaultCopyType</a>
<li><a href="#deletenonusermail">DeleteNonUserMail</a>
<li><a href="#deletenonownermail">DeleteNonOwnerMail</a>
<li><a href="#domain">domain</a>
<li><a href="#dryrun">DryRun</a>
<li><a href="#editfilesize">editfilesize</a>
<li><a href="#excludecopy">ExcludeCopy</a>
<li><a href="#excludelinks">ExcludeLinks</a>
<li><a href="#ExpireAfter">ExpireAfter</a>
<li><a href="#homepattern">HomePattern</a>
<li><a href="#IfElapsed">IfElapsed</a>
<li><a href="#Inform">Inform</a>
<li><a href="#interfacename">InterfaceName</a>
<li><a href="#fileextension">FileExtensions</a>
<li><a href="#LockDirectory">LockDirectory</a>
<li><a href="#LogDirectory">LogDirectory</a>
<li><a href="#linkcopies">LinkCopies</a>
<li><a href="#moduledirectory">moduledirectory</a>
<li><a href="#mountpattern">mountpattern</a>
<li><a href="#netmask">netmask</a>
<li><a href="#nonalphanumfiles">NonAlphaNumFiles</a>
<li><a href="#nfstype">nfstype</a>
<li><a href="#repchar">RepChar</a>
<li><a href="#repository">Repository</a>
<li><a href="#secureinput">SecureInput</a>
<li><a href="#sensiblecount">SensibleCount</a>
<li><a href="#sensiblesize">SensibleSize</a>
<li><a href="#showactions">ShowActions</a>
<li><a href="#site">site/faculty</a>
<li><a href="#SplayTime">SplayTime</a>
<li><a href="#split">Split</a>
<li><a href="#suspiciousnames">suspiciousnames</a>
<li><a href="#sysadm">sysadm</a>
<li><a href="#Syslog">Syslog</a>
<li><a href="#timezone">timezone</a>
<li><a href="#TimeOut">TimeOut</a>
<li><a href="#Verbose">Verbose</a>
<li><a href="#Warnings">Warnings</a>
<li><a href="#warnnonusermail">WarnNonUserMail</a>
<li><a href="#warnnonownermail">WarnNonOwnerMail</a>
</ul>
<li><a href="#classes">classes</a>
<li><a href="#copy">copy</a>
<ul>
<li><a href="#hard%20links%20in%20copy">Hard links in copying</a>
<li><a href="#Too%20many%20open%20files">Too many open files</a>
</ul>
<li><a href="#defaultroute">defaultroute</a>
<li><a href="#disks">disks</a>
<li><a href="#directories">directories</a>
<li><a href="#disable">disable</a>
<li><a href="#editfiles">editfiles</a>
<li><a href="#files">files</a>
<ul>
<li><a href="#Syntax">Syntax</a>
<li><a href="#Recursion">Recursion</a>
<li><a href="#Directory%20permissions">Directory permissions</a>
<li><a href="#home%20directive"><code>home</code> directive</a>
<li><a href="#Owner%20and%20group%20wildcards">Owner and group wildcards</a>
<li><a href="#Files%20linkchildren">Files linkchildren</a>
<li><a href="#touch">touch</a>
<li><a href="#create">create</a>
</ul>
<li><a href="#filters">filters</a>
<ul>
<li><a href="#Complete%20filter%20examples">Complete filter examples</a>
</ul>
<li><a href="#groups">groups/classes</a>
<li><a href="#homeservers">homeservers</a>
<li><a href="#ignore">ignore</a>
<li><a href="#import">import</a>
<li><a href="#interfaces">interfaces</a>
<li><a href="#links">links</a>
<ul>
<li><a href="#Single%20links">Single links</a>
<li><a href="#Multiple%20Links">Multiple Links</a>
<li><a href="#Link%20Children">Link Children</a>
<li><a href="#Relative%20and%20absolute%20links">Relative and absolute links</a>
<li><a href="#Hard%20links">Hard Links</a>
</ul>
<li><a href="#mailserver">mailserver</a>
<li><a href="#miscmounts">miscmounts</a>
<li><a href="#mountables">mountables</a>
<li><a href="#processes">processes</a>
<li><a href="#required">required</a>
<li><a href="#resolve">resolve</a>
<li><a href="#shellcommands">shellcommands</a>
<li><a href="#tidy">tidy</a>
<li><a href="#unmount">unmount</a>
</ul>
<li><a href="#Writing%20scripts%20for%20cfengine">Cfengine script gallery</a>
<ul>
<li><a href="#Old%20files">User scripts for tidying old files</a>
<li><a href="#Sharing%20files">Controlled opening of files for friends and colleagues</a>
<li><a href="#Disk%20clearing">Root script for emergency disk clearing</a>
<li><a href="#Script%20for%20making%20links">Script for making links</a>
<li><a href="#Ftp%20server">Ftp server</a>
</ul>
<li><a href="#Problem%20solving">Problem solving, bugs, FAQs and tips</a>
<ul>
<li><a href="#cf.preconf%20bootstrap%20file"><code>cf.preconf</code> bootstrap file</a>
<li><a href="#cfrc%20resource%20file"><code>cfrc</code> resource file</a>
<li><a href="#Problems%20with%20compilation%20and%20installation">Problems with compilation and installation</a>
<li><a href="#Bug%20reports%20and%20suggestions">Bug reports and suggestions</a>
<li><a href="#FAQS%20and%20Tips">FAQs and Tips</a>
<ul>
<li><a href="#General">General</a>
<li><a href="#AIX">AIX</a>
<li><a href="#BSDI">BSDI</a>
<li><a href="#HPUX">HPUX</a>
<li><a href="#IRIX">IRIX</a>
<li><a href="#LINUX">LINUX</a>
<li><a href="#OSF">OSF</a>
<li><a href="#SUN%20(4.1.*)">SUNOS (4.1.*)</a>
<li><a href="#SOLARIS%202">SOLARIS 2</a>
<li><a href="#FreeBSD">FreeBSD</a>
</ul>
</ul>
<li><a href="#Using%20the%20help%20scripts">Using the help scripts</a>
<ul>
<li><a href="#cfwrap">cfwrap</a>
<li><a href="#cfmail">cfmail</a>
</ul>
<li><a href="#Example%20configuration%20file">Example configuration files</a>
<ul>
<li><a href="#cfengine.conf">cfengine.conf</a>
<li><a href="#cf.groups">cf.groups</a>
<li><a href="#cf.main">cf.main</a>
<li><a href="#cf.site">cf.site</a>
<li><a href="#cf.motd">cf.motd</a>
<li><a href="#cf.users">cf.users</a>
<li><a href="#cf.solaris">cf.solaris</a>
<li><a href="#cf.linux">cf.linux</a>
<li><a href="#cf.freebsd">cf.freebsd / cf.netbsd</a>
<li><a href="#cfd.conf">cfd.conf</a>
</ul>
<li><a href="#Runtime%20Options">Runtime Options</a>
<li><a href="#Network%20protocol%20specs">Cfengine network protocol specs</a>
<li><a href="#Variable%20Index">Variable Index</a>
<li><a href="#Concept%20Index">Concept Index</a>
<li><a href="#FAQ%20Index">FAQ Index</a>
</ul>


</body></html>