Skip to content
Trustaige Docs

Connect a MikroTik VPN gateway to Trustaige

Set up RouterOS 7 as an IKEv2 gateway that passes EAP-TLS to Trustaige RADIUS and takes its disconnects, or checks Trustaige device certificates itself.

  • Scale
  • Needs RouterOS 7
  • Needs a fixed public address for the router
  • About 30 minutes
  • Rolling out
View as Markdown

RouterOS’s IPsec identities can pass a connection’s EAP conversation through to a RADIUS server (auth-method=eap-radius, RFC 3579). With Trustaige RADIUS as that server, managed devices connect with their Trustaige certificate, and Trustaige decides every connection by the device, its owner, its posture and your policies. RouterOS also takes Disconnect-Requests from RADIUS, so a device that loses its standing can be taken off the VPN in 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.

Before you start

You needWhy
RouterOS 7The commands below are RouterOS 7’s.
A certificate for the router, with its private keyDevices check it before they sign in (see the gateway’s certificate). RouterOS also requires a Subject Key Identifier in it.
A VPN network in the hub, served at a site, with the router registered thereThe hub gives you the RADIUS servers, the port and the shared secret.
UDP 500 and 4500 open to the router; 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 MikroTik. Enter the Public address the router’s RADIUS requests come from.

  3. Turn on Takes disconnects. The router takes Disconnect-Requests once incoming RADIUS is on, below.

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

On the router

  1. Import the router’s certificate with its key. Upload the PKCS #12 file under Files, then:

    /certificate import file-name=vpn-gateway.p12 passphrase="…" name=trustaige-vpn-gateway

    Import any intermediate that issued it the same way, so the router sends it with its own.

  2. Add Trustaige RADIUS for IPsec, with accounting:

    /radius add service=ipsec address=<your-radius-server> secret="<your-radius-secret>" \
        authentication-port=1812 accounting-port=1813 comment=trustaige
    /ip ipsec settings set interim-update=5m
    • Set authentication-port to the hub’s Port, and accounting-port to the port after it. If the hub showed a secondary server, add a second entry with that address.
    • RouterOS sends accounting for IPsec by default, and returns Trustaige’s Class in it unchanged. Trustaige shows each session under Connected now, and can disconnect only a session it saw in accounting. interim-update keeps the session’s figures current.
    • require-message-auth stays at its default, which Trustaige meets: it signs every reply.
  3. Take Disconnect-Requests on the port the hub shows beside the gateway (Disconnects on UDP 3799). RouterOS listens on 1700 unless told otherwise:

    /radius incoming set accept=yes port=3799

    Allow UDP 3799 in from the addresses the hub lists when you choose Disconnects on UDP 3799, and from nowhere else.

  4. The proposal. The IKE half goes in a profile, the tunnel half in a proposal. These are the one proposal and nothing else:

    /ip ipsec profile add name=trustaige-vpn hash-algorithm=sha256 enc-algorithm=aes-256 \
        dh-group=ecp256 lifetime=8h
    /ip ipsec proposal add name=trustaige-vpn auth-algorithms=sha256 enc-algorithms=aes-256-gcm \
        pfs-group=ecp256 lifetime=1h

    With AES-GCM the tunnel needs no separate integrity algorithm; auth-algorithms is kept to one value so nothing else is offered.

  5. Addresses, DNS and routes for devices:

    /ip pool add name=trustaige-vpn ranges=10.99.0.10-10.99.0.250
    /ip ipsec mode-config add name=trustaige-vpn address-pool=trustaige-vpn \
        split-include=<your-office-network> system-dns=no static-dns=10.20.0.53
    /ip ipsec policy group add name=trustaige-vpn
    /ip ipsec policy add group=trustaige-vpn template=yes src-address=<your-office-network> \
        dst-address=10.99.0.0/24 proposal=trustaige-vpn
    • The pool and DNS server are your own. Choose a range the office routes back to the router.
    • Add one policy template, and one split-include entry, for each of the VPN’s Office networks. The template’s src-address is what the router offers devices as its side of the tunnel, and Apple devices route only that. On a VPN that carries All traffic, use 0.0.0.0/0 and leave split-include out.
  6. The peer and the identity:

    /ip ipsec peer add name=trustaige-vpn exchange-mode=ike2 passive=yes profile=trustaige-vpn
    /ip ipsec identity add peer=trustaige-vpn auth-method=eap-radius \
        certificate=trustaige-vpn-gateway generate-policy=port-strict \
        mode-config=trustaige-vpn policy-template-group=trustaige-vpn

    auth-method=eap-radius authenticates the router by its certificate and passes the device’s EAP-TLS through to Trustaige. Devices expect the router to identify itself as <your-vpn-gateway>, the Gateway identity on the VPN network’s page, which must be a subject alternative name of its certificate.

Check it works

  1. Turn on logging for IPsec and RADIUS:

    /system logging add topics=ipsec,!packet
    /system logging add topics=radius,debug
  2. Connect from a managed device that has received the VPN. The log shows the proposal chosen, the RADIUS exchange with Trustaige and the identity matched.

  3. /ip ipsec active-peers print lists the device. 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. With Takes disconnects on, its peer leaves /ip ipsec active-peers within seconds.

If the device stays connected, RouterOS didn’t act on the Disconnect-Request. Turn Takes disconnects off in the hub and choose an interval under Connections sign in again every, so Trustaige caps each connection’s Session-Timeout at that interval.

The gateway checks the certificate

For a VPN whose Server is The gateway checks the certificate, the router authenticates the device certificate itself. Nothing is registered at a site. See A gateway that checks the certificate for what changes for devices.

  1. Import your authorities as trusted, and nothing above them. On the network’s page, open Your VPN gateway, download the trust bundle, upload it under Files, then:

    /certificate import file-name=acme-network-intermediates.pem trusted=yes

    Don’t import the platform root as trusted: it signs every organization’s authority, so the router would admit other organizations’ devices.

  2. Change the identity to authenticate the device by its certificate:

    /ip ipsec identity set [find peer=trustaige-vpn] auth-method=digital-signature \
        remote-id=ignore

    The router still checks that the device certificate chains to a trusted authority. remote-id=ignore stops it comparing the device’s IKE identity with the certificate: Apple devices send tq- followed by the device ID, which the certificate carries as its common name, not as an alternative name. Keep no other authorities trusted on this router, since any of them would be accepted.

  3. Turn on CRL checking, and look for your authority’s CRL:

    /certificate settings set crl-use=yes crl-download=yes
    /certificate crl print

    If the list doesn’t show a CRL from id.trustaige.com after a few minutes, the router can’t fetch it, and can’t see revocations.

Troubleshooting

The log shows “no suitable proposal found”

The profile or proposal differs from the device’s suite. Check enc-algorithm=aes-256, hash-algorithm=sha256 and dh-group=ecp256 on the profile, and enc-algorithms=aes-256-gcm with pfs-group=ecp256 on the proposal.

The device refuses the router before any RADIUS request

The device didn’t accept the router’s certificate. Check its subject alternative names against the Gateway identity, serverAuth, the Subject Key Identifier, and that its intermediate is imported.

The RADIUS log shows a timeout

Nothing came back from Trustaige. Check that outbound UDP to the hub’s port is allowed, that the router is registered at the address its requests come from, and the shared secret.

The hub shows a Disconnect-Request as not acknowledged

The router didn’t take it. Check /radius incoming (accept=yes, port 3799), the firewall, and that accounting is reaching Trustaige: Connected now lists the session only then.

The tunnel comes up, but some office networks are unreachable

A policy template or split-include entry is missing for one of the VPN’s Office networks. Add one for each.

What hasn’t been confirmed yet

  • Trustaige’s lab hasn’t yet recorded RouterOS ending an IPsec tunnel on a Disconnect-Request, nor acting on Session-Timeout for one. The live test above shows which your router does.
  • Whether a policy template narrower than 0.0.0.0/0 makes RouterOS offer only the office networks to Apple devices hasn’t been recorded in the lab. MikroTik notes that a narrowed template can trouble some clients.
  • Whether RouterOS accepts an authority below a root as its trust anchor, without the root itself, hasn’t been recorded in the lab.

MikroTik documentation

  • IPsec: profiles, proposals, identities and the IKEv2 EAP RADIUS road warrior
  • Certificates: import and CRL settings
  • RADIUS: services and incoming requests