> Source: https://docs.cyberelements.io/bastion/4.7/sv/Installation/MultiNode/InstallMediationController/

# Installation of the Mediation Controller servers of a multi-node platform

> **Note**
>
> As a reminder, switching to `root` on Debian machines must be done with the following command:
>
> ```
> 1
> ```

The instructions on this page are to be performed on **each** Mediation Controller server of the platform (each node), unless stated otherwise. Each node is first installed as a Standalone Mediation Controller, then joins the other nodes.

## Values used on this page

The following values are used in several commands and configuration files of this page. Enter them here: the commands displayed on this page are updated as you type.
A value used by a single command is entered in a table placed just before that command.

| Value | Variable | Definition |
|---|---|---|
|  | `IP_MC_WEB` | Main IP address of the Mediation Controller: the web consoles are reached through it. |
|  | `IP_MC_SSL` | Secondary IP address of the Mediation Controller: the SSL Router is reached through it. |

## Downloading the mirror and necessary tools

The CyberElements Bastion 4.7 mirror and the Systancia repository signature key for Debian 13 can be downloaded from this link (requires the creation of a client account): [Systancia Marketplace](https://www.systancia.com/my-systancia/marketplace/systancia-cleanroom/telechargements-cleanroom/)

In addition to the mirror and key, third-party tools will be required for the installation process:

- An SSH client (on Windows, you can use [PuTTY](https://putty.org/))
- An SCP client (on Windows, the [WinSCP](https://winscp.net/eng/index.php) or [FileZilla](https://filezilla-project.org/) tools can be used)

Use the SSH client to connect remotely to your server.

Use the SCP client to transfer files to your remote machine.

## Preparing for installation

### Configuration of the network

It is essential to configure a static network address for the Mediation Controller. To do this, you first need to retrieve the name of your machine's network interface. Run the following command as `root`:

```
1
```

This command displays the name of the network interface, its status, and the IP addresses assigned to the interface.

> **Example**
>
> After the command is executed, the following output is displayed:
>
> ```
> 1
> ```
>
> The name of the network interface is `ens192`.

Once the network interface name has been obtained, it is now possible to edit the machine's network configuration.
Edit the `/etc/network/interfaces` file to modify it using the following template:

| Value | Variable | Definition |
|---|---|---|
|  | `INTERFACE_NAME` | Name of the network interface, retrieved with the previous command. |
|  | `NETMASK` | Network mask associated with the IP addresses. |
|  | `NETWORK_GATEWAY` | Default network gateway. |
|  | `IP_DNS_1` | IP address of the DNS server. |
|  | `IP_DNS_2` | IP address of a second DNS server (optional: left empty, it disappears from the configuration). |
|  | `DNS_SUFFIX` | DNS suffix to use; without a suffix, delete the `dns-search` line. |

```
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
```

> **Example**
>
> ```
>  1
>  2
>  3
>  4
>  5
>  6
>  7
>  8
>  9
> 10
> 11
> 12
> 13
> 14
> 15
> 16
> 17
> 18
> 19
> 20
> 21
> 22
> 23
> ```

Before applying the configuration, there are three more steps to complete.

The first is to install the `resolvconf` package so that the DNS configuration specified in the previous file can be applied:

```
1
```

The second is to check the configuration of the `/etc/hosts` file with regard to the machine's primary IP address (`IP_MC_WEB`).
To do this, edit the `/etc/hosts` file: after the Debian installation, its second line holds the address `127.0.1.1` followed by the machine name. Replace this address with `IP_MC_WEB`, so that the second line is in the following format:

| Value | Variable | Definition |
|---|---|---|
|  | `FQDN` | Fully qualified name of the machine (name and domain); without a domain, delete it from the line. |
|  | `MACHINE_NAME` | Short name of the machine. |

```
2
```

> **Example**
>
> If the machine is named `MEDIATION-CONTROLLER` without belonging to a domain and its IP address `IP_MC_WEB` is `10.0.10.10`, then the file would be completed as follows:
>
> ```
> 2
> ```
>
> If the machine belongs to the `DOMAIN.LOCAL` domain, then the file would be completed as follows:
>
> ```
> 2
> ```

> **Attention!**
>
> An incorrect configuration of the file may cause an error when installing the `collectd` package.

Finally, restart the server to load the new network configuration. Restarting the `networking` service is not enough: the address obtained by DHCP during the Debian installation is only released by a restart.

```
1
```

### Configuring the APT package manager

Upload the files downloaded from the Systancia Marketplace to the `/tmp/` directory on the server using an SCP client:

- `systancia.gpg`
- `cleanroom-4.7.0-build75.1097.D13-full_auto.tgz`

Log in to the server as `root`, then run the following commands to unzip the Systancia repository, configure its use in APT, and authenticate it.

```
1
2
3
4
5
6
```

We strongly recommend disabling the installation of unnecessary packages when running `apt` commands. To do so, run the following command:

```
1
```

Then update the Debian packages already installed on the server:

```
1
2
```

> **Recommendation**
>
> The security hardening guide details the integrity check of the packages and of the APT repositories, and the automation of Debian security updates: see [R6](https://docs.cyberelements.io/bastion/4.7/sv/Security/SystemHardening/SystemInstallation/#r6) and [R7](https://docs.cyberelements.io/bastion/4.7/sv/Security/SystemHardening/SystemInstallation/#r7).

### Checking for the presence of the `en_US.utf8` locale

Installing the Mediation Controller server requires the generation of `en_US.utf8` locales.
To check whether they have already been generated on the server, run the following command as `root`:

```
1
```

If the command response displays `en_US.utf8`, proceed to the next step. Otherwise, run the following commands to add this locale to the machine:

```
1
2
```

### Removing the `systemd-timesyncd` package

The Mediation Controller synchronises its clock with NTPsec, which cannot coexist with the `systemd-timesyncd` service present on some Debian 13 installations. If this package is installed, the installation of the Mediation Controller components fails. Remove it beforehand with the following command as `root` (it has no effect if the package is absent):

```
1
```

## Installation of the Mediation Controller server

### Installation of basic components

Start installing the components using the following command as `root`:

```
1
```

After downloading all dependencies, a window will open asking you to select the server type. Select `mediation`:

![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_Install_IpdivaBase_HostKind_Mediation.png)

Then select the `Standalone` installation mode: each node of a multi-node platform is installed as a Standalone server.

![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_Install_IpdivaBase_InstallationMode.png)

Then enter the port that the SSL Router will listen on (usually `443`), the web access address of the node (`IP_MC_WEB`) and the IP address of its SSL Router (`IP_MC_SSL`), as for a [Standalone Mediation Controller](https://docs.cyberelements.io/bastion/4.7/sv/Installation/Standalone/FromScratch/InstallMediationController/).

The values entered are recorded in `/etc/ipdiva.conf`. Check them:

```
1
```

> **Example for a standalone Mediation Controller**
>
> ```
> 1
> 2
> 3
> 4
> 5
> 6
> ```

> **What should I do if there is an error?**
>
> If there is an error in the information you entered, continue installing the `ipdiva-base` package and then use the following command to reconfigure the server:
>
> ```
> 1
> ```

### Installation of specific components

Start installing the CyberElements Bastion components with the following command:

```
1
```

During the installation, a window asks for the initial password of the super-user account (SU) of the CyberElements Bastion system console (`/system`), then for its confirmation. This password is the one used for the first connection to the system console.

The password should be at least 10 characters long and contain at least one lowercase letter, one uppercase letter, one digit and one special character. If it does not meet these criteria, a second window asks whether to keep it anyway (`Use weak SU password`): answer `No` to enter another one.

> **Note**
>
> The window only appears if no SU password is defined yet on the server: a reinstallation or an upgrade of the packages does not ask for it again.

> **Information**
>
> The multi-node architecture is documented for the installation **without the CyberElements Gate console**.

The server must be restarted to complete the installation:

```
1
```

## Installation of drivers for connecting to Microsoft SQL Server databases

If you want to connect to an external database and it is a Microsoft SQL Server, then additional ODBC drivers must be installed.

Two versions are available: version 17 and version 18.

> **TLS connection required for drivers in version 18**
>
> Using ODBC 18 drivers requires that the connection be encrypted using TLS. To do this, you need to [configure MS SQL Server for connection encryption](https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/configure-sql-server-encryption?view=sql-server-ver16).
>
> The Mediation Controller checks the certificate of SQL Server against the certification authorities known to Debian: on each Mediation Controller server, add the certification authority that issued this certificate (PEM format, `.crt` extension), as `root`:
>
> ```
> 1
> 2
> ```
>
> The Edge Gateways of a tunnel do not need it: they relay the connection without decrypting it.

Before starting the installation of ODBC drivers, you must prepare the Microsoft repository for Debian 13. The `packages-microsoft-prod` package provided by Microsoft declares this repository and installs its signature key:

```
1
2
3
4
5
```

Next, install the drivers according to the selected version and configure the system to use the `sqlcmd` command:

**ODBC drivers version 17**

> ```
> 1
> 2
> ```

**ODBC drivers version 18**

> ```
> 1
> 2
> ```

The ODBC drivers are now correctly installed.
If the Mediation Controller server has access to an MS SQL server, the following command should allow the connection to the remote server:

| Value | Variable | Definition |
|---|---|---|
|  | `MSSQL_SERVER` | DNS name or IP address of the MS SQL server. |
|  | `MSSQL_INSTANCE` | Name of the instance to connect to (optional: left empty, it disappears; then also delete the backslash). |
|  | `MSSQL_PORT` | Connection port of the MS SQL database instance. |
|  | `MSSQL_USER` | Username used to establish the connection. |

```
1
```

> **Examples**
>
> If the Mediation Controller server has access to an MS SQL database server via the IP address `10.0.10.100`, the instance to be accessed is listening on the port `1433`, and the access account is `sql-user`. Then the connection command is as follows:
>
> ```
> 1
> ```
>
> If the connection instance named `MSSQLINSTANCE` had to be specified, the command would be modified as follows:
>
> ```
> 1
> ```

## Configuration of an NTP time server

> **Recommendation**
>
> The security hardening guide details the recommended NTPsec configuration, the control of the time sources and the associated flows: see [R24](https://docs.cyberelements.io/bastion/4.7/sv/Security/SystemHardening/SystemLogsAndTime/#r24).

It is recommended to set up a time server to keep the system clock up to date, identical on all nodes. The necessary steps are described [on the NTP configuration page](https://docs.cyberelements.io/bastion/4.7/sv/Usage/Configuration/MediationController/ConfigureAnNTPServer/).

## Connecting the nodes to the `default` database

All the nodes use the same system configuration database, named `default`, hosted on the external PostgreSQL server.

The database server, the connection role and the `default` database must exist beforehand: see the [database prerequisites of a multi-node platform](https://docs.cyberelements.io/bastion/4.7/sv/Installation/MediationController/Prerequisites/#database-multi-node).

On **each** node, edit the `/etc/ipdiva/care/databasesettings.ini` file so that it contains the following entries:

| Value | Variable | Definition |
|---|---|---|
|  | `DB_USERNAME` | Username used to connect to the database. |
|  | `DB_PASSWORD` | Password of this user. |
|  | `DB_HOST` | IP address or DNS name used to connect to the database (`127.0.0.1` with a connection via Edge Gateways). |
|  | `DB_PORT` | Port used to connect to the database instance (`1432` with a connection via Edge Gateways, `5432` by default with PostgreSQL). |

```
1
2
3
4
5
6
7
8
```

Initialise the database with the following commands, **on one node only**:

```
1
2
```

Then, on **each** node, restart the Apache2 service and the password rotation service:

```
1
2
```

## Initial configurations of each node

> **Password of the system console**
>
> The super-user account (SU) of the system console is unique for the platform: it is stored in the `default` database, where it is created at the first access to a system console after the connection of the nodes to this database. On every node, its password is therefore the one set during the installation of the node whose system console is opened first; the passwords entered during the installation of the other nodes are not used.

Before joining the nodes together, each node must be configured from its own system console (`https://IP_MC_WEB/system`), with the password of the super-user account (SU):

- (1) **[Install the certificates and the licence](https://docs.cyberelements.io/bastion/4.7/sv/Usage/Configuration/SystemConsole/ApplyCertificatesAndLicence/)**

  ---

  Each node requires its licence and its certificates (SSL Router, Watchdog, CyberElements Bastion client).
- (2) **[Configure the SSL virtual host](https://docs.cyberelements.io/bastion/4.7/sv/Usage/Configuration/SystemConsole/ConfigureVirtualhostSSL/)**

  ---

  Declare the SSL address and port of the node, as indicated in its licence.

On each Mediation Controller, run `/usr/local/ipdiva/bin/disable_watchdog_zope.py`.

## Joining the multi-node platform

On **each** node, connect over SSH and run the following command as `root`:

| Value | Variable | Definition |
|---|---|---|
|  | `PORT_MC_SSL` | Listening port of the SSL Router of the Mediation Controller (usually `443`). |

```
1
```

The SSH address is an address of the node itself through which the other nodes reach it. The address and port of the SSL Router are those indicated in the licence of the node: the Edge Gateways connect to them to reach this node, and pairing an Edge Gateway gives them to the instance that it creates for the node (see [Connection to every node](https://docs.cyberelements.io/bastion/4.7/sv/Installation/MultiNode/InstallEdgeGateway/#connection-to-every-node)).

> **Example**
>
> For a platform of two nodes whose web addresses are `10.0.10.10` and `10.0.10.20`, and whose SSL Routers listen on `10.0.10.11:443` and `10.0.10.21:443`, run on the first node:
>
> ```
> 1
> ```
>
> then on the second node:
>
> ```
> 1
> ```

The command registers the node in the `default` database and exchanges its SSH keys with the nodes already registered. When another node is already present, the shared secret and the files of the organisations are then retrieved from it automatically.

> **Information**
>
> The joining is not crossed: each node joins the platform by itself, with its own address. The command must therefore be run once on every node.

> **Address of the SSL Router**
>
> Always specify the `--gateway-address` option. Without it, the node is registered with its **web** address (`HTTPS_ADDRESS` in `/etc/ipdiva.conf`) rather than with that of its SSL Router: when the two addresses differ, the Edge Gateway instances created by the pairing cannot connect to the node. The command can be run again on a node already registered to correct its address: the node keeps its identifier.

### Checking the nodes

The following command lists the nodes of the platform, with the date of their last heartbeat; each node must appear with the `Active` mark:

```
1
```

If a node does not report any heartbeat, run on this node the following command, then interrupt it with `Ctrl`+`C`:

```
1
```

> **Information**
>
> If the local firewall filters the SSH flows, the connections between the nodes may be blocked: the rules must authorise each node to reach the others.

> **Information**
>
> When all the nodes have been stopped, the first node to restart finds no other node with a recent heartbeat: the `/var/log/ipdiva/clr_cluster.log` file then contains the errors `No peer with a recent heartbeat found` and `fetchallremotefile error`. They have no effect: the following nodes synchronise their files from the first one.

## Creation of the organisations

Organisations are created from the system console of one of the nodes, with an **external** database (PostgreSQL or Microsoft SQL Server), possibly reached through a tunnel between the Edge Gateways and the Mediation Controllers: [Configure the organisation](https://docs.cyberelements.io/bastion/4.7/sv/Usage/Configuration/SystemConsole/AddOrganization/)

Once an organisation is created, check on every node that its connection settings and its internal vault are present:

```
1
2
```

In case of synchronisation errors, the log of the exchanges between the nodes is available in `/var/log/ipdiva/clr_cluster.log`.

## Next steps

- (1) **[Check the password of the system console](https://docs.cyberelements.io/bastion/4.7/sv/Usage/Configuration/SystemConsole/ChangePassword/)**

  ---

  The account of the system console is stored in the `default` database: it is common to all the nodes, and its password is changed once for the platform.

  Its initial password is the one set during the installation of the node whose system console was opened first after the connection to the `default` database.
- (2) **[Choose the language of the system console](https://docs.cyberelements.io/bastion/4.7/sv/Usage/Administration/SystemConsole/SystemLanguages/)**

  ---

  The system console is displayed in French by default, whatever the language of the browser. Choose the language in the `Languages` tile.

  Once for the platform: the setting is stored in the `default` database and applies to the system console of every node.
- (3) **[Configure the certification authorities](https://docs.cyberelements.io/bastion/4.7/sv/Usage/Configuration/SystemConsole/AddANewTrustedCA/)**

  ---

  Add the certification authority (CA) or authorities that do not belong to Systancia and that will be used for Edge Gateway and HTML5 Gateway certificates.

  On **each** node, from its own system console.
- (4) **[Configure the Web certificate](https://docs.cyberelements.io/bastion/4.7/sv/Usage/Configuration/SystemConsole/ApplyWebCertificate/)**

  ---

  Configure the web certificate used to connect to web interfaces.

  On **each** node, from its own system console.
- (5) **[Declare a DNS name](https://docs.cyberelements.io/bastion/4.7/sv/Usage/Configuration/SystemConsole/AddAllowedDNSName/)**

  ---

  Add a DNS name authorised to connect to web interfaces.

  On **each** node, from its own system console.
- (6) **[Choose the language of the administration console](https://docs.cyberelements.io/bastion/4.7/sv/Usage/Administration/AdminConsole/ConfigurationWorkPanel/Languages/)**

  ---

  The administration console has its own language setting, for each organisation: it stays in French until another language is chosen in `Configuration` > `Languages`.

  Once for the platform, from the administration console of any node.
- (7) **[Declare the Edge Gateways](https://docs.cyberelements.io/bastion/4.7/sv/Usage/Configuration/AdminConsole/CreatePairingTokenForEdgeGateway/)**

  ---

  Declare the Edge Gateways or HTML5 Gateways to be installed and generate a pairing token.

  Once for the platform, from the administration console of any node: the pairing creates one instance per node (see [Connection to every node](https://docs.cyberelements.io/bastion/4.7/sv/Installation/MultiNode/InstallEdgeGateway/#connection-to-every-node)).
- (8) **[Create a logical site](https://docs.cyberelements.io/bastion/4.7/sv/Usage/Configuration/AdminConsole/CreateSite/)**

  ---

  Create and configure a logical site that groups together Edge Gateways and HTML5 Gateways that can access local resources.

  Once for the platform, from the administration console of any node.
- (9) **[Install an Edge Gateway](https://docs.cyberelements.io/bastion/4.7/sv/Installation/MultiNode/InstallEdgeGateway/)**

  ---

  Install and configure an Edge Gateway for the multi-node platform.
