> Source: https://docs.cyberelements.io/bastion/4.7/mt/Usage/Reference/ConfigurationFiles/EdgeGateway/Html5GatewayXml/

# html5gateway.xml

`html5gateway.xml` is the configuration of an HTML5 Gateway: the Mediation Controller it connects to, the certificate it presents and its TLS settings. It is the counterpart of [`gateway.xml`](https://docs.cyberelements.io/bastion/4.7/mt/Usage/Reference/ConfigurationFiles/EdgeGateway/GatewayXml/) for the service that renders sessions in the browser. An Edge Gateway can host several instances of HTML5 Gateway, each with its own file.

| Property | Value |
|---|---|
| **Component** | Edge Gateway |
| **Path** | `/etc/ipdiva/html5gateway/html5gateway.xml` |
| **Owner and permissions** | `ipdivahtml5gateway:ipdivahtml5gateway`, `400` |
| **Package** | none, written at installation |
| **Format** | XML |

> **Readable by its owner only**
>
> The permissions are `400`, as for `gateway.xml`: no group, no other reader. The file holds the password of the certificate in clear text, and nothing but the service has to read it: see [Edge Gateway certificate and private key](https://docs.cyberelements.io/bastion/4.7/mt/Security/GatewayCertificates/).

> **One directory per instance**
>
> Each additional instance `<name>` of the HTML5 Gateway has its own directory, `/etc/ipdiva/html5gateway<name>/`, with its own `html5gateway.xml`, created from the same template: the address of the Mediation Controller and the ports are left to be filled in by hand. What this page describes applies to each of them; such an instance is restarted by `systemctl restart ipdiva-html5gateway@<name>.service`.

## Structure

A single `<gateway>` element. The HTML5 Gateway uses only part of it:

| Section | Holds |
|---|---|
| [`<gateway>`](#gateway-root) | The address of the SSL Router of the Mediation Controller, and the local port on which the HTML5 Gateway receives the opening of its sessions. |
| [`<ssl>`](#ssl) | The TLS of the connection to the Mediation Controller: certificate and its password, certification authorities, versions and cipher suites. |
| [`<license>`](#license) | A former licence mechanism, absent from the installed file. |

The installed file also holds `<pipe>`, `<timeout>`, `<ticket>` and `<proxy>`, which the HTML5 Gateway reads without using them: its connection to the Mediation Controller uses built-in values, and never goes through a proxy.

The two values set at installation are `<server>` and the certificate of `<ssl>`. The installation procedure gives their exact form: see [Install an HTML5 Gateway](https://docs.cyberelements.io/bastion/4.7/mt/Installation/Standalone/FromScratch/InstallEdgeGateway/).

## Parameters

The tables list every element and every attribute that the HTML5 Gateway 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; *set at installation* marks a value that the installation writes from what it has collected.
- **If the element is absent**: the value that the HTML5 Gateway uses when it does not find the element.

### `<gateway>`

Elements placed directly under `<gateway>`.

| Element | Default value | If the element is absent | Effect |
|---|---|---|---|
| `server` | set at installation | required | Address of the SSL Router of the Mediation Controller, in the form `<address>:<port>:ssl`; the `ssl` suffix establishes the connection in TLS. Several addresses separated by `;` are tried in turn: after three failed attempts on one address, the HTML5 Gateway moves to the next one, and returns to the first after a successful connection. An attempt is made every 10 seconds, a value that cannot be configured. |
| `rpc-listen` | set at installation | `127.0.0.1:9080` | Address and TCP port on which the HTML5 Gateway listens for the local commands (XML-RPC over HTTP, unencrypted) that open and close its HTML5 sessions. The installation sets port `9088`; the `ipdiva_rpc_helper` tool delivered with the package always targets `127.0.0.1:9088`. When the element is absent, the port is `9080`, that of the Edge Gateway. An empty value disables listening. |

### `<ssl>`

TLS of the connection that the HTML5 Gateway opens to the SSL Router of the Mediation Controller: its certificate, the trust it grants to the certificate of the Mediation Controller, protocol versions and cipher suites. The TLS context is built only when `cert` is set. If the file named by `ca-file` does not exist, the HTML5 Gateway stops configuring TLS at that point: certificate, cipher suites and verification are not loaded. A configuration error marked below as preventing the start stops the service, which systemd restarts every 10 seconds.

| Element | Default value | If the element is absent | Effect |
|---|---|---|---|
| `cert` | set at installation | no TLS context | Certificate and private key that the HTML5 Gateway presents to the Mediation Controller: PKCS#12 when the file ends in `.p12`, PEM when it ends in `.pem`. Any other extension, or a file that cannot be read, prevents the start. The common name (CN) of the certificate gives the name of the HTML5 Gateway in its routing domain, prefixed with `H:`. The installation sets `/etc/ipdiva/html5gateway/ssl/keyfile.pem`; the pairing replaces it with `ssl/<name>.p12`. |
| `pkcs12` | — | — | Former name of `cert`, read only when `cert` is absent. |
| `key` | — | — | Former name of `cert`, read only when `cert` and `pkcs12` are absent. |
| `password` | `PASSWORD` | built-in passwords tried | Password of the certificate, in clear. For a PEM file, several values separated by `;` are tried in turn. For a PKCS#12 file whose password is not this one, the HTML5 Gateway tries built-in passwords and, when one of them opens the file, rewrites the file with a password derived from the machine. The template value `PASSWORD` is not replaced at installation. |
| `ca-file` | — | — | File of certification authorities trusted to sign the certificate of the Mediation Controller. |
| `calist` | — | — | Former name of `ca-file`; when present, it takes precedence over it. |
| `ca-dir` | set at installation | — | Directory of certification authorities trusted to sign the certificate of the Mediation Controller: every file it contains, subdirectories included, is loaded. A missing directory prevents the start. |
| `allowed-ca-file` | — | — | File of the certification authorities allowed to issue the certificate of the Mediation Controller: a certificate whose issuer is not in it is refused. Applies only when `verify-cert` is `true`. A file that cannot be read is ignored, with a message in the log. |
| `dh-file` | — | — | Diffie-Hellman parameters. They serve only a TLS server and do not change the connection of the HTML5 Gateway; a missing file prevents the start. |
| `ecdh-curve` | — | OpenSSL default | Elliptic curve, by its OpenSSL short name, to which the HTML5 Gateway restricts the key exchange it proposes. An unknown name prevents the start. |
| `cipherlist` | `!ADH:` `!AECDH:` `!MD5:` `kEECDH+AES:` `kEDH+AES:` `AES256+RSA:` `3DES+RSA` | OpenSSL default | Cipher suites up to TLS 1.2 that the HTML5 Gateway proposes, in the OpenSSL syntax. A list refused by OpenSSL prevents the start. |
| `cipherlist-tls1.3` | `TLS_CHACHA20_POLY1305_SHA256:` `TLS_AES_256_GCM_SHA384:` `TLS_AES_128_GCM_SHA256` | OpenSSL default | Cipher suites of TLS 1.3 that the HTML5 Gateway proposes, separated by `:`. A list refused by OpenSSL prevents the start. |
| `min-version` | `tls1.3` | `tls1.1` | Lowest TLS version accepted: `tls1`, `tls1.1`, `tls1.2` or `tls1.3`. Another value removes the minimum, with an error in the log. |
| `max-version` | empty | no maximum | Highest TLS version accepted, same values as `min-version`. Empty: no maximum. |
| `version` | — | — | Former form, read only when neither `min-version` nor `max-version` is present: the version given and all later ones are accepted. |
| `verify-cert` | `true` | `true` | Verification of the certificate of the Mediation Controller against the trusted authorities (`ca-dir`, `ca-file`). `false`: any certificate is accepted. |
| `verify-depth` | — | OpenSSL default | Maximum length of the certification chain of the Mediation Controller. `0`: OpenSSL default. |
| `accept-expired-cert` | — | `false` | `true`: an expired certificate of the Mediation Controller is accepted, with a message in the log. |
| `verify-certhostnamematch` | `true` | `false` | `true`: the certificate of the Mediation Controller must carry, in its common name or one of its alternative names, one of the names listed in `cert-peernames`. Without `cert-peernames`, no name is checked, whatever the value. |
| `cert-peernames` | — | no name | Names expected in the certificate of the Mediation Controller, one per `<element>` child. Checked only when `verify-cert` and `verify-certhostnamematch` are `true`. |
| `cert-peername` | — | — | Former form of `cert-peernames` for a single name, read only when `cert-peernames` is absent. |
| `secure-renegociation` | — | `force` | Handling of TLS renegotiation: `force` keeps the OpenSSL behaviour (secure renegotiation only); `allowUnsecure` also accepts the former, insecure renegotiation; `no` disables TLS session tickets. Another value is ignored, with an error in the log. |

### `<license>`

Former licence mechanism, absent from the installed file. When the element is present, the HTML5 Gateway must find a licence for HTML5 Gateways, otherwise it does not start; the name of the HTML5 Gateway then comes from the licence instead of the certificate.

| Element | Default value | If the element is absent | Effect |
|---|---|---|---|
| `license` | — | `gateway.lic` next to the configuration file | Licence file, read when `data` is absent. |
| `data` | — | — | Content of the licence, as provided by the publisher. It must be a licence for HTML5 Gateways. |
| `signature` | — | required for a licence in XML form | Signature of the licence. Without it, a licence in XML form prevents the start. |

## Applying a change

Restart the HTML5 Gateway:

```
1
```

An additional instance `<name>` (see “One directory per instance” at the top of the page) is restarted by its own service:

```
1
```

> **The restart closes the sessions displayed in the browser**
>
> Every HTML5 session served by this HTML5 Gateway is closed, and the users see their browser tab lose the session. When several HTML5 Gateways serve the same site, restart them one at a time.

## Upgrade

No package delivers the file, so an upgrade neither overwrites it nor asks you anything about it. It does set its owner and its `400` permissions again, and restarts the enabled instances of the HTML5 Gateway.
