> Source: https://docs.cyberelements.io/bastion/4.7/pt/Usage/Reference/ConfigurationFiles/MediationController/RemoteServersXml/

# remoteServers.xml

`/etc/ipdiva/server/remoteServers.xml` declares the links that the SSL Router of the Mediation Controller opens or accepts towards other SSL Routers: the other Mediation Controllers of the Cluster, and the remote sites. You complete it when you install a Cluster, to activate the link between the Mediation Controllers (see [Activation of the interserver link](https://docs.cyberelements.io/bastion/4.7/pt/Installation/Cluster/FromScratch/InstallMediationController/#activation-of-the-interserver-link)), or to set up an intersite link. No program writes it.

| Property | Value |
|---|---|
| **Component** | Mediation Controller |
| **Path** | `/etc/ipdiva/server/remoteServers.xml` |
| **Owner and permissions** | `zope:ipdivasrv`, `640` |
| **Package** | `ipdiva-server` (a configuration file kept on upgrade) |
| **Format** | XML |

> **The installed file declares no link**
>
> `<localCluster>` and `<intersites>` are present in it, but with no `<remoteServer>`, `<accept>` or `<remoteSite>`: a Standalone Mediation Controller needs no link. Its two values, `allowed-cns='SLAVECN'` and `localSiteName='localSite1'`, are examples to replace before you declare a link. The file is designated by the `<remoteservers>` element of [`server.xml`](https://docs.cyberelements.io/bastion/4.7/pt/Usage/Reference/ConfigurationFiles/MediationController/ServerXml/).

## Structure

A single `<remoteConfig>` element:

| Section | Holds |
|---|---|
| [`<remoteConfig>`](#remoteconfig-root) | The two blocks of the file, independent of each other. |
| [`<localCluster>`](#local-cluster) | The links between the Mediation Controllers of the Cluster. |
| [`<intersites>`](#intersites) | The links with remote sites. |
| [TLS elements](#tls-elements) | The TLS of an outgoing link, shared by `<remoteServer>` and `<remoteSite>`. |

## Parameters

The tables list every element and every attribute that the SSL Router reads. Two columns give a value:

- **Default value**: the value written in the file as installed. A dash marks an element absent from the installed file.
- **If the element is absent**: the value that the SSL Router uses when it does not find the element.

An element is written as a path from its section, and `@` marks an attribute:

- `remoteServer/@connect` is the `connect` attribute of the `<remoteServer>` element of `<localCluster>`;
- `remoteServer/cert` is the `<cert>` element placed in `<remoteServer>`;
- `@allowed-cns` is the `allowed-cns` attribute of the section itself, `<localCluster>`.

The TLS elements are placed in a `<remoteServer>` or in a `<remoteSite>`: `cert` there designates the `<cert>` element.

### `<remoteConfig>`

Root element of the file. It holds two independent blocks: `<localCluster>` for the links to the other Mediation Controllers of the Cluster, `<intersites>` for the links to remote sites. Element names are case-insensitive; attribute names are case-sensitive. If the file cannot be read as XML, or if any declaration of `<intersites>` makes it fail (see below), the whole file is ignored: no Cluster link and no intersite link.

| Element | Default value | If the element is absent | Effect |
|---|---|---|---|
| `remoteConfig` | — | the file has no effect | Root element. Under any other root name, the file is read without error but nothing is configured. |
| `localCluster` | — | no Cluster link, in either direction | Enables the Cluster links: the SSL Router then accepts incoming connections from other Mediation Controllers (filtered by `allowed-cns`) and opens one outgoing link per `<remoteServer>`. Absent: the SSL Router neither listens for nor opens any Cluster link. |
| `intersites` | — | no intersite link, in either direction | Enables the intersite links: the SSL Router then accepts the remote sites declared in `<accept>` and connects to those declared in `<remoteSite>`. Absent: no intersite link. |

### `<localCluster>`

Links between the Mediation Controllers of the Cluster. Each `<remoteServer>` is an outgoing link that this Mediation Controller opens and keeps open, retrying every 60 seconds (fixed value). The remote Mediation Controller must itself have a `<localCluster>` whose `allowed-cns` accepts the common name of the certificate presented by this one; it also refuses a peer with the same server number. On the incoming side, the listening certificate and the TLS settings of `server.xml` apply, not this file. For a link in both directions, each node declares the other in `<remoteServer>`.

| Element | Default value | If the element is absent | Effect |
|---|---|---|---|
| `@allowed-cns` | `SLAVECN` | `*` (any common name) | Common names accepted for an incoming Cluster link, separated by `;`: the common name of the certificate of the connecting Mediation Controller must be exactly one of them (case-sensitive); `*` accepts any. The installed value `SLAVECN` is an example: it refuses every Mediation Controller whose certificate does not have that exact common name. |
| `remoteServer` | — | no outgoing Cluster link | One outgoing link to another Mediation Controller of the Cluster, repeatable. It may contain the TLS elements described below; without `<cert>`, they are all ignored. |
| `remoteServer/@connect` | — | required | Address of the SSL Router to join, as `<address>:<port>:ssl`. Only an address ending in `:ssl` is encrypted; without it, the link is plain TCP. Several addresses separated by `;` are tried in turn, the next one after 3 consecutive failures, back to the first after a success. The part before the first `:` is the name expected in the remote certificate when `verify-certhostnamematch` is `true` and no `cert-peernames` is given. |
| `remoteServer/cert` | — | listening certificate and TLS settings of `server.xml` (`<ssl>`) | Certificate presented on this link, instead of the listening certificate. Its presence is what makes the SSL Router read the other TLS elements of the `<remoteServer>`: without `<cert>`, the link uses the listening certificate and all the TLS settings of `server.xml`, and the other TLS elements written here are ignored, `pkcs12` and `key` included. Format and other effects: see the TLS elements. |

### `<intersites>`

Links between sites. A `<remoteSite>` is an outgoing link to the SSL Router of another site; an `<accept>` authorises an incoming link from another site. A site that connects sends its `localSiteName`, the password and the patterns of the peers it wants to reach; the receiving site looks for the `<accept>` whose `name` is that `localSiteName`, checks the password, then announces only its local peers (Edge Gateways) that match both a pattern requested by the caller and a pattern of its `<accept>`. Patterns are regular expressions matched against the whole name of a peer (for example `S:edge-gateway@organization`), separated by `;`.

| Element | Default value | If the element is absent | Effect |
|---|---|---|---|
| `@localSiteName` | `localSite1` | required: if missing or empty, the whole file is ignored, Cluster links included | Name of this site, sent to the remote sites this one connects to: each of them must have an `<accept>` with this `name`. A `<remoteSite>` cannot bear the same name. |
| `accept` | — | no incoming intersite link accepted | Authorises the incoming link of one remote site, repeatable. Two `<accept>` with the same `name`: the last one wins. |
| `accept/@name` | — | — | Name of the remote site authorised: it must be exactly the `localSiteName` of that site (case-sensitive). Otherwise its connection is refused (`site access is forbidden`). |
| `accept/@password` | — | empty | Password expected from the remote site, in clear text: it must be identical to the `password` of its `<remoteSite>`. Empty: a site that sends an empty password is accepted. |
| `accept/@pattern` | — | — | Local peers that this site agrees to show to the remote site: regular expressions separated by `;`. A local peer is announced only if it matches one of these patterns and one of the patterns requested by the remote site. An invalid expression is ignored. |
| `remoteSite` | — | no outgoing intersite link | One outgoing link to the SSL Router of a remote site, repeatable, kept open and retried. It may contain the TLS elements described below. A `<remoteSite>` without `name`, without `pattern` or named like `localSiteName` is ignored, with an error in the log. Two `<remoteSite>` with the same `name`: only the last one is kept. |
| `remoteSite/@name` | — | required | Local name of the link, shown in the log and in the routing (`ISI:<name>`). The remote site does not check it. |
| `remoteSite/@password` | — | empty | Password sent to the remote site, in clear text in the file: it must be identical to the `password` of the `<accept>` that the remote site has for this one. |
| `remoteSite/@pattern` | — | required | Peers of the remote site to reach through this link (Edge Gateways): regular expressions separated by `;`, sent to the remote site, which announces only those of its peers that also match its own `<accept>`. |
| `remoteSite/@connect` | — | required | Address of the SSL Router of the remote site, as `<address>:<port>:ssl`. Only an address ending in `:ssl` is encrypted, and it then requires a `<cert>`; without `:ssl`, the link is plain TCP. Several addresses separated by `;` are tried in turn, the next one after 3 consecutive failures. |
| `remoteSite/@timeout` | — | `60000` | Delay in milliseconds between two connection attempts, also the time allowed for the remote site to answer. A value of `10000` or less is replaced by `60000`, with an error in the log. |

### TLS elements of `<remoteServer>` and `<remoteSite>`

The same TLS elements are read in a `<remoteServer>` and in a `<remoteSite>`, by the reader of `server.xml/<ssl>`, with the same defaults. They configure the outgoing connection, where this Mediation Controller is the TLS client. Two differences: in a `<remoteServer>`, they are read only if `<cert>` is present (otherwise the listening certificate and the TLS settings of `server.xml` are used); in a `<remoteSite>`, they are always read, but without `<cert>` no TLS context exists and a connection to an address ending in `:ssl` fails. In a `<remoteSite>`, an error in these elements (unreadable certificate, wrong password, missing `ca-dir`, cipher list refused) makes the whole file ignored, Cluster links included. In a `<remoteServer>`, it occurs when the link starts.

| Element | Default value | If the element is absent | Effect |
|---|---|---|---|
| `cert` | — | `<remoteServer>`: listening certificate; `<remoteSite>`: no TLS (a `:ssl` connection fails) | Certificate and private key presented to the remote SSL Router: PKCS#12 when the file ends in `.p12`, PEM (certificate and key in the same file) when it ends in `.pem`; any other extension makes the TLS configuration fail. The certification authorities contained in a `.p12` are added to the trusted authorities. |
| `pkcs12` | — | — | Former name of `cert`, read only when `cert` is absent. In a `<remoteServer>`, it is not enough on its own: only `<cert>` triggers the reading of the TLS elements. |
| `key` | — | — | Former name of `cert`, read only when `cert` and `pkcs12` are absent. Same limit as `pkcs12` in a `<remoteServer>`. |
| `password` | — | built-in passwords tried | Password of the certificate, in clear text. For a PEM file, several values separated by `;` are tried in turn. For a `.p12` file that this password does not open, the SSL Router tries a code specific to the machine, then built-in passwords; if a built-in password opens it, the file is saved again, protected by the code of the machine. |
| `ca-file` | — | — | PEM file of certification authorities trusted to verify the certificate of the remote SSL Router. If the file does not exist, the TLS configuration stops at this point, silently: certificate, cipher suites and verification are not applied. |
| `calist` | — | — | Former name of `ca-file`; when present, it takes precedence over it. |
| `ca-dir` | — | — | Directory of certification authorities trusted to verify the certificate of the remote SSL Router: every file it contains, subdirectories included, is loaded. A missing directory makes the TLS configuration fail. |
| `allowed-ca-file` | — | any issuer trusted | PEM file of the certification authorities allowed to sign the certificate of the remote SSL Router: a certificate whose issuer is not in it is refused. An unreadable file is reported in the log and leaves no restriction. |
| `crl-dir` | — | — | Directory of certificate revocation lists, loaded at startup and not reloaded. They are not checked during the TLS negotiation: they are checked only when the revocation lists of the listening certificate (`server.xml`) change, a check run every 60 seconds; a link whose remote certificate is revoked, or whose list has expired, is then closed. Ignored when `verify-cert` is `false`. |
| `crl-file` | — | — | A single revocation list, with the same limited effect as `crl-dir`. When `crl-dir` is also present, this list is dropped. |
| `min-version` | — | `tls1.1` | Minimum version of the protocol: `tls1`, `tls1.1`, `tls1.2` or `tls1.3`. Any other value is reported in the log and leaves no minimum. |
| `max-version` | — | no maximum | Maximum version of the protocol, with the same values as `min-version`. Empty: no maximum. |
| `version` | — | — | Former setting: ignored, with an error in the log, when `min-version` or `max-version` is present. Otherwise it sets the lowest version accepted (`tls1`, `tls1.1`, `tls1.2`, `tls1.3`, also written `tlsv1.2`…). |
| `cipherlist` | — | OpenSSL default | Cipher suites up to TLS 1.2, in the OpenSSL syntax. A list refused by OpenSSL makes the TLS configuration fail. |
| `cipherlist-tls1.3` | — | OpenSSL default | Cipher suites of TLS 1.3, separated by `:`. A list refused by OpenSSL makes the TLS configuration fail. |
| `verify-cert` | — | `true` | `true`: the certificate of the remote SSL Router is verified against the trusted authorities, and the link is refused if it is not valid. `false`: no verification; `verify-certhostnamematch` and the revocation lists then have no effect. Values: `true`, `yes`, `1` or `false`, `no`, `0`. |
| `verify-depth` | — | `0` | Maximum depth of the certificate chain accepted. `0` keeps the OpenSSL default. |
| `verify-certhostnamematch` | — | `false` | `true` (with `verify-cert` at `true`): the common name or one of the alternative names of the remote certificate must be exactly one of the names of `cert-peernames`; otherwise the link is refused. In a `<remoteServer>` without `cert-peernames`, the expected name is the address of `connect` as written (before the first `:`). In a `<remoteSite>` without `cert-peernames`, no name is checked. |
| `cert-peernames` | — | `<remoteServer>`: the address of `connect`; `<remoteSite>`: none | Names accepted in the remote certificate, used only by `verify-certhostnamematch`, one per child element: `<cert-peernames><element>name</element>…</cert-peernames>`. |
| `cert-peername` | — | — | Former form of `cert-peernames`, holding a single name; read only when `cert-peernames` is absent. |
| `accept-expired-cert` | — | `false` | `true`: an expired certificate of the remote SSL Router is accepted, and logged. |
| `secure-renegociation` | — | `force` | `force`: behaviour of OpenSSL; `no`: disables the session tickets; `allowUnsecure`: allows the unsecure legacy renegotiation. Case-sensitive; any other value is reported in the log and ignored. |

## Applying a change

The file is read only when the SSL Router starts. Edit the file, then restart the SSL Router to apply the change:

```
1
```

> **Restarting the SSL Router cuts the connections in progress**
>
> The SSL Router carries the connections of the Edge Gateways, of the clients and of the web accesses: those in progress are cut, and during the restart users can neither sign in to the portal nor launch an application. Plan the change outside working hours, and in a cluster restart one node at a time, checking that the link comes up before moving to the next one.

## Upgrade

The file is kept on upgrade, which applies the `640` permissions to it again. If you have changed it, the upgrade asks whether to keep your version or install the new one: the version not chosen is kept next to it, as `remoteServers.xml.dpkg-old` (your former version) or `remoteServers.xml.dpkg-dist` (the new one). Keeping your version is almost always the right choice here, the delivered version declaring no link.
