Skip to content

Support Firewall for public IPs in VPC - #12706

Merged
weizhouapache merged 32 commits into
apache:mainfrom
shapeblue:FWinVPCpublicIP
Jul 13, 2026
Merged

weizhouapache merged 32 commits into
apache:mainfrom
shapeblue:FWinVPCpublicIP

Conversation

@harikrishna-patnala

@harikrishna-patnala harikrishna-patnala commented Feb 25, 2026 •

Copy link
Copy Markdown
Member

Description

This PR adds support for firewall rules on public IPs in VPC networks.

Doc PR apache/cloudstack-documentation#633

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@harikrishna-patnala

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@harikrishna-patnala a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16942

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for firewall rules on public IPs in VPC networks, which were previously only available for non-VPC isolated networks. This is a major feature addition that enables VPC users to configure ingress/egress firewall rules on their public IP addresses, similar to the functionality available in traditional isolated networks.

Changes:

  • Enabled Firewall service for VPC offerings and networks by removing it from the list of non-supported services
  • Added Firewall capability to VpcVirtualRouterElement by removing the code that previously excluded it
  • Updated UI to show firewall tabs for VPC public IPs in various states (source NAT, static NAT, port forwarding, load balancing)
  • Implemented iptables firewall chain logic in VPC virtual routers to support per-public-IP firewall rules
  • Added database migration to retrofit existing VPC offerings, VPC networks, and VPCs with Firewall service

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
ui/src/views/offering/AddVpcOffering.vue Adds Firewall service with VpcVirtualRouter provider to the list of services when creating VPC offerings
ui/src/views/network/PublicIpResource.vue Updates tab visibility logic to show firewall tab for VPC IPs in various states (source NAT, static NAT, etc.)
systemvm/debian/opt/cloud/bin/cs/CsAddress.py Implements PREROUTING firewall chain jump and firewall chain with default DROP policy for public IPs in VPC routers
systemvm/debian/opt/cloud/bin/configure.py Modifies ACL processing to use AclIP (per-IP firewall) instead of AclDevice for VPC firewall rules
server/src/main/java/org/apache/cloudstack/network/RoutedIpv4ManagerImpl.java Removes VPCVirtualRouter check from isVirtualRouterGateway method for Network parameter
server/src/main/java/com/cloud/network/vpc/VpcManagerImpl.java Removes Service.Firewall from the list of non-supported VPC services
server/src/main/java/com/cloud/network/element/VpcVirtualRouterElement.java Re-enables Firewall capability for VPC Virtual Router by removing the code that excluded it
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java Updates network offering validation to no longer automatically set forVpc=false when Firewall service is included
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java Updates Kubernetes VPC network offering creation to include Firewall service with VPCVirtualRouter provider
engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42210to42300.java Adds database migration to insert Firewall service mappings for existing VPC offerings, networks, and VPCs
engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java Adds Firewall service to default VPC offering providers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-15532)

@harikrishna-patnala

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@harikrishna-patnala a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@codecov

codecov Bot commented Feb 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 21.96078% with 398 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.48%. Comparing base (8996286) to head (60186e4).
⚠️ Report is 24 commits behind head on main.

Files with missing lines Patch % Lines
...om/cloud/network/firewall/FirewallManagerImpl.java 45.54% 82 Missing and 22 partials ⚠️
...udstack/network/topology/BasicNetworkTopology.java 0.00% 72 Missing ⚠️
...cloud/network/element/VpcVirtualRouterElement.java 0.00% 28 Missing ⚠️
.../main/java/com/cloud/network/NetworkModelImpl.java 0.00% 25 Missing ⚠️
...a/com/cloud/network/router/CommandSetupHelper.java 0.00% 24 Missing ⚠️
...n/java/com/cloud/network/IpAddressManagerImpl.java 38.23% 14 Missing and 7 partials ⚠️
...src/main/java/com/cloud/api/ApiResponseHelper.java 0.00% 20 Missing ⚠️
.../router/VpcVirtualNetworkApplianceManagerImpl.java 0.00% 15 Missing ⚠️
...i/command/user/firewall/CreateFirewallRuleCmd.java 44.44% 7 Missing and 3 partials ⚠️
...va/com/cloud/network/dao/FirewallRulesDaoImpl.java 0.00% 10 Missing ⚠️
... and 18 more
Additional details and impacted files
@@            Coverage Diff             @@
##               main   #12706    +/-   ##
==========================================
  Coverage     19.47%   19.48%            
- Complexity    19352    19395    +43     
==========================================
  Files          6294     6296     +2     
  Lines        568164   568626   +462     
  Branches      69600    69713   +113     
==========================================
+ Hits         110664   110810   +146     
- Misses       445422   445677   +255     
- Partials      12078    12139    +61     
Flag Coverage Δ
uitests 3.44% <ø> (-0.01%) ⬇️
unittests 20.74% <21.96%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 12 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@harikrishna-patnala

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@harikrishna-patnala a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16957

@harikrishna-patnala

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@harikrishna-patnala a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16959

@harikrishna-patnala

Copy link
Copy Markdown
Member Author

@blueorangutan package

Copilot AI review requested due to automatic review settings July 10, 2026 07:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@harikrishna-patnala

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@harikrishna-patnala a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18527

@kiranchavala kiranchavala left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Verified manually

Need to make sure firewall is a supported service when creating a vpc offering

Image

Able to assign firewall rules to the public ip address acquired in a vpc network

Navigate to a vpc > Public ip address > acuire a public ip > Assign firewall rules

Image Image

@harikrishna-patnala
harikrishna-patnala marked this pull request as ready for review July 13, 2026 07:08

@weizhouapache weizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code and design lgtm

@weizhouapache

Copy link
Copy Markdown
Member

merging based on approvals and manual tests, thanks @harikrishna-patnala @kiranchavala @vishesh92

@weizhouapache
weizhouapache merged commit 13822b1 into apache:main Jul 13, 2026
18 of 27 checks passed
@weizhouapache
weizhouapache deleted the FWinVPCpublicIP branch July 13, 2026 07:14
@weizhouapache

Copy link
Copy Markdown
Member

@harikrishna-patnala
could you please have a look at the CI failures ?
thanks

dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Sep 11, 2026
calvix added a commit to calvix/cloudstack that referenced this pull request Oct 29, 2026
…les held them

Since VPC public IPs can carry firewall rules (apache#12706), such a rule has a
VPC but no network. unassignIPFromVpcNetwork() kept a VPC IP bound to its
network while the IP had any firewall_rules row, and deleting the network
never revokes these rules, because they belong to no network. The IP then
stayed bound to the removed network. deleteVPC removed the firewall rule,
looked the network up, got null, and failed with a NullPointerException in
applyIpAssociations(), leaving the IP in Releasing and the VPC undeletable.

Repro: VPC offering with the Firewall service, one network, a VM, a public
IP with a port forwarding rule and a firewall rule; destroy the VM, delete
the network, delete the VPC.

- Only static NAT and rules that belong to a network keep a VPC IP bound to
  its network; VPC firewall rules are applied through the VPC.
  isIpAllocatedToVpc(), which also decides whether the IP stays plugged on
  the router, is unchanged.
- disassociatePublicIpAddress() releases an IP whose associated network was
  removed as an unassociated IP instead of applying IP associations on a
  null network, so VPCs already stuck this way can be deleted.

(cherry picked from commit 364686a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CS4.22.0 vROUTER ACLs Feature is non RFC compliant applied to Internal Interface Support firewall rules on Public IP in VPC

7 participants