mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
Secure sim stats with an (optional) password.
There is way too much in these stats to expose them to the world, at least for some of us.
This commit is contained in:
@@ -47,6 +47,8 @@ namespace OpenSim.Framework.Monitoring
|
||||
// Subcommand used to list other stats.
|
||||
public const string ListSubCommand = "list";
|
||||
|
||||
public static string StatsPassword { get; set; }
|
||||
|
||||
// All subcommands
|
||||
public static HashSet<string> SubCommands = new HashSet<string> { AllSubCommand, ListSubCommand };
|
||||
|
||||
@@ -302,6 +304,17 @@ namespace OpenSim.Framework.Monitoring
|
||||
int response_code = 200;
|
||||
string contenttype = "text/json";
|
||||
|
||||
if (StatsPassword != String.Empty && (!request.ContainsKey("pass") || request["pass"].ToString() != StatsPassword))
|
||||
{
|
||||
responsedata["int_response_code"] = response_code;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = "Access denied";
|
||||
responsedata["access_control_allow_origin"] = "*";
|
||||
|
||||
return responsedata;
|
||||
}
|
||||
|
||||
string pCategoryName = StatsManager.AllSubCommand;
|
||||
string pContainerName = StatsManager.AllSubCommand;
|
||||
string pStatName = StatsManager.AllSubCommand;
|
||||
|
||||
Reference in New Issue
Block a user