> Source: https://docs.cyberelements.io/bastion/4.7/pl/Installation/Cluster/FromAppliances/InstallMediationController/

# Installation of Mediation Controller servers

> **Security hardening of the appliance**
>
> The appliance applies part of the recommendations of the advanced security hardening guide when it is built; the state of each recommendation, and what remains to be done after deployment, is given in [Security hardening of the Mediation Controller appliances](https://docs.cyberelements.io/bastion/4.7/pl/Installation/MediationController/AppliancesHardening/).

The instructions given on this page should be replicated on both Mediation Controller servers, starting with the `MASTER` server first. When differences appear between the `MASTER` and `SLAVE` servers, they will be highlighted. If there is no mention of this, then the instructions apply to both `MASTER` and `SLAVE` servers.

The Mediation Controller Cluster appliance installs CyberElements Bastion with the CyberElements Gate console (`/mediation/system`), with the same components as the `ipdiva-safe-server` package of an installation from scratch (see [CyberElements Gate console](https://docs.cyberelements.io/bastion/4.7/pl/Installation/MediationController/Introduction/#cyberelements-gate-console)).

## 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 |
|---|---|---|
|  | `RIP_MC_WEB_MASTER` | Main real IP address of the `MASTER` Mediation Controller: the web consoles are reached through it. |
|  | `RIP_MC_WEB_SLAVE` | Main real IP address of the `SLAVE` Mediation Controller: the web consoles are reached through it. |
|  | `MASTERCN` | CN of the SSL Router certificate of the `MASTER` Mediation Controller, usually its secondary real IP address. |
|  | `RIP_MC_SSL_MASTER` | Secondary real IP address of the `MASTER` Mediation Controller: the SSL Router is reached through it. |
|  | `PORT_MC_SSL_MASTER` | Listening port of the SSL Router of the `MASTER` Mediation Controller (usually `443`). |
|  | `TUNNEL_CERT_FILE` | Name of the certificate file with which the Edge Gateway instances of the tunnel connect to the Mediation Controllers. |
|  | `TUNNEL_CERT_PASSWORD` | Password of the certificate of the tunnel instances. |
|  | `RIP_MC_SSL_SLAVE` | Secondary real IP address of the `SLAVE` Mediation Controller: the SSL Router is reached through it. |

## Initial system settings

When the Mediation Controller Cluster appliance is started for the first time, the `Mediation cluster setup` initial configuration wizard appears. It configures the system, the network and the cluster addresses of the server, then initialises the Mediation Controller.

### System settings

The wizard begins by asking you to select a language: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_InstallMediationClusterAppliance_LanguageSelection.png)

> **Information**
>
> The language you choose will affect both the system display language and the keyboard layout. In English, the keyboard will have a QWERTY layout, while in French it will be AZERTY.

The wizard then confirms the chosen language and keyboard layout: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_InstallMediationClusterAppliance_LanguageConfirmation.png)

It then asks for a new password for the `root` system account, then for its confirmation (at least 12 characters, with at least one lowercase letter, one uppercase letter, one digit and one special character): ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_InstallMediationClusterAppliance_RootPassword.png)

Next comes the password of the `systancia` system user account, with the same rules, then its confirmation: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_InstallMediationClusterAppliance_SystanciaPassword.png)

Finally, enter the machine name (the field is pre-filled with `CRMed`): ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_InstallMediationClusterAppliance_Hostname.png)

### Role of the server in the cluster

The wizard asks for the role of the server: `Master` for the `MASTER` Mediation Controller server, `Slave` for the `SLAVE` server. Select the role with the `Space` key, then validate with `OK`: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_InstallMediationClusterAppliance_ClusterMode.png)

### Network settings

The Mediation Controller must have two fixed IP addresses. The first is used to access the product's various consoles and web portal (`RIP_MC_WEB_MASTER` or `RIP_MC_WEB_SLAVE`). The wizard asks you to configure it first, with the network mask, the gateway, the DNS servers and the DNS suffix: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_InstallMediationClusterAppliance_PrincipalIPConfiguration.png)

> **Tip**
>
> Several DNS servers can be entered (3 maximum) by separating them with spaces. Similarly, several DNS suffixes can be added by separating them with a space.

Next comes the second IP address, dedicated to the SSL Router component (`RIP_MC_SSL_MASTER` or `RIP_MC_SSL_SLAVE`), and its network mask: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_InstallMediationClusterAppliance_SecondaryIPConfiguration.png)

The wizard then asks for the addresses of the other server of the cluster, web then SSL: on the `MASTER` server, those of the `SLAVE` server (`RIP_MC_WEB_SLAVE`, `RIP_MC_SSL_SLAVE`); on the `SLAVE` server, those of the `MASTER` server (`RIP_MC_WEB_MASTER`, `RIP_MC_SSL_MASTER`): ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_InstallMediationClusterAppliance_OtherServerAddresses.png)

Finally, enter the virtual IP addresses of the cluster, identical on both servers: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_InstallMediationClusterAppliance_VirtualIPAddresses.png)

- `HTTPS virtual IP address`: virtual web IP address of the cluster, `VIP_MC_WEB`.
- `SSL virtual IP address`: virtual SSL IP address of the cluster, `VIP_MC_SSL`.
- `ZEO virtual IP address`: virtual IP address through which the `SLAVE` server reaches the internal configuration database of the `MASTER` server, `VIP_MC_ZEO`.

### Settings specific to CyberElements Bastion operation

The wizard then asks for the parameters used to initialise the Mediation Controller: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_InstallMediationClusterAppliance_MediationParameters.png)

**`HTML5 port`**

Local listening port for access to the HTML5 Gateway service. We recommend leaving the parameter at its default value `1234`.

**`Organization name`**

Name of the organisation to which the Edge Gateways and HTML5 Gateways will connect.

**`Gateway name`**

Name of the first Edge Gateway (the part before the `@` in the CN of its certificate), which also acts as the HTML5 Gateway.

> **Organisation and Edge Gateway names**
>
> The wizard does not create the organisation or the Edge Gateway: it declares, on the SSL Router, the HTML5 service `<Gateway name>@<Organization name>` on the local port `HTML5 port`, and publishes the `/HTML5/` access URL on the web server. The organisation (card 5 of the [initial configurations](#initial-configurations)) and the Edge Gateway (card 6) must then be created with **exactly** these names; the same values are entered on both servers.

After the `Mediation initialization in progress...` message, the wizard asks for the password of the Super-user account, then for its confirmation: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_InstallMediationClusterAppliance_SuperUserPassword.png)

This password gives access to the system console (`/system`) and to the CyberElements Gate system console (`/mediation/system`).

The wizard ends with a message giving the address of the system console of the server: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_InstallMediationClusterAppliance_SetupFinished.png)

Validate with `Finish`, then restart the server to apply the new configuration:

```
1
```

> **Connecting as `root`**
>
> Once the initial configuration wizard has finished, the `root` account is not accepted directly, neither in console mode nor over SSH (`PermitRootLogin no`). Log in with the `systancia` account, then switch to the `root` account with the following command and the `root` password set in the wizard:
>
> ```
> 1
> ```

> **Virtual IP addresses before pairing**
>
> Until the [pairing of the Mediation Controller servers](#mediation-controller-server-pairing), each server carries the three virtual IP addresses: the virtual web address does not respond reliably. After the pairing, only the `MASTER` server carries them.

### Time zone modification

By default, the virtual appliance is set to the `Europe/Paris` time zone.

To change this time zone, first use the following command to retrieve the syntax of available time zones:

```
1
```

Then use the following command line:

```
1
```

> **Example**
>
> To set the time zone to London, the following command must be executed:
>
> ```
> 1
> ```

Check the server's time zone using the following command line:

```
1
```

## Initialising the Mediation Controller cluster

The cluster configuration continues in the CyberElements Gate system console (`/mediation/system`) of each server, then on the command line.

### Changing the password of the CyberElements Gate `/mediation/system` console

The Super-user password set in the wizard also gives access to this console; to change it: [Change password](https://docs.cyberelements.io/bastion/4.7/pl/Usage/Configuration/SystemConsole/ChangePassword/#modification-on-the-cyberelements-gate-system-console)

### Applying licences and certificates

Still in the `/mediation/system` console, you will need to enter the certificates and licences for the Mediation Controller server.

> **Attention!**
>
> The SSL Router licence and certificate are specific to the `MASTER` or `SLAVE` Mediation Controller server.
> Configuring the wrong licence or certificate will cause malfunctions later on.

Apply the licence and certificate for the SSL Router component: ![](https://docs.cyberelements.io/bastion/4.7/img/Cleanroom/CLR_GateSystem_ApplyCertAndLicForSSLRouter.png)

1. Click the `Settings` tab.
2. Select `SSL Connections` from the menu.
3. Search for the certificate for the SSL Router.
4. Enter the password for the SSL Router certificate.
5. Click `Apply` to apply the certificate to the SSL Router.
6. Select the server licence file.
7. Click `Modify` to apply the server licence.

Next, enter the certificate information for the CyberElements Bastion client: ![](https://docs.cyberelements.io/bastion/4.7/img/Cleanroom/CLR_GateSystem_ApplyPluginCert.png)

1. Select the `Plugin` tab.
2. Search for the CyberElements Bastion client certificate.
3. Enter the certificate password.
4. Click `Apply` to apply the certificate.

You still need to enter the information for the Watchdog certificate: ![](https://docs.cyberelements.io/bastion/4.7/img/Cleanroom/CLR_GateSystem_ApplyWatchdogCert.png)

1. Select the `Watchdog` tab
2. Search for the Watchdog certificate.
3. Enter the certificate password.
4. Click `Apply` to apply the certificate.

For these changes to take effect, you need to restart the SSL Router and the Watchdog: ![](https://docs.cyberelements.io/bastion/4.7/img/Cleanroom/CLR_GateSystem_RestartServices.png)

### Mediation Controller Server Pairing

> **Attention!**
>
> By this point, both Mediation Controller servers must have been configured up to the [applying licences and certificates](#applying-licenses-and-certificates).
> If the `SLAVE` Mediation Controller server has not yet been configured, please do so by starting [from the beginning of this documentation](#installation-of-mediation-controller-servers).

The Mediation Controller server pairing step will establish a trusted link between the two servers and initialise the cluster operation.

**On the `SLAVE` Mediation Controller server**

Run the following command as `root` to initiate a pairing request with the `MASTER` Mediation Controller server:

```
1
```

> **Example**
>
> If `RIP_MC_WEB_MASTER` is equal to `10.0.10.10`, then the command to enter is as follows:
>
> ```
> 1
> ```

**On the `MASTER` Mediation Controller server**

Run the following command as `root` to check for pending pairing requests and retrieve the request ID:

```
1
```

Next, run the following command to accept the pairing request, replacing `ID` with the ID retrieved from the previous command:

```
1
```

> **Example**
>
> If the return value of the `hostManagerCtl getPendingRequests` command is as follows:
>
> ```
> 1
> 2
> 3
> ```
>
> So the command to accept the pairing request is as follows:
>
> ```
> 1
> ```

To verify the association, use the following command on the Mediation Controller server (either `MASTER` or `SLAVE`):

```
1
```

The result will differ depending on the server on which the command is executed:

**MASTER Mediation Controller Server**

> The expected result on the `MASTER` Mediation Controller server is as follows:
>
> ```
> 1
> ```
>
> > **Example**
> >
> > ```
> > 1
> > ```

**SLAVE Mediation Controller Server**

> The expected result on the `SLAVE` Mediation Controller server is as follows:
>
> ```
> 1
> ```
>
> > **Example**
> >
> > ```
> > 1
> > ```

**On the `SLAVE` Mediation Controller server**

You can check the bootstrap status from the `SLAVE` server using the following command:

```
1
```

A cluster that is not experiencing any synchronisation issues will return the value `0`.

A final series of commands is required, again on the `SLAVE` server, to synchronise a secret shared between both Mediation Controllers:

```
1
2
```

### Activation of the interserver link

> **What is the purpose of the inter-server connection?**
>
> This is a special connection for cluster operation that allows a Mediation Controller server to route traffic to another Mediation Controller server in cases where the target Edge Gateway is not connected to the first server but only to the second.
>
> For example, if the `MASTER` Mediation Controller server is no longer connected to the Edge Gateway, it can use the interserver link to reach the Edge Gateway via the `SLAVE` Mediation Controller server.
>
> ```mermaid
> flowchart LR
>     MASTER(Mediation Controller<br/>MASTER) --x |Connection lost| GW(Edge Gateway)
>     MASTER --> |Interserver link| SLAVE(Mediation Controller<br/>SLAVE) --> GW
> ```

**On the `MASTER` Mediation Controller server**

Edit the `/etc/ipdiva/server/remoteServers.xml` file to indicate the CN of the interserver certificate:

| Value | Variable | Definition |
|---|---|---|
|  | `SLAVECN` | CN of the certificate intended for the interserver connection (`*` if in doubt). |

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

If you do not know the CN of the interserver certificate, then the character `*` can be entered (recommended if in doubt):

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

> **Example**
>
> Taking into account the following information:
>
> - Interserver certificate CN: `my-interserver-cert`
>
> The `/etc/ipdiva/server/remoteServers.xml` file on the Mediation Controller `MASTER` server would be completed as follows:
>
> ```
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> ```
>
> > **Complete file**
> >
> > ```
> >  1
> >  2
> >  3
> >  4
> >  5
> >  6
> >  7
> >  8
> >  9
> > 10
> > 11
> > 12
> > 13
> > 14
> > 15
> > 16
> > 17
> > 18
> > 19
> > 20
> > 21
> > 22
> > 23
> > 24
> > 25
> > 26
> > 27
> > 28
> > 29
> > 30
> > 31
> > 32
> > 33
> > 34
> > 35
> > 36
> > 37
> > 38
> > 39
> > 40
> > 41
> > 42
> > 43
> > 44
> > 45
> > 46
> > 47
> > 48
> > 49
> > 50
> > 51
> > 52
> > 53
> > 54
> > 55
> > 56
> > 57
> > 58
> > 59
> > 60
> > 61
> > ```

**On the `SLAVE` Mediation Controller server**

Send the interserver certificate to the `SLAVE` Mediation Controller in the `/tmp/` directory.
Next, run the following commands as `root` to move it to the target directory with the appropriate permissions:

```
1
2
3
```

Next, edit the `/etc/ipdiva/server/remoteServers.xml` file to add the following content to the `<remoteConfig>` tag (the old `<localCluster>` tag can be deleted entirely):

| Value | Variable | Definition |
|---|---|---|
|  | `INTERSERVER_CERT_FILE` | Name of the certificate file intended for the interserver connection. |
|  | `INTERSERVER_CERT_PASSWORD` | Password of the interserver certificate. |

```
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
```

> **Example**
>
> Taking into account the following information:
>
> - Interserver certificate name: `my-interserver-cert.p12`
> - Interserver certificate password: `MySecurePassword`
> - RIP SSL of the Mediation Controller `MASTER`: `10.0.10.11`
> - Port on the SSL RIP of the Mediation Controller `MASTER`: `443`
> - CN of the Mediation Controller `MASTER` certificate: `10.0.10.11`
>
> The `/etc/ipdiva/server/remoteServers.xml` file on the Mediation Controller `SLAVE` server would be completed as follows:
>
> ```
>  5
>  6
>  7
>  8
>  9
> 10
> 11
> 12
> 13
> 14
> 15
> 16
> 17
> ```
>
> > **Complete file**
> >
> > ```
> >  1
> >  2
> >  3
> >  4
> >  5
> >  6
> >  7
> >  8
> >  9
> > 10
> > 11
> > 12
> > 13
> > 14
> > 15
> > 16
> > 17
> > 18
> > 19
> > 20
> > 21
> > 22
> > 23
> > 24
> > 25
> > 26
> > 27
> > 28
> > 29
> > 30
> > 31
> > 32
> > 33
> > 34
> > 35
> > 36
> > 37
> > 38
> > 39
> > 40
> > 41
> > 42
> > 43
> > 44
> > 45
> > 46
> > 47
> > 48
> > 49
> > 50
> > ```

Modify the configuration of the `SLAVE` SSL Router by running the following command:

```
1
```

**On the `MASTER` and `SLAVE` Mediation Controller servers**

Restart the SSL Router to apply the interserver link settings:

```
1
```

To confirm that the interserver link is working properly, the following command should return a result:

```
1
```

The previous command should produce a log containing the following: `TRACE Router.floodWithLocalInfos sent 0 peer(s), 0 foreignPeers and 0 multicast group(s)`.
If no such log is displayed, check the configuration set up [in this chapter](#activation-of-the-interserver-link).

**In the `/mediation/system` web console of the `MASTER` Mediation Controller**

Enable the inter-server connection between the two Mediation Controllers by editing the `default` SSL virtual host: ![](https://docs.cyberelements.io/bastion/4.7/img/Cleanroom/CLR_GateSystem_EditDefaultVHostSSL.png)

Fill in the various fields using the instructions below and enable the cross-server linking feature by checking the box labelled `Is interserver configured ?`: ![](https://docs.cyberelements.io/bastion/4.7/img/Cleanroom/CLR_GateSystem_EditDefaultVHostSSL_Configuration.png)

- `Public address for plugin connections`: corresponds to `VIP_MC_SSL` followed by its listening port (usually `443`).
- `Real IP addresses for web connections`: corresponds to the pair of actual web IP addresses (`RIP_MC_WEB_MASTER` and `RIP_MC_WEB_SLAVE`) with their corresponding ports, one line per IP address and port pair.
- `Real IP addresses for SSL connections`: corresponds to the actual SSL IP address pair (`RIP_MC_SSL_MASTER` and `RIP_MC_SSL_SLAVE`) with their corresponding ports, one line per IP address and port pair.

## Initialising CyberElements Bastion

### Connecting to the PostgreSQL database

To function, CyberElements Bastion requires the use of an external PostgreSQL database (DB) to store its settings and various logs in the `/system` console.
If the DB is directly accessible from the Mediation Controller servers, proceed directly to the [DB initialisation step](#initializing-the-database).

#### Connecting to a database on the LAN

In order to enable connection to a database located on the LAN without opening a DMZ to LAN flow, the database flow will be redirected through a TLS tunnel between the Edge Gateways and the Mediation Controllers.
To achieve this, it is necessary to configure one Edge Gateway (or two Edge Gateways) using the underlying CyberElements Gate technology.

##### Declaration of CyberElements Gate Edge Gateways

To do this, start by logging in to the `/mediation/system` console in CyberElements Gate.

Then go to the “Organizations” menu and click “Add”: ![](https://docs.cyberelements.io/bastion/4.7/img/Cleanroom/CLR_GateSystem_AddOrganization.png)

Enter the organisation name, which must be different from the one assigned to CyberElements Bastion (for example, `tunnel`), and specify at least one user session licence along with the password for the `admin` account: ![](https://docs.cyberelements.io/bastion/4.7/img/Cleanroom/CLR_GateSystem_AddOrganization_Configuration.png)

Log in to the administration interface of the organisation you created earlier using the `admin` account by going to `/gate/admin`: ![](https://docs.cyberelements.io/bastion/4.7/img/Cleanroom/CLR_GateAdmin_Authentication.png)

Then declare both Edge Gateways that will be used to set up the tunnel.
On the left, hover over `Infrastructure`, click `Gateways`, and then click the `Add` button: ![](https://docs.cyberelements.io/bastion/4.7/img/Cleanroom/CLR_GateAdmin_AddGateway.png)

Enter the name of the first Edge Gateway and confirm the entry: ![](https://docs.cyberelements.io/bastion/4.7/img/Cleanroom/CLR_GateAdmin_AddGateway_Configuration.png)

> **Information**
>
> As a reminder, the name of an Edge Gateway is linked to the certificate it will use to authenticate itself with the SSL Router of the Mediation Controller.
> This name takes the following form `<GW_NAME>@<ORGANIZATION_NAME>`, where `<GW_NAME>` corresponds to the name of the Edge Gateway and where `<ORGANIZATION_NAME>` corresponds to the organisation name created in the CyberElements Gate system console.

Repeat the Edge Gateway declaration step for the second Edge Gateway.

##### Tunnel connections and settings on Edge Gateways

> **Information**
>
> The following steps can be replicated on both Edge Gateways used for the tunnel to access the database.

> **Prerequisites**
>
> To complete this part, you will need to use either:
>
> - [A virtual Edge Gateway appliance](https://docs.cyberelements.io/bastion/4.7/pl/Installation/Cluster/FromAppliances/InstallEdgeGateway/#initial-system-settings) for which only the system initialisation has been performed.
> - [An Edge Gateway installed from scratch](https://docs.cyberelements.io/bastion/4.7/pl/Installation/Cluster/FromScratch/InstallEdgeGateway/) with the Edge Gateway components installed.

First, use a tool such as [WinSCP](https://winscp.net/eng/index.php) or [FileZilla](https://filezilla-project.org/) to transfer the certificate required for the connection to the `/tmp/` directory on the Edge Gateway via SCP.

Then connect via SSH and switch to `root`.

To connect the Edge Gateway to both Mediation Controllers, you need to create two new Edge Gateway instances: one will connect to the `MASTER` Mediation Controller, while the other will connect to the `SLAVE` Mediation Controller.
To create them, run the following commands:

```
1
2
```

Copy the certificate file to the `/etc/ipdiva/gateway-tunnel-master/ssl/` and `/etc/ipdiva/gateway-tunnel-slave/ssl/` directories:

```
1
2
```

Configure the Edge Gateway instances to allow them to connect to the Mediation Controllers.
The configurations differ depending on the Mediation Controller to be contacted. Perform both settings:

**Connection to the MASTER Mediation Controller**

> Edit the file `/etc/ipdiva/gateway-tunnel-master/gateway.xml` and complete it using the following information (several sections have been omitted and are indicated by `[…]`):
>
> | Value | Variable | Definition |
> |---|---|---|
> |  | `TUNNEL_MASTER_RPC_PORT` | Free TCP port of the machine for the RPC interface of the instance connected to the `MASTER` Mediation Controller (`9082` can be used). |
>
> ```
>  1
>  2
>  3
>  4
>  5
>  6
>  7
>  8
>  9
> 10
> 11
> 12
> ```
>
> > **Example**
> >
> > Taking into account the following information:
> >
> > - `RIP_MC_SSL_MASTER` equals: `10.0.10.11`
> > - SSL Router listening port: `443`
> > - Certificate file name: `gate-tunnel.p12`
> > - Certificate password: `Str0ngP@ssw0rd`
> >
> > The `/etc/ipdiva/gateway-tunnel-master/gateway.xml` file would be configured as follows:
> >
> > ```
> >  1
> >  2
> >  3
> >  4
> >  5
> >  6
> >  7
> >  8
> >  9
> > 10
> > 11
> > 12
> > ```
> >
> > > **Complete file**
> > >
> > > ```
> > >  1
> > >  2
> > >  3
> > >  4
> > >  5
> > >  6
> > >  7
> > >  8
> > >  9
> > > 10
> > > 11
> > > 12
> > > 13
> > > 14
> > > 15
> > > 16
> > > 17
> > > 18
> > > 19
> > > 20
> > > 21
> > > 22
> > > 23
> > > 24
> > > 25
> > > 26
> > > 27
> > > 28
> > > 29
> > > 30
> > > 31
> > > 32
> > > 33
> > > 34
> > > 35
> > > 36
> > > 37
> > > 38
> > > 39
> > > 40
> > > 41
> > > 42
> > > 43
> > > 44
> > > 45
> > > 46
> > > 47
> > > 48
> > > 49
> > > 50
> > > 51
> > > 52
> > > 53
> > > 54
> > > 55
> > > 56
> > > 57
> > > 58
> > > 59
> > > 60
> > > 61
> > > 62
> > > 63
> > > 64
> > > 65
> > > 66
> > > 67
> > > 68
> > > 69
> > > 70
> > > 71
> > > 72
> > > 73
> > > 74
> > > 75
> > > 76
> > > 77
> > > 78
> > > 79
> > > 80
> > > 81
> > > ```

**Connection to the SLAVE Mediation Controller**

> Edit the file `/etc/ipdiva/gateway-tunnel-slave/gateway.xml` and complete it using the following information (several sections have been omitted and are indicated by `[…]`):
>
> | Value | Variable | Definition |
> |---|---|---|
> |  | `PORT_MC_SSL_SLAVE` | Listening port of the SSL Router of the `SLAVE` Mediation Controller (usually `443`). |
> |  | `TUNNEL_SLAVE_RPC_PORT` | Free TCP port of the machine for the RPC interface of the instance connected to the `SLAVE` Mediation Controller (`9083` can be used). |
>
> ```
>  1
>  2
>  3
>  4
>  5
>  6
>  7
>  8
>  9
> 10
> 11
> 12
> ```
>
> > **Example**
> >
> > Taking into account the following information:
> >
> > - `RIP_MC_SSL_SLAVE` is equal to: `10.0.10.13`
> > - SSL Router listening port: `443`
> > - Certificate file name: `gate-tunnel.p12`
> > - Certificate password: `Str0ngP@ssw0rd`
> >
> > The `/etc/ipdiva/gateway-tunnel-slave/gateway.xml` file would be configured as follows:
> >
> > ```
> >  1
> >  2
> >  3
> >  4
> >  5
> >  6
> >  7
> >  8
> >  9
> > 10
> > 11
> > 12
> > ```
> >
> > > **Complete file**
> > >
> > > ```
> > >  1
> > >  2
> > >  3
> > >  4
> > >  5
> > >  6
> > >  7
> > >  8
> > >  9
> > > 10
> > > 11
> > > 12
> > > 13
> > > 14
> > > 15
> > > 16
> > > 17
> > > 18
> > > 19
> > > 20
> > > 21
> > > 22
> > > 23
> > > 24
> > > 25
> > > 26
> > > 27
> > > 28
> > > 29
> > > 30
> > > 31
> > > 32
> > > 33
> > > 34
> > > 35
> > > 36
> > > 37
> > > 38
> > > 39
> > > 40
> > > 41
> > > 42
> > > 43
> > > 44
> > > 45
> > > 46
> > > 47
> > > 48
> > > 49
> > > 50
> > > 51
> > > 52
> > > 53
> > > 54
> > > 55
> > > 56
> > > 57
> > > 58
> > > 59
> > > 60
> > > 61
> > > 62
> > > 63
> > > 64
> > > 65
> > > 66
> > > 67
> > > 68
> > > 69
> > > 70
> > > 71
> > > 72
> > > 73
> > > 74
> > > 75
> > > 76
> > > 77
> > > 78
> > > 79
> > > 80
> > > 81
> > > ```

Now that the instances are configured to connect to the Mediation Controllers, they still need to be configured to redirect the Mediation Controller connection to the database.
To do this, edit the `/etc/ipdiva/gateway-tunnel-master/services.xml` file and modify it as follows:

| Value | Variable | Definition |
|---|---|---|
|  | `DB_SERVER` | DNS name or IP address of the database server, as reached from the Edge Gateways. |
|  | `DB_INSTANCE_PORT` | Listening port of the database instance on its server (`5432` by default with PostgreSQL). |

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

Replicate these settings for the instance connecting to the `SLAVE` Mediation Controller server by copying the file:

```
1
```

Finally, start the Edge Gateway instances so that they establish a connection to the Mediation Controllers:

```
1
2
```

##### Configuring the Mediation Controllers tunnel

In order for the tunnel to be usable by the Mediation Controllers, you still need to declare their existence.
To do this, log in as `root` to the Mediation Controllers and edit the `/etc/ipdiva/server/services.xml` file to add the following section (several sections have been omitted and are marked with `[…]`):

| Value | Variable | Definition |
|---|---|---|
|  | `GW1_NAME` | Name of the first Edge Gateway. |
|  | `ORGANIZATION_NAME` | Name of the organisation to which the Edge Gateways connect. |
|  | `GW2_NAME` | Name of the second Edge Gateway. |

```
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
```

> **Example**
>
> Taking into account the following information:
>
> - Name of Edge Gateway 1: `gate-tunnel-1`
> - Name of Edge Gateway 2: `gate-tunnel-2`
> - Name of the organisation CyberElements Gate: `tunnel`
>
> The `/etc/ipdiva/server/services.xml` file would be completed as follows:
>
> ```
>  1
>  2
>  3
>  4
>  5
>  6
>  7
>  8
>  9
> 10
> 11
> 12
> 13
> 14
> ```
>
> > **Complete file**
> >
> > ```
> >  1
> >  2
> >  3
> >  4
> >  5
> >  6
> >  7
> >  8
> >  9
> > 10
> > 11
> > 12
> > 13
> > 14
> > 15
> > 16
> > 17
> > 18
> > 19
> > 20
> > 21
> > 22
> > 23
> > 24
> > 25
> > 26
> > 27
> > 28
> > 29
> > 30
> > 31
> > 32
> > 33
> > 34
> > 35
> > 36
> > ```

To apply the new configuration, restart the SSL Router with the following command:

```
1
```

#### Initialising the database

> **Attention!**
>
> You must create the `default` database before CyberElements Bastion initialises it (it is not created automatically).

To initialise the PostgreSQL system configuration database, you must first configure the connection settings on the Mediation Controllers.
To do this, edit the `/etc/ipdiva/care/databasesettings.ini` file on both servers and add 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). |

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

The database initialisation can be launched with the following commands, **to be executed only on a Mediation Controller**:

```
1
2
```

After that, all that remains is to restart the apache2 service **on both Mediation Controllers** to apply the initialisation of the system database:

```
1
```

Finally, restart the `cleanroom-vault` service **on both Mediation Controllers**: started at boot, before the database was initialised, it remained in a failed state.

```
1
```

> **File delivered with the appliance**
>
> On the appliance, `/etc/ipdiva/care/databasesettings.ini` already contains a `[database]` section (local database, empty user), after a first comment line: **replace** the entries of this section with the ones above.

## Configuring an NTP time server

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

## Initial configurations of CyberElements Bastion

### Initial configurations

The wizard has already authorised access to the web interfaces with the virtual IP address `VIP_MC_WEB` (`allowed_hosts` setting of `/etc/ipdiva/care/djangosettings.ini`).

At this stage, the Mediation Controllers servers are installed, but several actions still need to be performed:

- (1) **[Change the default passwords](https://docs.cyberelements.io/bastion/4.7/pl/Usage/Configuration/SystemConsole/ChangePassword/)**

  ---

  Change the default passwords for the system consoles.
- (2) **[Install certificates and licences](https://docs.cyberelements.io/bastion/4.7/pl/Usage/Configuration/SystemConsole/ApplyCertificatesAndLicence/)**

  ---

  The Mediation Controller requires various certificates and a licence to be operational.
  Only the certificate for the CyberElements Bastion client needs to be re-declared on both Mediations Controllers (use the RIP `RIP_MC_WEB_MASTER` and `RIP_MC_WEB_SLAVE`).
- (3) **[Configure the web certificate](https://docs.cyberelements.io/bastion/4.7/pl/Usage/Configuration/SystemConsole/ApplyWebCertificate/)**

  ---

  Configure the web certificate used to connect to web interfaces
- (4) **[Declare a DNS name](https://docs.cyberelements.io/bastion/4.7/pl/Usage/Configuration/SystemConsole/AddAllowedDNSName/)**

  ---

  Add a DNS name authorised to connect to web interfaces.

- (5) Configure the organisation

  ---

  Configure the CyberElements Bastion organisation.

  [→ Configure with direct access to the database](https://docs.cyberelements.io/bastion/4.7/pl/Usage/Configuration/SystemConsole/AddOrganization/#__tabbed_1_2)

  [→ Configure with access to the database via the Edges Gateways tunnel](https://docs.cyberelements.io/bastion/4.7/pl/Usage/Configuration/SystemConsole/AddOrganization/#__tabbed_1_3)
- (6) **[Declare the Edge Gateways](https://docs.cyberelements.io/bastion/4.7/pl/Usage/Configuration/AdminConsole/CreateEdgeGateway/)**

  ---

  Declare the Edge Gateways or HTML5 Gateways to be installed.
- (7) **[Create a logical site](https://docs.cyberelements.io/bastion/4.7/pl/Usage/Configuration/AdminConsole/CreateSite/)**

  ---

  Create and configure a logical site that groups together Edge Gateways and HTML5 Gateways that can access local resources.
- (8) **[Install an Edge Gateway](https://docs.cyberelements.io/bastion/4.7/pl/Installation/Cluster/FromAppliances/InstallEdgeGateway/)**

  ---

  Install and configure a new Edge Gateway with the newly installed Mediation Controller servers.
  An HTML5 Gateway instance will also be configured.
