diff options
Diffstat (limited to 'src')
23 files changed, 134 insertions, 76 deletions
diff --git a/src/main.lib/Clients/Acme/AcmeClient.cs b/src/main.lib/Clients/Acme/AcmeClient.cs index afe276f..f6ca381 100644 --- a/src/main.lib/Clients/Acme/AcmeClient.cs +++ b/src/main.lib/Clients/Acme/AcmeClient.cs @@ -83,7 +83,6 @@ namespace PKISharp.WACS.Clients.Acme {
signer = accountSigner.JwsTool();
}
-
var httpClient = _proxyService.GetHttpClient();
httpClient.BaseAddress = _settings.BaseUri;
var client = PrepareClient(httpClient, signer);
@@ -157,7 +156,7 @@ namespace PKISharp.WACS.Clients.Acme }
if (_client == null)
{
- throw new InvalidOperationException();
+ throw new InvalidOperationException("Failed to initialize AcmeProtocolClient");
}
return _client;
}
@@ -294,7 +293,7 @@ namespace PKISharp.WACS.Clients.Acme _log.Verbose("Writing terms of service to {path}", tosPath);
await File.WriteAllBytesAsync(tosPath, content);
_input.Show($"Terms of service", tosPath);
- if (_arguments.GetArguments<AccountArguments>().AcceptTos)
+ if (_arguments.GetArguments<AccountArguments>()?.AcceptTos ?? false)
{
return true;
}
@@ -655,4 +654,4 @@ namespace PKISharp.WACS.Clients.Acme Dispose(true);// TODO: uncomment the following line if the finalizer is overridden above.// GC.SuppressFinalize(this);
#endregion
}
-}
\ No newline at end of file +}
diff --git a/src/main.lib/Clients/Acme/ExternalAccountBinding.cs b/src/main.lib/Clients/Acme/ExternalAccountBinding.cs index 999d4e9..8049f64 100644 --- a/src/main.lib/Clients/Acme/ExternalAccountBinding.cs +++ b/src/main.lib/Clients/Acme/ExternalAccountBinding.cs @@ -55,7 +55,7 @@ namespace PKISharp.WACS.Clients.Acme return hmac.ComputeHash(input);
}
}
- throw new InvalidOperationException();
+ throw new InvalidOperationException($"Unsupported algorithm {Algorithm}");
}
}
}
diff --git a/src/main.lib/Clients/Acme/OrderManager.cs b/src/main.lib/Clients/Acme/OrderManager.cs index 51a30c3..c0ddaac 100644 --- a/src/main.lib/Clients/Acme/OrderManager.cs +++ b/src/main.lib/Clients/Acme/OrderManager.cs @@ -95,18 +95,30 @@ namespace PKISharp.WACS.Clients.Acme private async Task<OrderDetails?> CreateOrder(IEnumerable<string> identifiers, string cacheKey)
{
_log.Verbose("Creating order for hosts: {identifiers}", identifiers);
- var order = await _client.CreateOrder(identifiers);
- if (order.Payload.Error != null)
+ try
{
- _log.Error("Failed to create order {url}: {detail}", order.OrderUrl, order.Payload.Error.Detail);
- return null;
+ var order = await _client.CreateOrder(identifiers);
+ if (order.Payload.Error != null)
+ {
+ _log.Error("Failed to create order {url}: {detail}", order.OrderUrl, order.Payload.Error.Detail);
+ return null;
+ }
+ else
+ {
+ _log.Verbose("Order {url} created", order.OrderUrl);
+ SaveOrder(order, cacheKey);
+ }
+ return order;
+ }
+ catch (AcmeProtocolException ex)
+ {
+ _log.Error($"Failed to create order: {ex.ProblemDetail ?? ex.Message}");
}
- else
+ catch (Exception ex)
{
- _log.Verbose("Order {url} created", order.OrderUrl);
- SaveOrder(order, cacheKey);
+ _log.Error(ex, $"Failed to create order");
}
- return order;
+ return null;
}
/// <summary>
diff --git a/src/main.lib/Clients/EmailClient.cs b/src/main.lib/Clients/EmailClient.cs index 0f7f0a0..bbec75e 100644 --- a/src/main.lib/Clients/EmailClient.cs +++ b/src/main.lib/Clients/EmailClient.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Net; -using System.Reflection; using System.Threading.Tasks; namespace PKISharp.WACS.Clients @@ -32,7 +31,7 @@ namespace PKISharp.WACS.Clients private readonly string _version; private readonly IEnumerable<string> _receiverAddresses; - public EmailClient(ILogService log, ISettingsService settings) + public EmailClient(ILogService log, ISettingsService settings, VersionService version) { _log = log; _settings = settings; @@ -47,7 +46,7 @@ namespace PKISharp.WACS.Clients if (string.IsNullOrEmpty(_computerName)) { _computerName = Environment.MachineName; } - _version = Assembly.GetEntryAssembly().GetName().Version.ToString(); + _version = version.SoftwareVersion.ToString(); if (string.IsNullOrWhiteSpace(_senderName)) { diff --git a/src/main.lib/Plugins/TargetPlugins/IIS/IISOptionsFactory.cs b/src/main.lib/Plugins/TargetPlugins/IIS/IISOptionsFactory.cs index 206eb8f..8eebb99 100644 --- a/src/main.lib/Plugins/TargetPlugins/IIS/IISOptionsFactory.cs +++ b/src/main.lib/Plugins/TargetPlugins/IIS/IISOptionsFactory.cs @@ -585,7 +585,7 @@ namespace PKISharp.WACS.Plugins.TargetPlugins var identifiers = input.ParseCsv(); if (identifiers == null) { - throw new InvalidOperationException(); + throw new InvalidOperationException("No identifiers found"); } var ret = new List<long>(); diff --git a/src/main.lib/Plugins/ValidationPlugins/Dns/Script/Script.cs b/src/main.lib/Plugins/ValidationPlugins/Dns/Script/Script.cs index 222a7d2..ed747e1 100644 --- a/src/main.lib/Plugins/ValidationPlugins/Dns/Script/Script.cs +++ b/src/main.lib/Plugins/ValidationPlugins/Dns/Script/Script.cs @@ -92,10 +92,14 @@ namespace PKISharp.WACS.Plugins.ValidationPlugins.Dns var zoneName = _domainParseService.GetRegisterableDomain(identifier); var nodeName = "@"; - if (recordName != zoneName) + if (recordName.Length > zoneName.Length) { // Offset by one to prevent trailing dot - nodeName = recordName.Substring(0, recordName.Length - zoneName.Length - 1); + var idx = recordName.Length - zoneName.Length - 1; + if (idx != 0) + { + nodeName = recordName.Substring(0, idx); + } } ret = ret.Replace("{ZoneName}", zoneName); ret = ret.Replace("{NodeName}", nodeName); diff --git a/src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystem.cs b/src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystem.cs index c7e4c97..e4581b9 100644 --- a/src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystem.cs +++ b/src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystem.cs @@ -46,7 +46,7 @@ namespace PKISharp.WACS.Plugins.ValidationPlugins.Http protected override Task<bool> IsEmpty(string path)
{
var x = new DirectoryInfo(path);
- return Task.FromResult(x.Exists && x.EnumerateFileSystemInfos().Any());
+ return Task.FromResult(x.Exists && !x.EnumerateFileSystemInfos().Any());
}
protected override async Task WriteFile(string path, string content)
diff --git a/src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystemOptionsFactory.cs b/src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystemOptionsFactory.cs index 9a4e748..b32127c 100644 --- a/src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystemOptionsFactory.cs +++ b/src/main.lib/Plugins/ValidationPlugins/Http/FileSystem/FileSystemOptionsFactory.cs @@ -29,15 +29,16 @@ namespace PKISharp.WACS.Plugins.ValidationPlugins.Http { var args = _arguments.GetArguments<FileSystemArguments>(); var ret = new FileSystemOptions(BaseDefault(target)); - if (target.IIS && _iisClient.HasWebSites) + if (string.IsNullOrEmpty(ret.Path)) { - - if (args?.ValidationSiteId != null) + if (target.IIS && _iisClient.HasWebSites) { - // Throws exception when not found - var site = _iisClient.GetWebSite(args.ValidationSiteId.Value); - ret.Path = site.Path; - ret.SiteId = args.ValidationSiteId.Value; + if (args?.ValidationSiteId != null) + { + // Throws exception when not found + _iisClient.GetWebSite(args.ValidationSiteId.Value); + ret.SiteId = args.ValidationSiteId.Value; + } } } return ret; diff --git a/src/main.lib/Plugins/ValidationPlugins/Http/HttpValidation.cs b/src/main.lib/Plugins/ValidationPlugins/Http/HttpValidation.cs index a45e9e2..11a5c45 100644 --- a/src/main.lib/Plugins/ValidationPlugins/Http/HttpValidation.cs +++ b/src/main.lib/Plugins/ValidationPlugins/Http/HttpValidation.cs @@ -160,7 +160,7 @@ namespace PKISharp.WACS.Plugins.ValidationPlugins {
if (_path == null)
{
- throw new InvalidOperationException();
+ throw new InvalidOperationException("No path specified for HttpValidation");
}
var path = CombinePath(_path, challenge.HttpResourcePath);
WriteFile(path, challenge.HttpResourceValue);
@@ -180,7 +180,7 @@ namespace PKISharp.WACS.Plugins.ValidationPlugins {
if (_path == null)
{
- throw new InvalidOperationException();
+ throw new InvalidOperationException("No path specified for HttpValidation");
}
if (_options.CopyWebConfig == true)
{
diff --git a/src/main.lib/Plugins/ValidationPlugins/Http/SelfHosting/SelfHosting.cs b/src/main.lib/Plugins/ValidationPlugins/Http/SelfHosting/SelfHosting.cs index 3681c8d..bb3d84a 100644 --- a/src/main.lib/Plugins/ValidationPlugins/Http/SelfHosting/SelfHosting.cs +++ b/src/main.lib/Plugins/ValidationPlugins/Http/SelfHosting/SelfHosting.cs @@ -34,7 +34,7 @@ namespace PKISharp.WACS.Plugins.ValidationPlugins.Http { if (_listener == null) { - throw new InvalidOperationException(); + throw new InvalidOperationException("Listener not present"); } return _listener; } diff --git a/src/main.lib/Plugins/ValidationPlugins/Tls/SelfHosting/SelfHosting.cs b/src/main.lib/Plugins/ValidationPlugins/Tls/SelfHosting/SelfHosting.cs index f7cea99..b55906e 100644 --- a/src/main.lib/Plugins/ValidationPlugins/Tls/SelfHosting/SelfHosting.cs +++ b/src/main.lib/Plugins/ValidationPlugins/Tls/SelfHosting/SelfHosting.cs @@ -34,7 +34,7 @@ namespace PKISharp.WACS.Plugins.ValidationPlugins.Tls { if (_listener == null) { - throw new InvalidOperationException(); + throw new InvalidOperationException("Listener not present"); } return _listener; } diff --git a/src/main.lib/RenewalManager.cs b/src/main.lib/RenewalManager.cs index e563d78..c435cfb 100644 --- a/src/main.lib/RenewalManager.cs +++ b/src/main.lib/RenewalManager.cs @@ -164,7 +164,7 @@ namespace PKISharp.WACS if (_args.Force) { runLevel |= RunLevel.IgnoreCache; - } + }
await ProcessRenewal(renewal, runLevel); } }, @@ -467,7 +467,12 @@ namespace PKISharp.WACS { try { - await ProcessRenewal(renewal, runLevel); + var success = await ProcessRenewal(renewal, runLevel);
+ if (!success)
+ {
+ // Make sure the ExitCode is set
+ _exceptionHandler.HandleException();
+ } } catch (Exception ex) { @@ -482,7 +487,7 @@ namespace PKISharp.WACS /// Process a single renewal /// </summary> /// <param name="renewal"></param> - internal async Task ProcessRenewal(Renewal renewal, RunLevel runLevel) + internal async Task<bool> ProcessRenewal(Renewal renewal, RunLevel runLevel) { var notification = _container.Resolve<NotificationService>(); try @@ -493,7 +498,8 @@ namespace PKISharp.WACS _renewalStore.Save(renewal, result); if (result.Success) { - await notification.NotifySuccess(renewal, _log.Lines); + await notification.NotifySuccess(renewal, _log.Lines);
+ return true; } else { @@ -505,7 +511,8 @@ namespace PKISharp.WACS { _exceptionHandler.HandleException(ex); await notification.NotifyFailure(runLevel, renewal, new List<string> { ex.Message }, _log.Lines); - } + }
+ return false; } /// <summary> diff --git a/src/main.lib/RenewalValidator.cs b/src/main.lib/RenewalValidator.cs index 9fee240..3a1b496 100644 --- a/src/main.lib/RenewalValidator.cs +++ b/src/main.lib/RenewalValidator.cs @@ -277,7 +277,7 @@ namespace PKISharp.WACS { if (context.ValidationPlugin == null) { - throw new InvalidOperationException(); + throw new InvalidOperationException("No validation plugin configured"); } var client = context.Scope.Resolve<AcmeClient>(); try @@ -372,7 +372,7 @@ namespace PKISharp.WACS { if (validationContext.Challenge == null) { - throw new InvalidOperationException(); + throw new InvalidOperationException("No challenge found"); } try { @@ -388,7 +388,7 @@ namespace PKISharp.WACS _log.Error("[{identifier}] {Error}", validationContext.Identifier, updatedChallenge.Error.ToString());
} - validationContext.AddErrorMessage("Validation failed", validationContext.Success == false); + validationContext.AddErrorMessage("Validation failed", validationContext.Success != true); return; } else @@ -402,7 +402,7 @@ namespace PKISharp.WACS { _log.Error("[{identifier}] Error submitting challenge answer", validationContext.Identifier); var message = _exceptionHandler.HandleException(ex); - validationContext.AddErrorMessage(message, validationContext.Success == false); + validationContext.AddErrorMessage(message, validationContext.Success != true); } } diff --git a/src/main.lib/Services/CertificateService.cs b/src/main.lib/Services/CertificateService.cs index ad2f0bf..2852548 100644 --- a/src/main.lib/Services/CertificateService.cs +++ b/src/main.lib/Services/CertificateService.cs @@ -235,7 +235,7 @@ namespace PKISharp.WACS.Services {
if (order.Details == null)
{
- throw new InvalidOperationException();
+ throw new InvalidOperationException("No order details found");
}
// What are we going to get?
diff --git a/src/main.lib/Services/ExceptionHandler.cs b/src/main.lib/Services/ExceptionHandler.cs index ca54ee9..0ab6cb7 100644 --- a/src/main.lib/Services/ExceptionHandler.cs +++ b/src/main.lib/Services/ExceptionHandler.cs @@ -74,8 +74,8 @@ namespace PKISharp.WACS.Services else if (!string.IsNullOrEmpty(message)) { _log.Error(message); - ExitCode = -1; } + ExitCode = -1; return outMessage; } diff --git a/src/main.lib/Services/ProxyService.cs b/src/main.lib/Services/ProxyService.cs index 17e45fd..6294835 100644 --- a/src/main.lib/Services/ProxyService.cs +++ b/src/main.lib/Services/ProxyService.cs @@ -12,12 +12,14 @@ namespace PKISharp.WACS.Services private readonly ILogService _log;
private IWebProxy? _proxy;
private readonly ISettingsService _settings;
+ private readonly VersionService _version;
public SslProtocols SslProtocols { get; set; } = SslProtocols.None;
- public ProxyService(ILogService log, ISettingsService settings)
+ public ProxyService(ILogService log, ISettingsService settings, VersionService version)
{
_log = log;
_settings = settings;
+ _version = version;
}
/// <summary>
@@ -44,7 +46,9 @@ namespace PKISharp.WACS.Services {
httpClientHandler.DefaultProxyCredentials = CredentialCache.DefaultCredentials;
}
- return new HttpClient(httpClientHandler);
+ var httpClient = new HttpClient(httpClientHandler);
+ httpClient.DefaultRequestHeaders.Add("User-Agent", $"win-acme/{_version.SoftwareVersion} (+https://github.com/win-acme/win-acme)");
+ return httpClient;
}
private class LoggingHttpClientHandler : HttpClientHandler
diff --git a/src/main.lib/Services/SettingsService.cs b/src/main.lib/Services/SettingsService.cs index e930c96..dec26aa 100644 --- a/src/main.lib/Services/SettingsService.cs +++ b/src/main.lib/Services/SettingsService.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.Configuration; using PKISharp.WACS.Extensions; -using PKISharp.WACS.Plugins.StorePlugins; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/main.lib/Services/VersionService.cs b/src/main.lib/Services/VersionService.cs new file mode 100644 index 0000000..3383d12 --- /dev/null +++ b/src/main.lib/Services/VersionService.cs @@ -0,0 +1,31 @@ +using System; +using System.Reflection; + +namespace PKISharp.WACS.Services +{ + public class VersionService + { + public string Bitness => Environment.Is64BitProcess ? "64-bit" : "32-bit"; + + public string BuildType + { + get + { + var build = ""; +#if DEBUG + build += "DEBUG"; +#else + build += "RELEASE"; +#endif +#if PLUGGABLE + build += ", PLUGGABLE"; +#else + build += ", TRIMMED"; +#endif + return build; + } + } + + public Version SoftwareVersion => Assembly.GetEntryAssembly().GetName().Version; + } +} diff --git a/src/main.lib/Wacs.cs b/src/main.lib/Wacs.cs index be8faf9..36d3773 100644 --- a/src/main.lib/Wacs.cs +++ b/src/main.lib/Wacs.cs @@ -10,7 +10,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Reflection; using System.Threading.Tasks; namespace PKISharp.WACS.Host @@ -30,18 +29,27 @@ namespace PKISharp.WACS.Host private readonly ExceptionHandler _exceptionHandler; private readonly IUserRoleService _userRoleService; private readonly TaskSchedulerService _taskScheduler; + private readonly VersionService _versionService; - public Wacs(ILifetimeScope container) + public Wacs( + IContainer container, + IAutofacBuilder scopeBuilder, + ExceptionHandler exceptionHandler, + ILogService logService, + ISettingsService settingsService, + IUserRoleService userRoleService, + TaskSchedulerService taskSchedulerService, + VersionService versionService) { // Basic services _container = container; - _scopeBuilder = container.Resolve<IAutofacBuilder>(); - _exceptionHandler = container.Resolve<ExceptionHandler>(); - _log = _container.Resolve<ILogService>(); - _settings = _container.Resolve<ISettingsService>(); - _userRoleService = _container.Resolve<IUserRoleService>(); - _settings = _container.Resolve<ISettingsService>(); - _taskScheduler = _container.Resolve<TaskSchedulerService>(); + _scopeBuilder = scopeBuilder; + _exceptionHandler = exceptionHandler; + _log = logService; + _settings = settingsService; + _userRoleService = userRoleService; + _taskScheduler = taskSchedulerService; + _versionService = versionService; try { @@ -171,23 +179,11 @@ namespace PKISharp.WACS.Host /// </summary> private async Task ShowBanner() { - var build = ""; -#if DEBUG - build += "DEBUG"; -#else - build += "RELEASE"; -#endif -#if PLUGGABLE - build += ", PLUGGABLE"; -#else - build += ", TRIMMED"; -#endif - var version = Assembly.GetEntryAssembly().GetName().Version; var iis = _container.Resolve<IIISClient>().Version; Console.WriteLine(); _log.Information(LogType.Screen, "A simple Windows ACMEv2 client (WACS)"); - _log.Information(LogType.Screen, "Software version {version} ({build})", version, build); - _log.Information(LogType.Disk | LogType.Event, "Software version {version} ({build}) started", version, build); + _log.Information(LogType.Screen, "Software version {version} ({build}, {bitness})", _versionService.SoftwareVersion, _versionService.BuildType, _versionService.Bitness); + _log.Information(LogType.Disk | LogType.Event, "Software version {version} ({build}, {bitness}) started", _versionService.SoftwareVersion, _versionService.BuildType, _versionService.Bitness); if (_args != null) { _log.Information("ACME server {ACME}", _settings.BaseUri); @@ -378,7 +374,7 @@ namespace PKISharp.WACS.Host var acmeAccount = await acmeClient.GetAccount(); if (acmeAccount == null) { - throw new InvalidOperationException(); + throw new InvalidOperationException("Unable to initialize acmeAccount"); } _input.CreateSpace(); _input.Show("Account ID", acmeAccount.Payload.Id ?? "-"); diff --git a/src/main.test/Mock/MockContainer.cs b/src/main.test/Mock/MockContainer.cs index 76560ae..8c2076d 100644 --- a/src/main.test/Mock/MockContainer.cs +++ b/src/main.test/Mock/MockContainer.cs @@ -37,6 +37,7 @@ namespace PKISharp.WACS.UnitTests.Mock _ = builder.RegisterType<mock.MockRenewalStore>().As<real.IRenewalStore>().SingleInstance(); _ = builder.RegisterType<mock.MockSettingsService>().As<real.ISettingsService>().SingleInstance(); ; _ = builder.RegisterType<mock.UserRoleService>().As<real.IUserRoleService>().SingleInstance(); + _ = builder.RegisterType<real.VersionService>().SingleInstance(); _ = builder.RegisterType<real.ProxyService>().SingleInstance(); _ = builder.RegisterType<real.PasswordGenerator>().SingleInstance(); diff --git a/src/main.test/Tests/DnsValidationTests/When_resolving_name_servers.cs b/src/main.test/Tests/DnsValidationTests/When_resolving_name_servers.cs index b8d6427..3599ba3 100644 --- a/src/main.test/Tests/DnsValidationTests/When_resolving_name_servers.cs +++ b/src/main.test/Tests/DnsValidationTests/When_resolving_name_servers.cs @@ -16,7 +16,7 @@ namespace PKISharp.WACS.UnitTests.Tests.DnsValidationTests { var log = new LogService(true); var settings = new MockSettingsService(); - var proxy = new ProxyService(log, settings); + var proxy = new ProxyService(log, settings, new VersionService()); var domainParser = new DomainParseService(log, proxy, settings); _dnsClient = new LookupClientProvider(domainParser, log, settings); } diff --git a/src/main.test/Tests/InstallationPluginTests/MultipleInstallerTests.cs b/src/main.test/Tests/InstallationPluginTests/MultipleInstallerTests.cs index 8c8aa79..b05e95c 100644 --- a/src/main.test/Tests/InstallationPluginTests/MultipleInstallerTests.cs +++ b/src/main.test/Tests/InstallationPluginTests/MultipleInstallerTests.cs @@ -13,6 +13,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; using PKISharp.WACS.Clients.DNS; +using PKISharp.WACS.UnitTests.Mock; namespace PKISharp.WACS.UnitTests.Tests.InstallationPluginTests { @@ -40,13 +41,14 @@ namespace PKISharp.WACS.UnitTests.Tests.InstallationPluginTests var commandLine = "--installation iis"; var types = new List<Type>() { typeof(CertificateStore) }; var chosen = new List<IInstallationPluginOptionsFactory>(); - - + + var builder = new ContainerBuilder(); _ = builder.RegisterType<LookupClientProvider>(); _ = builder.RegisterType<ProxyService>(); _ = builder.RegisterType<DomainParseService>(); _ = builder.RegisterType<IISHelper>(); + _ = builder.RegisterType<VersionService>(); _ = builder.RegisterInstance(plugins). As<IPluginService>(). SingleInstance(); diff --git a/src/main/Program.cs b/src/main/Program.cs index 0c1a2ba..09892e3 100644 --- a/src/main/Program.cs +++ b/src/main/Program.cs @@ -31,7 +31,7 @@ namespace PKISharp.WACS.Host if (Environment.UserInteractive)
{
Console.WriteLine(" Press <Enter> to close");
- Console.ReadLine();
+ _ = Console.ReadLine();
} return; } @@ -42,9 +42,9 @@ namespace PKISharp.WACS.Host var original = Console.OutputEncoding; try - { - // Load instance of the main class and start the program - var wacs = new Wacs(container); + {
+ // Load instance of the main class and start the program
+ var wacs = container.Resolve<Wacs>(new TypedParameter(typeof(IContainer), container)); Environment.ExitCode = await wacs.Start(); } catch (Exception ex) @@ -107,6 +107,7 @@ namespace PKISharp.WACS.Host _ = builder.RegisterType<ProxyService>().SingleInstance(); _ = builder.RegisterType<PasswordGenerator>().SingleInstance(); _ = builder.RegisterType<RenewalStoreDisk>().As<IRenewalStore>().SingleInstance(); + _ = builder.RegisterType<VersionService>().SingleInstance(); pluginService.Configure(builder); @@ -132,6 +133,8 @@ namespace PKISharp.WACS.Host _ = builder.RegisterType<RenewalCreator>().SingleInstance(); _ = builder.Register(c => c.Resolve<IArgumentsService>().MainArguments).SingleInstance(); + _ = builder.RegisterType<Wacs>(); + return builder.Build(); } } |