mirror of https://github.com/infosecn1nja/C3.git
Load libsodium at startup
Sodium was loaded when gatway tried to connect to controller, and loading could fail if no VC++ redist package is installeddependabot/npm_and_yarn/Src/WebController/UI/websocket-extensions-0.1.4
parent
f80ee0f666
commit
58dca25974
|
@ -35,6 +35,10 @@ namespace MWR.C3.WebController
|
|||
Log.Information("Starting web host");
|
||||
CreateWebHostBuilder(args).Build().Run();
|
||||
}
|
||||
catch (TypeInitializationException e) when (e.InnerException is DllNotFoundException)
|
||||
{
|
||||
Log.Fatal(@"Failed to load soduim library. Check if you have Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 installed: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Fatal(ex, "Host terminated unexpectedly");
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
@ -25,6 +26,7 @@ namespace MWR.C3.WebController
|
|||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
CheckCryptoLib();
|
||||
services.AddMvc()
|
||||
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
|
||||
.AddJsonOptions(options => {
|
||||
|
@ -74,5 +76,10 @@ namespace MWR.C3.WebController
|
|||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "C3 Web API");
|
||||
});
|
||||
}
|
||||
|
||||
private static void CheckCryptoLib()
|
||||
{
|
||||
Sodium.SodiumCore.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue