OPNexusdocs

Adopting aliases and NAT from the firewall

Like rules, aliases and NAT rules (port forward, 1:1, outbound) that were created by hand in OPNsense can be adopted: on the respective page Adopt from firewall, choose the firewall, then either an object with Adopt or all of them at once with Adopt all adoptable. This brings an existing firewall under central management without retyping.

Adopting writes nothing to the firewall. OPNexus reads the object fresh from the firewall, creates it centrally (target: exactly this firewall) and remembers the UUID from OPNsense. That is why the preview shows "no change" right afterwards, and the next rollout after a change updates the same object instead of creating a second one. Adopting appears in the audit log; operators may adopt (it only creates central entries), read-only users may not.

What would distort the model is not adopted. The interface names the reason per object:

ObjectNot adoptable because …
AliasesOPNsense-internal (bogons, sshlockout, __lan_network …); type unknown to OPNexus (URL, URL table, GeoIP, dynamic IPv6 hosts, OpenVPN group, "External"); the name already exists in OPNexus; name with special characters; BGP ASN with IPv4/IPv6 restriction; reference to an alias that has not been adopted
Port forwardseveral or no interface; IP version neither IPv4 nor IPv6; protocol "any"; "No redirect"; no target; linked filter rule; inverted source or destination; unknown NAT reflection value; description missing
1:1 NATseveral or no interface; unknown type or NAT reflection value; mandatory fields or description missing
Outbound NATseveral or no interface; "No NAT" rule (nonat); IP version neither IPv4 nor IPv6; description missing

Automatically generated NAT rules (anti-lockout, "Auto created rule") never appear in the list. Nested aliases: an alias that contains another, not yet adopted alias waits for it; "Adopt all adoptable" adopts both in the right order, individually the contained alias first. If it refers to an alias that can never be adopted (e.g. of type URL), it stays behind with that reason. Outbound NAT can only be adopted if the firewall's outbound mode is hybrid or manual; in automatic mode OPNsense does not show manual rules at all, OPNexus then points this out and does not change the mode.

Settings that OPNexus does not manage (logging and pool options on port forwards, tags, categories, static NAT port) are never overwritten and are shown in the dialog as "Stays unchanged on the firewall".

If the same rule, alias or NAT rule exists on several firewalls (typically: both nodes of an HA cluster, several sites with the same policy), you adopt it once and link it on the other firewalls to the central object. This applies to rules, aliases, port forwards, 1:1 NAT and outbound NAT.

  1. Adopt normally on the first firewall.
  2. In the dialog choose the second firewall. For every entry that matches a central object exactly, it says "Already exists centrally" and offers the action Link (next to Adopt as separate object). Linking adds the firewall as a further target to the object and remembers the UUID there. Nothing is changed on the firewall.
  3. The preview then shows "no change" for this firewall. You deploy a later change to the object as usual for all targets together; no duplicate is created.

What "exactly" means: all fields managed by OPNexus are equal after the {{VARIABLES}} of the central object have been replaced with the values of this firewall (so an alias {{LAN_NET}} matches 192.168.2.0/24 if that is the variable of this firewall). For aliases, name, type, content including references to other aliases, description and active status must match. If a variable value is missing for the firewall, the object does not match; the dialog names the variable.

Deviations: if there is an object with the same name (alias) or the same description (rules, NAT) whose content differs, the dialog shows "Similar" with the differing fields (central versus firewall). It is then never linked, not even automatically. Either align the firewall or the central object, or adopt the object separately (for aliases this works only after a rename, because the name is unique centrally).

Adopt all adoptable: the dialog shows beforehand what will happen ("3 link, 2 adopt as new, 1 not adoptable"), and you confirm. Linking happens only if exactly one central object matches exactly; if there are several identical ones (legacy from earlier individual adoptions), you decide at the entry itself, and "All" adopts it as a new object. A central object is linked at most once per run.

Safety: when linking, the firewall is read fresh and compared exactly once more; if something changed between display and click, nothing is linked and the message names the fields. A second click changes nothing. The action appears in the audit log and in the object's revisions ("Linked with <firewall>"). Roles as for adopting: operators may, read-only users may not. If the central object has an open confirmation or an open rollback, linking happens only after it is resolved. "Adopt all adoptable" then skips such entries (note in the result). Important: a linked object is treated like any managed object: if the central object is deleted or the firewall is removed from its targets, the next rollout deletes the object on this firewall as well.