Network Security

Introduced in version 3.8.13

SpecMan4EPR is controlled over TCP/IP (see Client-Server Architecture). This page explains what is exposed on the network, what protects it, and how to set up a spectrometer computer so that only the people and programs you intend can reach it.

ChannelOptionDefaultWhat it carries
Client-Server portalways open in Server mode3128 (fixed)Everything the GUI does: configurations, experiments, queue, run/stop, file browsing, acquired data.
Console portNetwork → Console port (on/off)off; 8023 (fixed) when onThe text command interface used by the Remote control.
Data serverData server → TCPIP address / portlocalhost:3129Acquired data sent out to a data server program. SpecMan4EPR connects to it; it does not listen.
Instrumentsdevice configuration–SCPI and vendor protocols to AWGs, digitizers, lock-ins etc. SpecMan4EPR connects to them.

Both listening ports exist only in Server mode. In No network mode no port is opened. The port numbers are fixed – 3128 for the Client-Server port and 8023 for the console port – and cannot be changed, so firewall rules and this page always match the installation. The Client-Server port is always encrypted; the console port is encrypted unless you allow plain connections (see Encryption).

A client that is allowed to connect has full control of the spectrometer. While Python, MATLAB and programs are allowed (see below), it also controls the computer: it can run Python and MATLAB code and start programs. Treat every entry in the list of allowed hosts as a person or machine you would give an administrator account to.

The protections are:

Set a connection password (see Login) whenever other computers connect: without it, any computer admitted by the list of allowed hosts can connect. The data server Data header is sent as plain text and is not a password. If the connection has to cross a network you do not control, use a tunnel or VPN as well (see below).

TLS (Transport Layer Security) is the standard way to encrypt a network connection – the same protocol that protects https:// web pages. When a client connects, the two sides first run a short handshake: the Server presents its certificate, the client checks that it belongs to the right Server, and both agree on a secret key used only for this connection. From then on everything sent in either direction is encrypted and protected against changes. TLS does not decide who may connect; that is what the list of allowed hosts and the connection password are for.

Client-Server port. Every connection between a GUI and the Server is encrypted (TLS 1.2 or 1.3), the GUI on the Server computer included. There is no option to switch it off. As a consequence a GUI older than 3.8.13 cannot connect to a 3.8.13 Server, and a 3.8.13 GUI cannot connect to an older Server: update the Server and its clients together. A refused old client shows Server Key was not received; the Server log shows TLS handshake failed with its address.

Server certificate. On its first start in Server mode, SpecMan4EPR creates its own certificate, SpecMan4EPR_server.crt with the key SpecMan4EPR_server.key, in the folder of SpecMan4EPR.ini (a protected folder). Its fingerprint (SHA-256) identifies the Server. It is written to the log at every start

Server certificate SHA-256 fingerprint: 3F:A2:...:9C

and returned by the console command .s.fingerprint. Keep the key file private: anyone who copies it can pretend to be this Server. To create a new certificate, close SpecMan4EPR, delete both files and start it again; every client will then ask to confirm the new fingerprint.

Trusting a Server. The first time a GUI in Client mode connects to a Server, it shows the Server's fingerprint and asks whether to trust it. Compare it with the fingerprint in the Server log before you answer Yes. The GUI remembers it (file SpecMan4EPR_trusted.ini next to its SpecMan4EPR.ini) and connects without asking from then on. If the fingerprint ever changes, the GUI warns and does not connect until you accept the new one: this happens after the certificate was renewed or SpecMan4EPR was reinstalled on the Server, but it can also mean that someone is intercepting the connection. The GUI on the Server computer trusts its own Server without asking.

Console port. Network → Console encryption:

SettingPlain connectionEncrypted connection
0 – Offacceptedrefused
1 – Allowedacceptedaccepted
2 – Required (default)refused from other computers, accepted from the Server computeraccepted

The Server tells the two apart by the first bytes the client sends, so both use the same port. A refused plain client receives sm>.server.error='encrypted connection required'. Set Allowed while older scripts that cannot encrypt still connect from other computers. A changed setting applies to the next connection. How a script connects encrypted is shown in Remote control.

OpenSSL. The encryption uses OpenSSL 3, two files next to SpecMan4EPR.exe: libcrypto-3-x64.dll and libssl-3-x64.dll (with LICENSE-OpenSSL.txt). They are part of every installation. Without them Server and Client mode cannot start (the log says so); No network mode works without them. SpecMan4EPR loads them only from its own folder.

Options → Network → Connection password: type the password and accept the options. SpecMan4EPR stores only a salted hash of it (the field then shows that hash, starting with pbkdf2-sha256:); the password itself is not kept on the Server. Type a new password to change it, clear the field to remove it.

Set a password before you add other computers to the list of allowed hosts. A new or changed password applies to the next connection.

The GUI and the Server run on the same PC and nothing else needs access. A new installation starts in Client mode with 127.0.0.1 already in the list of allowed hosts, so only the operational mode needs to be changed.

Options → Network:
Operational mode = Server (or No network)
List of allowed hosts = 127.0.0.1 (or localhost)
Listen address = empty

The log shows Server is listening on 127.0.0.1, port 3128 (encrypted): the ports cannot be reached from other computers. Scripts and the Remote control on the same PC still work.

Options → Network:
List of allowed hosts – add 127.0.0.1 for the local GUI and each remote computer: a single IP (192.168.1.20) or a whole subnet (192.168.1.0/24). Prefer single IPs to subnets.
Listen address – the IP of the network card that faces the lab network (for example 192.168.1.10), so the ports are not open on other networks the PC is connected to. Leave it empty to listen on all network cards.

Once the list names another computer and the listen address is empty, the Server listens on all network cards; the log says all network interfaces. Changes of the listen address and switching the console port on or off take effect after SpecMan4EPR is restarted.

In addition, limit the ports in the Windows firewall: allow inbound TCP 3128 (and TCP 8023, if the console port is on) only from the lab computers or subnet. The firewall and the list of allowed hosts are independent; use both.

Every file name that reaches the Server from outside – file dialogs of the GUI, the file browser, queue files, console commands such as .s.open and .s.exec, and the automatic data saving – must point inside an allowed folder. The rule applies to all clients, including the GUI on the Server computer.

Always allowed, taken from Options → Directories and files:

To add a folder: Options → Network → List of allowed folders, add the full path, for example D:\EPRdata\2026. Sub-folders are included. Changes apply when the options are accepted.

The server file dialogs for templates, queues and data have a Root list: the dialog's own folder first, then the added folders. Pick a root to browse, load from, save into or create sub-folders in it. The Server remembers the root last picked for each kind of dialog (templates, queues, data) and opens the next dialog there, for every client, until SpecMan4EPR is restarted. A dialog opened for a known file starts in the root that holds that file. The configuration, pattern and calibration dialogs, and the dialog that picks the automatic-saving sub-folder, offer only their own folder.

The console command .s.folders returns the complete list, SpecMan folders included:

.s.folders .server.folders=D:\EPRdata; D:\SpecMan\tpl; D:\SpecMan\cfg; ...; E:\EPRdata

A refused request is reported in the log with the name that was asked for and the full list of allowed folders, for example

Writing 'E:\export\run1.exp' is refused: it is outside the allowed folders (D:\EPRdata; D:\SpecMan\tpl; ...).

If the automatic data saving would write outside the allowed folders (because the data root or sub-folder was changed), the data are saved in the dated folder under the data root instead, and an error is posted. The console command .s.fileget accepts only bare file names from the data buffer directory.

These folders come from the options of the Server computer, and no client can change them:

The file GUID set with .d.fguid becomes a file name in the data buffer directory, so it must be a plain name without folders, .. or :.

Nothing can be saved, from any client, console command or script, into:

A serial interface whose resource (in the device configuration) is not a COM or LPT port opens a file for writing; that file must lie in an allowed folder that is not protected. A COM or LPT resource always opens the port itself (\\.\COM3, \\.\LPT1), never a file whose path merely contains the port name.

Folders are compared by their real location: short names (PROGRA~1), junctions and symbolic links are resolved first, so they cannot make a protected folder look like another one. File names with an alternate data stream (file:stream) are refused.

The protection holds even when an allowed folder contains a protected one. The one exception is a SpecMan folder or allowed folder that was set up below a protected folder (for example templates in <program folder>\tpl): saving inside that sub-folder stays possible, the protected folder itself is not.

Options → Network → Allow MATLAB, Allow Python, Allow programs. All on by default.

Each switch stops the Server from running one kind of code it does not contain itself:

Each refused call is reported in the log. The switches apply to the Server computer for every client, the GUI on the Server computer included; a GUI in Client mode on another computer keeps its own MATLAB and Python. Switch off every one that the spectrometer does not need: with all three off, a client can control the spectrometer but not the computer.

An experiment can run a program when it completes (Setup → Processing). Because any client can set this field, the program is run only when:

The program runs with the scripts directory as its working folder. A refused program is reported in the log with the reason. Make the directory writable for administrators only (Windows folder permissions), so that only the people who manage the spectrometer can add programs.

Do not open port 3128 or port 8023 to the internet or to an untrusted network, even with encryption and a connection password. Connect through a tunnel or VPN and keep the Server listening on 127.0.0.1 only:

Most instruments accept commands from anyone on their network and do not support encryption. Put them on a separate network card or switch that only the spectrometer PC uses, and keep that network off the lab and building networks. Run the data server on the same PC or on that isolated network.

Server PC 192.168.1.10, one analysis computer, extra data disk. The [Network] section of the server .ini (normally written by the Options dialog):

Configuration file example:

[Network] ConsolePort=1 ListenAddress=192.168.1.10 ClientList_0=127.0.0.1 ClientList_1=192.168.1.25 AllowedFolder_0=E:\EPRdata ConsoleEncryption=2 ConsoleLogin=1 PasswordHash=pbkdf2-sha256:200000:...

Each version of SpecMan4EPR (the first three numbers, for example 3.8.14) receives security updates for five years from its first release. A security update keeps the version and changes the fourth number (3.8.14.1, 3.8.14.2, ...). With active technical support, fixes arrive in the current version; after support has ended, security updates are provided for the last version you are licensed for. The end date of your version is shown in Help → About and in the log at start; after it the log warns that the version no longer receives security updates. SpecMan4EPR does not update itself: download and install the update.

Report a suspected security vulnerability in SpecMan4EPR to security@specman4epr.com, not to the general contact address, and do not publish it before it is fixed. How reports are handled is described in the vulnerability disclosure policy. Security advisories are published on the same page.

See also

Client-Server Architecture, Network Settings, Remote control, Directories