# Forward a network from FreeRADIUS to Trustaige RADIUS

> Keep FreeRADIUS 3.2 for the networks it serves, and proxy one new SSID to Trustaige RADIUS with a home server pool, a realm and one authorize rule.

Source: https://docs.trustaige.com/manage/forward-from-freeradius

Replace these placeholders with your organization's own values:

- `<your-ssid>`: Network name (SSID), for example `Acme-Secure`. The Wi-Fi name the network broadcasts, as entered in the hub.
- `<your-radius-server>`: Trustaige RADIUS server, for example `203.0.113.10`. The Server, or Primary server, the hub shows when you register your RADIUS server at a site.
- `<your-radius-secret>`: RADIUS shared secret, a secret. The hub shows it once, when you register your RADIUS server at a site.

FreeRADIUS can admit Trustaige devices itself, as [Admit Trustaige devices on
FreeRADIUS](/manage/own-radius-freeradius) shows. Forwarding is the other
path: FreeRADIUS proxies one new SSID to Trustaige RADIUS, which checks the
device's certificate, its owner and its posture on every join, and answers
through FreeRADIUS. Every other request is handled as it is today.

1. Device → Access point: joins the new SSID
2. Access point → FreeRADIUS: Access-Request, Called-Station-Id ends in the SSID
3. FreeRADIUS → Trustaige RADIUS: Proxy-To-Realm sends it to the trustaige realm
4. Device ↔ Trustaige RADIUS: EAP-TLS, carried by the access point and FreeRADIUS
5. Trustaige RADIUS → FreeRADIUS: Access-Accept or Access-Reject
6. FreeRADIUS → Access point: passed back

The TLS session runs between the device and Trustaige RADIUS. FreeRADIUS
relays it and can't read it.

## Before you start

| You need | Why |
|---|---|
| FreeRADIUS 3.2, already serving your access points as clients | It stays their RADIUS server. |
| A [site connector](/manage/conduit) on the office network, a fixed public address for FreeRADIUS, or RadSec | FreeRADIUS forwards to the connector on the office network, straight to Trustaige from its public address, or over TLS with a certificate the hub issues. |
| Access points that send the SSID in `Called-Station-Id` | FreeRADIUS and Trustaige both tell the network apart by it, written as the access point's MAC, a colon, then the SSID. |

## In Trustaige

1. **Add the network.** Open **Devices › Networks**, choose **Add network**,
   and enter the new SSID. At **Server**, choose **Trustaige RADIUS**.

2. **Connect a site.** Open **Devices › Networks › Sites** and connect a site
   for the office FreeRADIUS serves. At **How it connects**, choose:
   - **Site connector**, the recommended route: install Conduit on the office
     network and turn on RADIUS on the connector.
   - **Access points send RADIUS**: allow outbound UDP 1812, and 1813 for
     accounting, from FreeRADIUS's fixed public address.
   - **Controller over RadSec**: FreeRADIUS connects to TCP 2083 over TLS, and
     its address may change.

3. **Register FreeRADIUS.** At **Access points**, choose **Your RADIUS
   server**, then **FreeRADIUS**, and name it.
   - Behind a connector, enter its **Office network address**; otherwise its
     **Public address**.
   - At a RadSec site, paste a certificate signing request instead. Make one
     on the FreeRADIUS server; the private key stays there:

     ```bash title="On the FreeRADIUS server"
     cd /etc/freeradius/3.0/certs
     openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes \
       -keyout trustaige-client.key -out trustaige-client.csr -subj "/CN=freeradius"
     ```

4. **Disconnects.** Leave **Passes disconnects on to its access points** off
   unless FreeRADIUS proxies Disconnect-Requests to your access points (see
   [Passing disconnects on](#passing-disconnects-on)). With it off, choose
   under **Devices sign in again every**: 15 minutes, 30 minutes, 1 hour (the
   default) or 4 hours. Every Access-Accept then carries a `Session-Timeout`
   no longer than that, with `Termination-Action` set to `RADIUS-Request`; a
   device that lost its standing is refused when it signs in again.

5. **Copy the values.** For RADIUS: the **Server** (or **Primary server** and
   **Secondary server**), the **Port**, and the shared secret, shown once. At
   a RadSec site: the servers, port `2083`, the **Controller certificate**
   and the **Server roots to trust**.

6. **Networks.** Serve the new network at this site, and leave **Live test**
   open while you set up FreeRADIUS.

## In FreeRADIUS

Paths below are Debian's and Ubuntu's (`/etc/freeradius/3.0`); other systems
use `/etc/raddb`.

1. **Add Trustaige as home servers, a pool and a realm.** Add these to
   `proxy.conf`, with the shared secret from the hub in `secret`. If the hub
   showed a secondary server, copy `trustaige1` as `trustaige2` with that
   address.

   ```txt title="proxy.conf"
   home_server trustaige1 {
       type = auth+acct
       ipaddr = <your-radius-server>
       port = 1812
       secret = <your-radius-secret>
       require_message_authenticator = yes
       status_check = status-server
   }

   home_server_pool trustaige {
       type = fail-over
       home_server = trustaige1
   }

   realm trustaige {
       pool = trustaige
       nostrip
   }
   ```

   - `type = auth+acct` sends Access-Requests to `port` and accounting to the
     port after it. Set `port` to the **Port** from the hub; behind a
     connector it may not be `1812`.
   - `require_message_authenticator = yes` refuses a reply without
     Message-Authenticator. Trustaige signs every reply with it.
   - `status_check = status-server` lets FreeRADIUS tell a live server
     from a dead one: Trustaige answers a signed Status-Server with an
     Access-Accept, and counts it as no join.

2. **Send the SSID's requests to the realm.** In
   `sites-available/default`, add this to `authorize`, after `suffix` and
   before `eap`:

   ```txt title="sites-available/default" {4-8}
   authorize {
       ...
       suffix
       if (&Called-Station-Id =~ /:<your-ssid>$/) {
           update control {
               &Proxy-To-Realm := trustaige
           }
       }
       eap {
           ok = return
       }
       ...
   }
   ```

   The order matters: with `Proxy-To-Realm` already set, the `eap` module
   leaves the conversation for Trustaige instead of starting one itself. If
   the SSID has `.`, `(`, `)`, `[`, `+`, `*`, `?` or `$` in it, put `\`
   before each.

   Match `Called-Station-Id` itself, and put the rule before
   `rewrite_called_station_id` if your configuration calls it. That policy
   moves the SSID out of `Called-Station-Id` into `Called-Station-SSID`, an
   attribute FreeRADIUS keeps to itself, so the forwarded request would reach
   Trustaige without the SSID.

3. **Forward accounting, if you want it.** Add the same rule to `preacct`,
   after `suffix`. Trustaige then records each session and shows it under
   **Connected now** on the site's and the network's pages.

4. **Check the configuration and restart.** Run `freeradius -XC` (or
   `radiusd -XC`), then restart the service.

### Over RadSec

At a RadSec site, use a TLS home server in place of `trustaige1`. Copy the
**Controller certificate** to `certs/trustaige-client.pem` and the **Server
roots to trust** to `certs/trustaige-radius-roots.pem`, beside the key you
made. FreeRADIUS must be built with TLS support for proxying, as
`sites-available/tls` needs.

```txt title="proxy.conf"
home_server trustaige1 {
    type = auth
    ipaddr = <your-radius-server>
    port = 2083
    proto = tcp
    secret = radsec
    nonblock = yes
    require_message_authenticator = yes
    status_check = status-server

    tls {
        private_key_file = ${certdir}/trustaige-client.key
        certificate_file = ${certdir}/trustaige-client.pem
        ca_file = ${certdir}/trustaige-radius-roots.pem
    }
}
```

`radsec` is the shared secret RFC 6614 fixes for RADIUS over TLS. The pool,
realm and `authorize` rule stay as above.

## On your access points

Add the new SSID with WPA3-Enterprise or WPA2-Enterprise, as you chose in the
hub, and the same RADIUS server they use today: FreeRADIUS. Keep accounting
on to see sessions in Trustaige.

## Passing disconnects on

Trustaige can end a session in seconds with a Disconnect-Request, but only
FreeRADIUS can reach the access point. Turn on **Passes disconnects on to its
access points** only once FreeRADIUS does that:

- it listens for Disconnect-Requests, as the `coa` virtual server in
  `sites-available/coa` does, with Trustaige's addresses as clients and the
  same shared secret;
- in `recv-coa`, it proxies each one to the access point that holds the
  session, a home server of `type = coa`. Trustaige's request carries the
  session's `Acct-Session-Id`, `Calling-Station-Id`, `User-Name` and the
  `NAS-Identifier` the access point sent in its accounting;
- it forwards accounting, since Trustaige can disconnect only a session it
  saw in accounting.

With the switch on, the server's row on the site's page shows **Disconnects
on UDP 3799**; choose it to change the port, and to see where Trustaige's
requests come from. With the switch off, Trustaige sends FreeRADIUS no
Disconnect-Request: **Disconnect now** ends the session when the device next
signs in.

## Check it works

- `freeradius -X` shows the request entering the `trustaige` realm and the
  reply coming back.
- **Live test** in the hub shows FreeRADIUS as heard from and the join as it
  happens. **Devices › Networks › Activity** reads "via" the access point,
  "forwarded by" FreeRADIUS.

## Troubleshooting

**The debug output shows the request handled locally**

The rule didn't match, or it runs after `eap`. Check the order in
`authorize`, and that `Called-Station-Id` in the debug output ends with a
colon and the SSID, exactly, including case.

**FreeRADIUS marks the home server dead**

Nothing came back from Trustaige. Check the connector is online, or that
outbound UDP 1812 (TCP 2083 for RadSec) is allowed, then the shared secret:
Trustaige drops a request it can't authenticate without answering, and that
includes a Status-Server signed with another secret.

**Activity says “An access point that is not registered sent a request.”**

Trustaige received the request from an address that isn't registered at the
site. Register the address FreeRADIUS forwards from; behind a connector,
**Live test** lists the addresses the connector heard.

**Activity says “The access point asked for a network this site does not serve.”**

The SSID in the request isn't one the site serves, or it was stripped from
`Called-Station-Id` before forwarding. Serve the network at the site, and
check that `rewrite_called_station_id` doesn't run before the rule.

## What hasn't been confirmed yet

Trustaige's lab hasn't yet recorded accounting over RadSec from FreeRADIUS,
which is why the TLS home server above is `type = auth`. Forward accounting
over RADIUS, or leave it off at a RadSec site.

## FreeRADIUS documentation

- [`proxy.conf` in FreeRADIUS 3.2](https://github.com/FreeRADIUS/freeradius-server/blob/v3.2.x/raddb/proxy.conf)
- [`sites-available/tls`: RadSec home servers](https://github.com/FreeRADIUS/freeradius-server/blob/v3.2.x/raddb/sites-available/tls)
- [`sites-available/coa`: receiving and proxying Disconnect-Requests](https://github.com/FreeRADIUS/freeradius-server/blob/v3.2.x/raddb/sites-available/coa)
- [`policy.d/canonicalization`: `rewrite_called_station_id`](https://github.com/FreeRADIUS/freeradius-server/blob/v3.2.x/raddb/policy.d/canonicalization)
