> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/tposs/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/tposs/latest/configuration/hss.md).

# HSS settings

> [!IMPORTANT]
> The [Diameter](https://docs.cennso.com/components/tposs/latest/configuration/diameter.md), [SBI API](https://docs.cennso.com/components/tposs/latest/configuration/sbi/sbi.md), and [CDMP](https://docs.cennso.com/components/tposs/latest/configuration/cdmp/cdmp.md) must be disabled if HSS is enabled. You can disable them using the **scg.diameter.enabled**, **sbi.enabled**, and **cdmp.enabled** configuration options.

To receive incoming Diameter requests from MME, you must specify a Diameter listener along with other Diameter options. Use these configuration options to enable the Diameter listener:

```yaml
hss:
  # Enables the Diameter S6a interface.
  enabled: true
  diameter:
    # TPOSS Diameter S6a server listener address.
    listener: "aaa://0.0.0.0:3868"
    # Origin-Realm used by TPOSS on the Diameter S6a interface.
    realm: "hss.example.com"
    # Diameter transport protocol, either `sctp` or `tcp`. If SCTP is used, it
    # requires the `sctp` kernel module and a CNI that forwards SCTP on every node.
    transport: sctp
    # The list of the local addresses that the TPOSS HSS Diameter listener binds to.
    # More than one makes the SCTP association multi-homed.
    # A comma-separated string is accepted as well.
    local_addresses: []
    # Number of connections that the Diameter server accepts.
    pool_size: 1
```

The listener address is specified in the `aaa://address:port` format. The **hss.diameter.pool_size** option controls the maximum number of Diameter connections that TPOSS can accept from the external Diameter agents.

The **hss.diameter.transport** configuration option specifies the underlying transport protocol that is used by the TPOSS HSS Diameter Service. The possible values are:

- `tcp`
- `sctp`

> [!IMPORTANT]
> If you set the **hss.diameter.transport** configuration option to `sctp`, make sure that the `sctp` kernel module is loaded on every node that runs the TPOSS HSS. Most distributions
> do not load it by default, and TPOSS refuses to open the S6a listener when it is missing. To load it, run this command on the node:
>
> ```bash
> sudo modprobe sctp
> ```
>
> To load the module on every boot, run this command:
>
> ```bash
> echo sctp | sudo tee /etc/modules-load.d/sctp.conf
> ```
>
> To check whether the module is already loaded, run `lsmod | grep sctp`. Empty output means it is not.

The **hss.diameter.local_addresses** configuration option specifies the local addresses that the S6a listener binds to. SCTP allows both sides of an association to use several addresses at once, so the association survives the loss of one network path. This is called multi-homing. For example:

```yaml
hss:
  diameter:
    # Local addresses. More than one makes the SCTP association multi-homed.
    local_addresses:
      - "10.0.0.1"
      - "10.0.0.2"
```

A comma-separated string works as well, which is the shorter form for `helm --set-string`, where a list otherwise needs `local_addresses[0]`, `local_addresses[1]` and so on:

```yaml
hss:
  diameter:
    local_addresses: "10.0.0.1,10.0.0.2"
```

Leave **hss.diameter.local_addresses** empty (the default) to bind the address resolved from **hss.diameter.listener** only.

## Configure timeouts for outgoing Diameter requests

When a subscriber attaches to an MME, and this MME is different from one that the subscriber was attached before, TPOSS sends a Diameter S6 `Cancel-Location` request to previous MME that used to serve it. You can use the following configuration option to control how long TPOSS waits for the answer:

```yaml
hss:
  diameter:
    # Timeout in milliseconds for ASR requests.
    clr_timeout: 30000
```

## Number of authentication vectors per request

An MME can request several authentication vectors at once, so it does not have to request them again for every attach. You can limit how many vectors TPOSS returns using the following configuration option:

```yaml
hss:
  auc:
    # The maximum number of the authentication vectors returned by TPOSS HSS.
    max_vectors_per_request: 5
```

The **hss.auc.max_vectors_per_request** configuration option limits the number of vectors TPOSS returns for one Diameter S6a `Authentication-Information` request, even when the MME asks for more than the configured value.

## Prometheus bucket settings

TPOSS provides the following metrics to measure the time that TPOSS needs to handle Diameter requests:

- **diameter_requests_rtt_milliseconds**
- **diameter_if_requests_rtt_milliseconds**

Both of these metrics are [Prometheus histograms](https://prometheus.io/docs/practices/histograms/) for which you can configure buckets using these configuration options:

```yaml
hss:
  diameter:
    # The time values that show how many Diameter S6a requests were handled for that time or less specified by the bucket.
    # The values are translated into Prometheus histogram buckets and are provided in milliseconds.
    # Histogram buckets in milliseconds for S6a request round-trip time.
    rtt_buckets: [10, 30, 50, 75, 100, 125, 150, 200, 250, 300, 400, 500, 750, 1000]
    # The time values that show how many Diameter S6a requests per-interface were handled for that time or less specified by the bucket.
    # The values are translated into Prometheus histogram buckets and are provided in milliseconds.
    if_rtt_buckets: [10, 30, 50, 75, 100, 125, 150, 200, 250, 300, 400, 500, 750, 1000]
```

In addition, TPOSS HSS provides the following metrics to measure RTT of the interaction with the Authentication Centre:

- **hss_auc_vector_rtt_milliseconds**
- **hss_auc_sqn_alloc_rtt_milliseconds metrics**

You can configure the buckets for these histograms using the following configuration options:

```yaml
hss:
  auc:
    # The time values that show how many requests to the Authnetication Centre were handled for that time or less specified by the bucket.
    # The values are translated into Prometheus histogram buckets and are provided in milliseconds.
    rtt_buckets: [10, 30, 50, 75, 100, 1000, 2000]
```

For more information about the HSS metrics, see the [HSS metrics](https://docs.cennso.com/components/tposs/latest/observability/hss.md) section.

## Additional Diameter settings

Here are the additional Diameter configuration options that you can use to control the size of buffers for the underlying sockets of the Diameter connections:

```yaml
hss:
  diameter:
    # Size of the S6a receive buffer in bytes. If unset, the default value is `212992` for TCP
    # and `net.core.rmem_default` for SCTP.
    recbuf: 1048576
    # Size of the S6a send buffer in bytes. If unset, the default value is `212992` for TCP
    # and `net.core.wmem_default` for SCTP.
    sndbuf: 1048576
    # Size of the S6a in-memory request and response buffer in bytes. If unset, the default
    # value is `425984` for TCP and `max(recbuf, sndbuf)` for SCTP.
    buffer: 1048576
```

If any of these configuration options are unset, the default system-level value is used. For receive buffers, it is the value of the `net.core.rmem_default` kernel parameter. For send buffers, it is the value of the `net.core.wmem_default` kernel parameter. If the value of the **hss.diameter.buffer** is unset, the maximum value of the **hss.diameter.recbuf** and **hss.diameter.sndbuf** is used.
