> 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/radius.md).

# RADIUS settings

TPOSS receives RADIUS requests from a packet gateway (PGW) to authorize sessions and maintain their state based on RADIUS accounting requests. To enable receiving the incoming RADIUS requests, you must specify RADIUS listeners in the TPOSS configuration.

For example:

```yaml
radius:
  # RADIUS authorization listener
  auth_listen: 0.0.0.0:1812
  # RADIUS accounting listener
  acct_listen: 0.0.0.0:1813
```

TPOSS RADIUS servers accept only RADIUS requests from the known source addresses. You can configure this behavior using these configuration options:

```yaml
radius:
  auth_source:
    # Specifies source addresses for RADIUS authorization requests from PGW
    ggsn:
      - PGW-AUTH:secret@192.0.2.0/24
    # Specifies source addresses for RADIUS authorization requests from SMF/TDF
    scg:
      - SCG-AUTH:secret@198.51.100.0/24
  acct_source:
    # Specifies source addresses for RADIUS accounting requests from PGW
    ggsn:
      - PGW-ACCT:secret@192.0.2.0/24
    # Specifies source addresses for RADIUS accounting requests from SMF/TDF
    scg:
      - SCG-ACCT:secret@198.51.100.0/24
```

> [!CAUTION]
> Most RADIUS metrics have labels that specify the NAS name (`PGW-AUTH`, `PGW-ACCT`, `SCG-AUTH`, and `SCG-ACCT` in the example above) and source IP of the incoming request. Setting wide IP ranges in the configuration of the accepted source addresses may lead to high resource consumption and performance degradation.

The configuration example above represents four source ranges from where the incoming RADIUS requests can be accepted. The format of each `auth_source` or `acct_source` is:

```yaml
source-key:
  - [NAS-Identifier]:secret@source-ip-address[/N]
```

The `source-key` can be one of:

- `ggsn`
- `scg`
- `ruckus`

`NAS-Identifier` is optional and used in [RADIUS metrics](https://docs.cennso.com/components/tposs/latest/observability/radius.md#radius-server-metrics), if defined. If the `NAS-Identifier` is not defined in the RADIUS source, the value of the `nas_id` label in the RADIUS-related metrics is constructed by combining `auth` or `acct` with the source IP address of the incoming request.

For example, the configuration of the RADIUS sources below may produce the metric **radiusServAcctUpdateRequests{nas_id="auth_192.0.2.1"} 206** for the RADIUS request received from the `192.0.2.1` address:

```yaml
radius:
  auth_source:
    ggsn:
      - secret@192.0.2.0/24
```

The `secret` part is a shared secret (password) exchanged between the client and the RADIUS server. The source itself is represented by the IP address or the range of IP addresses. The range of IP addresses consists of an IP address and a subnet mask.

Both authorization and accounting listeners may track time of the incoming requests handling. For this purpose, you can configure the [Prometheus histograms buckets](https://prometheus.io/docs/practices/histograms/) using this option:

```yaml
radius:
  # The time values that show how many RADIUS requests were handled for that time or less.
  # The values are translated into Prometheus histogram buckets and are provided in milliseconds.
  rtt_histogram_buckets: "10, 30, 50, 75, 100, 1000, 2000"
```

As TPOSS does not only receive RADIUS requests but also may send RADIUS Disconnect requests towards PGWs, provide the addresses of PGWs or RADIUS agents that are able to forward requests towards PGW:

```yaml
radius:
  # List of RADIUS CoA/Disconnect endpoints
  connect_coa: secret@eradiusd-1-rpr:3799, secret@eradiusd-2-rpr:3799
```

The **radius.disconnect_request_retries** and the **radius.disconnect_request_timeout** configuration options are applicable only if TPOSS can send RADIUS Disconnect request towards PGW (**radius.ggsn_creation_on_accounting** set to `false`):

```yaml
radius:
  # Number of tries to re-send RADIUS Disconnect requests.
  # Applicable only if **radius.ggsn_creation_on_accounting** is set to `false`.
  disconnect_request_retries: 3
  # Timeout in milliseconds that specifies how long TPOSS waits for the RADIUS Disconnect responses.
  # Applicable only if **radius.ggsn_creation_on_accounting** is set to `false`.
  disconnect_request_timeout: 5000
```

When TPOSS receives RADIUS requests, it stores them in a cache to avoid duplicated requests. The following configuration option represents how long such requests are preserved by TPOSS:

```yaml
# Timeout in milliseconds that specifies how long to store a response in a cache
radius:
  resend_timeout: 5000
```

If the RADIUS request fails and TPOSS does not receive a response, TPOSS may re-send the request. You can specify the number of tries to re-send the RADIUS request and the request timeout using the following configuration options:

```yaml
radius:
  # Number of tries to re-send RADIUS Accounting requests.
  # Applicable only in the environments with vSCG (**scg.diameter.enabled**, **sbi.enabled**, and **cdmp.enabled** set to `false`).
  request_retries: 3
  # Timeout in milliseconds that specifies how long TPOSS waits for the RADIUS Accounting responses.
  # Applicable only in the environments with vSCG (**scg.diameter.enabled**, **sbi.enabled**, and **cdmp.enabled** set to `false`).
  request_timeout: 5000
```

The **radius.request_retries** and the **radius.request_timeout** configuration options are applicable in environments where [PCEF](https://docs.cennso.com/components/tposs/latest/glossary.md#telecom-abbreviations) uses only RADIUS. In such environments, Diameter, [SBI](https://docs.cennso.com/components/tposs/latest/configuration/sbi/sbi.md), and [CDMP](https://docs.cennso.com/components/tposs/latest/configuration/cdmp/cdmp.md) interface support is usually disabled (**scg.diameter.enabled**, **sbi.enabled**, and **cdmp.enabled** set to `false`).

In addition, you can specify the size of the UDP buffer using the following configuration option:

```yaml
radius:
  # radius.recbuf -- Size of the receive buffer in bytes.
  recbuf: "204800"
```
