Ejemplo n.º 1
0
        private void RemoveRulesNotRequried(List <FirewallRule> newRules)
        {
#if !DotNetCoreClrIOT
            List <string> rulesToBeDeleted = new List <string>();
            foreach (var rule in this.rules)
            {
                NetFwRule fwRule = (NetFwRule)rule;
                if (fwRule == null)
                {
                    continue;
                }
                if (FabricNodeFirewallRules.IsFabricFirewallRule(fwRule))
                {
                    if (newRules.All(newRule => newRule.Name != fwRule.Name)) // Firewall rule is not in the set of new rules
                    {
                        rulesToBeDeleted.Add(fwRule.Name);
                    }
                }
            }
            foreach (string ruleToBeDeleted in rulesToBeDeleted)
            {
                rules.Remove(ruleToBeDeleted);
            }
#endif
        }
Ejemplo n.º 2
0
        public void RemoveWindowsFabricRules()
        {
#if !DotNetCoreClrIOT
            List <string> windowsFabricRuleNames = new List <string>();
            foreach (var rule in this.rules)
            {
                NetFwRule fwRule = (NetFwRule)rule;
                if (FabricNodeFirewallRules.IsFabricFirewallRule(fwRule))
                {
                    windowsFabricRuleNames.Add(fwRule.Name);
                }
            }

            foreach (var ruleName in windowsFabricRuleNames)
            {
                this.rules.Remove(ruleName);
            }
#endif
        }