/// <summary> /// This function disables all firewall exceptions for the nodes. /// </summary> /// <param name="nodes">The nodes for which exceptions are to be disabled.</param> /// <returns>true if exceptions are disabled false otherwise.</returns> public static bool DisableFirewallSettings() { Firewall fw = new Firewall(); if (!fw.IsEnabled()) { return(true); } fw.RemoveWindowsFabricRules(); 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); }