Skip to main content

Reconfigure a Medulla server’s network settings (IP, FQDN, HTTPS)

Applies to: Medulla
Version: All
Environment: On-Premise
Category: Server administration

Background

This procedure allows you to modify the network configuration of a Medulla instance: IP address, FQDN (fully qualified domain name), gateway, DNS servers, and protocol (http / https).

Examples:

192.168.1.10/24            → 10.0.0.50/24
medulla.ancien-domaine.lan → medulla.nouveau-domaine.fr

The reconfigure_network.py script replaces the old rename_fqdn_and_protocol.py script. It allows you to:

  • Change the server’s IP address, subnet mask, gateway, and DNS servers
  • Change the instance’s FQDN
  • Automatically update the Medulla configuration files and the database
  • Migrate from http to https and configure Apache for SSL
  • Regenerate Medulla agents with the new FQDN
  • Reconfigure a relay server (ARS)

Important:
If the FQDN changes, the new FQDN must be resolvable via DNS before running the script: the script checks its resolution and stops if it is not.
Do not delete the old DNS record until all workstations have been switched over (see Propagation to client workstations).


Prerequisites

  • The script must be run as root
  • The Python mysql-connector module (mysql-connector-python package) must be installed
  • FQDN change: The new FQDN exists in the DNS and points to the Medulla server’s IP address (new or current)
  • FQDN change: The old FQDN remains resolvable throughout the transition period
  • IP change: The server’s network configuration is managed by /etc/network/interfaces (see Limitations)
  • IP change: The pulse entry in the /etc/hosts file contains the current IP address (it is used to detect the old IP)
  • IP change: Have console access to the server (hypervisor console, iDRAC/iLO, physical access) in case of a connection loss
  • HTTPS: Have an SSL certificate in PEM format covering the FQDN (CN or SAN), as well as its unencrypted private key

Backup before execution

Recommendation:
The script does not perform any automatic rollback. Back up the configuration files and the xmppmaster database before running the script.

mysqldump xmppmaster > /root/xmppmaster_$(date +%F).sql
tar czf /root/conf_backup_$(date +%F).tgz \
  /etc/network/interfaces /etc/hosts /etc/mmc /etc/pulse-xmpp-agent* \
  /etc/apache2 /etc/guacamole /var/lib/pulse2/clients/config \
  /var/lib/pulse2/clients/.generation_options /var/lib/pulse2/clients/win/install-agent.ps1

Download the script

Download the script:

wget https://dl.medulla-tech.io/ma/reconfigure_network.py

Make it executable:

chmod +x reconfigure_network.py

View script help:

./reconfigure_network.py --help

Execution process

  1. The script checks the arguments, detects the old IP address (pulse entry in /etc/hosts) and the old FQDN (system hostname, unless --old-fqdn is provided).
  2. A warning is displayed for 10 seconds: press Ctrl+C to cancel.
  3. The configuration files, the database, and Apache are updated, and the relevant services are restarted.
  4. If the IP address changes, the network service is restarted last. Instructions for reconnecting are displayed just before this step.

Tip:
The old FQDN is derived from the server’s hostname. If this does not match the FQDN used by Medulla, specify it explicitly using --old-fqdn.


Change the IP address

The new address must be provided in CIDR notation (address/prefix). The subnet mask is inferred from the prefix.

./reconfigure_network.py \
--new-ip 10.0.0.50/24 \
--gateway 10.0.0.1 \
--dns-servers "10.0.0.10 10.0.0.11"

Caution:
When changing the IP address, always specify --gateway and --dns-servers, even if they do not change. Without these options, the existing gateway and dns-nameservers lines are removed from /etc/network/interfaces, and the server loses its gateway and DNS servers.

Caution:
If you are connected via SSH, the connection will be terminated when the network restarts. You will then need to reconnect using the new IP address.

Note:
If the interface is configured for DHCP, it is converted to a static configuration with the provided address.


Change the FQDN

./reconfigure_network.py \
--old-fqdn medulla.ancien-domaine.lan \
--new-fqdn medulla.nouveau-domaine.fr

Change the IP and FQDN

./reconfigure_network.py \
--new-ip 10.0.0.50/24 \
--gateway 10.0.0.1 \
--dns-servers "10.0.0.10 10.0.0.11" \
--old-fqdn medulla.ancien-domaine.lan \
--new-fqdn medulla.nouveau-domaine.fr

Switch from HTTP to HTTPS

The protocol can be changed at the same time as the IP address or FQDN. If --new-protocol is not specified, the existing protocol is retained.

./reconfigure_network.py \
--old-fqdn medulla.ancien-domaine.lan \
--new-fqdn medulla.nouveau-domaine.fr \
--new-protocol https \
--ssl-pem-chain-filename /root/fullchain.pem \
--ssl-pem-key-filename /root/privkey.pem

To switch to HTTPS without changing the FQDN, specify the current FQDN in --new-fqdn (the script requires at least --new-ip or --new-fqdn):

./reconfigure_network.py \
--new-fqdn medulla.mondomaine.fr \
--new-protocol https \
--ssl-pem-chain-filename /root/fullchain.pem \
--ssl-pem-key-filename /root/privkey.pem

With a certificate, the script automatically performs the following:

  • Copying the certificate and key to /etc/ssl/certs/ (key permissions set to 600)
  • Enabling the Apache ssl and headers modules
  • Configuring and enabling the default-ssl site
  • Redirecting HTTP to HTTPS

Caution:
Always provide the certificate and private key with the --new-protocol https option. Without a certificate, URLs will switch to https, but Apache will not be configured for SSL.


Regenerate the agents

If client workstations communicate with Medulla via the FQDN, regenerate the agents so they use the new DNS name:

./reconfigure_network.py \
--old-fqdn medulla.ancien-domaine.lan \
--new-fqdn medulla.nouveau-domaine.fr \
--update-agent-conf

Note:
This option updates agentconf.ini and .generation_options, then regenerates the Medulla agents.

Caution:
After regeneration, the new agents must be deployed to the workstations so they can continue communicating with the server. Keep the old DNS record until this deployment is complete.


Reconfigure a relay server (ARS)

On a relay server, add the --ars option:

./reconfigure_network.py \
--ars \
--new-ip 10.0.1.20/24 \
--gateway 10.0.1.1 \
--dns-servers "10.0.0.10 10.0.0.11"

In ARS mode, only the network, /etc/hosts, relayconf.ini.local, and package-server.ini.local are updated. The database, Apache, Guacamole, and the agents are not modified.

Reconfigure only the network

The --only-network option modifies only the network configuration and /etc/hosts, without affecting the Medulla configuration:

./reconfigure_network.py --only-network \
--new-ip 10.0.0.50/24 --gateway 10.0.0.1 --dns-servers "10.0.0.10"

Propagation to client workstations

The Guacamole URL for each computer is updated in the database with a reconfiguration flag (need_reconf). The new configuration is transmitted to each workstation during its next check-in.

Note:
Propagation is not instantaneous; it depends on how often the agents connect. Workstations that are powered off or offline will not switch over until their next connection.

Caution:
Keep the old DNS record until all workstations have switched over. Deleting it too soon will cut off communication with workstations that haven’t been reconfigured yet.


Available script options

Argument Description
--new-ip New IP address in CIDR notation (e.g., 10.0.0.50/24)
--new-fqdn New FQDN. Must be resolvable via DNS
--old-fqdn Current FQDN. If omitted, derived from the server’s hostname
--gateway Gateway. Only taken into account with --new-ip
--dns-servers DNS servers separated by spaces, enclosed in quotes. Only taken into account with --new-ip
--new-protocol http or https. If omitted, the existing protocol is retained
--ssl-pem-chain-filename PEM SSL certificate (full chain). To be used with --new-protocol https
--ssl-pem-key-filename Unencrypted PEM private key. To be used with --new-protocol https
--update-agent-conf Updates the agent configuration and regenerates the agents
--ars Relay server mode (ARS)
--only-network Reconfigures only the network, without the Medulla configuration
--log-level debug, info (default), warning, or error

Note:
At least one of the options --new-ip or --new-fqdn is required.


What exactly does the script change?

Item Action performed Condition
/etc/network/interfaces Address, subnet mask, gateway, DNS IP change
/etc/hosts IP of the pulse entry IP change
relayconf.ini.local Server IP, Guacamole URL Always (except --only-network)
xmppmaster.ini.local Server IP, Guacamole / Graph / Render URLs Main server
security.ini.local Server ID (cve_central) Main server
assessor_agent.ini.local Server IP, Guacamole URL Main server
agent_master_substitute_*.ini.local Server IP Main server, IP change
package-server.ini.local Public IP and subnet mask IP change
mmc.ini.local Server description Main server, FQDN change
xmppmaster database relayserver table: Guacamole URL, IP, subnet, subnet mask. machines table: Guacamole URL and need_reconf flag Main server
Apache ProxyPass / Referer in guacamole.conf, medulla_agent.conf, pulse.conf, websocketlogs.conf Main server
Apache SSL Certificates, default-ssl site, HTTPS redirection --new-protocol https with certificate
/etc/guacamole/tomcat.xml Server IP Main server, IP change
Medulla agents agentconf.ini, .generation_options, regeneration --update-agent-conf
install-agent.ps1 Download URL Main server, FQDN change

Services automatically restarted

  • pulse-xmpp-agent-relay
  • mmc-agent
  • pulse-xmpp-master-substitute-assessor
  • All substitutes (restart-pulse-services restart allsubs), in the event of an IP change
  • pulse2-package-server, in the event of an IP change
  • apache2
  • tomcat8 (Guacamole), in case of an IP change
  • networking—last—in the event of an IP change

Caution:
A service interruption is to be expected during execution. Schedule the operation outside of usage hours.


After execution

  • Update the DNS records (new IP and/or new FQDN)
  • Update the firewall rules if the IP address has changed
  • Verify access to the Medulla interface via the new FQDN (and via HTTPS if configured)
  • Verify that the services are active:
    systemctl status pulse-xmpp-agent-relay mmc-agent pulse-xmpp-master-substitute-assessor pulse2-package-server apache2 tomcat8
  • Verify that no references to the old IP or old FQDN remain:
    grep -rE "192\.168\.1\.10|medulla\.ancien-domaine\.lan" /etc/mmc /etc/pulse-xmpp-agent* /etc/apache2 /etc/guacamole
  • Monitor the migration of workstations: the number of computers marked as need_reconf should decrease as check-ins occur
  • If --update-agent-conf was used: deploy the regenerated agents to the workstations
  • If the main server’s IP address has changed: reconfigure the relay servers (ARS) that point to it

Limitations

  • Network manager: Only /etc/network/interfaces is supported. With Netplan or NetworkManager, the script displays a warning and the network configuration must be modified manually (the rest of the Medulla reconfiguration is performed).
  • Single interface: The script applies the new address to the interfaces listed in /etc/network/interfaces. On a server with multiple interfaces, modify the network configuration manually and run the script without the --new-ip option, or contact support.
  • Remote assessor: If the assessor is hosted on another server, assessor_agent.ini.local is not updated. On that server, replace the IP (serverip) and the FQDN of the Guacamole URL (guacamole_baseurl), then restart pulse-xmpp-master-substitute-assessor. The script’s execution is not interrupted.

Error handling

If a critical step fails, the script stops immediately. Failures involving assessor_agent.ini.local, the substitute files, and package-server.ini.local are reported without interrupting execution.

Important:
The script does not perform any automatic rollback. Changes that have already been applied remain in effect. Fix the problem and then rerun the script with the same parameters, or restore the backup created before execution.

For more details about an error, rerun the script with the --log-level debug option.


Connecting to the database

The connection parameters are read from the [database] section of /etc/mmc/plugins/xmppmaster.ini (and .local, if it exists).

Parameter Default value
SQL host localhost
SQL port 3306
SQL user mmc
SQL password None: must be defined in the configuration