Next Previous Contents

1. Introduction

The configuration of a Unix/Linux computer is done through a collection of editable (ASCII) files located mostly under the /etc directory tree. On a local network most computers are configured in an identical or at least a very similar way: they will have the same base of users, use the same software, implement the same security strategy... . One of the network administrator's duties is to maintain these configuration files and keep them up to date. When the configuration files are identical it is useful if they can all be maintained centrally from a master file.

The Network Information Service (NIS is also known as the yellow pages) addresses this issue for a few files like the /etc/passwd file for example: the data are stored centrally in a database and computers query this database instead of reading the local file. One of the limitations of NIS is that it can only be used for the files for which it has been designed. One can easily create other NIS tables, but for a computer to consult the NIS server for these new tables, one would usually have to modify some internal libraries. Another limitation of the NIS entry is that it only works for files that are identical for all computers, or at best, the data stored in the NIS table can be added to the content of the local file (like the passwd file for example).

1.1 Managing system files across a network

There are many configuration files that are not implementable as NIS tables but that would benefit from being maintained centrally. sysf (pronounced sys-ef) is a tools designed to do this. The administrator choses which system files he or she wants to maintain with sysf (as described below) and use the tool to archive the configuration files for each host keeping only one copy of the files when its content is the same for a group of hosts.

WARNING: sysf is an administration tools which can modify important system files across an entire network. Configuring or using sysf without a detailed understanding of how it works can seriously damage vital files on many hosts at once. Although sysf has been thoroughly tested by its author there is no guarantee that it is entirely bug free. It is thus recommended that every user tests new configurations on dummy files before deploying them on a real system.

Here are a few examples of files that can be managed with sysf:

To manage these files centrally, we make a copy of each of them in a shared directory (typically /usr/local/sys/config) which we will now refer to as the config directory. We also add a suffix to their name to distinguish the host they belong to. For example, the file XF86Config.trovald, printcap.RoomA and root_cshrc.DEFAULT will be respectively the XF86Config file for the host trovald, the printcap file for all the computers in the classroom A and the /root/.cshrc file shared by all computers. To check that the config file root_cshrc.DEFAULT is identical to the system file /root/.cshrc on every host one executes the command

    # sysf -check root_cshrc -h ALL
Similarly, to check the file XF86Config on all the computers that have a Matrox card, one uses
    # sysf -check XF86Config -h MATROX

As the number of files to maintain can become quite large, the files are split in different categories each of which correspond to a sub-directory of the config directory.

In what follows we will refer to the actual Unix/Linux files (/etc/printcap) as the system files and to their archived copies (/usr/local/sys/config/printing/printcap.DEFAULT) as the config files.

The suffix used for the config files can be of four different types:

sysf determines the actual config file as follow. First it searches for the config file CONFIG_NAME.HOST_NAME for the current host where the config name is the name in the fourth column of the file sysf.conf for the corresponding entry. Then it searches for the file CONFIG_NAME.HOST_GROUP for all the host groups to which the the current host belongs in the order they are defined in the file hosts.conf, taking the first one it finds. If none are found, then the config file is taken as CONFIG_NAME.DEFAULT.

To avoid having a very large number of files in the same directory, the configuration files are split in different categories each of which has its own directory (the group directory in the config directory). For example the group directory X11 contains all the files related to the X library, filesys contains the files related to the file system (fstab, exports, auto.home ...) and security contains the files addressing some security issues (ftpaccess, httpd.conf, ...).

The sysf command is used to manage the system files and their copy (config files in the sysf nomenclature) . One can copy a system file into its config file (archive) and vice-versa. One can also check that a system file is identical to its config file or list the difference between the two (as the output of the diff command). It is also possible to compare the config files of two different hosts. All operations can be performed for a single file as well as on any group of file. Sysf can also check files for a specific hosts as well as any group of hosts. For example, the command

    sysf -check ALL -host ALL
lists all the system files which differ from their config file on all the hosts.
    sysf -install fstab 
updates the fstab system file from the config file on the current host.
    sysf -diff printcap -host RoomA
lists the differences between the printcap system files and their config file for all the computers belonging to the host group RoomA.

The sysf command can also execute some auxiliary commands to perform further configuration tasks. For example, after the printcap file has been modified one should restart the lpd daemon. This can be done by configuring sysf to execute a specific command, usually a script file, to perform that operation each time the printcap file is updated.

1.2 What sysf was designed for

The strength of sysf is to simplify the maintenance of the system files across a network and in particular:

Aside from helping the management of a large number of configuration files, the config directory can be used as a backup copy of all configuration files of all computers on the network. Should a computer need to be reinstalled from scratch all the information is contained in the config directory. The only two missing parts are the user data files and other shared disks, which should be stored carefully and be thoroughly backed up, and the software installed on the computer (which one can reinstall from CD or other media). If one used rpm, the sysf rpm.list entry described below will provide the list of rpms that were installed. To configure a new computer on the network where sysf has been properly configured, one only has to execute the command

    # sysf -OSI ALL

1.3 Terminology

Before we continue, we must define some terminology used in this manual:

Sysf uses three configuration files

1.4 The Config Directory

The config directory, typically /usr/local/sys/config is where all the configuration files are saved. This directory must be accessible from every host. It is thus normally somewhere on an NFS mounted directory. One cannot use a samba mounted file system because sysf must be able to creates symbolic links, something that samba does not support.

The directory must contain the files sysf.conf and hosts.conf and a directory for every config group. It must also contain the directory BIN which contains the auxiliary commands, typically shell scripts, that one can write to get sysf to perform further operations.

We illustrate below the structure of the config directory by listing a few of the files it might contain. In the example, trovald and cox would be the name of two hosts, lprsever would be the print server while MATROX and ELSA will be host groups corresponding to the computers fitted with Matrox and Elsa graphic cards respectively.

 ../config/
          |
          + sysf.conf
          |
          + hosts.conf
          |
          + BIN/
          |    |
          |    + crontab
          |    |
          |    + printcap
          |    
          + etc/
          |    |
          |    + fstab.trovald
          |    | 
          |    + fstab.cox
          |    | 
          |    + printcap.DEFAULT
          |    | 
          |    + printcap.lprsever
          |      
          + local/
          |      |
          |      + motd.SHARED
          |      
          + X11/
               |
               + XF86Config.MATROX
               | 
               + XF86Config.ELSA
               | 
               + Xsession.DEFAULT

Notice that the config files belonging to a given group are saved in the corresponding directory.

1.5 The Config Files

The config files are archived copies of the corresponding system files. Their full path name have the following form:

    /CONFIG_DIR/CONFIG_GROUP/CONFIG_NAME.SUFFIX
where

To determine the config file of a given host, sysf searches first for the file with the host-name extension. If there isn't one, sysf scans all the host groups the host belongs to (in the same order as they appear in the hosts.conf file) and takes the first file found with the matching suffix. If this fails, the DEFAULT file is used, and if there isn't any, a warning message is displayed. The suffix SHARED is used for the sysf entries which have the s flag set (cfr below). This is for files that are stored on a shared (NFS mounted) file system.

One can also specify that a system file must not exist. This is done by creating the corresponding config file as a symbolic link to the name NONE (which does not have to exist as a file).

Config files should not be symbolic links to other files as sysf removes any such link when performing an archive operation and creates a regular files instead. This is a design choice was made to avoid making unintentional modification to a config file. If two computers share the same config file a host group should be created for them instead. Symbolic links (to NONE) should only be used to specified that a system file does not exist.

1.6 The System Files

The system files are most of the time the files used directly by the operating system. The file names and the locations of these files are set by the operating system and must be given as the 3rd column of the file sysf.conf. Rather than maintaining all the system files with sysf one would usually maintain only the ones that have been modified after the installation of the operating system.

Some of the system files are special in that they are not editable files. An example is the standard Unix crontab file; the crontab entries are stored in a binary file but can be listed by executing the command crontab -l. The list of installed Red Hat packages (rpms) is another example of a system file stored in a binary format. The list of packages can be obtained with the command rpm -qa. To work properly, sysf must first create a temporary file containing the relevant information which can then be compared to the corresponding config file. These entries must have the C flag set in the sysf.conf telling sysf to execute the corresponding auxiliary command to create the system file each time a sysf command is executed.


Next Previous Contents