Directory listings are used to monitor the contend of a directory. The
config file
contains the list of all the files in the directory as well as
their properties including the links of symbolic links. sysf
can then be
used to check that none of the files have been modified but also that no
files has been added or removed from the directory. Directory listings are
particularly useful to maintain the rc.d
directories.
The difference between a directory entry and a directory listing entry is
that a directory entry describes the properties of a directory (ownership,
modes ...) while a directory listing describes the content of a directory.
The same directory can have a sysf entry both as a directory and as a
directory listing (one will have to use two different entry name
and config names
for them).
An entry for a directory listing in the sysf.conf
file looks like this:
ENTRY_NAME = GROUP SYSTEM_FILE CONFIG_NAME g[OTHER_FLAGS];where
SYSTEM_FILE
is the path of the system directory
and
g
is the flag that states that the entry is a directory listing. Other
flags can be set has well.
The config file
lists all
the files in the directory with their properties in the following format:
FILENAME = OWNER_UID GROUP_GID MODE FILE_TYPE SIZE CHECK_SUM [LINK];where
FILENAME
is the name of the file (directory, symbolic link ...)
in the directory.OWNER_UID
the owner UID
as a decimal number. This field is
ignored for symbolic links. GROUP_GID
the group GID
as a decimal number. This field is
ignored for symbolic links. MODE
the access mode as an octal number. This field is
ignored for symbolic links.FILE_TYPE
the first character is the type of the file while the
remaining one describe some properties. The valid file types are the following:
f
: an ordinary file.d
: a directory.l
: a symbolic link.c
: a character device.b
: a block device.F
: a FIFO stream.?
: used for any other type of file. I
: ignore this entry. This is used for files that are created
and removed regularly by the system and that can't be monitored. This way
sysf
won't list the mismatch between the config
and system file
when it occurs. 0
: ignore the size and the check sum for this entry. This is
typically used for log files which by nature change all the time.S
: ignore the check sum for this entry. This can be used for
very long files that takes time to hash.SIZE
the size of the file. This is used for regular files only and
set to 0 for the other types. CHECK_SUM
a string computed for regular files but set
to 0 for the other type of files. The check sum can either be computed using
md5 (recommended) or using a method that generates a check sum value between
0
and and 1048572
and that is sensitive to any change in
the file. The check sum is used to check if a file has been modified in any
way without keeping a copy of the file. In particular it is useful to track
files that have been changed by a configuration tool or while installing
new packages (especially patches). It is also a convenient way to ensure that
different hosts have identical files when they should. LINK
is the link (the file the symbolic links points to)
for symbolic links. This entry does not exists for other types of file.In the example below we show a few typical entries for directory lists in the
sysf.conf
file. The directory rc2.d
and rc3.d
are directory
lists with the flag r
set so that .DIST
files are not created
by the command first_install
and OS_install
. The flag I
indicates that an auxiliary command must be executed by sysf
.
(It is given
in the case study section below. It starts and stops the different services
as the symbolic links are added or removed)
In our example, the directory etc
is maintained using
both a directory entry and a directory list entry. The entry etc_D
maintains the properties of the directory while etc_DL
maintains its
content.
rc2.d = rc /etc/rc2.d rc2.d grI; rc3.d = rc /etc/rc3.d rc3.d grI; etc_D = etc /etc etc_D d; etc_DL = etc /etc etc_DL g;
We given below a short extract from a possible config file
etc_DL
.
The file .pwd.lock
is completely ignored. The
content (size and check sum) of the passwd
file are ignored so that
changes made by users don't show up (this is maybe not a good idea).
The file /etc/rc.local
is a symbolic link to rc.d/rc.local
and resolv.conf
is a regular file with the md5 check sum
f0c2d408cdd2b94066487ae60dceb82c
.
.pwd.lock = 0 0 600 "fI" 0 1; X11 = 0 0 755 "d" 0 0; passwd = 0 0 644 "f0" 0 0; rc.local = 0 0 777 "l" 0 0 "rc.d/rc.local"; resolv.conf = 0 0 644 "f" 88 "f0c2d408cdd2b94066487ae60dceb82c";
The config files
for directory lists should not be created by hand
but rather initialised with the sysf
commands new
, makegroup
or makedef
.
When the sysf
command is install
, first_install
or
OS_install
and when an entry has the flag I
set in the
sysf.conf
file, the auxiliary command named after the
entry name
for the directory list is executed for each
modified entries. The auxiliary command is never executed for the sysf
command that do not modify the system file
.
The auxiliary command is executed when a member of a directory lists
must be created or removed. It is executed for every type of entry even
when sysf
is unable to update a given type of entry
(like creating a non existing regular file).
When an entry needs to be modified, (when the entry has changed) the
auxiliary command is executed first before trying to remove the entry and
once after trying to create the new entry.
The arguments of the auxiliary commands are as follow:
AUX_COM SYSTEM_FILE TYPE ACTION ECHO_ON SYSF_COMMANDwhere
AUX_COM
: the name of the auxiliary command.SYSTEM_FILE
: the full path name of the directory entry (the
directory that is modified).TYPE
: the type of file ("l", "d", "f"). ACTION
: is either REMOVE
or CREATE
and specifies if the
system file
is being removed or created. File that are modified are first
removed and then created.ECHO_ON
: is set to either on
or off
.SYSF_COMMAND
: the name of the sysf
command,
install
, first_install
or OS_install
.When a file is removed, the auxiliary command is executed with the ACTION
set to REMOVE
before the file is actually removed.
When a file is created, the auxiliary command is executed with the ACTION
set to CREATE
after the file has been created.
When a file is modified the auxiliary command is executed with the ACTION
set to REMOVE
before the file is changed and again with the ACTION
set to CREATE
after the change.