-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Support Firewall for public IPs in VPC #12706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
7c0f30a
2aaa7f7
d4450b4
8b950b2
47bbce0
0a6468a
f1f0cd0
1022c61
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2713,9 +2713,8 @@ private void createNetworkOfferingForKubernetes(String offeringName, String offe | |||||
| defaultKubernetesServiceNetworkOfferingProviders.put(Service.UserData, provider); | ||||||
| if (forVpc) { | ||||||
| defaultKubernetesServiceNetworkOfferingProviders.put(Service.NetworkACL, forNsx ? Network.Provider.Nsx : provider); | ||||||
| } else { | ||||||
| defaultKubernetesServiceNetworkOfferingProviders.put(Service.Firewall, forNsx ? Network.Provider.Nsx : provider); | ||||||
| } | ||||||
| defaultKubernetesServiceNetworkOfferingProviders.put(Service.Firewall, Network.Provider.VPCVirtualRouter); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| defaultKubernetesServiceNetworkOfferingProviders.put(Service.Lb, forNsx ? Network.Provider.Nsx : provider); | ||||||
| defaultKubernetesServiceNetworkOfferingProviders.put(Service.SourceNat, forNsx ? Network.Provider.Nsx : provider); | ||||||
| defaultKubernetesServiceNetworkOfferingProviders.put(Service.StaticNat, forNsx ? Network.Provider.Nsx : provider); | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1134,6 +1134,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { | |
| defaultVpcNetworkOfferingProviders.put(Service.StaticNat, Provider.VPCVirtualRouter); | ||
| defaultVpcNetworkOfferingProviders.put(Service.PortForwarding, Provider.VPCVirtualRouter); | ||
| defaultVpcNetworkOfferingProviders.put(Service.Vpn, Provider.VPCVirtualRouter); | ||
| defaultVpcNetworkOfferingProviders.put(Service.Firewall, Provider.VPCVirtualRouter); | ||
|
|
||
| for (Map.Entry<Service,Provider> entry : defaultVpcNetworkOfferingProviders.entrySet()) { | ||
| NetworkOfferingServiceMapVO offService = | ||
|
|
@@ -1161,6 +1162,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { | |
| defaultVpcNetworkOfferingProvidersNoLB.put(Service.StaticNat, Provider.VPCVirtualRouter); | ||
| defaultVpcNetworkOfferingProvidersNoLB.put(Service.PortForwarding, Provider.VPCVirtualRouter); | ||
| defaultVpcNetworkOfferingProvidersNoLB.put(Service.Vpn, Provider.VPCVirtualRouter); | ||
| defaultVpcNetworkOfferingProvidersNoLB.put(Service.Firewall, Provider.VPCVirtualRouter); | ||
|
|
||
| for (Map.Entry<Service,Provider> entry : defaultVpcNetworkOfferingProvidersNoLB.entrySet()) { | ||
| NetworkOfferingServiceMapVO offService = | ||
|
|
@@ -1186,6 +1188,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { | |
| internalLbOffProviders.put(Service.Gateway, Provider.VPCVirtualRouter); | ||
| internalLbOffProviders.put(Service.Lb, Provider.InternalLbVm); | ||
| internalLbOffProviders.put(Service.SourceNat, Provider.VPCVirtualRouter); | ||
| internalLbOffProviders.put(Service.Firewall, Provider.VPCVirtualRouter); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure about this. But if the LB is internal, the firewall will work only on public traffic for VPC Virtual router. Is this change required here? |
||
|
|
||
| for (Service service : internalLbOffProviders.keySet()) { | ||
| NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(internalLbOff.getId(), service, internalLbOffProviders.get(service)); | ||
|
|
@@ -1256,7 +1259,6 @@ private Map<Service, Provider> getServicesAndProvidersForProviderNetwork(Network | |
| serviceProviderMap.put(Service.UserData, routerProvider); | ||
| if (forVpc) { | ||
| serviceProviderMap.put(Service.NetworkACL, provider); | ||
| } else { | ||
| serviceProviderMap.put(Service.Firewall, provider); | ||
| } | ||
harikrishna-patnala marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (networkMode == NetworkOffering.NetworkMode.NATTED) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -705,8 +705,8 @@ def process(self): | |||||||||
|
|
||||||||||
| for item in self.dbag: | ||||||||||
| if item == "id": | ||||||||||
| continue | ||||||||||
| if self.config.is_vpc(): | ||||||||||
| continue | ||||||||||
| if self.config.is_vpc() and not ("purpose" in self.dbag[item] and self.dbag[item]["purpose"] == "Firewall"): | ||||||||||
|
Comment on lines
+708
to
+709
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not exactly sure about this change. |
||||||||||
| self.AclDevice(self.dbag[item], self.config).create() | ||||||||||
| else: | ||||||||||
| self.AclIP(self.dbag[item], self.config).create() | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -632,6 +632,18 @@ def fw_vpcrouter(self): | |
| (self.address['network'], self.address['network'])]) | ||
|
|
||
| if self.get_type() in ["public"]: | ||
| # Add PREROUTING firewall chain jump for public IP | ||
| self.fw.append(["mangle", "front", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We seem to be adding this for all the VPC Offerings which might not have firewall as a supported service. |
||
| "-A PREROUTING " + | ||
| "-d %s/32 -j FIREWALL_%s" % (self.address['public_ip'], self.address['public_ip'])]) | ||
|
|
||
| # Add the firewall chain with default DROP policy | ||
| self.fw.append(["mangle", "front", | ||
| "-A FIREWALL_%s " % self.address['public_ip'] + | ||
| "-m state --state RELATED,ESTABLISHED -j RETURN"]) | ||
| self.fw.append(["mangle", "", | ||
| "-A FIREWALL_%s -j DROP" % self.address['public_ip']]) | ||
|
|
||
| self.fw.append( | ||
| ["mangle", "", "-A FORWARD -j VPN_STATS_%s" % self.dev]) | ||
| self.fw.append( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -525,6 +525,12 @@ export default { | |
| { name: 'ConfigDrive' } | ||
| ] | ||
| }) | ||
| services.push({ | ||
| name: 'Firewall', | ||
| provider: [ | ||
| { name: 'VpcVirtualRouter' } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure if we can add providers (NSX, etc.) other than |
||
| ] | ||
| }) | ||
|
Comment on lines
+528
to
+533
|
||
| services.push({ | ||
| name: 'Lb', | ||
| provider: [ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if we should update the existing service offerings. IMO, it would be better to add new service offerings. This will change the behavior of a network after a network restart with cleanup.