jdx/mise · error

firewall rule ' ' uses per-source connection limiting…

Error message

firewall rule '{}' uses per-source connection limiting, which firewalld policies cannot express safely; select backend = "nftables" or "ufw"

What it means

Firewalld policies cannot express per-source connection limiting safely, so the library rejects any action = "limit" rule when the selected backend is Firewalld. It directs the developer to nftables or ufw, which can implement source-scoped rate limiting correctly.

Solutions

  1. Change the request's backend to FirewallBackend::Nftables or FirewallBackend::Ufw.
  2. Remove or rework the limit rule into plain allow/deny rules compatible with firewalld.
  3. Install and manage nftables/ufw on the host if per-source limiting is required.
  4. Split deployment: apply limit rules via a nftables-backed request and the rest via firewalld.

Example fix

// before
apply(&FirewallRequest { backend: FirewallBackend::Firewalld, rules: vec![limit_rule], .. }, false, true)?
// after
apply(&FirewallRequest { backend: FirewallBackend::Nftables, rules: vec![limit_rule], .. }, false, true)?
Defensive patterns

Strategy: validation

Validate before calling

fn limit_compatible(backend: FirewallBackend, rules: &[FirewallRule]) -> bool {
    backend != FirewallBackend::Firewalld
        || !rules.iter().any(|r| r.action == FirewallAction::Limit)
}

Try / catch

match apply(&request, false, true) {
    Err(e) if e.to_string().contains("firewalld policies cannot express") => {
        eprintln!("switch backend to nftables or ufw for limit rules");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Submitting a FirewallRequest containing a rule with action = FirewallAction::Limit while backend = FirewallBackend::Firewalld.

Common situations: Team standardized on firewalld but copied an SSH rate-limit rule from an nftables/ufw config; migrating rule sets between backends without adjusting the backend field; a default backend of firewalld combined with pre-built limit rules.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/ede978a99f082bc3. Report an issue: GitHub.

Appendix: source

Thrown at src/system/firewall.rs:1052

        }
        FirewallBackend::Ufw => backend_active(backend),
        FirewallBackend::Auto => false,
    }
}

fn validate_backend_request(request: &FirewallRequest, backend: FirewallBackend) -> Result<()> {
    for rule in &request.rules {
        if rule.action == FirewallAction::Limit {
            if rule.direction != FirewallDirection::Incoming
                || rule.protocol != Some(FirewallProtocol::Tcp)
            {
                bail!(
                    "firewall rule '{}' uses action = \"limit\", which requires direction = \"incoming\" and protocol = \"tcp\"",
                    rule.name
                );
            }
            if backend == FirewallBackend::Firewalld {
                bail!(
                    "firewall rule '{}' uses per-source connection limiting, which firewalld policies cannot express safely; select backend = \"nftables\" or \"ufw\"",
                    rule.name
                );
            }
        }
        if backend == FirewallBackend::Firewalld && rule.interface.is_some() {
            bail!(
                "firewall rule '{}' uses interface matching, which firewalld policies cannot express safely; select backend = \"nftables\" or \"ufw\"",
                rule.name
            );
        }
        if backend == FirewallBackend::Ufw
            && matches!(
                rule.protocol,
                Some(FirewallProtocol::Sctp | FirewallProtocol::Dccp)
            )
        {
            bail!(

View on GitHub (pinned to 533346cc37)