Add certificate params to main config
This commit is contained in:
parent
7637140aad
commit
0f1eec56fb
3 changed files with 21 additions and 3 deletions
|
@ -6,7 +6,7 @@ using System.Reflection;
|
||||||
[assembly: AssemblyCompany("ZNI")]
|
[assembly: AssemblyCompany("ZNI")]
|
||||||
[assembly: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)]
|
[assembly: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)]
|
||||||
[assembly: AssemblyCopyright("© 2020 Tara Piccari")]
|
[assembly: AssemblyCopyright("© 2020 Tara Piccari")]
|
||||||
[assembly: AssemblyFileVersion("5.1.960")]
|
[assembly: AssemblyFileVersion("5.1.961")]
|
||||||
[assembly: AssemblyDescription("Second Life Bot - BotCore5")]
|
[assembly: AssemblyDescription("Second Life Bot - BotCore5")]
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ namespace Bot.Assemble
|
||||||
public class ASMInfo
|
public class ASMInfo
|
||||||
{
|
{
|
||||||
public static string BotName = "ZBotCore";
|
public static string BotName = "ZBotCore";
|
||||||
public static string BotVer = "5.1.960";
|
public static string BotVer = "5.1.961";
|
||||||
public static string GitPassword
|
public static string GitPassword
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -63,6 +63,8 @@ namespace Bot
|
||||||
public string WebServerIP { get; set; } = "zontreck.dev";
|
public string WebServerIP { get; set; } = "zontreck.dev";
|
||||||
|
|
||||||
public bool UseSSL { get; set; } = false;
|
public bool UseSSL { get; set; } = false;
|
||||||
|
public string SSLCertificatePFX { get; set; } = "certificate.pfx";
|
||||||
|
public string SSLCertificatePWD { get; set; } = "";
|
||||||
|
|
||||||
public Dictionary<UUID, int> BotAdmins { get; set; } = new Dictionary<UUID, int>();
|
public Dictionary<UUID, int> BotAdmins { get; set; } = new Dictionary<UUID, int>();
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@ using System.IO;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace Bot.WebHookServer
|
namespace Bot.WebHookServer
|
||||||
{
|
{
|
||||||
|
@ -58,11 +60,25 @@ namespace Bot.WebHookServer
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
listener = new HttpListener();
|
listener = new HttpListener();
|
||||||
MHEx = MH.callbacks;
|
|
||||||
if (MainConfiguration.Instance.UseSSL)
|
if (MainConfiguration.Instance.UseSSL)
|
||||||
|
{
|
||||||
|
|
||||||
|
X509Certificate cert = new X509Certificate2(MainConfiguration.Instance.SSLCertificatePFX, MainConfiguration.Instance.SSLCertificatePWD);
|
||||||
|
|
||||||
|
Type hepmType = Type.GetType("System.Net.HttpEndPointManager, System.Net.HttpListener");
|
||||||
|
Type heplType = Type.GetType("System.Net.HttpEndPointListener, System.Net.HttpListener");
|
||||||
|
MethodInfo getEPListener = hepmType.GetMethod("GetEPListener", BindingFlags.Static | BindingFlags.NonPublic);
|
||||||
|
FieldInfo heplCert = heplType.GetField("_cert", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
|
object epl = getEPListener.Invoke(null, new object[] { "+", MainConfiguration.Instance.WebServerPort, listener, true });
|
||||||
|
heplCert.SetValue(epl, cert);
|
||||||
listener.Prefixes.Add($"https://*:{MainConfiguration.Instance.WebServerPort}/");
|
listener.Prefixes.Add($"https://*:{MainConfiguration.Instance.WebServerPort}/");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
listener.Prefixes.Add($"http://*:{MainConfiguration.Instance.WebServerPort}/");
|
listener.Prefixes.Add($"http://*:{MainConfiguration.Instance.WebServerPort}/");
|
||||||
|
|
||||||
|
|
||||||
|
MHEx = MH.callbacks;
|
||||||
|
|
||||||
listener.Start();
|
listener.Start();
|
||||||
var hc = new HookCmds();
|
var hc = new HookCmds();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue