> Source: https://docs.cyberelements.io/bastion/4.7/pl/Upgrade/HotVersionUpgrade/EdgeGateway/

# Live upgrade of the Edge Gateway

> **Important**
>
> The documentation for the live upgrade of the Edge Gateway to version 4.7 is intended for any Edge Gateway in version 4.6, running Debian 12. The Debian version can be checked using the following command (to be executed in SSH or console access):
>
> ```
> 1
> ```

> **Information**
>
> As a reminder, switching to `root` on Debian machines must be performed using the following command:
>
> ```
> 1
> ```

> **Virtual appliances**
>
> For an Edge Gateway installed from a virtual appliance (OVA), the procedure is the same, with the following particularities:
>
> - Before the upgrade, check the disk space of `/usr`: see [Disk space extension for virtual appliances](#disk-space-extension-for-virtual-appliances).
> - Open the console with the `systancia` account, then switch to `root` with the `su -` command.
> - After the upgrade, report the hardening settings of the appliance in the replaced files, from their `.dpkg-old` version (see [Triggering the version upgrade](#triggering-the-version-upgrade)).
> - The move to Debian 13 removes the `/etc/sysctl.conf` file without asking any question; its version is kept as `/etc/sysctl.conf.dpkg-bak`: report its settings in a file of `/etc/sysctl.d/`.

## Planning and Preparation

### Opening flows

When upgrading the product, many packages must be downloaded from the Debian repositories due to the transition from Debian version 12 to 13. `TCP 80` access must be opened to `security.debian.org` and `ftp.fr.debian.org`.

To test the opening of streams on the machine, a synchronisation of the Debian repositories can be launched. If error messages regarding access to the Debian repositories are displayed, then the network flow is not open, probably blocked by the organisation's firewall. Repository synchronisation can be initiated with the following command:

```
1
```

### Downloading the mirror and necessary tools

The CyberElements Bastion 4.7 mirror can be downloaded from this link (requires the creation of a customer account): [Systancia Marketplace](https://www.systancia.com/en/my-systancia/marketplace/systancia-cleanroom/downloads-cleanroom/)

The `systancia.gpg` key for Debian 13, which authenticates the CyberElements Bastion repository, must also be downloaded from the Systancia Marketplace: it is different from the key used with Debian 12.

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

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

### Installing and using the screen tool

The `screen` tool allows you to open multiple shell terminals in a single console. It is essential to use this tool to perform the CyberElements Bastion version upgrade, in order to remove dependency on the stability of network connectivity. In fact, without using the screen tool, the installation would be stopped in the event of a break in SSH connectivity with the CyberElements Bastion servers.

By using the `screen` tool, when reconnecting to the shell console of the CyberElements Bastion equipment, the terminal in which the update process was executed can be retrieved.

The screen package should be installed using the following command line:

```
1
```

To open a new `screen` terminal, the following command must be executed:

```
1
```

> **Example**
>
> For CyberElements version upgrades, the `cye-upgrade` identifier is easily identifiable. The command would therefore be as follows:
>
> ```
> 1
> ```

To retrieve a terminal opened by `screen`, simply execute the following command:

```
1
```

> **Example**
>
> The terminal previously opened with the `cye-upgrade` identifier can be retrieved with the following command:
>
> ```
> 1
> ```

To close the terminal once the upgrade is complete, enter the `exit` command or keyboard shortcut ctrl+d in the terminal.

This will return you to the console. The message “screen is terminating” confirms that the terminal has been closed.

### Disk space extension for virtual appliances

The upgrade to version 4.7 requires a `/usr` partition of **6 GB**. The virtual appliances (OVA) of version 4.6 provide a `/usr` partition of 4.6 GB, in a volume group with no free space left: the upgrade could run out of disk space and be blocked during the operation. Before the upgrade, extend `/usr` so that it reaches 6 GB.

When connecting to the server, whether via SSH or in console mode, a welcome message informs you that you are connected to a Systancia machine. On a virtual appliance, an additional line gives the version of the appliance.

> **Example**
>
> A virtual appliance in version 4.6.1 displays the following message:
>
> ```
>  1
>  2
>  3
>  4
>  5
>  6
>  7
>  8
>  9
> 10
> 11
> 12
> 13
> 14
> 15
> ```

If the server is not a virtual appliance, skip this section.

Check the size of the `/usr` partition, as `root`:

```
1
```

On a 4.6 virtual appliance whose partitioning has not been modified, the size displayed is `4.6G`: the disk must be extended by **1.5 GB**. If the size displayed is already `6.0G` or more, skip this section.

> **Backup strongly recommended**
>
> The following steps modify the disk partitioning of the server. They assume the partitioning delivered with the appliance: if it has been modified by hand, they may not be suitable and may leave the machine unusable.
>
> Before going further, back up the virtual machine or duplicate it. A snapshot prevents the extension of the disk, particularly with VMware: remove the existing snapshots before extending the disk. Once the disk is extended, a snapshot can be taken before running the commands below.

At the hypervisor level, extend the disk of the virtual machine by 1.5 GB. With VMware vSphere, the extension can be performed while the virtual machine is running: neither a shutdown nor a restart is necessary.

Once the disk is extended, run the following commands as `root` to extend the `/usr` partition. They are the commands of the Edge Gateway in [Extend the disk space of a virtual appliance](https://docs.cyberelements.io/bastion/4.7/pl/HowTo/ExtendVirtualApplianceDiskSpace/#extend-the-partition), with the `/usr` directory:

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

`fdisk` displays the messages `This disk is currently in use - repartitioning is probably a bad idea.` and `Partition #3 contains a LVM2_member signature.`: they are expected, and the signature is kept.

Check the result: `df -h /usr` must display a size of `6.0G`. No restart is necessary.

### Edge Gateways still in licence mode

Since version 4.5, an Edge Gateway is installed without a licence: its certificate alone identifies it, with a common name (CN) in the `GATEWAY_ID@ORGANIZATION` format. An Edge Gateway installed with an earlier version may still use a licence file.

If this is the case, it is recommended to switch the Edge Gateway to the licence-free mode before the upgrade:

1. Obtain, for each Edge Gateway and HTML5 Gateway instance, a certificate whose CN follows the `GATEWAY_ID@ORGANIZATION` format, and replace the certificate in place.
2. Delete the `<license>` element and its content in the `/etc/ipdiva/gateway/gateway.xml` and `/etc/ipdiva/html5gateway/html5gateway.xml` files, and in those of every other instance of the server (for example `/etc/ipdiva/gateway-slave/gateway.xml` for an Edge Gateway connected to a cluster).
3. Restart the instances.

### Recording the versions and settings in place

Note the version of the Edge Gateway before the upgrade:

```
1
```

If the server also acts as an HTML5 Gateway, note the content of the `/etc/guacamole/printer-config` file, which sets the name and driver of the virtual printer of HTML5 sessions: the upgrade replaces it with a template without any setting.

```
1
```

Also note the `hosts` line of the `/etc/nsswitch.conf` file, which the upgrade may modify:

```
1
```

## 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 |
|---|---|---|
|  | `SCREEN_SESSION` | Name that identifies the `screen` session, chosen when it is opened. |

## Upgrade

### Updating Debian packages

Since upgrading CyberElements Bastion requires upgrading Debian, it is recommended that you properly update Debian 12 packages before switching to Debian 13, in order to reduce the duration of the upgrade. To do this, run the following commands as `root` (system update then removal of unnecessary packages):

```
1
2
3
```

Messages asking you to modify the configuration of several configuration files may appear. In these cases, select the option to keep the current configuration.

If a Microsoft ODBC driver is installed (`msodbcsql17` or `msodbcsql18`), its update displays the licence terms: accept them (`Yes`) to continue.

### Preparing the CyberElements Bastion 4.7 mirror

The mirror retrieved during the preparation phase (file with the tgz extension) must be sent to the server via SCP. It should be placed in the `/tmp/` directory.

Next, prepare the mirror by executing the following commands as `root` (residual files from an old version upgrade will be deleted):

```
1
2
3
```

### APT configuration

The APT package manager is configured to retrieve Debian 12 packages; it must be reconfigured to retrieve Debian 13 packages. It is also necessary to update the reference to the local CyberElements Bastion mirror. To do this, execute the following commands as `root`:

```
1
2
```

The local mirror is authenticated by the `systancia.gpg` key for Debian 13 downloaded during the preparation phase. Send it to the server via SCP, in the `/tmp/` directory, then install it with the following command as `root` (it replaces the key used with Debian 12):

```
1
```

In addition to configuring the new repositories, we strongly recommend applying the following setting to instruct APT not to install recommended dependencies that are not strictly necessary, in order to reduce the number of components installed. The following command applies this setting as`root`:

```
1
```

Finally, it is necessary to update the list of packages in the repositories with the following command:

```
1
```

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

### Opening the screen and the operation log

Access the Edge Gateway server via SSH and switch to `root`, then open a screen [as indicated above](#installing-and-using-the-screen-tool). The following steps are performed in this screen.

It is recommended to keep a log of the operation. The `script` command records everything displayed in the terminal in a file, until the `exit` command:

```
1
```

### Triggering the version upgrade

In the screen opened previously, initiate the upgrade with the following command:

```
1
```

If the “Restart services during package upgrades without asking?” window of the `libc6` package is displayed, answer `Yes` (`No` is preselected).

If the Kerberos configuration window of the `krb5-config` package (“Default Kerberos version 5 realm”) is displayed, enter the domain to which the Edge Gateway belongs, or leave the field empty if it does not belong to any. This window is only displayed if the `krb5-config` package is installed during the upgrade.

During the upgrade, you will be asked questions about whether to replace configuration files with the version of the new packages, or to keep the configuration in place. Depending on the changes made to the server since its installation, all or some of the following questions may be asked; here are our recommendations:

| Configuration file | Recommended action |
|---|---|
| `/etc/security/limits.conf` | Apply changes, answer `Y` (the previous file is kept as `/etc/security/limits.conf.dpkg-old`) |
| `/etc/login.defs` | Apply changes, answer `Y` (the previous file is kept as `/etc/login.defs.dpkg-old`) |
| `/etc/snmp/snmp.conf` | Apply changes, answer `Y` (the previous file is kept as `/etc/snmp/snmp.conf.dpkg-old`) |
| `/etc/ipdiva/careserver/careserver.xml` | Apply changes, answer `Y` (the previous file is kept as `/etc/ipdiva/careserver/careserver.xml.dpkg-old`) |
| `/etc/ssh/sshd_config` | To keep, answer `Keep the local version currently installed` |
| `/etc/tomcat10/server.xml.ipdiva` (menu window of the `tomcat10` package) | Apply the maintainer's version, choose `install the package maintainer's version` |
| `/etc/tomcat10/server.xml.ipdiva` (following question, `ipdiva-tomcat10-conf` package) | Apply changes, answer `Y`: this answer sets the CyberElements Bastion version of the file |

For the files that are not in this table, keep the version in place (`N`).

At the end of the upgrade, if the `/etc/security/limits.conf`, `/etc/login.defs` and `/etc/snmp/snmp.conf` files were replaced, report in each of them the settings of its `.dpkg-old` version.

> **Recommendation**
>
> The settings of `/etc/login.defs` and `/etc/security/limits.conf` are part of the hardening of local accounts: see [Accounts, privileges and local authentication](https://docs.cyberelements.io/bastion/4.7/pl/Security/SystemHardening/SystemAccounts/).

Then remove the packages that are no longer necessary, exit the operation log and restart the server:

```
1
2
3
```

### Restoring the settings

After the restart, compare the `hosts` line of the `/etc/nsswitch.conf` file with the value noted before the upgrade, and restore its previous value if it was modified:

```
1
```

If the `/etc/ipdiva/careserver/careserver.xml` file of the recording service was replaced, report in it the settings of its `.dpkg-old` version (listening address and port, certificate and its password), then restart the recording service:

```
1
```

If the server also acts as an HTML5 Gateway, set again in the `/etc/guacamole/printer-config` file the name and driver of the virtual printer noted before the upgrade, then restart the `guacd` service. For example, with the values of the [HTML5 Gateway installation](https://docs.cyberelements.io/bastion/4.7/pl/Installation/HTML5Gateway/InstallDebian/#installation-of-html5-gateway-components):

```
1
2
```

### Keeping only Tomcat 10

The HTML5 Gateway web application runs on Tomcat 10. After the upgrade, earlier versions of Tomcat (8 and 9) may remain installed. To check, run the following commands; each one returns the version of the web application if it is deployed in the corresponding Tomcat version:

```
1
2
3
```

Only Tomcat 10 must be kept. If Tomcat 8 or Tomcat 9 is present, remove it along with its directory:

**Tomcat 8**

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

**Tomcat 9**

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

## Validation

Once the upgrade operation has been completed, a validation phase to ensure that the CyberElements Bastion infrastructure is functioning properly is required before returning to production. If validation fails, a rollback via the restoration of CyberElements Bastion server backups should be considered.

Check the version of the Edge Gateway:

```
1
```

Then access the administrator interface, then the Edge Gateways management menu: the updated Edge Gateways should report version 8.10 if they have successfully reconnected to the Mediation Controller.

Finally, launch a resource with the CyberElements Bastion client and an HTML5 resource: both must open.

If all servers have been upgraded, then all functional tests can be performed to validate the entire acceptance checklist.
