Skip to content

com.limdm.firewall (list)

Console: Firewall.

{"enforce": true, "allow": ["22/tcp"], "rules": [{"port": "5432/tcp", "from": "10.0.0.0/8"}],
 "zones": [{"name": "internal", "interfaces": ["wg0"], "sources": ["10.0.0.0/8"], "allow": ["9100/tcp"]}],
 "outbound": {"policy": "deny", "allow": [{"to": "192.0.2.0/24", "port": "443/tcp"}, {"port": "80/tcp"}]}}
Field Type Rules
enforce true or false switch the firewall on and deny inbound traffic except the allowed ports
allow list of text port/proto or low:high/proto, ports 1 to 65535, proto tcp or udp
rules[].port text as in allow
rules[].from text source network (CIDR) or address
zones[].name text lower case, up to 17 characters, each once
zones[].interfaces list of text interface names, for example wg0
zones[].sources list of text networks (CIDR) or addresses; a zone needs interfaces or sources
zones[].allow list of text ports as in allow
outbound.policy text allow or deny; without outbound outgoing traffic is left alone
outbound.allow[].to text destination network (CIDR) or address, empty is any
outbound.allow[].port text as in allow, empty is any; to or port is required
template true or false render every rule text per device (see Templates)
keep list of text exceptions: rules LiMDM did not add that stay on the device (the match of the firewall inventory); agents of 0.18 and before refuse an item with keep

Merged as a union; enforce is on when any item sets it, zones of the same name are combined, and outbound deny wins over allow. allow opens ports for everybody, rules opens a port only for a source network or address, zones open ports only for traffic that arrives on the listed interfaces or from the listed sources.

Zones per backend:

  • firewalld: the zone of that name (created when missing). Interfaces are moved into it with --change-interface, sources added with --add-source, ports with --zone=… --add-port.
  • ufw and nftables have no zones; the closest equivalent is one rule per port, interface and source: ufw allow in on wg0 from 10.0.0.0/8 to any port 9100 proto tcp. The zone name only groups the rules.

Outbound deny allows only the listed destinations plus what the device needs to stay managed: DNS (53 udp and tcp), DHCP (67/udp, 547/udp), NTP (123/udp) and the LiMDM server, or the proxy the agent reaches it through, resolved at each run. Established connections and loopback always pass. The allow rules go in first, the deny policy last, and when outbound deny is no longer declared the policy is switched back before the rules go. With ufw it is ufw default deny outgoing plus ufw allow out …; with firewalld a policy object limdm-egress (ingress zone HOST, egress zone ANY, target REJECT, firewalld 0.9 or newer) holding the allow rules as rich rules; on Alpine the output chain of the LiMDM table. If the server address cannot be resolved, nothing is changed.

  • Debian family: ufw (installed when missing). Allow rules are added first, then ufw default deny incoming and ufw --force enable, so an active SSH session is never cut. A rule with a source becomes ufw allow from … to any port … proto …. A device with an active nftables service and no ufw is reported instead of being overwritten.
  • Other families: firewalld (installed and enabled when missing); ports in the default zone, rules with a source as rich rules.
  • Alpine: nftables (installed when missing). The agent writes one table it owns, inet limdm, to /etc/nftables.d/limdm.nft and loads that file atomically with nft -f whenever it changes or is missing. The file deletes and recreates only inet limdm and never contains flush ruleset. The agent never starts, restarts or reloads the nftables service and never loads or edits the main configuration (/etc/nftables.conf, /etc/nftables.nft): both begin with flush ruleset and would drop the tables of Docker, NetBird or CrowdSec. Input policy drop with established traffic, loopback, ICMP and DHCP replies allowed, then the declared rules; output policy drop only with outbound deny. nftables was chosen over awall because it is the kernel's current firewall, needs no second policy language on top of iptables, and is what the firewall.active check reads. Other tables still apply: a packet must pass every input chain, so a stock /etc/nftables.nft with its own drop policy must allow the same ports or be reduced to the include.

The agent keeps the rules in line with the declaration also while the firewall is active: new rules are added first, rules it added earlier and that are no longer declared are deleted. Rules added by hand or by agents before 0.16 are never deleted. Without a firewall declaration (or with enforce off) the rules are left as they are, so a dropped item cannot lock out SSH. The default library item "Host firewall, SSH allowed" allows 22/tcp.

Field reference

Generated from the payload schema of the server (GET /api/v1/schemas/{type}), the same reference the console editor shows. Unknown fields are rejected.

com.limdm.firewall

Console: Firewall. Host firewall: inbound traffic denied except the listed ports.

Field Type Meaning Limits
enforce boolean Enforce Deny inbound traffic except the listed ports.
allow list of string Allowed ports Port and protocol, for example 22/tcp or 60000:61000/udp.
rules list of object Rules by source Allow a port only from these networks.
rules[].port string Port As in allowed ports, for example 22/tcp.
rules[].from string From Address or network in CIDR, for example 10.0.0.0/8.
zones list of object Zones Open ports only for traffic from these interfaces or networks. firewalld uses the zone of that name; ufw and nftables match interface and source per rule.
zones[].name string Zone Lower case, for example internal or trusted.
zones[].interfaces list of string Interfaces For example wg0.
zones[].sources list of string Sources Addresses or networks in CIDR.
zones[].allow list of string Allowed ports As in allowed ports.
outbound object Outbound Traffic the device sends; empty leaves it alone.
outbound.policy string Default Deny allows only the rules below plus DNS, DHCP, NTP and the LiMDM server. one of "allow" (Allow), "deny" (Deny)
outbound.allow list of object Allowed destinations
outbound.allow[].to string To Address or network in CIDR, empty is any.
outbound.allow[].port string Port For example 443/tcp, empty is any.
template boolean Template Render every rule per device, for example {{.Attributes.office_net}}; check it with the preview.
keep list of string Exceptions Rules LiMDM did not add that stay on the device, as set in the firewall tab of a device. Nothing removes them.
remove list of string Rules to remove Rules LiMDM did not add that the agent deletes whenever it finds them, also after a reboot, as set with Discard in the firewall tab of a device. Rules of LiMDM, of container, VPN and protection tools and exceptions are never removed.
Example payload
{
  "enforce": true,
  "allow": [
    "22/tcp"
  ]
}