Repository navigation
Description
problem
With the Firewall service for VPC public IPs (#12706), a firewall rule can be created on a
public IP of a VPC before the IP has any port forwarding, load balancing or static NAT rule. In
that order the IP is never configured on the VPC virtual router:
IpAddressManagerImpl.applyRulesresolves only the VPC for a VPC firewall rule
(networkIdis null), skips the IP association and logs
Unable to resolve network for firewall rules (networkId=null, vpcId=...); skipping IP association.
The firewall rules are sent to the VR anyway and theFIREWALL_<ip>chain is created.- The first LB or PF rule on the IP is applied afterwards, but no
IpAssocVpcCommandis sent
for it. The IP never appears in theipsdata bag of the VR and is not added to the public
interface. Clients on the same public subnet getNo route to host, others time out. - When the LB/PF rules are applied, the VR also deletes the previously added firewall rules
fromFIREWALL_<ip>(Delete rule -D FIREWALL_<ip> ...in/var/log/cloud.log), so only the
final DROP remains. Re-applying the firewall rules restores them, but the IP is still not on
the VR. (On a correctly associated IP, re-applying PF rules during a CKS scale kept the
firewall rules.)
With the opposite order (LB/PF first, firewall rules afterwards) everything works: the LB/PF
apply sends IpAssocVpcCommand, the VR runs ip addr add dev eth1 <ip>/<mask>, and later
firewall rules take effect immediately. The skip in step 1 is harmless then, because the IP is
already associated.
Observed on 4.23.0.0 with a VPC offering that has the Firewall service (provider
VpcVirtualRouter), same VPC, same tier, same steps except for the order:
| firewall rules before LB/PF | firewall rules after LB/PF | |
|---|---|---|
IpAssocVpcCommand in the job that applied LB/PF |
0 | 8 |
IP on the VR public interface (ip addr) |
no | yes (secondary eth1) |
FIREWALL_<ip> after the LB/PF apply |
rules deleted, only DROP | rules present |
| TCP from an allowed source | timeout / No route to host |
open |
In the "before" case the management server also logged
Merovingian2: Was unable to find lock for the key user_ip_address<id> while applying the LB
rule on that IP.
A side observation: after an IP with firewall rules is released, its FIREWALL_<ip> chain stays
on the VR (with RELATED/ESTABLISHED and DROP), and the PREROUTING -d <ip> -j FIREWALL_<ip>
jump stays as well. When the IP is acquired again in the same VPC the chain is reused.
versions
- Apache CloudStack 4.23.0.0;
IpAddressManagerImpl.applyRulesis unchanged onmain
(a7be64a) - KVM, advanced zone, VPC offering with the Firewall service (provider VpcVirtualRouter),
SystemVM template for 4.23 on the VR
The steps to reproduce the bug
- In a VPC with the Firewall service, get a new public IP that is associated with the VPC and
with a tier but has no rules yet. We saw it with the IP that CKS acquires for a cluster
(associateIPToVpc+associateIPToGuestNetwork); a plainassociateIpAddress vpcid=...
was not tested. - Create a firewall rule on that IP, for example TCP 22 from your address.
- Create a port forwarding (or load balancing) rule on the same IP to a VM in the tier.
- The port is not reachable.
ip addron the VR (orgetDiagnosticsData files=ipaddr) does not
show the IP, and the job that applied the port forwarding rule sent noIpAssocVpcCommand.
Doing step 3 before step 2 works.
What to do about it?
When firewall rules are applied for a VPC public IP that is not yet associated with the VR,
associate it first, as applyRules does for network-scoped rules (resolve the network from
the IP's associated network or use the VPC-level IP association). The VR should not drop
firewall rules of an IP when PF/LB rules for that IP are applied. Released IPs should have their
firewall chain removed.
Found while fixing CKS for VPCs with the Firewall service (#14668), whose fix creates the
firewall rules after the LB/PF rules to avoid this.
Related, but a different problem in the same feature: #14068 (NPE when destroying a VPC tier
with the Firewall service, PR #14133).
Activity
adestis-mf commentedon Nov 11, 2026
This is the same problem as #14146, which I did not find before opening this issue. I have put
the root cause and a reproduction without CKS there; the fix is #14681. Please feel free to close
this issue as a duplicate of #14146.
One point of the description is not covered there: step 3, the firewall rules being removed from
FIREWALL_<ip>when the load balancing or port forwarding rules were applied. I saw that once, inthe order described above, and have not reproduced it since; it is not part of the fix.
github-actions commentedon Nov 11, 2026
Warning
threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.
What happened
The threat detection engine failed to produce results.
Review the workflow run logs for details.
🎯 Triage report
On a VPC with the Firewall service, a firewall rule created on a new public IP before any PF or LB rule prevents the IP from being configured on the VR.
applyRulesskips the IP association for VPC firewall rules, so noIpAssocVpcCommandis sent later when the PF or LB rule is applied. The VR also deletes the firewall rules fromFIREWALL_<ip>at that point. Creating the PF or LB rule first avoids the problem. The reporter's table shows the difference on 4.23.0.0.📊 Assessment
IpAddressManagerImpl, rule handling on the VR🔗 Similar issues
💡 Notes and suggestions
ip addron the VR and/var/log/cloud.log.FIREWALL_<ip>chain and PREROUTING jump) is a separate cleanup item; consider a separate issue.Add this agentic workflow to your repo
To install this agentic workflow, run