> Source: https://docs.cyberelements.io/bastion/4.7/ga/Usage/Reference/ConfigurationFiles/MediationController/DjangoSettings/

# djangosettings.ini

`djangosettings.ini` holds the settings of the web consoles of the Mediation Controller: the administration console, the system console and the user portal. It controls, among others, the names under which these consoles can be reached, the duration of some sessions, the size of CSV exports, the public API and the debug logs per organisation.

| Property | Value |
|---|---|
| **Component** | Mediation Controller |
| **Path** | `/etc/ipdiva/care/djangosettings.ini` |
| **Owner and permissions** | `www-data`, `600` |
| **Package** | `ipdiva-care-site` (a configuration file kept on upgrade) |
| **Format** | INI file: sections in brackets, one `key = value` per line |

> **Rewritten by the product**
>
> The product rewrites this file in two cases (see [Rewriting by the product](#rewriting-by-the-product)). Your values are kept, but **the comments of the file are removed**.

## Structure

The file is made of sections, written `[name]`, each followed by `key = value` lines.

- **Section names are case-sensitive**: `[security]` and `[Security]` are two different sections.
- **Key names are not case-sensitive**: `ALLOWED_HOSTS` and `allowed_hosts` are the same key.
- A key that is absent from the file takes the value listed in the **If the key is absent** column of the tables below. Some keys are not in the delivered file: add them to the right section to change their behaviour.

> **Both separators are accepted**
>
> `key = value` and `key: value` have the same meaning, so you may come across the second form, for instance after an upgrade. The next rewriting of the file by the product normalises every line to `=` (see [Rewriting by the product](#rewriting-by-the-product)).

Example of content:

```
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
```

> **Boolean values**
>
> Except in the `[debug_logs…]` sections, a parameter is enabled **only** by the exact value `True`, with a capital T. `true`, `TRUE`, `1` or `yes` are read as **false**, without any error. For `validate_blocked_pattern_only`, whose default value is `True`, writing `true` therefore reverses the behaviour.

## Parameters

Two columns give a value, and they do not always agree:

- **Default value**: the value written in the file as installed. A dash means the key is not in the delivered file.
- **If the key is absent**: the value the product uses when it does not find the key. Removing a line therefore does not always restore the value you started from: `saml_expiration_sec` is delivered at `3600` but falls back to `7200`, and `max_csv_size` is delivered at `50000` but falls back to `10000`.

### [security]

| Parameter | Default value | If the key is absent | Effect |
|---|---|---|---|
| `ALLOWED_HOSTS` | `127.0.0.1,localhost` | empty: the consoles refuse every request | Names and IP addresses under which the web consoles can be reached, separated by commas. A request whose host name is not in the list is refused. The comparison ignores case and the port. `.domain.local` accepts the domain and all its subdomains; `*` disables the check. An empty list makes the consoles unreachable. |
| `saml_expiration_sec` | `3600` | `7200` | Duration, in seconds, of a session opened through SAML or OpenID Connect authentication. |

> **Information**
>
> The product adds to `ALLOWED_HOSTS` on its own the web address of the Mediation Controller and the domains of the reverse proxy and Web VPN virtual hosts. To declare an additional name, see [Add a DNS name authorised to connect to the Web interfaces](https://docs.cyberelements.io/bastion/4.7/ga/Usage/Configuration/SystemConsole/AddAllowedDNSName/).

### [debug]

| Parameter | Default value | If the key is absent | Effect |
|---|---|---|---|
| `ENABLED` | `False` | `False` | `True` enables the debug mode of the web consoles: detailed error pages, and commands that generate test data. |

> **Never enable the debug mode in production**
>
> The debug mode exposes detailed error pages, which disclose the internals of the platform, and enables commands that generate test data.

### [record]

| Parameter | Default value | If the key is absent | Effect |
|---|---|---|---|
| `max_idle_time_sec` | `7200` | `7200` | Duration, in seconds, after which the session used by a recording to send its events expires without activity. |
| `careinit` | `1` | `1` | Privileged RDS applications with agent only. `1`: the initial program of the session is `CareInit.exe`, which starts the recorded session and then launches the application (`explorer.exe` if none is set). Any other integer value: the application is launched directly as initial program, without that step. |
| `data_upload_max_number_fields` | — | `1000` | Maximum number of parameters accepted in a single request sent to the consoles. |

> **`careinit` is not honoured by every launch mode**
>
> Only the **Windows client** and **HTML5 (RDP)** read this parameter. A session opened from **macOS**, from **Linux**, or through **Use another client program** always starts with `CareInit.exe`, whatever the value.
>
> Setting another value therefore disables the start of the recorded session for the two modes that honour it, and changes nothing for the other three.

### [reports]

| Parameter | Default value | If the key is absent | Effect |
|---|---|---|---|
| `max_csv_size` | `50000` | `10000` | Maximum number of lines of a CSV export (applications, Edge Gateways, logs, user statistics, password safe accounts). Beyond it, the export is truncated without warning. |
| `encoding` | `utf8` | `utf8` | Encoding of exported and imported CSV files. On export, a character that the encoding cannot represent is removed without warning; on import, an invalid character makes the import fail. |

### [api]

| Parameter | Default value | If the key is absent | Effect |
|---|---|---|---|
| `enabled` | `False` | `False` | `True` enables the public API and displays the API keys module in the console. |
| `white_list` | — | empty: every address is accepted | IP addresses allowed to call the public API, separated by commas. Each address is compared as text: neither networks nor CIDR notation are supported. Applies only when `enabled = True`. |
| `max_page_size` | — | `10000` | Maximum number of entries per page returned by the public API for logs. Minimum value: `1`. |
| `cli_portal_driver_enabled` | — | `False` | `True` enables the user portal driver. |

### [pulse]

| Parameter | Default value | If the key is absent | Effect |
|---|---|---|---|
| `timeout` | `10` | `10` | Timeout, in seconds, of the calls to Pulse. |
| `validate_pattern_after_otp` | `False` | `False` | `True`: after a successful one-time password following a Pulse analysis, the pattern of the user is declared valid to Pulse. |
| `validate_blocked_pattern_only` | `True` | `True` | Applies only when `validate_pattern_after_otp = True`. `True`: only refused patterns are declared valid; any other value: every pattern is. |
| `version` | — | `v2` | Version of the Pulse interface: `v1` or `v2`. Any other value is replaced by `v2` without warning. |

### [cluster]

| Parameter | Default value | If the key is absent | Effect |
|---|---|---|---|
| `main_heartbeat_timeout_sec` | `300` | `300` | In a cluster, delay in seconds after which a node takes the role of main node when the current main node no longer signals itself. |

### [workflow]

| Parameter | Default value | If the key is absent | Effect |
|---|---|---|---|
| `uselessness_detection_delay` | — | `120` | Delay, in seconds, after which an access request that has become useless is deleted (the request no longer concerns the user, or the application is no longer restricted). The value is kept between `30` and `300`. |

### [deployment]

| Parameter | Default value | If the key is absent | Effect |
|---|---|---|---|
| `online_doc` | empty | empty | Base address of the online documentation opened by the help button of the consoles. As long as it is empty, the consoles open the public documentation, `https://docs.cyberelements.io`. Set it to send the help button to another instance of the documentation. |

> **The other parameters of these sections belong to the product**
>
> The parameters of the `[deployment]`, `[resource]` and `[discovery]` sections that are not listed here are written by the installation and by the consoles. Changing them breaks the operation of the platform.

### [development]

| Parameter | Default value | If the key is absent | Effect |
|---|---|---|---|
| `partial_backup` | — | `False` | `True` allows the restoration of a backup exported without sensitive data. Without it, such a backup cannot be restored. Intended for development and support. |

### [resource]

| Parameter | Default value | If the key is absent | Effect |
|---|---|---|---|
| `isolate_enabled` | `False` | `False` | `True` enables Browser Isolation: the console shows the [Container or virtualization hosts](https://docs.cyberelements.io/bastion/4.7/ga/Usage/Administration/AdminConsole/MainWorkPanel/VirtualMachines/ContainerOrVirtualizationHosts/) and [Image templates](https://docs.cyberelements.io/bastion/4.7/ga/Usage/Administration/AdminConsole/MainWorkPanel/VirtualMachines/ImageTemplates/) screens, and offers the Isolate (Web) application type, [privileged](https://docs.cyberelements.io/bastion/4.7/ga/Usage/Administration/AdminConsole/MainWorkPanel/Applications/PrivilegedApplications/IsolateWebPrivileged/) as well as [standard](https://docs.cyberelements.io/bastion/4.7/ga/Usage/Administration/AdminConsole/MainWorkPanel/Applications/StandardApplications/IsolateWebStandard/). |
| `mcp_enabled` | `False` | `False` | `True` enables MCP redirection: the console offers the [MCP](https://docs.cyberelements.io/bastion/4.7/ga/Usage/Administration/AdminConsole/MainWorkPanel/Applications/PrivilegedApplications/McpPrivileged/) privileged application type. |
| `vms_enabled` | `False` | `False` | `True` enables virtual machine management (VMware and Proxmox): the console shows the [Virtual machines](https://docs.cyberelements.io/bastion/4.7/ga/Usage/Administration/AdminConsole/MainWorkPanel/VirtualMachines/VirtualMachines/) and [Container or virtualization hosts](https://docs.cyberelements.io/bastion/4.7/ga/Usage/Administration/AdminConsole/MainWorkPanel/VirtualMachines/ContainerOrVirtualizationHosts/) screens, and offers the Virtual desktop application type, [privileged](https://docs.cyberelements.io/bastion/4.7/ga/Usage/Administration/AdminConsole/MainWorkPanel/Applications/PrivilegedApplications/VirtualDesktopPrivileged/) as well as [standard](https://docs.cyberelements.io/bastion/4.7/ga/Usage/Administration/AdminConsole/MainWorkPanel/Applications/StandardApplications/VirtualDesktopStandard/). |
| `vms_debug` | `False` | `False` | `True` sets the logs of the virtual machine management (VMware and Proxmox) to the debug level. |

> **Product options**
>
> Browser Isolation, MCP redirection and virtual machine management are product options, disabled at installation. Enabling them does not depend on the licence: set the key to `True`, then [apply the change](#applying-a-change). As long as an option is disabled, neither its screens, nor its application type, nor its public API routes are offered.

## Debug logs per organisation

A section whose name begins with `debug_logs` enables detailed logs for one or more organisations, without enabling the debug mode of the whole platform.

| Key | Value |
|---|---|
| `orgname` | Names of the organisations concerned, separated by commas. Without this key, or if it is empty, the section is ignored. |
| `workflow` | Logs of the access request workflows and of the authentication on directories. |
| `outdated_videos` | Logs of the deletion of outdated recordings. |

A log is enabled by the value `true`, `1`, `yes` or `on`, in any case. Several sections add up. The logs are written in `/var/lib/ipdiva/care/logs/cleanroom-<log>-<organization>.log`, with a rotation at 1 MB and three kept files.

> **Example**
>
> To enable the workflow logs of the `org1` and `org2` organisations:
>
> ```
> 1
> 2
> 3
> ```

## Applying a change

The web consoles read the file when they start. Renewing their processes is enough, and does not interrupt the service:

```
1
```

The web server runs the consoles in daemon mode and watches the date of that file: changing it renews the processes, which read the file again. `systemctl reload apache2` has the same effect. A full restart of the web server is not needed.

> **Information**
>
> `main_heartbeat_timeout_sec` is an exception: it is read again at each run of the cluster heartbeat, that is at the latest ten minutes after the change, without any restart.

## Rewriting by the product

The product rewrites the whole file:

- at each installation or upgrade of the product, to update `ALLOWED_HOSTS`;
- when a reverse proxy or Web VPN virtual host is added, modified or deleted in the system console (see [Virtual hosts](https://docs.cyberelements.io/bastion/4.7/ga/Usage/Reference/SystemConsole/VirtualHosts/)).

Your values are kept, but the file is written again as a whole: **its comments are removed** and the separators become `=`. In a cluster, the change of `ALLOWED_HOSTS` is propagated to the other nodes.

## Upgrade

The file is kept on upgrade. If you modified it, the upgrade asks whether to keep your version or to install the new one: the version not chosen is kept next to it, as `djangosettings.ini.dpkg-old` (your former version) or `djangosettings.ini.dpkg-dist` (the new version). See [Restoring configurations](https://docs.cyberelements.io/bastion/4.7/ga/Upgrade/HotVersionUpgrade/MediationController/#restoring-configurations).
