diff --git a/src/fiskaltrust.Launcher/Commands/Common.cs b/src/fiskaltrust.Launcher/Commands/Common.cs index 7bc41d10..74f0842f 100644 --- a/src/fiskaltrust.Launcher/Commands/Common.cs +++ b/src/fiskaltrust.Launcher/Commands/Common.cs @@ -83,12 +83,11 @@ public static async Task HandleAsync( Func> handler) where S : notnull { Log.Verbose("call CommonHandler HandleAsync"); - /* + var collectionSink = new CollectionSink(); Log.Logger = new LoggerConfiguration() .WriteTo.Sink(collectionSink) .CreateLogger(); - */ var launcherConfiguration = new LauncherConfiguration(); @@ -203,7 +202,6 @@ public static async Task HandleAsync( .Enrich.FromLogContext() .CreateLogger(); - /* foreach (var logEvent in collectionSink.Events) { Log.Write(logEvent); @@ -212,7 +210,7 @@ public static async Task HandleAsync( if (collectionSink.Events.Where(e => e.Level == LogEventLevel.Fatal).Any()) { return 1; - }*/ + } Log.Debug("Launcher Configuration File: {LauncherConfigurationFile}", options.LauncherConfigurationFile); Log.Debug("Cashbox Configuration File: {CashboxConfigurationFile}", launcherConfiguration.CashboxConfigurationFile); @@ -220,19 +218,14 @@ public static async Task HandleAsync( var dataProtectionProvider = DataProtectionExtensions.Create(launcherConfiguration.AccessToken, useFallback: launcherConfiguration.UseLegacyDataProtection!.Value); - Log.Verbose($"dataProtectionProvider is null: {dataProtectionProvider == null}"); try { - if (!launcherConfiguration.UseLegacyDataProtection!.Value) - { - launcherConfiguration.Decrypt(dataProtectionProvider.CreateProtector(LauncherConfiguration.DATA_PROTECTION_DATA_PURPOSE)); - } + launcherConfiguration.Decrypt(dataProtectionProvider.CreateProtector(LauncherConfiguration.DATA_PROTECTION_DATA_PURPOSE)); } catch (Exception e) { Log.Warning(e, "Error decrypring launcher configuration file."); } - Log.Verbose($"finished handler"); return await handler(options, new CommonProperties(launcherConfiguration, cashboxConfiguration, clientEcdh, dataProtectionProvider), specificOptions, host.Services.GetRequiredService()); } diff --git a/src/fiskaltrust.Launcher/Commands/DoctorCommand.cs b/src/fiskaltrust.Launcher/Commands/DoctorCommand.cs index 230cb224..9007e414 100644 --- a/src/fiskaltrust.Launcher/Commands/DoctorCommand.cs +++ b/src/fiskaltrust.Launcher/Commands/DoctorCommand.cs @@ -124,7 +124,7 @@ public static async Task HandleAsync(CommonOptions commonOptions, CommonPro } var dataProtectionProvider = checkUp.Check("Setup data protection", () => DataProtectionExtensions.Create(launcherConfiguration.AccessToken, useFallback: launcherConfiguration.UseLegacyDataProtection!.Value)); - if (dataProtectionProvider is not null && !launcherConfiguration.UseLegacyDataProtection!.Value) + if (dataProtectionProvider is not null) { checkUp.Check("Decrypt launcher configuration", () => launcherConfiguration.Decrypt(dataProtectionProvider.CreateProtector(LauncherConfiguration.DATA_PROTECTION_DATA_PURPOSE))); } diff --git a/src/fiskaltrust.Launcher/Commands/RunCommand.cs b/src/fiskaltrust.Launcher/Commands/RunCommand.cs index 74a362bc..28db3b63 100644 --- a/src/fiskaltrust.Launcher/Commands/RunCommand.cs +++ b/src/fiskaltrust.Launcher/Commands/RunCommand.cs @@ -67,10 +67,7 @@ public static class RunHandler { public static async Task HandleAsync(CommonOptions commonOptions, CommonProperties commonProperties, RunOptions _, RunServices runServices) { - Log.Verbose($"RunHandler call"); - Log.Verbose($"runServices.LauncherExecutablePath {runServices.LauncherExecutablePath.Path}"); var builder = WebApplication.CreateBuilder(); - Log.Verbose($"WebApplication.CreateBuilder()"); builder.Host .UseSystemd() .UseSerilog() @@ -87,7 +84,6 @@ public static async Task HandleAsync(CommonOptions commonOptions, CommonPro services.AddSingleton(_ => runServices.LauncherExecutablePath); }); - Log.Verbose($"RunHandler builder.Host"); builder.WebHost.ConfigureBinding(new Uri($"http://[::1]:{commonProperties.LauncherConfiguration.LauncherPort}"), protocols: HttpProtocols.Http2); builder.Services.AddCodeFirstGrpc(); @@ -98,11 +94,9 @@ public static async Task HandleAsync(CommonOptions commonOptions, CommonPro #pragma warning disable ASP0014 app.UseEndpoints(endpoints => endpoints.MapGrpcService()); #pragma warning restore ASP0014 - Log.Verbose($"RunHandler PrepareSelfUpdate.call"); - try { - await runServices.SelfUpdater.PrepareSelfUpdate(Log.Logger, commonProperties.LauncherConfiguration, app.Services.GetRequiredService()); - } catch (Exception e) { Log.Error(e, "An unhandled exception occured."); return 1;} - Log.Verbose($"RunHandler PrepareSelfUpdate.end"); + + await runServices.SelfUpdater.PrepareSelfUpdate(Log.Logger, commonProperties.LauncherConfiguration, app.Services.GetRequiredService()); + try { await app.RunAsync(runServices.Lifetime.ApplicationLifetime.ApplicationStopping); @@ -118,7 +112,6 @@ public static async Task HandleAsync(CommonOptions commonOptions, CommonPro { Log.CloseAndFlush(); } - Log.Verbose($"RunHandler end"); return 0; } } diff --git a/src/fiskaltrust.Launcher/Download/PackageDownloader.cs b/src/fiskaltrust.Launcher/Download/PackageDownloader.cs index a2b35d1a..89ee1958 100644 --- a/src/fiskaltrust.Launcher/Download/PackageDownloader.cs +++ b/src/fiskaltrust.Launcher/Download/PackageDownloader.cs @@ -146,7 +146,6 @@ public async Task DownloadAsync(string name, string version, string platform, st return request; }); - _logger?.LogInformation("response1"); response.EnsureSuccessStatusCode(); await using var fileStream = new FileStream(sourcePath, FileMode.Create, FileAccess.Write, FileShare.None); @@ -163,7 +162,6 @@ public async Task DownloadAsync(string name, string version, string platform, st return request; }); - _logger?.LogInformation("response2"); response.EnsureSuccessStatusCode(); await File.WriteAllTextAsync($"{sourcePath}.hash", await response.Content.ReadAsStringAsync()); } diff --git a/src/fiskaltrust.Launcher/Extensions/DataProtectionExtensions.cs b/src/fiskaltrust.Launcher/Extensions/DataProtectionExtensions.cs index 5255d8ec..39f858a8 100644 --- a/src/fiskaltrust.Launcher/Extensions/DataProtectionExtensions.cs +++ b/src/fiskaltrust.Launcher/Extensions/DataProtectionExtensions.cs @@ -200,7 +200,7 @@ public static IDataProtectionBuilder ProtectKeysCustom(this IDataProtectionBuild } else if (OperatingSystem.IsLinux()) { - Log.Warning("Fallback config encryption mechanism used."); + Log.Warning("Fallback config encryption mechanism is used on linux."); } else if (OperatingSystem.IsMacOS()) { @@ -210,7 +210,6 @@ public static IDataProtectionBuilder ProtectKeysCustom(this IDataProtectionBuild Log.Debug("Fallback config encryption mechanism used."); builder.Services.Configure(options => options.XmlEncryptor = new LegacyXmlEncryptor(builder.Services)); - Log.Verbose("config KeyManagementOptions"); return builder; } }