Skip to content
Trustaige Docs

Connect a strongSwan VPN gateway to Trustaige

Set up strongSwan 6 as an IKEv2 gateway that passes EAP-TLS to Trustaige RADIUS, takes its disconnects, or checks Trustaige certificates itself.

  • Scale
  • Needs strongSwan 6 with swanctl
  • Needs a fixed public address for the gateway
  • About 30 minutes
  • Rolling out
View as Markdown

strongSwan’s eap-radius plugin passes each connection’s EAP conversation to a RADIUS server without taking part in it. With Trustaige RADIUS as that server, every managed device signs in to the VPN with its Trustaige certificate, and Trustaige decides each connection by the device, its owner, its posture and your policies. The same plugin takes Trustaige’s Disconnect-Requests, so a device that loses its standing is off the VPN within seconds.

Read Connect managed devices to your VPN gateway first for the hub’s side: the VPN network, the one proposal and the gateway’s certificate. Paths below are the package defaults on Linux: /etc/swanctl for connections and credentials, /etc/strongswan.d and /etc/strongswan.conf for the daemon.

Before you start

You needWhy
strongSwan 6 with swanctl and the charon-systemd or charon daemonThe configuration below is swanctl.conf’s.
The eap-radius and eap-identity pluginsOn Debian and Ubuntu they come in libcharon-extra-plugins.
A certificate for the gateway, with its private keyDevices check it before they sign in (see the gateway’s certificate).
A VPN network in the hub, served at a site, with the gateway registered thereThe hub gives you the RADIUS servers, the port and the shared secret.
UDP 500 and 4500 open to the gateway; UDP 1812 and 1813 out to TrustaigeIKE and NAT traversal in; RADIUS and accounting out.

In Trustaige

  1. Add the VPN network with Server set to Trustaige RADIUS, and serve it at the site, as the overview describes.

  2. On the site’s page, under Access points, choose Add access point, then A VPN gateway and strongSwan. Enter the Public address the gateway’s RADIUS requests come from.

  3. Turn on Takes disconnects: strongSwan ends a tunnel on a Disconnect-Request once dae is on, below.

  4. Choose Register gateway, and copy the Server (or Primary server and Secondary server), the Port and the shared secret.

The RADIUS plugin

Give eap-radius Trustaige’s servers, accounting and the dynamic authorization listener. Put it in /etc/strongswan.d/charon/eap-radius.conf, replacing that file’s contents, or in /etc/strongswan.conf:

eap-radius {
    load = yes
    accounting = yes
    accounting_send_class = yes

    servers {
        trustaige1 {
            address = <your-radius-server>
            port = 1812
            acct_port = 1813
            secret = <your-radius-secret>
            nas_identifier = head-office-vpn
        }
    }

    dae {
        enable = yes
        listen = 0.0.0.0
        port = 3799
        secret = <your-radius-secret>
    }
}
  • Set port to the hub’s Port, and acct_port to the port after it. If the hub showed a secondary server, copy trustaige1 as trustaige2 with that address.
  • accounting = yes sends Accounting-Start and Accounting-Stop for every tunnel. Trustaige shows the session under Connected now, and can disconnect only a session it saw in accounting.
  • accounting_send_class = yes returns the Class from Trustaige’s Access-Accept in accounting. It ties the session to the device that signed in; without it, the session appears but can’t be disconnected by device.
  • dae takes Disconnect-Requests, signed with the same shared secret, on the port the site’s page shows beside the gateway (Disconnects on UDP 3799). strongSwan ends every tunnel whose EAP identity matches the request’s User-Name, which Trustaige copies from the gateway’s own accounting.
  • Leave class_group off. Trustaige’s Class names the connection, not a group.

Allow UDP 3799 in to the gateway only from the addresses the hub lists when you choose Disconnects on UDP 3799.

eap-radius {
    load = yes
    accounting = yes
    accounting_send_class = yes

    servers {
        trustaige1 {
            address = <your-radius-server>
            port = 1812
            acct_port = 1813
            secret = <your-radius-secret>
            nas_identifier = head-office-vpn
        }
    }

    dae {
        enable = yes
        listen = 0.0.0.0
        port = 3799
        secret = <your-radius-secret>
    }
}

The connection

connections {
    trustaige-vpn {
        version = 2
        proposals = aes256-sha256-ecp256
        rekey_time = 8h
        pools = trustaige-vpn
        send_cert = always

        local {
            auth = pubkey
            certs = gateway.pem
            id = <your-vpn-gateway>
        }
        remote {
            auth = eap-radius
            eap_id = %any
        }
        children {
            trustaige-vpn {
                local_ts = <your-office-network>
                esp_proposals = aes256gcm16-ecp256
                rekey_time = 1h
            }
        }
    }
}

pools {
    trustaige-vpn {
        addrs = 10.99.0.0/24
        dns = 10.20.0.53
    }
}
  • proposals and esp_proposals are the one proposal. swanctl.conf uses exactly the proposals listed, and adds strongSwan’s defaults only when default is in the list, so nothing else is offered. The ! that marks a strict proposal belongs to the older ipsec.conf and has no place here.
  • send_cert = always sends the gateway’s certificate unasked. Apple devices don’t ask for it, and strongSwan otherwise sends it only when asked.
  • local.certs is the gateway’s certificate in /etc/swanctl/x509/; its key goes in /etc/swanctl/private/, and any intermediate certificates in /etc/swanctl/x509ca/. local.id is the identity devices expect, the Gateway identity on the VPN network’s page.
  • remote.auth = eap-radius passes the EAP conversation to Trustaige. eap_id = %any asks the device for its EAP identity first.
  • local_ts is the VPN’s Office networks, separated by commas, exactly as the hub lists them. Apple devices route only what the gateway offers here. On a VPN that carries All traffic, set local_ts = 0.0.0.0/0, ::/0.
  • pools hands each device an address. Choose a range your office routes back to the gateway, and the DNS servers you entered in the hub.

Load everything, then check that the connection and the pool are there:

sudo systemctl restart strongswan
sudo swanctl --load-all
sudo swanctl --list-conns

When disconnects can’t reach the gateway

If the gateway is behind NAT that Trustaige’s Disconnect-Requests can’t cross, turn Takes disconnects off in the hub instead and choose an interval under Connections sign in again every. Trustaige then caps each connection’s Session-Timeout at that interval, and strongSwan enforces it by re-authentication: the device signs in again, and Trustaige decides it again. Keep accounting = yes, so sessions still appear under Connected now.

connections {
    trustaige-vpn {
        version = 2
        proposals = aes256-sha256-ecp256
        rekey_time = 8h
        pools = trustaige-vpn
        send_cert = always

        local {
            auth = pubkey
            certs = gateway.pem
            id = <your-vpn-gateway>
        }
        remote {
            auth = eap-radius
            eap_id = %any
        }
        children {
            trustaige-vpn {
                local_ts = <your-office-network>
                esp_proposals = aes256gcm16-ecp256
                rekey_time = 1h
            }
        }
    }
}

pools {
    trustaige-vpn {
        addrs = 10.99.0.0/24
        dns = 10.20.0.53
    }
}
sudo systemctl restart strongswan
sudo swanctl --load-all
sudo swanctl --list-conns

Check it works

  1. Watch the daemon’s log on the gateway: sudo swanctl --log.
  2. Connect from a managed device that has received the VPN. The log shows the IKE proposal chosen, sending RADIUS Access-Request and RADIUS authentication of '…' successful, then the tunnel’s traffic selectors.
  3. sudo swanctl --list-sas lists the tunnel. In the hub, the site’s Recent joins and the network’s Recent connections show the decision, and Connected now shows the session.
  4. Block the device in the hub. The log shows the Disconnect-Request and the tunnel closing; the hub records the disconnect as delivered.

The gateway checks the certificate

For a VPN whose Server is The gateway checks the certificate, strongSwan authenticates the device certificate itself and asks Trustaige for its status over OCSP. Nothing is registered at a site; the network’s Your VPN gateway page has what strongSwan needs. See A gateway that checks the certificate for what changes for devices.

  1. On the network’s page, open Your VPN gateway, then Trust bundle, revocation and gateway guides, and download the trust bundle.

  2. Put each authority in its own file in /etc/swanctl/x509ca/:

    cd /etc/swanctl/x509ca
    sudo awk '/BEGIN CERTIFICATE/{n++} n{print > ("trustaige-network-" n ".pem")}' \
      ~/acme-network-intermediates.pem

    Replace the path with the file you downloaded. During a rollover the bundle holds two authorities; download it again and repeat when the hub lists a new one.

  3. Check that the revocation and curl plugins are loaded: sudo swanctl --stats lists them. revocation reads the OCSP address from each device certificate, and curl fetches it over HTTPS, the only scheme Trustaige’s status addresses answer on.

  4. Change the connection’s remote section:

            remote {
                auth = pubkey
                cacerts = trustaige-network-1.pem, trustaige-network-2.pem
                revocation = strict
            }
    • cacerts admits only certificates your organization’s authorities issued. It doesn’t admit another organization’s devices, as the platform root alone would.
    • revocation = strict refuses a device whose status can’t be fetched, as well as one Trustaige reports revoked or on hold.
  5. Remove the eap-radius servers if nothing else uses them, then reload with sudo swanctl --load-all.

strongSwan checks status when the tunnel is set up and at each re-authentication. A device that loses its standing is refused at its next connection; one already connected stays until then. To bound that, set reauth_time on the connection, for example reauth_time = 1h, in place of rekey_time.

Troubleshooting

The log says “no acceptable proposal found” or “received proposals … configured proposals …”

The device and the gateway disagree on the suite. Check proposals and esp_proposals letter for letter, including ecp256 in esp_proposals, which is the tunnel’s PFS group.

The log says “RADIUS server is not responding”

Nothing came back from Trustaige. Check that outbound UDP to the hub’s port is allowed, that the gateway is registered at the address its requests come from, and the shared secret: Trustaige drops a request it can’t authenticate without answering.

The log says “RADIUS authentication of '…' failed”

Trustaige refused the device. The site’s Recent joins or Devices › Networks › Activity gives the reason, such as a device that isn’t assigned to the VPN or a certificate that was revoked.

The device fails right after IKE_SA_INIT, with no RADIUS request in the log

The device didn’t accept the gateway’s certificate, or the identity it asked for isn’t local.id. Check the certificate’s subject alternative names and serverAuth, and that /etc/swanctl/x509ca/ holds its intermediates.

The hub shows a Disconnect-Request as not acknowledged

strongSwan found no tunnel for the request’s User-Name, or didn’t receive it. Check that accounting = yes is set, that UDP 3799 is open from Trustaige’s addresses, and that dae.secret is the shared secret. A tunnel still being set up is skipped; Trustaige’s next request reaches it.

With the gateway's check, the log says “no trusted … public key found”

The device certificate doesn’t chain to an authority in cacerts, or its IKE identity isn’t in the certificate. Download the bundle again and load every authority in it. See What hasn’t been confirmed yet for Apple devices.

What hasn’t been confirmed yet

  • Trustaige’s lab hasn’t yet recorded a strongSwan gateway checking an Apple device’s certificate itself. Apple devices send their IKE identity as tq- followed by the device ID, the device certificate’s common name, and strongSwan requires that identity in the certificate’s subject or alternative names. Use Trustaige RADIUS for Apple devices on strongSwan until this is confirmed.
  • How strongSwan treats an OCSP answer of revoked with the reason certificateHold hasn’t been recorded in the lab. Trustaige sends that answer for a device that lost its standing, and expects a refusal.