internal static bool ReduceDynamicPortRange(List <NodeSettings> nodes, bool isScaleMin) { if (isScaleMin && NetworkApiHelper.IsAddressLoopback(nodes[0].IPAddressOrFQDN)) { return(true); } List <Tuple <int, int> > portRanges = GetDynamicPortRangeForNodes(nodes); foreach (Tuple <int, int> portRange in portRanges) { ReduceDynamicPortRange(portRange.Item1, portRange.Item2); } return(true); }
/// <summary> /// This function enables the firewall exceptions for all the nodes provied. The exceptions are for lease driver port, application ports and fabric process. /// </summary> /// <param name="nodes">The list of nodes for which exceptions need to be provided.</param> /// <param name="isScaleMin">Whether te deployment is scale min or not.</param> /// <param name="securitySection"> The security section which specifies what type of firewall profiles to set.</param> /// <param name="removeRulesIfNotRequired">Should we delete the existing rules that are not required.</param> /// <returns>true if exceptions are all enabled, false otherwise.</returns> public static bool EnableFirewallSettings(List <NodeSettings> nodes, bool isScaleMin, SettingsOverridesTypeSection securitySection, bool removeRulesIfNotrequired) { Firewall fw = new Firewall(); if (!fw.IsEnabled()) { return(true); } if (isScaleMin && NetworkApiHelper.IsAddressLoopback(nodes[0].IPAddressOrFQDN)) { return(true); } List <FirewallRule> newRules = GetRulesForNodes(nodes, securitySection); fw.UpdateRules(newRules, removeRulesIfNotrequired); return(true); }