Пример #1
0
        public CentralSsl(
            ILogService log,
            ISettingsService settings,
            CentralSslOptions options,
            SecretServiceManager secretServiceManager)
        {
            _log = log;

            var passwordRaw = !string.IsNullOrWhiteSpace(options.PfxPassword?.Value) ?
                              options.PfxPassword.Value :
                              DefaultPassword(settings);

            _password = secretServiceManager.EvaluateSecret(passwordRaw);

            var path = !string.IsNullOrWhiteSpace(options.Path) ?
                       options.Path :
                       DefaultPath(settings);

            if (path != null && path.ValidPath(log))
            {
                _path = path;
                _log.Debug("Using CentralSsl path: {_path}", _path);
            }
            else
            {
                throw new Exception($"Specified CentralSsl path {path} is not valid.");
            }
        }
Пример #2
0
        public EmailClient(
            ILogService log,
            ISettingsService settings,
            SecretServiceManager secretService)
        {
            _log          = log;
            _settings     = settings;
            _server       = _settings.Notification.SmtpServer;
            _port         = _settings.Notification.SmtpPort;
            _user         = _settings.Notification.SmtpUser;
            _password     = secretService.EvaluateSecret(_settings.Notification.SmtpPassword);
            _secure       = _settings.Notification.SmtpSecure;
            _secureMode   = _settings.Notification.SmtpSecureMode;
            _senderName   = _settings.Notification.SenderName;
            _computerName = _settings.Notification.ComputerName;
            if (string.IsNullOrEmpty(_computerName))
            {
                _computerName = Environment.MachineName;
            }
            _version = VersionService.SoftwareVersion.ToString();

            if (string.IsNullOrWhiteSpace(_senderName))
            {
                _senderName = _settings.Client.ClientName;
            }
            _senderAddress     = _settings.Notification.SenderAddress;
            _receiverAddresses = _settings.Notification.ReceiverAddresses ?? new List <string>();

            // Criteria for emailing to be enabled at all
            Enabled =
                !string.IsNullOrEmpty(_senderAddress) &&
                !string.IsNullOrEmpty(_server) &&
                _receiverAddresses.Any();
            _log.Verbose("Sending e-mails {_enabled}", Enabled);
        }
Пример #3
0
        public PemFiles(
            ILogService log, ISettingsService settings,
            PemService pemService, PemFilesOptions options,
            SecretServiceManager secretServiceManager)
        {
            _log        = log;
            _pemService = pemService;

            var passwordRaw = !string.IsNullOrWhiteSpace(options.PemPassword?.Value) ?
                              options.PemPassword.Value :
                              settings.Store.PemFiles?.DefaultPassword;

            _password = secretServiceManager.EvaluateSecret(passwordRaw);

            var path = options.Path;

            if (string.IsNullOrWhiteSpace(path))
            {
                path = DefaultPath(settings);
            }
            if (!string.IsNullOrWhiteSpace(path) && path.ValidPath(log))
            {
                _log.Debug("Using .pem files path: {path}", path);
                _path = path;
            }
            else
            {
                throw new Exception($"Specified .pem files path {path} is not valid.");
            }
        }
Пример #4
0
 public WebDav(
     WebDavOptions options,
     HttpValidationParameters pars,
     RunLevel runLevel,
     IProxyService proxy,
     SecretServiceManager secretService) :
     base(options, runLevel, pars) =>
Пример #5
0
        public PfxFile(
            ILogService log,
            ISettingsService settings,
            PfxFileOptions options,
            SecretServiceManager secretServiceManager)
        {
            _log = log;

            var passwordRaw = !string.IsNullOrWhiteSpace(options.PfxPassword?.Value) ?
                              options.PfxPassword.Value :
                              settings.Store.PfxFile?.DefaultPassword;

            _password = secretServiceManager.EvaluateSecret(passwordRaw);

            var path = !string.IsNullOrWhiteSpace(options.Path) ?
                       options.Path :
                       settings.Store.PfxFile?.DefaultPath;

            if (path != null && path.ValidPath(log))
            {
                _path = path;
                _log.Debug("Using pfx file path: {_path}", _path);
            }
            else
            {
                throw new Exception($"Specified pfx file path {path} is not valid.");
            }
        }
Пример #6
0
 public KeyVault(KeyVaultOptions options, SecretServiceManager ssm, IProxyService proxyService, ILogService log)
 {
     _options      = options;
     _proxyService = proxyService;
     _log          = log;
     _ssm          = ssm;
 }
Пример #7
0
 public DreamhostDnsValidation(
     LookupClientProvider dnsClient,
     ILogService logService,
     ISettingsService settings,
     SecretServiceManager ssm,
     DreamhostOptions options)
     : base(dnsClient, logService, settings)
     => _client = new DnsManagementClient(ssm.EvaluateSecret(options.ApiKey) ?? "", logService);
Пример #8
0
 public FtpOptionsFactory(
     ILogService log,
     IArgumentsService arguments,
     SecretServiceManager secretServiceManager) : base(arguments)
 {
     _log = log;
     _secretServiceManager = secretServiceManager;
 }
Пример #9
0
 public SimplyDnsValidation(
     LookupClientProvider dnsClient,
     ILogService logService,
     ISettingsService settings,
     IProxyService proxyService,
     SecretServiceManager ssm,
     SimplyOptions options)
     : base(dnsClient, logService, settings)
     => _client = new SimplyDnsClient(
Пример #10
0
        private ManualOptions?Options(string commandLine)
        {
            var optionsParser = new ArgumentsParser(log, plugins, commandLine.Split(' '));
            var input         = new Mock.Services.InputService(new());
            var secretService = new SecretServiceManager(new SecretService(), input, log);
            var argsInput     = new ArgumentsInputService(log, optionsParser, input, secretService);
            var x             = new ManualOptionsFactory(argsInput);

            return(x.Default().Result);
        }
Пример #11
0
 public PemFilesOptionsFactory(
     ILogService log,
     ISettingsService settings,
     IArgumentsService arguments,
     SecretServiceManager secretServiceManager)
 {
     _log                  = log;
     _arguments            = arguments;
     _settings             = settings;
     _secretServiceManager = secretServiceManager;
 }
Пример #12
0
 public TransIpOptionsFactory(
     IArgumentsService arguments,
     ILogService log,
     IProxyService proxy,
     SecretServiceManager secretServiceManager) : base(Dns01ChallengeValidationDetails.Dns01ChallengeType)
 {
     _arguments            = arguments;
     _log                  = log;
     _proxy                = proxy;
     _secretServiceManager = secretServiceManager;
 }
Пример #13
0
 public FtpClient(
     NetworkCredentialOptions?options,
     ILogService log,
     SecretServiceManager secretService)
 {
     _log = log;
     if (options != null)
     {
         Credential = options.GetCredential(secretService);
     }
 }
Пример #14
0
 public TransIpOptionsFactory(
     ArgumentsInputService arguments,
     SecretServiceManager ssm,
     ILogService log,
     IProxyService proxy) : base(Dns01ChallengeValidationDetails.Dns01ChallengeType)
 {
     _arguments = arguments;
     _ssm       = ssm;
     _log       = log;
     _proxy     = proxy;
 }
Пример #15
0
        private ScriptOptions?Options(string commandLine)
        {
            var optionsParser = new ArgumentsParser(log, plugins, commandLine.Split(' '));
            var input         = new Mock.Services.InputService(new());
            var secretService = new SecretServiceManager(new SecretService(), input, log);
            var argsInput     = new ArgumentsInputService(log, optionsParser, input, secretService);
            var x             = new ScriptOptionsFactory(log, argsInput);
            var target        = new Target("", "", new List <TargetPart>());

            return(x.Default(target).Result);
        }
Пример #16
0
        private IISOptions?Options(string commandLine)
        {
            var optionsParser = new ArgumentsParser(log, plugins, commandLine.Split(' '));
            var input         = new mock.InputService(new());
            var secretService = new SecretServiceManager(new mock.SecretService(), input, log);
            var argsInput     = new ArgumentsInputService(log, optionsParser, input, secretService);
            var args          = new MainArguments();
            var x             = new IISOptionsFactory(log, helper, args, argsInput, userRoleService);

            return(x.Default().Result);
        }
Пример #17
0
 public Azure(AzureOptions options,
              LookupClientProvider dnsClient,
              SecretServiceManager ssm,
              IProxyService proxyService,
              ILogService log,
              ISettingsService settings) : base(dnsClient, log, settings)
 {
     _options      = options;
     _proxyService = proxyService;
     _recordSets   = new Dictionary <string, Dictionary <string, RecordSet?> >();
     _helpers      = new AzureHelpers(_options, log, ssm);
 }
Пример #18
0
 public LuaDns(
     LookupClientProvider dnsClient,
     IProxyService proxy,
     ILogService log,
     ISettingsService settings,
     SecretServiceManager ssm,
     LuaDnsOptions options) : base(dnsClient, log, settings)
 {
     _proxyService = proxy;
     _userName     = options.Username;
     _apiKey       = ssm.EvaluateSecret(options.APIKey);
 }
Пример #19
0
 public Cloudflare(
     CloudflareOptions options,
     IProxyService proxyService,
     LookupClientProvider dnsClient,
     SecretServiceManager ssm,
     ILogService log,
     ISettingsService settings) : base(dnsClient, log, settings)
 {
     _options = options;
     _hc      = proxyService.GetHttpClient();
     _ssm     = ssm;
 }
Пример #20
0
 public NS1DnsValidation(
     LookupClientProvider dnsClient,
     ILogService logService,
     ISettingsService settings,
     NS1Options options,
     SecretServiceManager ssm,
     IProxyService proxyService)
     : base(dnsClient, logService, settings)
 {
     _client = new DnsManagementClient(
         ssm.EvaluateSecret(options.ApiKey) ?? "",
         logService, proxyService);
 }
Пример #21
0
        public Wacs(
            IContainer container,
            IAutofacBuilder scopeBuilder,
            ExceptionHandler exceptionHandler,
            ILogService logService,
            ISettingsService settingsService,
            IUserRoleService userRoleService,
            IDueDateService dueDateService,
            TaskSchedulerService taskSchedulerService,
            SecretServiceManager secretServiceManager)
        {
            // Basic services
            _container        = container;
            _scopeBuilder     = scopeBuilder;
            _exceptionHandler = exceptionHandler;
            _log                  = logService;
            _settings             = settingsService;
            _userRoleService      = userRoleService;
            _taskScheduler        = taskSchedulerService;
            _secretServiceManager = secretServiceManager;
            _dueDateService       = dueDateService;

            if (!string.IsNullOrWhiteSpace(_settings.UI.TextEncoding))
            {
                try
                {
                    Console.OutputEncoding = System.Text.Encoding.GetEncoding(_settings.UI.TextEncoding);
                }
                catch
                {
                    _log.Warning("Error setting text encoding to {name}", _settings.UI.TextEncoding);
                }
            }

            _arguments = _container.Resolve <ArgumentsParser>();
            _arguments.ShowCommandLine();
            _args         = _arguments.GetArguments <MainArguments>() !;
            _input        = _container.Resolve <IInputService>();
            _renewalStore = _container.Resolve <IRenewalStore>();

            var renewalExecutor = container.Resolve <RenewalExecutor>(
                new TypedParameter(typeof(IContainer), _container));

            _renewalCreator = container.Resolve <RenewalCreator>(
                new TypedParameter(typeof(IContainer), _container),
                new TypedParameter(typeof(RenewalExecutor), renewalExecutor));
            _renewalManager = container.Resolve <RenewalManager>(
                new TypedParameter(typeof(IContainer), _container),
                new TypedParameter(typeof(RenewalExecutor), renewalExecutor),
                new TypedParameter(typeof(RenewalCreator), _renewalCreator));
        }
Пример #22
0
        public TransIp(
            LookupClientProvider dnsClient,
            ILogService log,
            IProxyService proxy,
            ISettingsService settings,
            DomainParseService domainParser,
            SecretServiceManager ssm,
            TransIpOptions options) : base(dnsClient, log, settings)
        {
            var auth = new AuthenticationService(options.Login, ssm.EvaluateSecret(options.PrivateKey), proxy);

            _dnsService   = new DnsService(auth, proxy);
            _domainParser = domainParser;
        }
Пример #23
0
 public GodaddyDnsValidation(
     LookupClientProvider dnsClient,
     ILogService logService,
     ISettingsService settings,
     DomainParseService domainParser,
     GodaddyOptions options,
     SecretServiceManager ssm,
     IProxyService proxyService)
     : base(dnsClient, logService, settings)
 {
     _client = new DnsManagementClient(
         ssm.EvaluateSecret(options.ApiKey) ?? "",
         ssm.EvaluateSecret(options.ApiSecret) ?? "",
         logService, proxyService);
     _domainParser = domainParser;
 }
Пример #24
0
        public DomeneshopDnsValidation(
            LookupClientProvider dnsClient,
            ILogService logService,
            ISettingsService settings,
            DomainParseService domainParser,
            DomeneshopOptions options,
            SecretServiceManager ssm,
            IProxyService proxyService)
            : base(dnsClient, logService, settings)
        {
            _client = new DomeneshopClient(new Options
            {
                ClientId     = ssm.EvaluateSecret(options.ClientId) ?? "",
                ClientSecret = ssm.EvaluateSecret(options.ClientSecret) ?? ""
            });

            _domainParser = domainParser;
            _logService   = logService;
        }
Пример #25
0
 public WebDavClientWrapper(
     NetworkCredentialOptions?options,
     ILogService log,
     IProxyService proxy,
     SecretServiceManager secretService)
 {
     _log = log;
     if (options != null && options.UserName != null)
     {
         _credential = options.GetCredential(secretService);
     }
     _proxy  = proxy;
     _client = new WebDavClient(new WebDavClientParams()
     {
         Proxy = _proxy.GetWebProxy(),
         UseDefaultCredentials = _proxy.UseSystemProxy,
         Credentials           = _credential
     });
 }
Пример #26
0
        public Route53(
            LookupClientProvider dnsClient,
            ILogService log,
            IProxyService proxy,
            ISettingsService settings,
            SecretServiceManager ssm,
            Route53Options options) : base(dnsClient, log, settings)
        {
            var region = RegionEndpoint.USEast1;
            var config = new AmazonRoute53Config()
            {
                RegionEndpoint = region
            };

            config.SetWebProxy(proxy.GetWebProxy());
            _route53Client = !string.IsNullOrWhiteSpace(options.IAMRole)
                ? new AmazonRoute53Client(new InstanceProfileAWSCredentials(options.IAMRole), config)
                : !string.IsNullOrWhiteSpace(options.AccessKeyId)
                    ? new AmazonRoute53Client(options.AccessKeyId, ssm.EvaluateSecret(options.SecretAccessKey), config)
                    : new AmazonRoute53Client(config);
        }
Пример #27
0
 public AzureHelpers(IAzureOptionsCommon options, ILogService log, SecretServiceManager ssm)
 {
     _options = options;
     _ssm     = ssm;
     ResourceManagersEndpoint = new Uri(AzureEnvironments.ResourceManagerUrls[AzureEnvironments.AzureCloud]);
     if (!string.IsNullOrEmpty(options.AzureEnvironment))
     {
         if (!AzureEnvironments.ResourceManagerUrls.TryGetValue(options.AzureEnvironment, out var endpoint))
         {
             // Custom endpoint
             endpoint = options.AzureEnvironment;
         }
         try
         {
             ResourceManagersEndpoint = new Uri(endpoint);
         }
         catch (Exception ex)
         {
             log.Error(ex, "Could not parse Azure endpoint url. Falling back to default.");
         }
     }
 }
Пример #28
0
 public WebDavOptionsFactory(
     IArgumentsService arguments,
     SecretServiceManager secretServiceManager) : base(arguments) =>
Пример #29
0
 public NetworkCredential GetCredential(
     SecretServiceManager secretService) =>
Пример #30
0
 public Ftp(
     FtpOptions options,
     HttpValidationParameters pars,
     RunLevel runLevel,
     SecretServiceManager secretService) :
     base(options, runLevel, pars) =>