Enterprise Configurator

Epconf helps to configure software components that are commonly used in an enterprise environment (e.g. at companies).

Supported devices:

It supports the installation and modification of:

  • Browser bookmark thumbnail images: thumbnail_* files.
  • Wifi root certificates: *.crt files are used when authenticating via WLAN.
  • GConf schemas: *.schemas files are registered with GConf.
  • VCard files: *.vcard files are added to the contact list.
  • Custom actions: Custom configuration can be done with epconftool in-files (*.epin).

The above mentioned input files are taken from the /usr/share/epconf-sets/SET directory.

With epconf in-files you can configure:

  • Arbitrary XML files
  • GConf values
  • Anything with script files

If an epconf in-file file matches *.do-as-user.epin then the operations described by it will be executed as the user 'user'. For more information about in-files, please refer to epconftool. See the epconftool section for more details about epconftool in-files.

Contents

[edit] Command line syntax

usage: epconf [debug] macro file_name ACTION SET[:GROUP[:ELEMENT]]...
    debug            Enables debug output.
    macro            Uses the specified macro file instead of the default one.
    ACTION           May be either install or uninstall.
    SET              Name of the configuration set to process.
                     It may be "all" which means "Process all the available set".
                     "all" cannot be mixed with other sets!
    GROUP            Can be one of
                         thumbnail: Process thumbnail_* thumbnails
                         crt: Process *.crt certificates
                         vcard: Process *.vcard vCards.
                         schemas: Process *.schemas GConf schemas
                         epin: Process *.epin epconftool in-files
                     If it is not given then all the groups are processed.
    ELEMENT          This can be used only with epin group.
                     Only the infile with the given name willbe processed.

The following example pulls the input files from /usr/share/enterprise_pilot/my_set:

epconf macro /home/user/macro.xml install my_set

The following example processes

  • best_in*.epin from /usr/share/enterprise_pilot/my_set then
  • *.vcard from /usr/share/enterprise_pilot/your_set and finally
  • all supported files from /usr/share/enterprise_pilot/their_set:
epconf install my_set:epin:best_in your_set:vcard their_set

[edit] epconftool

Epconftool processes in-files that can be used for the creation of sophisticated configuration scripts.

[edit] Command line syntax

usage: epconftool [-f] [-s] [-d] { -x | -l } macro-file { -i | -u } in-files...

  -i    Install using the given input files.
  -u    Uninstall using the given input files.
  -x    Macro file in XML format
  -l    Macro file in plain key-value format
  -f    Force. If the process fails at one input file it goes on to the next one.
        Without this option (default), a bad input file stops the entire process
        and the subsequent input files are not processed.
  -s    Do simple macro substitution (a macro in a macro is not processed).
  -d    Print debug output to stderr.
        Either -i or -u can be used. They cannot be mixed.

Built-in macros:

  • TIME_EPOCH: The seconds elapsed since 1970.01.01 (see 'man 2 time').
  • INFILE_DIR: Absolute path of the directory containing the in-file being processed.
  • MARKER: This may be used e.g. in XML in-files. If a node_path node contains this as a text field anywhere in its subtree, then that node is removed during un-installation. Otherwise it is not removed!

[edit] Macro file

The MACRO file contains usernames, passwords, etc. Each value in this file has a key associated with it. E.g., the WLAN_username key may have the value Jack. The keys of the MACRO file can be used in in-files as %key_name%. E.g., %WLAN_username%.

Two kinds of macro files are supported:

  • XML
  • Key-value list

[edit] XML

Let's take the following as an example:

<?xml version="1.0" encoding="UTF-8" ?>
<CONF>
  <NAME>Joe Buck</NAME>
  <REMOTE_ACCESS>
    <LOGIN>joebuck</LOGIN>
  </REMOTE_ACCESS>
  <SIP>
    <NAME>ext-joe.4.buck</NAME>
    <PASS>98765876</PASS>
  </SIP>
  <WLAN>
    <RESTAURANT>
      <LOGIN>joejoe</LOGIN>
      <PASS>buckybuck</PASS>
    </RESTAURANT>
  </WLAN>
  <EMAIL>
    <ADDRESS>ext-joe.4.buck@company.org</ADDRESS>
  </EMAIL>
</CONF>

When using the above example macro file, the macro values are the text nodes and the macro names are formed formed the tag names. For example, the %CONF_REMOTE_ACCESS_LOGIN% macro refers to the value "joebuck".

[edit] Key-value list

Let's take the following as an example:

"CONF_NAME" "Joe Buck"
"CONF_REMOTE_ACCESS_LOGIN" "joebuck"
"CONF_SIP_NAME" "ext-joe.4.buck"
"CONF_SIP_PASS" "98765876"
"CONF_WLAN_RESTAURANT_LOGIN" "joejoe"
"CONF_WLAN_RESTAURANT_PASS" "buckybuck"
"CONF_EMAIL_ADDRESS" "ext-joe.4.buck@company.org"

When using the above example macro file, the %CONF_REMOTE_ACCESS_LOGIN% macro refers to the value "joebuck".

If the " (double quote) character appears in a key or a value, then it must be escaped. For example, "Norton said \"Howdy!\" and then he left.". Same for the \ (backslash) character. For example, "\\" represents a single backslash character.

[edit] Input Template file (in-file)

In-files have the following general format:

[CONTROL]
# Comment
type:gconf|xml|shell
...

[DATA]
...
...%MACRO%...
...

The following lines are ignored:

  • empty lines: lines with only whitespace or newline
  • comments: lines whose first non-whitespace character is hash-mark ("#")

The tag (e.g., "type") and its value (e.g., "xml") in the CONTROL section are separated by a single colon character. The "type" tag is mandatory, and it must be the first non-ignored line in the CONTROL section.

Every %MACRO% macro is replaced with the matching value from the MACRO file during the installation/un-installation process. Macro substitution is applied to the entire in-file (e.g. if the value of MARKER is "Hello Hippo" then [CON%MARKER%TROL] is replaced with [CONHello HippoTROL]).

No recursive macro substitution is done. For example, if macro %APPLE% has the value "Hello %WORLD%" then the %WORLD" is not considered as a macro for substitution.

[edit] GConf

This in-file is used to add/remove GConf values. See [2] for an example!

Syntax:

[CONTROL]
type:gconf

[DATA]
dir:/path/to/gconf/directory
behavior:type:key_name:value
behavior:type-list:key_name:[value,value,...]
...

The "type" tag tells that it's a gconf in-file. The first line in the DATA section is the gconf directory that we want to configure. Subsequent lines describe key/value pairs for GConf keys, whitespaces are not allowed. Value lists are also supported. In this case, the type name is suffixed with the "-list" word and the value is a comma separated list enclosed in brackets. The behavior can be one of the following:

  • replace: If the key already exists, it is replaced.
  • merge: Only for value lists. If the key already exists, it is merged with the specified one.
  • keepold: If the key already exists, it is not changed.

Installation:

  • In the DATA section, all the %MACRO% tags are replaced with the proper values.
  • If the gconf directory /path/to/gconf/directory does not exist, it is created and populated with the provided key/value pairs.
  • If the gconf directory /path/to/gconf/directory exists:
    • If a provided key does not exist, it is created and its value is set.
    • If a provided key exists, the action taken depends on the specified behavior.

Uninstallation:

  • Simple values: The key is deleted.
  • List values: If behavior is "merge" only the values given in the in-file are removed from the list. For other behaviors, the entire key is deleted.
  • If after removing the keys, the entire /path/to/gconf/directory directory is deleted from gconf if it has become empty.

[edit] XML

This in-file is used to add/remove nodes in XML files, such as bookmarks and Pidgin accounts.

Syntax:

[CONTROL]
type:xml
target:/path/to/the/xml/file/that/we/want/to/modify/or/create.xml
node_path:/xml/path/to/a/node
node_id_path:/xml/path/to/the/id/node /xml/path/to/another/id/node
remove_by:id|marker
if_exists:replace|keepold

[DATA]
A complete XML document...
  • type: Tells that it's an XML in-file.
  • target: The file system path of the final output. If the file exists, it is also used as input.
  • node_path: It is an XML-path that defines the nodes in the in-file DATA section that will be added to the target file.
  • node_id_path: It is a spaces and/or tabs separated list of XML-paths. These paths are combined and used as the primary-key to identify duplicate/existing entries.
  • if_exists: Optional. Default is "keepold". Defines the behavior for installation. When set to "replace", existing nodes are replaced with the ones in the DATA section. When set to "keepold", existing nodes are left intact.
  • remove_by: Optional. Default is "marker". Defines the behavior for uninstallation. When set to "id", nodes that match the node_path/node_id_path are removed. When set to "marker", nodes that contain the %MARKER% value in any of their (or children) attributes or children nodes, are removed.

All XML-paths use the X-Path syntax, see http://www.w3schools.com/XPath/default.asp, http://www.w3.org/TR/xpath20/, http://xmlsoft.org/html/libxml-xpath.html.

The DATA section contains a complete XML document.

Installation:

  • In the DATA section, all the %MACRO% tags are replaced with the proper values.
  • If the target file does not exist, it is created with the output of the previous steps, which is the processed DATA section (the un-macroed DATA section).
  • If the target file exists:
    • Based on the node_id_path and node_path, nodes from the processed DATA section are added to the target file. If a node already exists (based on node_id_path), the node is not added.

Uninstallation:

  • If remove_by is "marker": Delete every node (based on node_path), from the target file that has a text element anywhere in it with the %MARKER% macro. Therefore, you MUST add the %MARKER% macro somewhere in the nodes that you want to be removed later.
  • If remove_by is "id": Delete every node (based on node_path), from the target file that has the same id value (based on node_id_path) as the XML in the DATA section.

[edit] shell

Shell in-files are a flexible way to create custom configurator scripts.

Syntax:

[CONTROL]
type:shell

[DATA]
install:
commands
commands
commands
...

uninstall:
commands
commands
commands
...

The DATA section consists of and "install" and an "uninstall" subsection. The command lines below the subsections constitute the content of the script. A script file is created with that content and is executed. So basically, you can write, e.g., shell scripts, perl and python scripts, etc.. Command lines cannot start with "install:" or "uninstall:"!