Importing configuration data

Although Zentyal UI interface greatly eases the system administrator work, some configuration tasks through the interface can be tedious if you have to perform them a large number of times. For example, adding 100 new user accounts or enabling an e-mail account for all 100 users.

These tasks can be automated easily through the Application Programming Interface (API) which is provided by Zentyal. You only need a basic knowledge of Perl [1], and to know the public methods exposed by the Zentyal modules you want to use. In fact, Zentyal web interface uses the same programming interface.

[1]Perl is a high-level, general-purpose, interpreted, dynamic programming language. http://www.perl.org/

An example on how to create a small utility is shown below, using the Zentyal API to automatically add an arbitrary number of users defined in a Comma Separated Values (CSV) file

#!/usr/bin/perl

use strict;
use warnings;

use EBox;
use EBox::Global;

EBox::init();
my $usersModule = EBox::Global->modInstance('users');

my @users;
open (my $USERS, 'users');

while (my $line = <$USERS>) {
    chomp ($line);
    my $user;
    my ($username, $givenname, $surname, $password) = split(',', $line);
    $user->{'user'} = $username;
    $user->{'givenname'} = $givenname;
    $user->{'surname'} = $surname;
    $user->{'password'} = $password;
    push (@users, $user);
}
close ($USERS);

foreach my $user (@users) {
    $usersModule->addUser($user, 0);
}

1;

Save the file with the name bulkusers and grant it execution permission using the following command: chmod +x bulkusers.

Before running the script, you must have a file called users in the same directory. The appearance of this file should be as follows:

jfoo,John,Foo,jfoopassword,
jbar,Jack,Bar,jbarpassword,

Finally, you must be in the directory where files are placed and run:

sudo ./bulkusers

This section has shown a small example of task automation using the Zentyal API, but the possibilities are almost unlimited.

Service Advanced Customisation

This section discusses two options for system customisation for those users with special requirements:

  • Tailor service configuration files managed by Zentyal.
  • Perform actions in the process of saving changes in configuration.

When a module is responsible for automatically setting up a service, it tries to cover the most common configuration options. Furthermore, there are cases where there are so many configuration settings that it would be impossible for Zentyal to control them all. In addition to this, one of the Zentyal goals is simplicity. However, there are users who want to adjust some of those unhandled parameters to adapt Zentyal to their requirements. One of the possibilities is editing the configuration files that handle the service directly.

Before deciding to modify a configuration file manually, you must understand how Zentyal works internally. The Zentyal modules, once enabled, overwrite the original system configuration files for the services they manage. They do this through templates that essentially contain the basic structure of a typical configuration file for the service. However, some of their parts are parametrised through variables. The values of these variables are assigned before overwriting the file, taken from the configuration previously set using the Zentyal web interface.

How the configuration template system works

How the configuration template system works

Therefore, if you want to make your changes persistent, and prevent them from being overwritten every time Zentyal saves changes, you must edit such templates instead of system configuration files. Those templates are in /usr/share/ebox/stubs and their names are the original configuration file names plus the .mas extension.

It should be remembered that although we make these changes in templates, those changes will be lost if an upgrade is performed. Installing a new module version will overwrite all template files. Therefore it is recommended to keep a backup copy of your modifications in order to restore them after the upgrade.

It is possible that you need to perform certain additional actions while Zentyal is saving changes instead of customising configuration files. For example, when Zentyal saves changes related to the firewall, the first thing the firewall module does is to remove all existing rules, and then add the ones configured in Zentyal. If you manually add a custom iptables rule that is not covered by Zentyal interface, it will disappear when saving firewall module changes. To prevent that, Zentyal let us run scripts while the saving changes process is being performed. There are six points during the process when you may execute those scripts, also known as hooks. Two of them are general and the remaining four are per module:

Before saving changes:
In /etc/ebox/pre-save directory all scripts with running permissions are run before starting the save changes process.
After saving changes:
Scripts with running permissions in /etc/ebox/post-save directory are executed when the process is finished.
Before saving module configuration:
Writing /etc/ebox/hooks/<module>.presetconf file being <module> the module name you want to tailor, the hook is executed prior to overwriting the module configuration. It is the ideal time to modify configuration templates from a module.
After saving module configuration:
/etc/ebox/hooks/<module>.postsetconf file is executed after saving <module> configuration.
Before restarting the service:
/etc/ebox/hooks/<module>.preservice is executed. This script could be useful to load Apache modules, for instance.
After restarting the service:
/etc/ebox/hooks/<module>.postservice is executed. In the firewall case, all the extra rules must be added here.

As you can imagine, these operations have a great potential and allow for a highly customisable Zentyal operation to allow better integrated with the rest of the systems.

Environment for new modules development

This chapter has shown how to resolve some of the configuration limitations from Zentyal modules. But it is possible that modules provided by Zentyal may not cover all our needs. This is important, since Zentyal is designed with extensibility in mind and it is relatively simple to create new modules.

Anyone with Perl language knowledge may take advantage of the Zentyal framework to create web interfaces, and also benefit from the integration with the rest of the modules and the common features from the vast Zentyal library.

Zentyal design is completely object-oriented and it takes advantage of the Model-View-Controller (MVC) design pattern [2], so the developer only needs to define those features required by the data model. The remaining parts are generated automatically by Zentyal. To simplify the process further, a development tool called zmoddev [3] is provided to ease the development of new modules, auto-generating templates depending on the parameters provided by the user. This will save time, however, its explanation and development is beyond the scope of this course.

[2]An explanation about Model-View-Controller design pattern http://en.wikipedia.org/wiki/Model_View_Controller.
[3]zmoddev SVN repository access svn://svn.zentyal.org/zentyal/trunk/extra/zmoddev.

Zentyal is designed to be installed on a dedicated machine. This recommendation is also extended to the developing scheme. Developing on the same host is highly discouraged. A virtual system to develop on is the recommended option as virt-chapter-ref explains in depth.

Bug management policy

Each open source software project has its own bug management policy.

Ubuntu may have more than one version considered as stable and maintained at the same time. Maintained means that when a new bug is found, a new public update is released to fix it. Updates will be covered in more depth below. These stable versions are supported for a length of time which depends on the kind of the release.

Zentyal has a single stable version. Some modifications are added to this version to fix several bugs at once. This happens until a new release is published, which already uses these fixes.

The project management tool Trac [4] is used by the Zentyal development team to manage bugs and other tasks. It lets users open tickets to report problems and it is open to all users. Once the ticket is created by a user, its state can be tracked by the user through the web or e-mail. You may reach Zentyal Trac at http://trac.zentyal.org.

[4]Trac: is an enhanced Viki and issue tracking system for software development projects http://trac.edgewall.org.

Ubuntu, however, uses Launchpad [5], a tool developed and supported by Canonical to manage their bugs:

[5]Launchpad is available at https://launchpad.net.

It is highly recommended to report a bug when you are fairly sure that your problem is easily reproduced. You should provide detailed instructions to reproduce it. In addition, you should make sure that your problem is really a bug and not just an expected result from the program under determined circumstances. Finally, it is even better to provide a solution for your problem. This could be done by modifying the application itself through a patch or by following some steps to avoid the problem temporarily (workaround).

Patches and security updates

A patch is a modification in the source code used to fix a bug or add a new feature to that software. In open source projects, community members are able to send patches to the project maintainers and if they consider the patches suitable, then they will be merged into the application.

Developers themselves often publish official patches too, for example, fixing a known vulnerability. But, typically, projects like Zentyal or Ubuntu, release a new version of the package - including the official patch.

The Ubuntu policy for official releases; is to publish updates to fix security bugs.

By default, when a stable version of Ubuntu is installed, the system is prepared to install security updates afterwards.

There is a file called /etc/apt/sources.list This is where repositories are defined so that packages can be retrieved from them.

This file should include a line to specify the security updates, similar to the following one:

deb http://security.ubuntu.com/ubuntu/ lucid-security universe main multiverse restricted

You may check out the new updates and install them, as aptitude-ref explains, but if you have Zentyal installed, then you can manage them using the web interface through the software module [6].

[6]Section Software updates shows this module in depth.

Technical support

Open source software usually provides technical support to the application users through different methods. Ubuntu and Zentyal are not an exception.

We must distinguish between two kinds of support: the one provided to the community, which is free, and the commercial type, where a company offers its services by charging a certain amount of money.

Community support

Community support is provided mainly on the Internet. There are many occasions where the community is able to support itself. That is, application users help each other. The product development team usually have a prominent role within the community.

The community are an important, even fundamental, provider of improvement in the product development. Users contribute by discovering hidden bugs and help developers to improve the product so it becomes more attractive to more users.

This voluntary support, logically, does not offer any guarantees. If a user asks a question, it is possible that no reply is given depending on the question format, timing or any other circumstance.

The most typical community support channels are forums, mailing lists and IRC [7] channels.

[7]Internet Relay Chat (IRC) is a real-time communication protocol based on text where users are usually discussing in a defined channel RFC 1459.

These are the main community resources for Zentyal:

  • IRC: irc.freenode.net server, #Zentyal (English) and #Zentyal-es (Spanish) channels.
  • Forums: http://forum.zentyal.org (providing several specific boards in English and a general one in Spanish)
  • Mailing lists (http://lists.zentyal.org):
    • zentyal-users, general user list.
    • zentyal-users-es, general Spanish user list.
    • zentyal-devel, developers list.
    • zentyal-announce, official announce list.
    • zentyal-i18n, Zentyal translator list.

All this information is available, with further documentation, in the community section of Zentyal web site (http://www.zentyal.org).

Commercial support

The commercial support allows the user access to other channels, apart from the Internet, to obtain support from a company. Phone and physical presence in client facilities are also possible.

Unlike community support, the commercial support offers several guarantees as follows:

  • Maximum response time: depending on the service package that time will be shorter or longer.
  • Well-trained supporting people: in some cases the development team will be giving the support, otherwise well-trained and certified people will do so.
  • Additional features which add value to the product and are not available to the community.

These advantages are pretty clear for those companies whose business relies on this software. In addition to this, commercial support ensures no time is wasted trying to work out what is wrong with your installation.