{"record":{"id":"ede978a99f082bc3","repo":"jdx/mise","slug":"firewall-rule-uses-per-source-connection-limi","errorCode":null,"errorMessage":"firewall rule '{}' uses per-source connection limiting, which firewalld policies cannot express safely; select backend = \"nftables\" or \"ufw\"","messagePattern":"firewall rule '(.+?)' uses per-source connection limiting, which firewalld policies cannot express safely; select backend = \"nftables\" or \"ufw\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/firewall.rs","lineNumber":1052,"sourceCode":"        }\n        FirewallBackend::Ufw => backend_active(backend),\n        FirewallBackend::Auto => false,\n    }\n}\n\nfn validate_backend_request(request: &FirewallRequest, backend: FirewallBackend) -> Result<()> {\n    for rule in &request.rules {\n        if rule.action == FirewallAction::Limit {\n            if rule.direction != FirewallDirection::Incoming\n                || rule.protocol != Some(FirewallProtocol::Tcp)\n            {\n                bail!(\n                    \"firewall rule '{}' uses action = \\\"limit\\\", which requires direction = \\\"incoming\\\" and protocol = \\\"tcp\\\"\",\n                    rule.name\n                );\n            }\n            if backend == FirewallBackend::Firewalld {\n                bail!(\n                    \"firewall rule '{}' uses per-source connection limiting, which firewalld policies cannot express safely; select backend = \\\"nftables\\\" or \\\"ufw\\\"\",\n                    rule.name\n                );\n            }\n        }\n        if backend == FirewallBackend::Firewalld && rule.interface.is_some() {\n            bail!(\n                \"firewall rule '{}' uses interface matching, which firewalld policies cannot express safely; select backend = \\\"nftables\\\" or \\\"ufw\\\"\",\n                rule.name\n            );\n        }\n        if backend == FirewallBackend::Ufw\n            && matches!(\n                rule.protocol,\n                Some(FirewallProtocol::Sctp | FirewallProtocol::Dccp)\n            )\n        {\n            bail!(","sourceCodeStart":1034,"sourceCodeEnd":1070,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/firewall.rs#L1034-L1070","documentation":"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.","triggerScenarios":"Submitting a FirewallRequest containing a rule with action = FirewallAction::Limit while backend = FirewallBackend::Firewalld.","commonSituations":"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.","solutions":["Change the request's backend to FirewallBackend::Nftables or FirewallBackend::Ufw.","Remove or rework the limit rule into plain allow/deny rules compatible with firewalld.","Install and manage nftables/ufw on the host if per-source limiting is required.","Split deployment: apply limit rules via a nftables-backed request and the rest via firewalld."],"exampleFix":"// before\napply(&FirewallRequest { backend: FirewallBackend::Firewalld, rules: vec![limit_rule], .. }, false, true)?\n// after\napply(&FirewallRequest { backend: FirewallBackend::Nftables, rules: vec![limit_rule], .. }, false, true)?","handlingStrategy":"validation","validationCode":"fn limit_compatible(backend: FirewallBackend, rules: &[FirewallRule]) -> bool {\n    backend != FirewallBackend::Firewalld\n        || !rules.iter().any(|r| r.action == FirewallAction::Limit)\n}","typeGuard":null,"tryCatchPattern":"match apply(&request, false, true) {\n    Err(e) if e.to_string().contains(\"firewalld policies cannot express\") => {\n        eprintln!(\"switch backend to nftables or ufw for limit rules\");\n    }\n    other => other?,\n}","preventionTips":["Choose backend based on required rule features, not habit","Keep per-backend rule capability checks in config loaders","Test rule sets against the intended backend in CI","Avoid mixing firewalld hosts with limit-style rule templates"],"tags":["firewall","firewalld","limitation"],"backgroundTag":"unsupported-config-value","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}