Skip to content

Sync policy rules to a firewall

This page is about a FortiGate, Sophos Firewall or LANCOM R&S®Unified Firewall in front of a gateway asset's networks, to which the asset writes the access rules itself. It is not the page about a firewall in front of the agent that blocks XplicitTrust traffic: for that, see Firewalls, proxies and TLS inspection.

A gateway asset often sits behind a firewall that separates it from the networks it fronts: the virtual assets and subnets it provides access to live on the far side of that firewall. Every policy that grants access to such a destination then needs a matching rule on the firewall, and every policy change needs the rule changed.

Firewall sync lets the gateway asset do that itself. For each policy that grants access to a virtual asset or subnet behind the gateway, the asset creates the address objects, the service and one allow rule on the firewall, keeps them in step with the policy, and removes them when the policy goes. The asset talks to the firewall over its own LAN; the firewall's management API is never exposed to the internet, and the credentials for it are never stored on the XplicitTrust servers.

Firewall Sync Firewall Sync

Supported firewalls:

Firewall Interface Credentials Since
Fortinet FortiGate FortiOS REST API API key of a REST API administrator agent 1.136
Sophos Firewall (SFOS) SFOS XML API Username and password of an API administrator agent 1.139
LANCOM R&S®Unified Firewall (LCOS FX) LCOS FX REST API of the web client Username and password of an administrator agent 1.139

In short

Create an API administrator on the firewall with the rights the sync needs, enter the firewall's management URL on the gateway asset's FW Sync tab, hand over the API key (FortiGate) or the administrator's login (Sophos Firewall, LANCOM), and pin the firewall's certificate. The asset then keeps one allow rule per policy and destination in step with your policies.

How it works

The gateway asset receives, with its configuration, the list of destinations behind it that policies grant access to, together with the services of those policies. From that it maintains on the firewall:

  • an address object for each destination (a host or a network) and one for the gateway's own address toward it,
  • a service object for each service definition a policy uses, reusing the firewall's predefined services (such as HTTPS) where they match,
  • one allow rule per policy and destination, from the gateway's address to the destination for that service. On a LANCOM, this is one connection on the desktop between the gateway's host object and the destination, with one rule per service.

The asset works out where the gateway and each destination sit on the firewall: which interface reaches them and, on a Sophos Firewall, which zone that interface belongs to. A destination that the firewall reaches through the same interface as the gateway is on the gateway's own segment; the firewall is not in that path, and the rule is skipped unless you choose to create such rules anyway. Nothing is created on the firewall for a skipped rule; it is listed so you can see that the destination was considered.

Every object the asset creates carries an ownership marker in its comment or description and a name starting with the configured prefix (xt- by default). Rules are grouped under the section label and placed either before or after your own rules, as configured; a LANCOM has no rule order, so placement does not apply there. The asset never touches objects it does not own, and on removal it deletes exactly the objects it created. Drift introduced on the firewall is repaired every 15 minutes.

How the two firewalls differ:

FortiGate Sophos Firewall LANCOM
Addresses Firewall addresses IP hosts Hosts and networks on the desktop, each bound to the interface that reaches it
Rules match Interfaces, as the firewall's routing table names them Zones of the interfaces that reach the gateway and the destination, worked out from the interfaces, static routes and default gateways A desktop connection between the gateway's host and the destination, one rule per service; the interfaces come from the network connections and routing tables
Rule placement Before or after your rules Before or after your rules No rule order; does not apply
Section label Sequence grouping in the policy list A rule group of that name, holding all the rules the asset created A desktop tag of that name on the hosts and networks the asset created
NAT Disabled on each rule No NAT rule is created; the default masquerading toward WAN does not apply to traffic toward LAN zones Off on each connection rule (the firewall's own default is source NAT)
Applying changes Immediate Immediate Staged on the desktop; the asset activates its own changes at the end of each run
VDOM The VDOM the gateway sits in, or the one configured No VDOMs No VDOMs

Before you start

Gateway asset. A Linux asset that reaches the firewall's management interface over the LAN, running agent 1.136 or newer for a FortiGate and 1.139 or newer for a Sophos Firewall or a LANCOM.

Routing. The destinations must be routed through the firewall. In an HA cluster, use the cluster's management address; each member presents its own certificate, so pin one fingerprint per member (see below).

FortiGate

A REST API administrator for the asset. Use a dedicated administrator with the least privilege the sync needs: read-write on firewall addresses, services and policies, read on the system, network and router tables, no GUI or SSH access, and the trusted host limited to the gateway asset's address. On the FortiGate CLI:

config system accprofile
    edit "xt-sync"
        set sysgrp read
        set netgrp read
        set fwgrp custom
        config fwgrp-permission
            set policy read-write
            set address read-write
            set service read-write
            set schedule read
            set others read
        end
    next
end
config system api-user
    edit "xt-sync"
        set accprofile "xt-sync"
        config trusthost
            edit 1
                set ipv4-trusthost <gateway asset address> 255.255.255.255
            next
        end
    next
end
execute api-user generate-key xt-sync

The key is shown once; copy it for the console. Firewall sync is validated on FortiOS 8.0.2 and uses the REST API paths that exist since FortiOS 6.4. Earlier releases have not been tested.

Sophos Firewall

Sophos Firewall has no API keys: the asset signs in as an administrator with a username and password. Prepare three things in the web admin console:

  1. API access. Under Administration › API access, turn on API configuration and add the gateway asset's LAN address as an allowed IP address (a single address, not a network). Requests from any other address are refused.
  2. A device access profile under Profiles › Device access, for example xt-sync, with every right set to None except:

    Right Level Why
    Objects Read-write IP hosts and services
    Firewall Read-write Rules and rule groups
    Network Read-only Interfaces, zones, VLANs and static routes
    System › Other system configuration Read-only The firewall's hostname for the side panel; optional
  3. An administrator under Authentication › Users: user type Administrator, the profile above, and a strong password of its own. Changes the sync makes then show in the firewall's log under that name.

The asset uses the XML API on the web admin port, 4444 by default. Firewall sync is validated on SFOS 22.0.3. Static routes, VLAN, alias and bridge interfaces, SD-WAN routes, HA pairs and IPv6 have not been tested on a device yet.

LANCOM R&S®Unified Firewall

The asset uses the REST API behind the LCOS FX web client: JSON over HTTPS on the web client port, 3438 by default. LCOS FX has no API keys and no separate API switch; the asset signs in as an administrator and signs out at the end of every run. Prepare two things in the web client:

  1. Web client access. The settings for the web client (in the overview, the gear next to Firewall Access › Webclient Access) also govern the REST API: its port, its certificate and the addresses allowed to connect. If access is restricted, allow the gateway asset's LAN address.
  2. An administrator for the sync alone, with a strong password of its own and only these rights:

    Right Level Why
    Desktop Configuration Read and write Hosts, networks, services, connections and tags on the desktop, and activating the asset's changes
    Server Settings Read Network connections, interfaces and routing tables, and the firewall's hostname
    High Availability Read The high-availability state in the side panel; optional

    Changes the sync makes then show in the firewall's log under that name.

LCOS FX gives write access to one session at a time, and an activation puts every pending desktop change live, whoever made it. The asset therefore never takes write access from someone signed in to the web client, and never activates changes it did not make: a run that finds another administrator signed in with write access, or changes on the desktop waiting for activation, writes nothing, says why, and tries again 15 minutes later. Sign out of the web client when you are done, and activate or discard your own changes.

Firewall sync on a LANCOM is validated on LCOS FX 11.2.2 and supports IPv4 only, as the desktop does. VLAN interfaces, IP ranges, host groups, HA pairs and the traffic path through the firewall have not been tested on a device yet.

On the FW Sync tab, a LANCOM has no VDOM field and no Rule placement; the credentials are the administrator's username and password:

FW Sync tab with LANCOM R&S Unified Firewall chosen FW Sync tab with LANCOM R&S Unified Firewall chosen

Set it up

  1. Open the gateway asset on the Assets page, choose Edit and switch to the FW Sync tab.
  2. Choose the firewall vendor and enter the Management URL of the firewall as reachable from the asset: https://host or https://host:port for a FortiGate, https://host:4444 (the web admin port) for a Sophos Firewall, https://host:3438 (the web client port) for a LANCOM. For a FortiGate, leave VDOM empty unless the API administrator is not bound to a VDOM and the gateway's VDOM is not the one you want; the asset detects the VDOM the gateway sits in. A Sophos Firewall and a LANCOM have no VDOM field.
  3. Review the object name prefix, the rule placement (before or after your own rules; not offered for a LANCOM), what to do with destinations on the asset's own segment, the section label and whether the rules should log all traffic. Save.
  4. Hand over the credentials and choose Hand over to asset: the device API key for a FortiGate, the username and password of the API administrator for a Sophos Firewall or a LANCOM. The asset must be online: the credentials are encrypted for that asset's own certificate, kept for two minutes for it to collect, and discarded. The status moves from waiting for the asset to delivered, verifying.
  5. On its first contact the asset refuses the firewall's management certificate, which is normally self-signed: the status shows The device presented a certificate that is not pinned with the fingerprint it saw. Compare it with the certificate on the firewall (System → Certificates on a FortiGate, Certificates on a Sophos Firewall, the web client's certificate on a LANCOM) and choose Pin the certificate the device presented, then save. The next run verifies the credentials against the device and creates the rules.

FW Sync tab with Sophos Firewall chosen FW Sync tab with Sophos Firewall chosen

The side panel shows the state of the credentials, the last sync, the device the asset found (hostname, model, firmware and, on a FortiGate, serial number, VDOM, operation mode and high availability; on a LANCOM, high availability) and how many rules were applied, skipped or failed. The sync report lists every rule with its outcome and the interfaces it was placed on, with the zone in brackets on a Sophos Firewall. The counts above each rule list filter it: click one to show or hide the rules with that outcome. Skipped rules are hidden at first.

In the asset list, the FW Sync column marks every gateway asset that syncs a firewall, in the colour of its state: green when the sync runs, amber when it is switched on but not active yet, red when it fails. Its filter finds the assets whose sync fails.

Pinning the certificate up front

If you have the SHA-256 fingerprint of the management certificate at hand, add it under Pinned certificate fingerprints before handing over the credentials. Without a pin the certificate has to chain to a public certificate authority.

Verify

  1. On the gateway asset's FW Sync tab, the credentials read delivered, verifying and then verified against the device, and the side panel shows the device the asset found.
  2. The counts show rules applied, skipped and failed. Open the sync report to see every rule with its outcome and the interfaces it was placed on; select skipped to list the skipped rules too.
  3. On the firewall there is one allow rule per policy and destination, with names starting with the prefix (xt- by default): on a FortiGate under the section label in the policy list, on a Sophos Firewall in the rule group named after the section label, on a LANCOM as connections on the desktop between the gateway's host and the destinations, which carry the section label as their tag. The desktop shows no changes waiting for activation afterwards.
  4. Change a policy: the rule follows. Drift on the firewall is repaired every 15 minutes.

If it doesn't work

What you see What it means
not handed over yet Settings saved, no credentials handed over.
waiting for the asset The asset has not collected the credentials yet. It needs to be online; the handoff expires after two minutes.
handoff expired, hand it over again The asset did not collect the credentials in time. Check that the asset is online and its agent recent enough, then hand them over again.
delivered, verifying The asset holds the credentials and has not reached the device yet, or the device's certificate is not pinned. Look at the last sync message.
rejected by the device The firewall refused the API key or the login. Generate a new key, or check the administrator's username and password, and hand them over again.
The device presented a certificate that is not pinned Normal on first contact and after a certificate rotation or a failover. Pin the fingerprint shown after checking it on the firewall.
The API user may not read: (FortiGate) The API administrator's profile lacks read access to the listed tables. Facts from those tables show as unknown; widen the profile as in the prerequisites.
The administrator's profile does not grant: (Sophos Firewall) The device access profile lacks the listed right. Only the hostname is optional; for anything else the sync stops and names the right it needs.
Last sync message mentions API access (Sophos Firewall) API configuration is off, or the asset's address is not an allowed IP address under Administration › API access.
Last sync message says the answer is not the API's XML (Sophos Firewall) The management URL does not point at the web admin port. Use https://host:4444 or the port you moved it to.
… is signed in with write access (LANCOM) Someone holds the web client's write session. The sync does not take it over and tries again on the next run; sign out of the web client.
The desktop has changes waiting for activation (LANCOM) Changes that the sync did not make are pending on the desktop. Activate or discard them in the web client; until then the sync writes nothing.
The administrator lacks … (LANCOM) The administrator is missing Desktop Configuration read and write or Server Settings read. Grant them as in the prerequisites.
Last sync message says the answer is not the API's JSON (LANCOM) The management URL does not point at the web client port. Use https://host:3438 or the port you set for the web client.
Rules skipped The firewall reaches the destination through the same interface as the gateway, so the traffic never passes the firewall and nothing is created for the rule. If every rule is skipped, check that the gateway routes the destinations through the firewall. Choose Create rules anyway for hosts that are routed through the firewall although they share the gateway's prefix.
A destination is missing from the sync report A virtual asset defined by a hostname is synced once the hostname has resolved.
Rules failed The sync report carries the firewall's error for each rule. Common causes are the policy limit of a FortiGate-VM trial license, an administrator without write access to rules, and, on a Sophos Firewall or a LANCOM, a destination for which the firewall has no route. On a LANCOM, a policy that allows every protocol fails too: LCOS FX has no service for all protocols.

Next

Turning it off

Turning the sync off makes the asset remove the rules and objects it created and forget the credentials; the settings stay, so it can be turned on again with new credentials. Remove firewall sync deletes the settings too.

Security notes

  • The credentials are encrypted for the gateway asset's certificate before they leave the console, are held by the asset only and never stored on the XplicitTrust servers. Nothing is written to the device until the credentials and the device's certificate have been verified.
  • The gateway asset holds credentials that can change firewall rules within the administrator's profile. Keep that profile to the rights above, limit the trusted host or allowed API address to the asset, and treat the gateway asset as the sensitive host it is.
  • On a Sophos Firewall, the administrator's password is sent with every request to the firewall, inside the TLS connection to its web admin port. On a LANCOM, it is sent once per run to sign in, inside the TLS connection to the web client port, and the session is closed at the end of the run. Use an administrator for the sync alone, so its password can be changed without touching anyone else's access.
  • There is no way to skip certificate verification. The management certificate is pinned by fingerprint, or it has to chain to a public certificate authority.

See also