Re: Rollback money server
iseki
投稿数: 1581

Hi everyone.
I understand the cause of this problem now.
At r/15147, ValidateServerCertificate() function was added to ScriptsHttpRequests.cs
So, this function refused certificate file that we use.
This certificate file (SineWaveCert.pfx) had been used since DTL Currency Server.
We are thinking about the best method for this problem.
If there is a good idea, please teach us.
diff of r/15146 and r/15147
引用:
I understand the cause of this problem now.
At r/15147, ValidateServerCertificate() function was added to ScriptsHttpRequests.cs
So, this function refused certificate file that we use.
This certificate file (SineWaveCert.pfx) had been used since DTL Currency Server.
We are thinking about the best method for this problem.
If there is a good idea, please teach us.
diff of r/15146 and r/15147
引用:
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index d78931a..a37c781 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -29,8 +29,10 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
+using System.Net.Security;
using System.Text;
using System.Threading;
+using System.Security.Cryptography.X509Certificates;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
@@ -84,6 +86,7 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
{
+
public class HttpRequestModule : IRegionModule, IHttpRequestModule
{
private object HttpListLock = new object();
@@ -100,8 +103,23 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
public HttpRequestModule()
{
+ ServicePointManager.ServerCertificateValidationCallback +=ValidateServerCertificate;
}
+ public static bool ValidateServerCertificate(
+ object sender,
+ X509Certificate certificate,
+ X509Chain chain,
+ SslPolicyErrors sslPolicyErrors)
+ {
+ HttpWebRequest Request = (HttpWebRequest)sender;
+
+ if(Request.Headers.Get("NoVerifyCert") != null)
+ {
+ return true;
+ }
+ return chain.Build(new X509Certificate2(certificate));
+ }
#region IHttpRequestModule Members
public UUID MakeHttpRequest(string url, string parameters, string body)
@@ -141,8 +159,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
break;
case (int)HttpRequestConstants.HTTP_VERIFY_CERT:
-
- // TODO implement me
+ htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0);
break;
}
}
@@ -282,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
public string HttpMethod = "GET";
public string HttpMIMEType = "text/plain;charset=utf-8";
public int HttpTimeout;
- // public bool HttpVerifyCert = true; // not implemented
+ public bool HttpVerifyCert = true; // not implemented
private Thread httpThread;
// Request info
@@ -344,6 +361,17 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
Request.Method = HttpMethod;
Request.ContentType = HttpMIMEType;
+ if(!HttpVerifyCert)
+ {
+ // Connection Group Name is probably not used so we hijack it to identify
+ // a desired security exception
+// Request.ConnectionGroupName="NoVerify";
+ Request.Headers.Add("NoVerifyCert" , "true");
+ }
+// else
+// {
+// Request.ConnectionGroupName="Verify";
+// }
if (proxyurl != null && proxyurl.Length > 0)
{
if (proxyexcepts != null && proxyexcepts.Length > 0)
投票数:103
平均点:4.17
投稿ツリー
-
Rollback money server (milo, 2011-4-8 15:17)
-
Re: Rollback money server (iseki, 2011-4-9 12:23)
-
Re: Rollback money server (milo, 2011-4-9 20:49)
-
Re: Rollback money server (milo, 2011-4-10 1:48)
-
Re: Rollback money server (milo, 2011-4-16 19:12)
-
Re: Rollback money server (iseki, 2011-4-17 23:45)
-
-
Re: Rollback money server (milo, 2011-4-18 14:54)
-
Re: Rollback money server (iseki, 2011-4-18 18:54)
-
-
Re: Rollback money server (milo, 2011-4-19 1:13)
-
Re: Rollback money server (iseki, 2011-4-20 13:26)
-
-
Re: Rollback money server (milo, 2011-4-20 22:58)
-
Re: Rollback money server (iseki, 2011-4-22 14:42)
-
Re: Rollback money server (milo, 2011-4-22 16:55)
-
-
-
Re: Rollback money server (milo, 2011-4-22 15:58)
-
Re: Rollback money server (milo, 2011-4-23 4:14)
-
Re: Rollback money server (milo, 2011-4-24 14:48)
-
Re: Rollback money server (iseki, 2011-4-26 14:55)
-
-
Re: Rollback money server (milo, 2011-4-26 15:10)
-
Re: Rollback money server (iseki, 2011-4-26 16:17)
-
Re: Rollback money server (milo, 2011-4-26 17:05)
-
Re: Rollback money server (iseki, 2011-4-27 11:41)
-
Re: Rollback money server (iseki, 2011-4-27 17:40)
-
-
-
-
-