# Introduction to WAPT¶

## For what purpose is WAPT useful?¶

WAPT installs, updates and removes software and configurations on Windows, Linux and macOS devices. Software deployment (Firefox, MS Office, etc.) can be carried out from a central server using a graphical console. WAPT is taking many ideas from Debian Linux apt package management tool, hence its name.

Private companies of all sizes, Colleges, Schools, Universities, research labs, local and state governments, Hospitals, city governments, state ministries around the world are successfully using WAPT.

WAPT exists in two versions, Discovery and Enterprise, both proprietary, the Community version having been friendly forked to the Opensource Community.

WAPT is very efficient to address recurrent Firefox or Chrome update needs and it is often to cover that basic need that WAPT is initially adopted; it then becomes a tool of choice for the sysadmin’s daily tasks.

## Security Certification from French Cyberdefense Agency ANSSI¶

Security Visa from ANSSI dated 14th of February 2018 for WAPT Enterprise Edition 1.5.0.13

Following its first level security certification obtained on 14 February 2018, WAPT has obtained on 15 march 2018 a higher level certification from ANSSI.

## The genesis of WAPT¶

### Our assessment after 15 years of IT management¶

Managing large IT installed bases of Microsoft Windows computers is today a difficult task in a secured environment:

• common ghosting methods (Clonezilla or Ghost) are efficient on homogeneous IT infrastructures with roaming user profiles;

• deployment tools (OCSInventory or WPKG) can broadcast software but do not easily allow software level or user level customizations that are useful to prevent or limit user support requests;

• software from smaller vendors often need Local Administrator rights to run properly;

• currently available solutions to address theses problems are either too expensive or too inefficient, and they are in every case too complex;

### WAPT development hypotheses and motivations¶

The development of WAPT is motivated by these two principles:

• what is complicated should be made simple;

• what is simple should be made trivial;

WAPT relies on a small set of fundamental hypotheses:

• sysadmins should know a scripting language and WAPT has chosen Python for the depth and breadth of its libraries;

• sysadmins who have little experience with scripting languages must find inspiration in simple and efficient examples that they’ll adapt to fit their needs;

• sysadmins must be able to communicate on the efficiency of their actions to their superiors and report process gaps to internal or external auditors;

• sysadmins must be able to collaborate with their IT team; thereby WAPT local repositories provide signed packages that they can trust to be deployed on their network. Alternatively, they can choose external public repositories providing them the security guarantees that they consider sufficient;

• sysadmins are aware that user workstations serve business purposes and some customizations must be possible. The adaptation of the infrastructure to the business needs is facilitated by the notion of groups and OU; it allows to select a large number of machines to customize their configuration;

# Fundamental principles¶

## Repository principle¶

Packages are stored in a web repository. They are not stored in a database.

Note

Transport protocol used for deploying packages is HTTPS.

WAPT packages are served by the Nginx web server, available with Linux and Windows.

The Packages index file is the only thing necessary. It lists the packages available on allowed repositories and some basic information on each package.

That mechanism allows to easily set up a replication process between multiple repositories.

Replication and multiple repositories

Large organizations with remote sites and subsidiaries sometimes require services to be replicated locally to avoid bandwidth congestion (Edge Computing).

## Replicated repository ¶

WAPT Enterprise offers the possibility to upgrade remote agents to serve as remote repositories that can be managed directly from the WAPT Console. All WAPT agents can then be centrally configured to automatically select the best repository based on a set of rules.

When WAPT is used on bandwidth limited remote sites, it makes sense to have a local device that will replicate the main WAPT repository to reduce the network bandwidth consumed when deploying updates on remote devices.

With remote repositories, WAPT remains a solution with a low operating cost because high bandwidth fiber links are not required to take advantage of WAPT.

Replicating WAPT repositories

It works as follows:

• a small form factor and no maintenance appliance with the role of secondary repository is deployed on the local network of each remote site; a workstation can also be used, although it may not be up and running if you want to connect to it;

• the remote repository replicates the packages from the main repository;

• the WAPT clients connect in priority with the repository that is the closest to them, the local repository;

## Packages principle¶

A WAPT package structure is similar to Debian Linux .deb packages. Each WAPT package includes the binaries to be executed and the other files it needs.

A package is easily transportable.

Here is how a WAPT package looks:

WAPT package structure

To learn more about the composition of a WAPT package, visit the documentation on the structure of a WAPT package.

### Types of WAPT packages¶

There are 7 types of WAPT packages:

Anatomy of a simple WAPT package

#### base packages¶

They are classic software packages.

They are stored in the web directory https://srvwapt.mydomain.lan/wapt/.

#### group packages¶

They are groups of packages.

Each group often correspond to :

• service in company (ex: accounting);

• a room, building, etc.

Hint

A host can be a member of several groups;

They are stored in the web directory https://srvwapt.mydomain.lan/wapt/.

#### host packages¶

Host packages are named after the UUID of the computer BIOS or the FQDN of the host.

Each host will look for its host package to know the packages that it must install (i.e. dependencies).

Host packages are stored in the web directory https://srvwapt.mydomain.lan/wapt-host/.

#### unit packages ¶

Unit packages bear the complete name of OU, example: OU=room1,OU=prod,OU=computers,DC=mydomain,DC=lan.

By default, each computer looks for the unit packages and then installs the list of associated dependencies.

Unit packages are stored in the web directory https://srvwapt.mydomain.lan/wapt/.

#### wsus packages ¶

Wsus packages contain the list of authorized or prohibited Windows Updates.

When this package is installed on the endpoints, the next update scan performed by WAPT will choose Windows updates based on this filtering.

Wsus packages are stored in the web directory https://srvwapt.mydomain.lan/wapt/.

#### self-service packages ¶

Self-service packages contain a list of groups or users (Active Directory or local) and their associated lists of authorized packages that Users are allowed to install by themselves.

Self-service packages are stored in the web directory https://srvwapt.mydomain.lan/wapt/.

#### profile packages ¶

Profile packages are similar to group packages.

However, profile packages work a little differently and are most useful when an Active Directory Server is operating within the Organization:

## Dependency mechanism¶

In WAPT everything works on the principle of dependencies.

By default, the WAPT agent will look for its host package. The host package lists packages to install on the computer.

The host package is correctly installed when all its dependencies are satisfied.

Each sub-dependency must be satisfied to satisfy an upper-level dependency.

When every dependency has been satisfied, the host notifies its status to the WAPT Server. Its indicator turns OK and green in the WAPT console, meaning the host has the host profile that the Administrator or Package Deployer has defined for it.

Conceptual diagram of the dependency mechanism

Hint

When attributing a software package to a host as a dependency, only the software canonical name without its version number is registered as a dependency (ex: I want Freemind to be installed on this machine in its latest version and Freemind to be configured so that the User does not call me because she does not find the icon on her desktop!).

For each dependency, the WAPT agent will take care of automatically installing the latest available package version. So if several versions of Freemind are available on the repository, the WAPT agent will always get the latest version, unless I have pinned the version for reason of compatibility with other sets of tools.

Afterwards, when the agent contacts the repository to check for new updates, it will compare the package versions on the repository with its own local list of packages already installed on the machine.

If an update of an installed package is available, the client will switch the status of the package to NEED UPGRADE. It will then install the software updates during the next upgrade.

## Private key / Public certificate principle¶

Like Android APK packages, WAPT packages are signed; a hash of the control sum of all the files included in the package is calculated.

This signing method guarantees the origin and integrity of the package.

Private key / public certificate

To work properly, WAPT requires a private key / public certificate pair (self-signed, issued by an internal Certificate Authority or commercially issued).

The private key will be used to sign WAPT packages whereas the public certificate will be distributed with every WAPT client so that WAPT agents may validate the files that were signed with the private key.

The different public certificates will be stored in the WAPT subdirectory ssl. That folder can contain several public certificates.

### Package verification¶

When a WAPT package is downloaded, the WAPT agent (waptagent) will check the integrity of the package, and then check that the package has been properly signed.

If the WAPT package signature does not match any of the public certificates located in C:\Program Files (x86)\wapt\ssl on Windows or in /opt/wapt/ssl on Linux and macOS, the WAPT agent will refuse to install the package.

For more information, please refer to the documentation on how the integrity of the installation process a WAPT package is insured.

### The private certificate is important¶

Attention

The private key must NOT be stored on the WAPT Server, nor on any public or shared storage that could be accessed by non-authorized personnel. Indeed, WAPT security is based on keeping the private key private.

The private key must be stored in a safe place, because she who has your key controls your network!

Finally, to ensure maximum security, the private key can be secured in a smartcard or a cryptographic token that WAPT Administrators or Package Deployer will carry physically on them, using the smartcard or the token only when needed to sign a WAPT package.

Note

The private key is protected with a password by default.

### Differentiating user roles in WAPT ¶

WAPT offers the possibility to differentiate roles based on:

• PKI;

• ACL;

#### Public Key Infrastructure¶

Hint

The usage of an existing PKI is possible, the WAPT console comes with a simple certificate generator.

WAPT works as a CA mode in regards to PKI.

By design, WAPT is capable of generating certificates that may be used as parent keys to generate other public and private child keys.

Therefore the main WAPT Administrator who acts as a may issue certificates for each IT admin so their actions may be identified when they use WAPT.

Child certificates issued from the CA can themselves be configured as:

• code-signing to allow IT admins to package, sign and deploy WAPT packages containing executable loads (i.e. setup.py);

• CA to delegate to other IT admins the right to issue certificates;

• no right to limit IT admins to only deploying packages containing non executable loads (i.e. configure hosts);

WAPT user role differentiation

#### Access Control Lists¶

With WAPT, it is possible to define user rights using ACL.

Each IT technician is identified with his own certificate and rights can therefore be be finely applied on an individual basis.

For exemple, a WAPT console user may have a View right on a host but may not be allowed to click on Edit hosts.

ACL roles differentiation

# WAPT mode of operation¶

## Inventory¶

WAPT keeps a hardware and software inventory of each host.

That inventory is stored in a small database integrated in each WAPT agent.

Inventory feedback mechanism

• when first registering with the WAPT Server, the WAPT agent sends the entire inventory (BIOS, hardware, software) to the server;

• when the WAPT agent updates, the WAPT agent will report its inventory status to the WAPT Server;

The inventory in the WAPT console

The central inventory allows you to filter hosts by their components, software or any other searchable argument.

## Information feedback¶

The WAPT agents also report back their WAPT package status.

Inventory feedback returned to the WAPT Server

In case of errors during package installation, the information will be reported to the WAPT Server. The host will then appear in ERROR in the console.

Packages with error status in the WAPT console

The Administrator can see the package returned in error in the console and fix the package accordingly.

For each upgrade, WAPT will try to install a new version of the package until no error status is returned.

Note

WAPT agents sign their inventory before sending it to the WAPT Server.

## WAPT common interactions¶

### update¶

When an update command is launched on an agent, it is equivalent to ordering the agent to check the WAPT repository for new packages. By default, the WAPT agent will look for updates every two hours.

If the date of the Packages index file has changed since the last update, then the WAPT agent downloads the new Packages file (between 20 and 100k), otherwise, it does nothing.

The WAPT agent then compares the Packages file with its own local database.

If the WAPT agent detects that a package must be added or updated, it will switch the status of the host and the status of the package to NEED-UPGRADE.

It will not launch the installation of the package immediately. The WAPT agent will wait for an “upgrade” order to launch the upgrade.

When we launch an upgrade, we ask the WAPT agent to install the packages having a NEED-UPGRADE status.

An update must come before an upgrade, otherwise the agent will not know whether updates are available.

By default, the WAPT agent will trigger an update/ download-upgrade at startup; after starting up, the WAPT agent will then check every 2 hours to see whether it has something to do.

Packages to be installed will be downloaded and cached in the folder C:\Program Files (x86)\wapt\cache.

waptexit will launch an upgrade when the computer shuts down. An Administrator will also be able to force the immediate launch of an upgrade from the WAPT console. Alternatively, an end-user may choose to manually launch an upgrade. Lastly, a scheduled task may be set up on hosts to launch an upgrade.

If the WAPT Server is not reachable when upgrading, the WAPT agent will still be able to install cached packages.

Inventory updates will then be sent to the WAPT Server when network connectivity returns.

The 5 goals of the WAPT agent are therefore:

• to install a base, a group or a unit package if it is available;

• to remove obsolete packages;

• to resolve package dependencies and conflicts;

• to make sure all installed WAPT packages are up to date compared to the ones stored on the repository;

• to regularly update the WAPT server with its hardware status and the status of installed software;

## WAPT agent behavior¶

A key concept that can be hard to understand is the behavior of a WAPT agent when installing a package and the considerations around it.

WAPT agent package installation can be split in simple steps:

• on triggerring an update, the agent downloads NEED-UPGRADE or NEED-INSTALL packages and stores them in the cache folder;

• on triggerring an upgrade, the agent unzips the packages into a temporary folder;

• the setup.py content is parsed and stored in WAPT agent database located in C:\Program Files (x86)\wapt\db\waptdb.sqlite;

• setup.py is executed and the software is installed from unzipped files;

• in case of success: the downloaded packages and unzipped files are deleted. An OK status is returned to the WAPT Server;

• in case of failure: the downloaded packages are kept and the unzipped files are deleted. An ERROR status is returned to the WAPT Server;

That behavior is important for understanding the lifecycle of an installed package.

WAPT install behavior

For instance when removing a package the following steps are taken:

• the setup.py content is retrieved from WAPT agent database located in C:\Program Files (x86)\wapt\db\waptdb.sqlite;

• the WAPT agent looks up the UninstallString in the local database;

• if defined in the setup.py copied into the local database during initial installation of the WAPT package, the uninstall() function is executed;

Similar steps are activated when executing session_setup and audit.

WAPT behavior with uninstall / session_setup and audit

## Complete diagram of the WAPT operating mechanism¶

WAPT general operating mode

We find here the common WAPT behavior, from duplicating a package from an external repository accessible on the Internet, to deploying it on network hosts.

• import packages from an external repository (or create a new package from scratch);

• test, validate, build and then sign the package;

• upload the package onto the main repository;

• packages are executed based on the selected method:

• the upgrade is executed when the machine shuts down;

• the User chooses the right time for herself (at shutdown or using the self-service);

• inventory information feedback;

• the updated inventory is reported in the WAPT console;

# WAPT Server architecture¶

The WAPT Server architecture relies on several distinct roles:

• the repository role for distributing packages;

• the inventory and central server role for hardware and software inventory;

• the proxy role to relay actions between the WAPT console and the WAPT agents;

## Repository role¶

First, the WAPT Server serves as a web repository.

WAPT repository mechanism

## Inventory server role¶

Second, the WAPT Server serves as an inventory server.

The inventory server is a passive service that collects information reported by WAPT agents:

• hardware inventory;

• software inventory;

• WAPT packages status;

• tasks status (running, pending, error);

Note

The WAPT service is not active in the sense that it only receives information from clients. As a consequence, if the inventory server fails, the inventory will recover by itself from inventory status reports received from the deployed WAPT agents.

In the Discovery version of WAPT, access to inventory data is only possible through the WAPT console.

WAPT Enterprise comes with reporting capabilities. In parallel, it is possible to push WAPT inventory to GLPI ITSM tool.

## Proxy role¶

Third, the WAPT Server serves as a command relay proxy.

It acts as a relay between the WAPT management console and deployed WAPT agents.

WAPT proxy mechanism

Note

Every action triggered on a WAPT agent from the server are signed with a private key. Without a valid private key, it is not possible to trigger remote actions on remote WAPT equipped devices. For more information on remote actions, please refer to signing actions relayed to the WAPT agents.

# WAPT language and development environment¶

WAPT is built using the Python language.

Attention

With WAPT 2.0, the WAPT internals have switched to python3. WAPT packages must NOW follow the new python3 syntax.

Refer to this documentation to help you identify potential problems when switching your existing packages from Python2 to Python3.

Any Rapid Application Development environment intended for Python development is suitable.

Tranquil IT has developed some useful WAPT specific plugins for the PyScripter IDE (https://sourceforge.net/projects/pyscripter).

Tranquil IT recommends using PyScripter for developing WAPT packages for Windows and vscode for developing WAPT packages for macOS and Linux.

## The strength of Python¶

All the power of Python can be advantageously put to use.

Many libraries already exist in Python for:

• doing conditional loops (if … then … else …);

• copying, pasting, moving files and directories;

• checking whether files or directories exist;

• checking whether registry keys exist;

• checking access rights, modifying access rights;

• looking up information on external data sources (LDAP, databases, files, etc);

• etc …

## The power of WAPT¶

Functions most commonly used with WAPT were simplified within libraries called Setuphelpers.

Setuphelpers libraries simplify the process of creating and testing WAPT packages, thus validating WAPT’s main objectives:

• what was complicated is made simple

• what was simple is made trivial