예제 #1
0
        private static List <FirewallRule> GetRulesForNodes(List <NodeSettings> nodes, SettingsOverridesTypeSection securitySection)
        {
            List <FirewallRule> newRules = new List <FirewallRule>();

            foreach (NodeSettings setting in nodes)
            {
                string fabricPath = Path.Combine(
                    setting.DeploymentFoldersInfo.GetCodeDeploymentDirectory(Constants.FabricService),
                    Constants.ServiceExes[Constants.FabricService]);
                string dcaPath = Path.Combine(
                    setting.DeploymentFoldersInfo.GetCodeDeploymentDirectory(Constants.DCAService),
                    Constants.ServiceExes[Constants.DCAService]);
                string fileStoreServicePath = Path.Combine(
                    GetFabricSystemApplicationCodeFolder(setting.DeploymentFoldersInfo, Constants.FileStoreService, Constants.SystemServiceCodePackageName, Constants.SystemServiceCodePackageVersion),
                    Constants.ServiceExes[Constants.FileStoreService]);
                string fabricGatewayPath = Path.Combine(
                    setting.DeploymentFoldersInfo.GetCodeDeploymentDirectory(Constants.FabricService),
                    Constants.ServiceExes[Constants.FabricGatewayService]);
                string fabricAppGatewayPath = Path.Combine(
                    setting.DeploymentFoldersInfo.GetCodeDeploymentDirectory(Constants.FabricService),
                    Constants.ServiceExes[Constants.FabricApplicationGatewayService]);
                string faultAnalysisServicePath = Path.Combine(
                    GetFabricSystemApplicationCodeFolder(setting.DeploymentFoldersInfo, Constants.FaultAnalysisService, Constants.SystemServiceCodePackageName, Constants.SystemServiceCodePackageVersion),
                    Constants.ServiceExes[Constants.FaultAnalysisService]);
#if !DotNetCoreClrLinux
                string backupRestoreServicePath = Path.Combine(
                    GetFabricSystemApplicationCodeFolder(setting.DeploymentFoldersInfo, Constants.BackupRestoreService, Constants.SystemServiceCodePackageName, Constants.SystemServiceCodePackageVersion),
                    Constants.ServiceExes[Constants.BackupRestoreService]);
#else
                string backupRestoreServicePath = null;
#endif
                string fabricUpgradeServicePath = Path.Combine(
                    GetFabricSystemApplicationCodeFolder(setting.DeploymentFoldersInfo, Constants.FabricUpgradeService, Constants.SystemServiceCodePackageName, Constants.SystemServiceCodePackageVersion),
                    Constants.ServiceExes[Constants.FabricUpgradeService]);
                string fabricRepairServicePath = Path.Combine(
                    GetFabricSystemApplicationCodeFolder(setting.DeploymentFoldersInfo, Constants.FabricRepairManagerService, Constants.SystemServiceCodePackageName, Constants.SystemServiceCodePackageVersion),
                    Constants.ServiceExes[Constants.FabricRepairManagerService]);
                string fabricInfrastructureServicePath = Path.Combine(
                    GetFabricSystemApplicationCodeFolder(setting.DeploymentFoldersInfo, Constants.FabricInfrastructureService, Constants.SystemServiceCodePackageName, Constants.SystemServiceCodePackageVersion),
                    Constants.ServiceExes[Constants.FabricInfrastructureService]);

#if !DotNetCoreClrLinux && !DotNetCoreClrIOT
                string centralsecretServicePath = Path.Combine(
                    GetFabricSystemApplicationCodeFolder(setting.DeploymentFoldersInfo, Constants.CentralSecretService, Constants.SystemServiceCodePackageName, Constants.SystemServiceCodePackageVersion),
                    Constants.ServiceExes[Constants.CentralSecretService]);
#else
                string centralsecretServicePath = null;
#endif
#if !DotNetCoreClrLinux
                string upgradeOrchestrationServicePath = Path.Combine(
                    GetFabricSystemApplicationCodeFolder(setting.DeploymentFoldersInfo, Constants.UpgradeOrchestrationService, Constants.SystemServiceCodePackageName, Constants.SystemServiceCodePackageVersion),
                    Constants.ServiceExes[Constants.UpgradeOrchestrationService]);
#else
                string upgradeOrchestrationServicePath = null;
#endif

                string leaseDriverPort      = null;
                string applicationPortRange = null;
                string dynamicPortRange     = null;
                string httpGatewayPort      = null;
                string httpAppGatewayPort   = null;

                GetPorts(
                    setting,
                    out leaseDriverPort,
                    out applicationPortRange,
                    out httpGatewayPort,
                    out httpAppGatewayPort,
                    out dynamicPortRange);

                var rulesForNode = FabricNodeFirewallRules.GetRulesForNode(
                    setting.NodeName,
                    leaseDriverPort,
                    applicationPortRange,
                    httpGatewayPort,
                    httpAppGatewayPort,
                    fabricPath,
                    dcaPath,
                    fileStoreServicePath,
                    fabricGatewayPath,
                    fabricAppGatewayPath,
                    faultAnalysisServicePath,
                    backupRestoreServicePath,
                    fabricUpgradeServicePath,
                    fabricRepairServicePath,
                    fabricInfrastructureServicePath,
                    upgradeOrchestrationServicePath,
                    centralsecretServicePath,
                    dynamicPortRange,
                    securitySection);
                newRules.AddRange(rulesForNode);

#if DotNetCoreClrLinux
                string clientConnectionPort            = null;
                string clusterConnectionPort           = null;
                string serviceConnectionPort           = null;
                string clusterManagerReplicatorPort    = null;
                string repairManagerReplicatorPort     = null;
                string namingReplicatorPort            = null;
                string failoverManagerReplicatorPort   = null;
                string imageStoreServiceReplicatorPort = null;
                string upgradeServiceReplicatorPort    = null;

                GetPorts2(
                    setting,
                    out clientConnectionPort,
                    out serviceConnectionPort,
                    out clusterConnectionPort,
                    out clusterManagerReplicatorPort,
                    out repairManagerReplicatorPort,
                    out namingReplicatorPort,
                    out failoverManagerReplicatorPort,
                    out imageStoreServiceReplicatorPort,
                    out upgradeServiceReplicatorPort);

                var rulesForNode2 = FabricNodeFirewallRules.GetRulesForNode2(
                    setting.NodeName,
                    clientConnectionPort,
                    serviceConnectionPort,
                    clusterConnectionPort,
                    clusterManagerReplicatorPort,
                    repairManagerReplicatorPort,
                    namingReplicatorPort,
                    failoverManagerReplicatorPort,
                    imageStoreServiceReplicatorPort,
                    upgradeServiceReplicatorPort);
                newRules.AddRange(rulesForNode2);
#endif
            }
            return(newRules);
        }