summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWouter Tinus <win.acme.simple@gmail.com>2019-12-07 08:34:49 +0100
committerWouter Tinus <win.acme.simple@gmail.com>2019-12-07 08:34:49 +0100
commit812aa36dfc44a57c5ea356558e81ed37628c0b42 (patch)
tree7a9a691229b3e77cbc6853f743c5598f6a51c65d /src
parent0639136bcbbd9b6e4d9bf6f4b45e2131660d63f0 (diff)
downloadletsencrypt-win-simple-812aa36dfc44a57c5ea356558e81ed37628c0b42.zip
letsencrypt-win-simple-812aa36dfc44a57c5ea356558e81ed37628c0b42.tar.gz
letsencrypt-win-simple-812aa36dfc44a57c5ea356558e81ed37628c0b42.tar.bz2
Fix broken import
Diffstat (limited to 'src')
-rw-r--r--src/main.lib/DomainObjects/Renewal.cs4
-rw-r--r--src/main.lib/Plugins/ValidationPlugins/Validation.cs2
-rw-r--r--src/main.lib/Services/ArgumentsService.cs9
-rw-r--r--src/main.lib/Services/AutofacBuilder.cs18
-rw-r--r--src/main.lib/Services/Interfaces/IArgumentsService.cs2
-rw-r--r--src/main.lib/Services/Legacy/Importer.cs1
-rw-r--r--src/main.lib/Services/Legacy/LegacySettingsService.cs15
-rw-r--r--src/main.lib/Services/Legacy/LegacyTarget.cs20
-rw-r--r--src/main.lib/Services/Legacy/LegacyTaskSchedulerService.cs2
-rw-r--r--src/main.lib/Services/Legacy/RegistryLegacyRenewalService.cs2
-rw-r--r--src/main.lib/Services/TaskSchedulerService.cs6
11 files changed, 51 insertions, 30 deletions
diff --git a/src/main.lib/DomainObjects/Renewal.cs b/src/main.lib/DomainObjects/Renewal.cs
index cbc3064..c3a1e4c 100644
--- a/src/main.lib/DomainObjects/Renewal.cs
+++ b/src/main.lib/DomainObjects/Renewal.cs
@@ -71,14 +71,14 @@ namespace PKISharp.WACS.DomainObjects
/// Friendly name for the certificate. If left
/// blank or empty, the CommonName will be used.
/// </summary>
- public string FriendlyName { get; set; }
+ public string? FriendlyName { get; set; }
/// <summary>
/// Display name, as the program shows this certificate
/// in the interface. This is set to the most recently
/// used FriendlyName
/// </summary>
- public string LastFriendlyName { get; set; }
+ public string? LastFriendlyName { get; set; }
/// <summary>
/// Plain text readable version of the PfxFile password
diff --git a/src/main.lib/Plugins/ValidationPlugins/Validation.cs b/src/main.lib/Plugins/ValidationPlugins/Validation.cs
index 13bd1e6..a5fd057 100644
--- a/src/main.lib/Plugins/ValidationPlugins/Validation.cs
+++ b/src/main.lib/Plugins/ValidationPlugins/Validation.cs
@@ -20,7 +20,7 @@ namespace PKISharp.WACS.Plugins.ValidationPlugins
{
if (challenge.GetType() != typeof(TChallenge))
{
- throw new InvalidOperationException();
+ throw new InvalidOperationException("Unexpected challenge type");
}
else
{
diff --git a/src/main.lib/Services/ArgumentsService.cs b/src/main.lib/Services/ArgumentsService.cs
index f9ff334..3bf802b 100644
--- a/src/main.lib/Services/ArgumentsService.cs
+++ b/src/main.lib/Services/ArgumentsService.cs
@@ -9,7 +9,7 @@ namespace PKISharp.WACS.Services
private readonly ILogService _log;
private readonly ArgumentsParser _parser;
- public MainArguments? MainArguments { get; private set; }
+ public MainArguments MainArguments { get; private set; } = new MainArguments();
public ArgumentsService(ILogService log, ArgumentsParser parser)
{
@@ -17,7 +17,12 @@ namespace PKISharp.WACS.Services
_parser = parser;
if (parser.Validate())
{
- MainArguments = parser.GetArguments<MainArguments>();
+ var main = parser.GetArguments<MainArguments>();
+ if (main == null)
+ {
+ throw new InvalidOperationException("No MainArguments");
+ }
+ MainArguments = main;
}
}
diff --git a/src/main.lib/Services/AutofacBuilder.cs b/src/main.lib/Services/AutofacBuilder.cs
index b635877..47b105a 100644
--- a/src/main.lib/Services/AutofacBuilder.cs
+++ b/src/main.lib/Services/AutofacBuilder.cs
@@ -29,9 +29,11 @@ namespace PKISharp.WACS.Host
{
return main.BeginLifetimeScope(builder =>
{
+ var realSettings = main.Resolve<ISettingsService>();
+ var realArguments = main.Resolve<IArgumentsService>();
+
builder.Register(c => new MainArguments {
- BaseUri = toUri.ToString(),
- ImportBaseUri = fromUri.ToString()
+ BaseUri = fromUri.ToString()
}).
As<MainArguments>().
SingleInstance();
@@ -41,12 +43,20 @@ namespace PKISharp.WACS.Host
SingleInstance();
builder.RegisterType<LegacySettingsService>().
- WithParameter(new TypedParameter(typeof(ISettingsService), main.Resolve<ISettingsService>())).
+ WithParameter(new TypedParameter(typeof(ISettingsService), realSettings)).
SingleInstance();
builder.RegisterType<LegacyTaskSchedulerService>();
+
builder.RegisterType<TaskSchedulerService>().
- WithParameter(new TypedParameter(typeof(RunLevel), RunLevel.Import)).
+ WithParameter(new TypedParameter(typeof(IArgumentsService), realArguments)).
+ WithParameter(new TypedParameter(typeof(ISettingsService), realSettings)).
+ SingleInstance();
+
+ builder.RegisterType<RenewalService>().
+ WithParameter(new TypedParameter(typeof(IArgumentsService), realArguments)).
+ WithParameter(new TypedParameter(typeof(ISettingsService), realSettings)).
+ As<IRenewalStore>().
SingleInstance();
// Check where to load Renewals from
diff --git a/src/main.lib/Services/Interfaces/IArgumentsService.cs b/src/main.lib/Services/Interfaces/IArgumentsService.cs
index 941ec7f..e613119 100644
--- a/src/main.lib/Services/Interfaces/IArgumentsService.cs
+++ b/src/main.lib/Services/Interfaces/IArgumentsService.cs
@@ -5,7 +5,7 @@ namespace PKISharp.WACS.Services
{
public interface IArgumentsService
{
- MainArguments? MainArguments { get; }
+ MainArguments MainArguments { get; }
T? GetArguments<T>() where T : class, new();
bool Active();
bool HasFilter();
diff --git a/src/main.lib/Services/Legacy/Importer.cs b/src/main.lib/Services/Legacy/Importer.cs
index 8aa5755..e93881b 100644
--- a/src/main.lib/Services/Legacy/Importer.cs
+++ b/src/main.lib/Services/Legacy/Importer.cs
@@ -85,6 +85,7 @@ namespace PKISharp.WACS.Services.Legacy
legacy.Binding.TargetPluginName = "IISSites";
break;
case "Manual":
+ default:
legacy.Binding.TargetPluginName = "Manual";
break;
}
diff --git a/src/main.lib/Services/Legacy/LegacySettingsService.cs b/src/main.lib/Services/Legacy/LegacySettingsService.cs
index 33c39e6..259f51a 100644
--- a/src/main.lib/Services/Legacy/LegacySettingsService.cs
+++ b/src/main.lib/Services/Legacy/LegacySettingsService.cs
@@ -13,7 +13,6 @@ namespace PKISharp.WACS.Host.Services.Legacy
{
private readonly List<string> _clientNames;
private readonly ILogService _log;
- private readonly ISettingsService _settings;
public UiSettings UI { get; private set; }
public AcmeSettings Acme { get; private set; }
@@ -33,14 +32,20 @@ namespace PKISharp.WACS.Host.Services.Legacy
public LegacySettingsService(ILogService log, MainArguments main, ISettingsService settings)
{
_log = log;
- _settings = settings;
UI = settings.UI;
Acme = settings.Acme;
ScheduledTask = settings.ScheduledTask;
Notification = settings.Notification;
Security = settings.Security;
Script = settings.Script;
- Client = settings.Client;
+ // Copy so that the "ConfigurationPath" setting is not modified
+ // from outside anymore
+ Client = new ClientSettings()
+ {
+ ClientName = settings.Client.ClientName,
+ ConfigurationPath = settings.Client.ConfigurationPath,
+ LogPath = settings.Client.LogPath
+ };
Validation = settings.Validation;
Store = settings.Store;
ExePath = settings.ExePath;
@@ -74,7 +79,7 @@ namespace PKISharp.WACS.Host.Services.Legacy
_clientNames.Insert(0, customName);
}
}
- BaseUri = new Uri(main.ImportBaseUri);
+ BaseUri = new Uri(main.BaseUri);
CreateConfigPath(main, userRoot);
}
@@ -128,7 +133,7 @@ namespace PKISharp.WACS.Host.Services.Legacy
}
}
- Client.ConfigurationPath = Path.Combine(configRoot, CleanFileName(options.ImportBaseUri));
+ Client.ConfigurationPath = Path.Combine(configRoot, CleanFileName(options.BaseUri));
_log.Debug("Legacy config folder: {_configPath}", Client.ConfigurationPath);
}
diff --git a/src/main.lib/Services/Legacy/LegacyTarget.cs b/src/main.lib/Services/Legacy/LegacyTarget.cs
index 7e6d01e..6282ae8 100644
--- a/src/main.lib/Services/Legacy/LegacyTarget.cs
+++ b/src/main.lib/Services/Legacy/LegacyTarget.cs
@@ -31,7 +31,7 @@ namespace PKISharp.WACS.Services.Legacy
/// <summary>
/// Path to use for Http validation (may be local or remote)
/// </summary>
- public string WebRootPath { get; set; }
+ public string? WebRootPath { get; set; }
/// <summary>
/// Identify the IIS website that the target is based on
@@ -66,7 +66,7 @@ namespace PKISharp.WACS.Services.Legacy
/// <summary>
/// IP address to create new SSL bindings on
/// </summary>
- public string SSLIPAddress { get; set; }
+ public string? SSLIPAddress { get; set; }
/// <summary>
/// Port to use to listen to HTTP-01 validation requests
@@ -76,7 +76,7 @@ namespace PKISharp.WACS.Services.Legacy
/// <summary>
/// List of bindings to exclude from the certificate
/// </summary>
- public string ExcludeBindings { get; set; }
+ public string? ExcludeBindings { get; set; }
/// <summary>
/// List of alternative names for the certificate
@@ -86,36 +86,36 @@ namespace PKISharp.WACS.Services.Legacy
/// <summary>
/// Name of the plugin to use for refreshing the target
/// </summary>
- public string TargetPluginName { get; set; }
+ public string? TargetPluginName { get; set; }
/// <summary>
/// Name of the plugin to use for validation
/// </summary>
- public string ValidationPluginName { get; set; }
+ public string? ValidationPluginName { get; set; }
/// <summary>
/// Options for ValidationPlugins.Http.Ftp
/// </summary>
- public LegacyCredentials HttpFtpOptions { get; set; }
+ public LegacyCredentials? HttpFtpOptions { get; set; }
/// <summary>
/// Options for ValidationPlugins.Http.WebDav
/// </summary>
- public LegacyCredentials HttpWebDavOptions { get; set; }
+ public LegacyCredentials? HttpWebDavOptions { get; set; }
/// <summary>
/// Options for ValidationPlugins.Dns.Azure
/// </summary>
- public LegacyAzureDnsOptions DnsAzureOptions { get; set; }
+ public LegacyAzureDnsOptions? DnsAzureOptions { get; set; }
/// <summary>
/// Options for ValidationPlugins.Dns.Script
/// </summary>
- public LegacyDnsScriptOptions DnsScriptOptions { get; set; }
+ public LegacyDnsScriptOptions? DnsScriptOptions { get; set; }
/// <summary>
/// Legacy
/// </summary>
- public string PluginName { get; set; }
+ public string? PluginName { get; set; }
}
} \ No newline at end of file
diff --git a/src/main.lib/Services/Legacy/LegacyTaskSchedulerService.cs b/src/main.lib/Services/Legacy/LegacyTaskSchedulerService.cs
index e761339..633aa7e 100644
--- a/src/main.lib/Services/Legacy/LegacyTaskSchedulerService.cs
+++ b/src/main.lib/Services/Legacy/LegacyTaskSchedulerService.cs
@@ -26,7 +26,7 @@ namespace PKISharp.WACS.Services.Legacy
Task existingTask = null;
foreach (var clientName in _settings.Client.ClientName.AsEnumerable().Reverse())
{
- taskName = $"{clientName} {CleanFileName(_options.ImportBaseUri)}";
+ taskName = $"{clientName} {CleanFileName(_options.BaseUri)}";
existingTask = taskService.GetTask(taskName);
if (existingTask != null)
{
diff --git a/src/main.lib/Services/Legacy/RegistryLegacyRenewalService.cs b/src/main.lib/Services/Legacy/RegistryLegacyRenewalService.cs
index afb2037..f34dd91 100644
--- a/src/main.lib/Services/Legacy/RegistryLegacyRenewalService.cs
+++ b/src/main.lib/Services/Legacy/RegistryLegacyRenewalService.cs
@@ -18,7 +18,7 @@ namespace PKISharp.WACS.Services.Legacy
LegacySettingsService settings) :
base(settings, log)
{
- _baseUri = main.ImportBaseUri;
+ _baseUri = main.BaseUri;
_hive = $"HKEY_CURRENT_USER{Key}";
if (RenewalsRaw == null)
{
diff --git a/src/main.lib/Services/TaskSchedulerService.cs b/src/main.lib/Services/TaskSchedulerService.cs
index ef239b0..4f3b2d5 100644
--- a/src/main.lib/Services/TaskSchedulerService.cs
+++ b/src/main.lib/Services/TaskSchedulerService.cs
@@ -17,11 +17,11 @@ namespace PKISharp.WACS.Services
public TaskSchedulerService(
ISettingsService settings,
- IArgumentsService options,
+ IArgumentsService arguments,
IInputService input,
ILogService log)
{
- _arguments = options.MainArguments;
+ _arguments = arguments.MainArguments;
_settings = settings;
_input = input;
_log = log;
@@ -30,7 +30,7 @@ namespace PKISharp.WACS.Services
private string WorkingDirectory => Path.GetDirectoryName(_settings.ExePath);
private string ExecutingFile => Path.GetFileName(_settings.ExePath);
- private Task ExistingTask
+ private Task? ExistingTask
{
get
{