make SSL support for botcore5 be windows only and fix the requet logs folder so git works once more.

* Reason for the above: There is no reliable method on all platforms to utilize a SSL certificate until Microsoft fixes this bug/inconsistency.
This commit is contained in:
Zontreck 2020-10-22 09:22:02 -07:00
parent c00c129499
commit 43a89fc88a
6 changed files with 19 additions and 11 deletions

View file

@ -7,7 +7,7 @@ using LibZNI;
[assembly: AssemblyCompany("ZNI")]
[assembly: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)]
[assembly: AssemblyCopyright("(C) 2020 Tara Piccari")]
[assembly: AssemblyFileVersion("5.0.5.1255")]
[assembly: AssemblyFileVersion("5.0.5.1256")]
[assembly: AssemblyDescription("Second Life Bot - BotCore5")]
[assembly: AutoUpdater("/job/Bot", "!os!.tar")]
@ -16,7 +16,7 @@ namespace Bot.Assemble
public class ASMInfo
{
public static string BotName = "ZBotCore";
public static string BotVer = "5.0.5.1255";
public static string BotVer = "5.0.5.1256";
public static string GitPassword
{
get

View file

@ -14,10 +14,12 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Terminal.Gui" Version="0.90.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\LibZNIcpp\LibZNIcpp.vcxproj" />
<ProjectReference Include="..\..\LibZNI\LibZNI.csproj" />
<ProjectReference Include="..\libremetaverse\LibreMetaverse.StructuredData\LibreMetaverse.StructuredData.csproj" />
<ProjectReference Include="..\libremetaverse\LibreMetaverseTypes\LibreMetaverse.Types.csproj" />

View file

@ -1,8 +1,5 @@
using Bot.CommandSystem;
using OpenMetaverse;
using System;
using System.Collections.Generic;
using System.Text;
namespace Bot
{

View file

@ -3,7 +3,6 @@ using OpenMetaverse;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
namespace Bot

View file

@ -31,7 +31,7 @@ namespace Bot.WebHookServer
StreamReader SR = new StreamReader(body, CTX.Request.ContentEncoding);
string Response = SR.ReadToEnd();
if (!Directory.Exists("request_log")) Directory.CreateDirectory("request_log");
if (!Directory.Exists("BotData/request_log")) Directory.CreateDirectory("BotData/request_log");
string RequestPath = CTX.Request.RawUrl;
@ -45,7 +45,7 @@ namespace Bot.WebHookServer
CustomReplyStr = reply.ReplyString;
byte[] buffer = Encoding.UTF8.GetBytes("\n" + CustomReplyStr);
CTX.Response.ContentLength64 = buffer.Length;
CTX.Response.AddHeader("Server", "1.6");
CTX.Response.AddHeader("Server", "1.7");
CTX.Response.StatusCode = reply.Status;
if (reply.ReturnContentType != "" && reply.ReturnContentType != null)
{

View file

@ -19,12 +19,15 @@ using System.Net;
using Newtonsoft.Json;
using System.Security.Cryptography.X509Certificates;
using System.Reflection;
using System.Net.Sockets;
using LibZNI;
namespace Bot.WebHookServer
{
class GitServer : IProgram
{
public HttpListener listener;
//public Socket skt;
public string ProgramName
{
get { return "GitServer"; }
@ -32,7 +35,7 @@ namespace Bot.WebHookServer
public float ProgramVersion
{
get { return 1.7f; }
get { return 1.8f; }
}
public void getTick()
@ -63,14 +66,19 @@ namespace Bot.WebHookServer
if (MainConfiguration.Instance.UseSSL)
{
X509Certificate cert = new X509Certificate2("BotData/"+MainConfiguration.Instance.SSLCertificatePFX, MainConfiguration.Instance.SSLCertificatePWD);
/*
* Removed because SSL is apparently windows only, and this implementation is not supported on windows... Use of netsh is pretty much required
*/
/*
X509Certificate cert = new X509Certificate2("BotData/" + 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);
heplCert.SetValue(epl, cert);*/
listener.Prefixes.Add($"https://*:{MainConfiguration.Instance.WebServerPort}/");
}
else
@ -91,11 +99,13 @@ namespace Bot.WebHookServer
//MessageFactory.Post(Destinations.DEST_LOCAL, "Error: Program could not escalate to Admin Privileges. WebHook engine not running\n\n" + e.Message + "\n" + e.StackTrace, UUID.Zero);
}
}
private void CurrentDomain_ProcessExit(object sender, EventArgs e)
{
listener.Stop();
//skt.Close();
}
}
}