Beispiel #1
0
 public IISSiteTests()
 {
     log     = new Mock.Services.LogService();
     iis     = new Mock.Clients.MockIISClient();
     helper  = new IISSiteHelper(log, iis);
     plugins = new PluginService(log);
 }
 public FileSystemOptionsFactory(
     IIISClient iisClient, ILogService log,
     IArgumentsService arguments) : base(arguments)
 {
     _log       = log;
     _iisClient = iisClient;
 }
        public ScriptPluginTests()
        {
            log = new Mock.Services.LogService(true);
            iis = new Mock.Clients.MockIISClient();
            cs  = new Mock.Services.CertificateService();
            var tempPath = new DirectoryInfo(Environment.ExpandEnvironmentVariables("%TEMP%\\wacs"));

            if (!tempPath.Exists)
            {
                tempPath.Create();
            }
            batchPath = new FileInfo(tempPath.FullName + "\\create.bat");
            File.WriteAllText(batchPath.FullName, "echo hello %1");

            psPath = new FileInfo(tempPath.FullName + "\\create.ps1");
            File.WriteAllText(psPath.FullName,
                              $"$arg = $($args[0])\n" +
                              $"if ($arg -ne $null -and $arg -ne \"world\") {{ Write-Error \"Wrong\" }}\n" +
                              $"Write-Host \"Hello $arg\""
                              );

            psNamedPath = new FileInfo(tempPath.FullName + "\\createnamed.ps1");
            File.WriteAllText(psNamedPath.FullName,
                              $"param([Parameter(Mandatory)][string]$What)\n" +
                              $"if ($What -ne \"world\") {{ Write-Error \"Wrong\" }} else {{\n" +
                              $"Write-Host \"Hello $arg\" + " +
                              $"}}"
                              );
        }
Beispiel #4
0
 public IISSite(ILogService logService, IIISClient iisClient, IISSiteHelper helper, IISSiteOptions options)
 {
     _log       = logService;
     _iisClient = iisClient;
     _helper    = helper;
     _options   = options;
 }
Beispiel #5
0
 public IISBindingTests()
 {
     log     = new Mock.Services.LogService(false);
     iis     = new Mock.Clients.MockIISClient();
     helper  = new IISBindingHelper(log, iis);
     plugins = new PluginService(log);
 }
Beispiel #6
0
 public IISFtp(IISFtpOptions options, IIISClient iisClient, ILogService log, UserRoleService userRoleService)
 {
     _iisClient       = iisClient;
     _options         = options;
     _log             = log;
     _userRoleService = userRoleService;
 }
Beispiel #7
0
 /// <summary>
 /// Constructore
 /// </summary>
 /// <param name="client"></param>
 public IISHttpBindingUpdater(
     IIISClient <TSite, TBinding> client,
     ILogService log)
 {
     _client = client;
     _log    = log;
 }
Beispiel #8
0
 public IISWeb(Target target, IISWebOptions options, IIISClient iisClient, ILogService log)
 {
     _iisClient = iisClient;
     _log       = log;
     _options   = options;
     _target    = target;
 }
Beispiel #9
0
 public IISBinding(ILogService logService, IIISClient iisClient, IISBindingHelper helper, IISBindingOptions options)
 {
     _iisClient = iisClient;
     _log       = logService;
     _options   = options;
     _helper    = helper;
 }
Beispiel #10
0
 public IISHelper(ILogService log, IIISClient iisClient, DomainParseService domainParser)
 {
     _log         = log;
     _iisClient   = iisClient;
     _idnMapping  = new IdnMapping();
     DomainParser = domainParser;
 }
        public ScriptPluginTests()
        {
            log = new Mock.Services.LogService(true);
            iis = new Mock.Clients.MockIISClient();
            cs  = new Mock.Services.CertificateService();
            var tempPath = Infrastructure.Directory.Temp();

            batchPath = new FileInfo(tempPath.FullName + "\\create.bat");
            File.WriteAllText(batchPath.FullName, "echo hello %1");

            psPath = new FileInfo(tempPath.FullName + "\\create.ps1");
            File.WriteAllText(psPath.FullName,
                              $"$arg = $($args[0])\n" +
                              $"if ($arg -ne $null -and $arg -ne \"world\") " +
                              $"{{ " +
                              $"  Write-Error \"Wrong: $arg\" " +
                              $"}} else {{" +
                              $"  Write-Host \"Hello $arg\" " +
                              $"}}"
                              );

            psNamedPath = new FileInfo(tempPath.FullName + "\\createnamed.ps1");
            File.WriteAllText(psNamedPath.FullName,
                              $"param([Parameter(Mandatory)][string]$What)\n" +
                              $"if ($What -ne \"world\") " +
                              $"{{ " +
                              $"  Write-Error \"Wrong: $What\" " +
                              $"}} else {{ " +
                              $"  Write-Host \"Hello $What\"" +
                              $"}}"
                              );
        }
Beispiel #12
0
        /// <summary>
        /// Determine the default certificate store
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="client"></param>
        /// <returns></returns>
        public static string DefaultStore(ISettingsService settings, IIISClient client)
        {
            // First priority: specified in settings.json
            string?storeName;

            try
            {
                storeName = settings.Store.CertificateStore?.DefaultStore;
                if (string.IsNullOrWhiteSpace(storeName))
                {
                    storeName = settings.Store.DefaultCertificateStore;
                }
                // Second priority: defaults
                if (string.IsNullOrWhiteSpace(storeName))
                {
                    // Default store should be WebHosting on IIS8+, and My (Personal) for IIS7.x
                    storeName = client.Version.Major < 8 ? nameof(StoreName.My) : "WebHosting";
                }
            }
            catch
            {
                storeName = DefaultStoreName;
            }
            return(storeName);
        }
Beispiel #13
0
 public ManualTests()
 {
     log     = new Mock.Services.LogService(false);
     iis     = new Mock.Clients.MockIISClient(log);
     version = new VersionService(log);
     plugins = new MockPluginService(log, version);
 }
Beispiel #14
0
 public CertificateStore(ILogService log, IIISClient iisClient, CertificateStoreOptions options)
 {
     _log       = log;
     _iisClient = iisClient;
     _options   = options;
     ParseCertificateStore();
     _store = new X509Store(_storeName, StoreLocation.LocalMachine);
 }
Beispiel #15
0
 public IISWeb(Target target, IISWebOptions options, IIISClient iisClient, ILogService log, UserRoleService userRoleService)
 {
     _iisClient       = iisClient;
     _log             = log;
     _options         = options;
     _target          = target;
     _userRoleService = userRoleService;
 }
Beispiel #16
0
 public IISSiteTests()
 {
     log             = new Mock.Services.LogService(false);
     iis             = new Mock.Clients.MockIISClient(log);
     helper          = new IISSiteHelper(log, iis);
     plugins         = new MockPluginService(log);
     userRoleService = new UserRoleService(iis);
 }
Beispiel #17
0
 public IISBindingTests()
 {
     log             = new Mock.Services.LogService(false);
     iis             = new Mock.Clients.MockIISClient(log);
     helper          = new IISHelper(log, iis);
     version         = new VersionService(log);
     plugins         = new MockPluginService(log, version);
     userRoleService = new Mock.Services.UserRoleService();
 }
Beispiel #18
0
 public IISSitesTests()
 {
     log             = new mock.LogService(false);
     iis             = new Mock.Clients.MockIISClient(log);
     helper          = new IISHelper(log, iis);
     version         = new VersionService(log);
     plugins         = new mock.MockPluginService(log, version);
     userRoleService = new UserRoleService(iis);
 }
 public CertificateStoreOptionsFactory(
     IUserRoleService userRoleService,
     IArgumentsService arguments,
     ISettingsService settings,
     IIISClient iisClient)
 {
     _arguments       = arguments;
     _iisClient       = iisClient;
     _settingsService = settings;
     Disabled         = CertificateStore.Disabled(userRoleService);
 }
 public IISBindingOptionsFactory(
     ILogService log, IIISClient iisClient,
     IISBindingHelper helper, IArgumentsService arguments,
     UserRoleService userRoleService)
 {
     _helper    = helper;
     _log       = log;
     _arguments = arguments;
     Hidden     = !(iisClient.Version.Major > 6);
     Disabled   = IISBinding.Disabled(userRoleService);
 }
Beispiel #21
0
 internal static bool Disabled(UserRoleService userRoleService, IIISClient iisClient)
 {
     if (!userRoleService.AllowIIS)
     {
         return(true);
     }
     if (!iisClient.HasFtpSites)
     {
         return(true);
     }
     return(false);
 }
Beispiel #22
0
        public IISSitesTests()
        {
            log = new mock.LogService(false);
            iis = new Mock.Clients.MockIISClient(log);
            var settings = new mock.MockSettingsService();
            var proxy    = new mock.ProxyService();

            domainParse     = new DomainParseService(log, proxy, settings);
            helper          = new IISHelper(log, iis, domainParse);
            plugins         = new mock.MockPluginService(log);
            userRoleService = new UserRoleService(iis);
        }
 public IISSitesOptionsFactory(ILogService log, IIISClient iisClient,
                               IISSiteHelper helper, IArgumentsService arguments,
                               UserRoleService userRoleService)
 {
     _iisClient     = iisClient;
     _siteHelper    = helper;
     _log           = log;
     _arguments     = arguments;
     _optionsHelper = new IISSiteOptionsHelper(log);
     Hidden         = !(iisClient.Version.Major > 6);
     Disabled       = IISSites.Disabled(userRoleService);
 }
Beispiel #24
0
 public CertificateStore(
     ILogService log, IIISClient iisClient,
     ISettingsService settings, UserRoleService userRoleService,
     CertificateStoreOptions options)
 {
     _log             = log;
     _iisClient       = iisClient;
     _options         = options;
     _settings        = settings;
     _userRoleService = userRoleService;
     ParseCertificateStore();
     _store = new X509Store(_storeName, StoreLocation.LocalMachine);
 }
Beispiel #25
0
 public IISOptionsFactory(
     ILogService log,
     IIISClient iisClient,
     IISHelper iisHelper,
     IArgumentsService arguments,
     IUserRoleService userRoleService)
 {
     _iisHelper = iisHelper;
     _log       = log;
     _arguments = arguments;
     Hidden     = !(iisClient.Version.Major > 6);
     Disabled   = IIS.Disabled(userRoleService);
 }
Beispiel #26
0
 public CertificateStore(
     ILogService log, IIISClient iisClient,
     ISettingsService settings, IUserRoleService userRoleService,
     FindPrivateKey keyFinder, CertificateStoreOptions options)
 {
     _log             = log;
     _iisClient       = iisClient;
     _options         = options;
     _settings        = settings;
     _userRoleService = userRoleService;
     _keyFinder       = keyFinder;
     _storeName       = options.StoreName ?? DefaultStore(settings, iisClient);
     if (string.Equals(_storeName, "Personal", StringComparison.InvariantCultureIgnoreCase) ||
         string.Equals(_storeName, "Computer", StringComparison.InvariantCultureIgnoreCase))
     {
         // Users trying to use the "My" store might have set "Personal" in their
         // config files, because that's what the store is called in mmc
         _storeName = nameof(StoreName.My);
     }
     _log.Debug("Certificate store: {_certificateStore}", _storeName);
     _store = new X509Store(_storeName !, StoreLocation.LocalMachine);
 }
 public IISWebOptionsFactory(IIISClient iisClient, IArgumentsService arguments, UserRoleService userRoleService)
 {
     _iisClient = iisClient;
     _arguments = arguments;
     Disabled   = IISWeb.Disabled(userRoleService, iisClient);
 }
Beispiel #28
0
 public FileSystem(FileSystemOptions options, IIISClient iisClient, RunLevel runLevel, HttpValidationParameters pars) : base(options, runLevel, pars) => _iisClient = iisClient;
Beispiel #29
0
 public IISWebOptionsFactory(ILogService log, IIISClient iisClient) : base(log)
 {
     _iisClient = iisClient;
 }
Beispiel #30
0
 public FileSystemOptionsFactory(IIISClient iisClient, ILogService log) : base(log)
 {
     _iisClient = iisClient;
 }