Honouring System Default Policies on ntop Packages

Posted · Add Comment

Many distributions provide mechanisms to let the system administrator decide if the new installed packages should be enabled and/or started automatically. Previously, the ntop services were always enabled and started automatically after the first package installation, regardless of any system preferences. Now the ntop packages rely on system utilities to properly start, stop and restart services after installation in order to correctly honor system policies.

Due to the distribution specific defaults, this is now the default behaviour of the services installed by the ntop packages:

Debian/Ubuntu Centos 7 Other
Started after Install Yes No Yes
Enabled after Install Yes No Yes
Restarted after Upgrade Yes Yes Yes

Here are some instructions on how to modify the default behaviour on the supported systems.

On Debian/Ubuntu based distributions, the administrator can use the script policy-rc.d to define the default behavior for the services installed from packages. By default, all the services are enabled and started automatically, but this can be changed by creating the file /usr/sbin/policy-rc.d with the following contents:

exit 101

and making it executable. Now all the new services (which honor the policy-rc.d policy) will not be automatically started or enabled. The specification for policy-rc.d can be found at the following URL.

On the other hand, on CentOS/Fedora based distributions, the default behaviour for installed services is to not enable and start them. Actually, on CentOS services are never started automatically after installation. However, the administrator can decide to change the default policy or to override the policy for some specific packages. CentOS relies on the standard systemd-preset mechanism to define such policies. The directory /usr/lib/systemd/system-preset contains the configuration files which define the policies of the system. In particular, the file /usr/lib/systemd/system-preset/90-default.preset contains the default presets for some common packages.

For example, in order to automatically start ntopng after installation, the file /usr/lib/systemd/system-preset/20-ntop.preset can be created with the following contents:

enable ntopng

Now that you know all this, you can play with the new ntop dev packages that already implement this new behaviour. In the near future we will port them also to the stable version to implement a new consistent platform behaviour.