Μετάβαση στο περιεχόμενο

Live upgrade of the Mediation Controller

Important

The documentation for live upgrading the Mediation Controller to version 4.7 is intended for any Mediation Controller 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
cat /etc/debian_version

Information

As a reminder, switching to root on Debian machines must be performed using the following command:

1
su -

Virtual appliances

For a Mediation Controller 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.
  • 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, in particular the pam_securetty line of /etc/pam.d/login, from its .dpkg-old version. The /etc/ssh/sshd_config file is kept by following the table of the configuration files in 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
apt update

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

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 tool can be used)
  • An SCP client (on Windows, the WinSCP or FileZilla 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
apt install -y --no-install-recommends screen

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

1
screen -S SCREEN_SESSION
Example

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

1
screen -S cye-upgrade

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

1
screen -r SCREEN_SESSION
Example

The terminal previously opened with the cye-upgrade identifier can be retrieved with the following command:

1
screen -r cye-upgrade

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
         ____            _                   _
        / ___| _   _ ___| |_ __ _ _ __   ___(_) __ _
        \___ \| | | / __| __/ _  | '_ \ / __| |/ _  |
         ___) | |_| \__ \ || (_| | | | | (__| | (_| |
        |____/ \__, |___/\__\__,_|_| |_|\___|_|\__,_|
               |___/
#################################################################
# WARNING:                                                      #
# You must have specific authorization to access this machine.  #
# Unauthorized access to this machine is prohibited and will be #
# considered as intrusion.                                      #
# Unauthorized users will be logged, monitored, and could be    #
# prosecuted.                                                   #
#################################################################
Systancia Cleanroom 4.6.1 B33

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

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

1
df -h /usr

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:

1
2
3
4
5
6
echo 1 > /sys/class/block/sda/device/rescan
start_lvm_partition=`fdisk -l /dev/sda | grep LVM | awk '{print $2}'`
echo -e "d\n2\nn\ne\n2\n\n\nn\n$start_lvm_partition\n\nt\n5\n8E\nw" | fdisk /dev/sda
pvresize /dev/sda5
lvresize -l +100%FREE /dev/mapper/SystanciaLVMGroup-usr
resize2fs /dev/mapper/SystanciaLVMGroup-usr

fdisk displays the messages This disk is currently in use - repartitioning is probably a bad idea. and Partition #5 contains a LVM2_member signature.: they are expected, and the signature is kept. Depending on the state of the partition table, fdisk may also display The kernel still uses the old partitions. The new table will be used at the next reboot. and Failed to update system information about partition 2: Device or resource busy: they have no consequence, the check of the result below is what counts.

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

Recording the name resolution settings

The upgrade may modify the hosts line of the /etc/nsswitch.conf file, which sets the order of the name resolution sources. Note its current value to restore it after the upgrade:

1
grep '^hosts' /etc/nsswitch.conf

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

Cluster architecture

In a Cluster architecture, the procedure of this page is performed on each Mediation Controller, as follows:

  1. Upgrade the two Mediation Controllers either one after the other, starting with the SLAVE Mediation Controller, or in parallel. In both cases, the resynchronisation of the shared secret and the migration of the databases (steps 3 and 4) are performed once both Mediation Controllers have been upgraded. Until the MASTER Mediation Controller is upgraded, the already upgraded SLAVE Mediation Controller no longer publishes the consoles and the portal: plan to upgrade both Mediation Controllers within the same maintenance window.
  2. On each Mediation Controller, before the restart that follows the upgrade, modify the /etc/network/interfaces file. The move to Debian 13 deletes the /etc/sysctl.conf file, which the virtual addresses of the cluster read at startup with the sysctl -p command; the following command replaces it with sysctl --system:

    1
    sed -i 's|pre-up sysctl -p|pre-up sysctl --system|' /etc/network/interfaces
    
  3. Once both Mediation Controllers have been upgraded, on the SLAVE Mediation Controller, run the following commands to resynchronise the shared secret between the MASTER Mediation Controller and the SLAVE:

    1
    2
    hostManagerCtl masterSynchro /etc/ipdiva/secure/secret /etc/ipdiva/secure/secret
    systemctl restart apache2
    

    Check that the /etc/ipdiva/secure/secret file is identical on both Mediation Controllers, by comparing the result of the following command on each of them:

    1
    sha256sum /etc/ipdiva/secure/secret
    
  4. Then, from only one of the Mediation Controllers, regardless of which one, migrate the databases once: the system configuration database (default), then the databases of the organisations, as described in Migration of the CyberElements Bastion database.

  5. Check the access to the system console (/system), to the administrator interface (/console) and to the user portal (/cloud), through the virtual address of the cluster and through the address of each Mediation Controller.

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
apt update
apt upgrade -y
apt autoremove -y

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 Microsoft SQL Server drivers

Additional steps are required if Microsoft SQL Server drivers are installed.
To check whether they are present on the server, the following command can be executed as root:

1
apt list --installed 'ms*'

If no package is listed, the drivers are not installed and you can proceed to the mirror preparation step.
Otherwise, the msodbcsql17 or msodbcsql18 package is listed: follow the instructions in this section.

The Microsoft repository must be declared for Debian 13. Remove the declaration of the Debian 12 repository, then install the packages-microsoft-prod package for Debian 13, which declares the new repository and its signature key:

1
2
3
4
rm -f /etc/apt/sources.list.d/mssql-release.list
curl -sSL -O https://packages.microsoft.com/config/debian/13/packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

After the APT configuration, update the installed driver (msodbcsql17 or msodbcsql18) with the command of its version, which accepts the Microsoft licence. The command has no effect if the driver is already up to date:

1
ACCEPT_EULA=Y apt install -y msodbcsql17
1
ACCEPT_EULA=Y apt install -y msodbcsql18

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
mkdir -p /opt/systancia/repository
rm -rf /opt/systancia/repository/*
tar xvzf /tmp/*.tgz -C /opt/systancia/repository/

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
echo -e 'deb http://security.debian.org/debian-security/ trixie-security main contrib non-free non-free-firmware\ndeb http://ftp.fr.debian.org/debian trixie main contrib non-free non-free-firmware\ndeb http://ftp.fr.debian.org/debian trixie-updates main contrib non-free non-free-firmware' > /etc/apt/sources.list
echo "deb file:///opt/systancia/repository/ trixie ipdiva" > /etc/apt/sources.list.d/systancia.list

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
mv /tmp/systancia.gpg /etc/apt/trusted.gpg.d/

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 asroot:

1
echo -e 'APT::Install-Recommends false;\nAPT::Install-Suggests false;' > /etc/apt/apt.conf.d/99norecommends

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

1
apt update

Recommendation

The security hardening guide details the integrity check of the packages and of the APT repositories: see R6.

Opening the screen and the operation log

Access the Mediation Controller server via SSH and switch to root, then open a screen as indicated above. 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
script -f /root/upgrade-4.7.log

Triggering the version upgrade

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

1
apt dist-upgrade -y

During the upgrade, the following windows are displayed:

Window Answer
“Upgrade PostgreSQL cluster 15/main to 17?” (Debian 13 provides PostgreSQL 17) Yes; the question is asked twice, and the first time No is preselected
“Do you want to upgrade glibc now?” (libc6 package, the postgresql service must be stopped) Yes
“Restart services during package upgrades without asking?” (libc6 package) Yes (No is preselected)

You will also be asked several 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, all or some of these questions may be asked. Answer Y to every question, except for the files that the following table says to keep:

Configuration file Recommended action
/etc/ipdiva/plugin/plugin.xml To keep, answer N
/etc/ipdiva/care/djangosettings.ini Apply changes, answer Y (the previous file is kept as /etc/ipdiva/care/djangosettings.ini.dpkg-old, see Restoring configurations)
/etc/default/grub (menu window) To keep, choose keep the local version currently installed
/etc/ssh/sshd_config (menu window) To keep, choose keep the local version currently installed

Attention!

When a file is replaced, its previous version is kept with the .dpkg-old extension (.ucf-old for the files of a menu window). If hardening settings had been applied to a replaced file (for example /etc/login.defs or /etc/security/limits.conf), report them in the new file after the upgrade, from its previous version. The security hardening guide details these settings: see Accounts, privileges and local authentication.

Removing PostgreSQL 15

Once the upgrade is complete, check the state of the PostgreSQL instances:

1
pg_lsclusters

The version 17 instance must be the only one online. The version 15 instance can then be deleted, as well as the packages that are no longer necessary:

1
2
pg_dropcluster 15 main
apt autoremove -y

Cluster architecture

On a Mediation Controller of a cluster, modify the /etc/network/interfaces file before the restart: see step 2 of Cluster architecture.

Exit the operation log, then restart the server:

1
2
exit
reboot

Restoring the name resolution settings

After the restart, compare the hosts line of the /etc/nsswitch.conf file with the value noted before the upgrade:

1
grep '^hosts' /etc/nsswitch.conf

If it was modified, restore its previous value by editing the file, so as to avoid any name resolution problem.

Migration of the CyberElements Bastion database

The product configuration is stored in the database, which needs to be migrated so that it can contain the configurations of the changes made by the new version. In a Standalone architecture, the system configuration database (default) is migrated automatically during the upgrade; in a Cluster architecture, it is migrated by the command in the box below. However, the databases of the organisations are not migrated automatically. The operation is performed on the Mediation Controller as root.

Cluster architecture

For a Cluster architecture, perform the operation once both Mediation Controllers have been upgraded, from only one of them, regardless of which one (see Cluster architecture). Start with the migration of the system configuration database (default):

1
python3 /var/lib/ipdiva/care/manage.py migrate

Data migration is triggered with a command equivalent to this one:

Value Variable Definition
MIGRATED_ORGANIZATION Name of the organisation to migrate.
1
python3 /var/lib/ipdiva/care/manage.py migrate --database=MIGRATED_ORGANIZATION

Please note that if the Mediation Controller has multiple organisations (multi-tenants), then you will need to run the command as many times as there are organisations to migrate.

Example

For a CyberElements Bastion platform that has the organisations systancia and systancia-test, you will need to run the following commands:

1
2
python3 /var/lib/ipdiva/care/manage.py migrate --database=systancia
python3 /var/lib/ipdiva/care/manage.py migrate --database=systancia-test

Following the database migration, the Apache2 service must be restarted:

1
systemctl restart apache2

During the upgrade, the sections of the organisations and of the remote vault databases are moved from the /etc/ipdiva/care/databasesettings.ini file to one file per database in the /etc/ipdiva/care/databases.d/ directory; only the [database] section remains in databasesettings.ini, and the original file is kept as /etc/ipdiva/care/databasesettings.ini.pre-migration.

Restoring configurations

If the /etc/ipdiva/care/djangosettings.ini file was replaced during the upgrade, its previous version is kept as /etc/ipdiva/care/djangosettings.ini.dpkg-old. The allowed_hosts line takes the Web VPN virtual hosts configured on the platform: it normally does not need to be restored. The other settings modified by hand in this file must however be reported in the new file. To identify them, compare the two versions as root:

1
diff /etc/ipdiva/care/djangosettings.ini.dpkg-old /etc/ipdiva/care/djangosettings.ini

After reporting settings, restart the Apache2 service as root:

1
systemctl restart apache2

Validation

Once the upgrade has been completed, the CyberElements Bastion infrastructure must be validated to ensure it is functioning correctly before going back into production. If validation fails, consider rolling back by restoring the CyberElements Bastion server backups.

Access the system console (/system) and the administrator interface of an organisation (/console), then go to the “About” menu in the control bar to check that the Mediation Controller version has been successfully upgraded to 4.7. Also check access to the user portal (/cloud).

Association with Workplace

If the association with Workplace was enabled before the upgrade, a site must be chosen in its Reverse Proxy section after the upgrade, so that the communication with the Workplace server is active again. The upgrade also creates an access contract named CleanroomAccessProfile, which authorises access to Workplace.

Initial tests of the platform's functionality can be initiated, but we recommend using version 4.7 of Edge Gateway to ensure optimal performance of CyberElements Bastion applications.