RemoteAdmin

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Example in C# .NET)
(RemoteAdmin Commands)
 
(61 intermediate revisions by 16 users not shown)
Line 1: Line 1:
__NOTOC__
+
{{Quicklinks}}
{{Template:Quicklinks}}
+
<br />
+
  
<div style="background-color:#ffa0a0; padding:15px">
+
== Introduction ==
<b>Caution ! The RemoteAdmin feature is unsecured at this time. For testing uses only.</b>
+
</div>
+
  
== How to Setup the Remote Admin ==
+
RemoteAdmin is an interface for simulators that allows various operations to be executed from outside the simulator.  '''Operations that relate to the simulator itself (e.g teleport user) are always available.  Those that relate to grid services (user creation and updating) are only available in standalone mode.  In grid mode, one has to use ROBUST level [[UserManipulation]] capabilities instead.'''
  
=== Setup OpenSim ===  
+
== How to Setup the Remote Admin interface ==
  
First you should enable the remote admin interface to do so just add the following lines to your OpenSim.ini file:
+
First you should enable the remote admin interface to do so just add the following lines to your OpenSim.ini file Port should be set to a nonzero value to have the remote admin on a different port
 +
 
 +
As of r/16843 you can limit access to remote admin to specific IP addresses by using the optional access_ip_addresses. You can list all IP's allowed to access remote admin by seperating each IP by a comma. If access_ip_addresses isn't set, then all IP addresses can access RemoteAdmin.
  
 
  [RemoteAdmin]
 
  [RemoteAdmin]
 
  enabled = true
 
  enabled = true
 
  access_password = secret
 
  access_password = secret
 +
enabled_methods = all
  
=== Example in C# .NET ===
+
See OpenSim.ini.example in the OpenSimulator distribution for more details.
  
This example needs the Nwc.XmlRpc library, located in your OpenSim bin folder.
+
=== Further options ===
  
<pre>
+
You can also specify a different port for the XMLRPCAdmin command listener from the default simulator HTTP port
public void CreateUser(Uri url, string adminPassword, string firstName, string lastName, string password, string email, int regionX, int regionY)
+
{
+
    var address = Dns.GetHostEntry(url.DnsSafeHost).AddressList[0];
+
    var l = new List<object>();
+
    var ht = new Hashtable();
+
    ht["password"] = adminPassword;
+
    ht["user_firstname"] = firstName;
+
    ht["user_lastname"] = lastName;
+
    ht["user_password"] = password;
+
    ht["user_email"] = email;
+
    ht["start_region_x"] = regionX;
+
    ht["start_region_y"] = regionY;
+
    var parameters = new List<Hashtable> { ht };
+
    var rpc = new XmlRpcRequest("admin_create_user", parameters);
+
    rpc.Invoke(url.ToString());
+
}
+
  
[Test]
+
[RemoteAdmin]
public void NativeUserRegistrationTest()
+
port = <port-number>
{
+
    CreateUser(new Uri("http://yourgrid.com:9000/"), "secret", "Test2", "user2", "apassword", "email@address.com", 0, 0);
+
}
+
</pre>
+
  
<pre>
+
== RemoteAdmin Commands ==
//This Works!
+
<div style="background-color:#FFA0A0; padding:10px; padding-bottom:5px; border: 1px #FF544F solid">
//    ||
+
'''Caution ! All commands using parameters for the uuid of a region use "region_id" as parameter. All other parameters eg. region_uuid or regionID will be removed after June 2012'''
//    \/
+
</div>
using System;
+
using System.Data;
+
using System.Configuration;
+
using System.Collections;
+
using System.Web;
+
using System.Web.Security;
+
using System.Web.UI;
+
using System.Web.UI.WebControls;
+
using System.Web.UI.WebControls.WebParts;
+
using System.Web.UI.HtmlControls;
+
using CookComputing.XmlRpc;
+
  
public struct OpenSimCreateUser
+
=== Agent management ===
{
+
*[[Remoteadmin:admin teleport agent|admin_teleport_agent]]
}
+
*[[Remoteadmin:admin get agents|admin_get_agents]] (post OpenSimulator 0.7.5)
  
[XmlRpcUrl("http://ServerIpAddress:9000/")]
+
=== User account management ===
public interface RemoteOpensim : IXmlRpcProxy
+
*[[RemoteAdmin:admin create user|admin_create_user]]  
{
+
*[[RemoteAdmin:admin create user email|admin_create_user_email]]
    //Create new user
+
*[[RemoteAdmin:admin exists user|admin_exists_user]]
    [XmlRpcMethod("admin_create_user")]
+
*[[RemoteAdmin:admin update user|admin_update_user]]
    OpenSimCreateUser admin_create_user(XmlRpcStruct Parameters);
+
*[[RemoteAdmin:admin authenticate user|admin_authenticate_user]] (not in 0.7.6.1)
}
+
  
public partial class _Default : System.Web.UI.Page
+
=== Object management ===
{
+
    protected void Page_Load(object sender, EventArgs e)
+
    {
+
       
+
    }
+
    protected void SubmitButton_Click(object sender, EventArgs e)
+
    {
+
        try
+
        {
+
            RemoteOpensim Admin = XmlRpcProxyGen.Create<RemoteOpensim>();
+
  
            XmlRpcStruct Parameters = new XmlRpcStruct();
+
=== Parcel management ===
  
            Parameters.Add("password", "RemotePassword"); //Password you set in the .ini file for the RemoteAdmin
+
=== Region management ===
            Parameters.Add("user_firstname", SomeStringWithFirstName);
+
*[[RemoteAdmin:admin broadcast|admin_broadcast]]
            Parameters.Add("user_lastname",  SomeStringWithLastName);
+
*[[RemoteAdmin:admin close region|admin_close_region]]
            Parameters.Add("user_password",  SomePassword);
+
*[[RemoteAdmin:admin create region|admin_create_region]]
            Parameters.Add("start_region_x", 0);
+
*[[RemoteAdmin:admin delete region|admin_delete_region]]
            Parameters.Add("start_region_y", 0);
+
*[[RemoteAdmin:admin modify region|admin_modify_region]]
 +
*[[RemoteAdmin:admin region query|admin_region_query]]
 +
*[[RemoteAdmin:admin restart|admin_restart]]
 +
*[[RemoteAdmin:admin shutdown|admin_shutdown]]
  
            OpenSimCreateUser NewUser = Admin.admin_create_user(Parameters);
+
=== Region file management ===
        }
+
* [[RemoteAdmin:admin load heightmap|admin_load_heightmap]]
        catch (Exception ex)
+
* [[RemoteAdmin:admin load oar|admin_load_oar]]
        {
+
* [[RemoteAdmin:admin load xml|admin_load_xml]]
            Response.Write(ex.Message);
+
* [[RemoteAdmin:admin save heightmap|admin_save_heightmap]]
        }
+
* [[RemoteAdmin:admin save oar|admin_save_oar]]
    }
+
* [[RemoteAdmin:admin save xml|admin_save_xml]]
}
+
</pre>
+
  
=== Example in Python ===
+
=== Region access management ===
# Author  : DrScofield
+
* [[RemoteAdmin:admin acl list|admin_acl_list]]
# Source  : http://xyzzyxyzzy.net/2008/01/23/using-pythons-xmlrpclib-with-opensim/
+
* [[RemoteAdmin:admin acl clear|admin_acl_clear]]
# License : BSD License
+
* [[RemoteAdmin:admin acl add|admin_acl_add]]
+
* [[RemoteAdmin:admin acl remove|admin_acl_remove]]
#!/usr/bin/python 
+
import xmlrpclib 
+
 
+
# XML-RPC URL (http_listener_port) 
+
gridServerURL = ‘http://127.0.0.1:9000′ 
+
   
+
# instantiate server object 
+
gridServer = xmlrpclib.Server(gridServerURL) 
+
 
+
# invoke admin_alert: requires password and message 
+
gridServer.admin_broadcast({’password’: ’secret’,  ‘message’: ‘the answer is 42′})
+
  
=== RemoteAdmin executable for Windows ===
+
=== Estate management ===
 +
* [[RemoteAdmin:admin estate reload|admin_estate_reload]]
  
The RemoteAdmin executable for Windows is a command line tool based on the RemoteAdmin PHP Class.
+
=== Administration ===
 +
* [[RemoteAdmin:admin console command|admin_console_command]]
  
Downloads and documentation on the [http://lab.newworldgrid.com/index.php/RemoteAdmin_Executable RemoteAdmin Executable webpage]
+
=== Misc (Undocumented) ===
 
+
* [[RemoteAdmin:admin dialog|admin_dialog]]
=== Example in PHP ===
+
* [[RemoteAdmin:admin reset land|admin_reset_land]]
 
+
* [[RemoteAdmin:admin refresh search|admin_refresh_search]]
This example needs the RemoteAdmin PHP Class file available [http://code.google.com/p/opensimtools/wiki/RemoteAdminPHPClass here].
+
* [[RemoteAdmin:admin refresh map|admin_refresh_map]]
<source lang=php>
+
* [[RemoteAdmin:admin get opensim version|admin_get_opensim_version]]
<?php
+
* [[RemoteAdmin:admin get agent count|admin_get_agent_count]]
 
+
// Author  : Olish Newman
+
// Source  : http://code.google.com/p/opensimtools/wiki/RemoteAdminPHPClass
+
// Licence : BSD License
+
 
+
// Including the RemoteAdmin PHP class. It can be downloaded from the link above.
+
include('RemoteAdmin.php');
+
 
+
// Instantiate the class with parameters identical to the Python example above
+
$myRemoteAdmin = new RemoteAdmin('127.0.0.1', 9000, 'secret');
+
 
+
// Invoke admin_broadcast
+
$parameters = array('message' => 'the answer is 42');
+
$myRemoteAdmin->SendCommand('admin_broadcast', $parameters);
+
 
+
// Invoke admin_shutdown (example for use without parameters)
+
$myRemoteAdmin->SendCommand('admin_shutdown');
+
 
+
// Invoke admin_create_user (multiple parameters)
+
$parameters = array('user_firstname' => 'Ruth', 'user_lastname' => 'OpenSim', 'user_password' => 'MyPassword', 'start_region_x' => '1000', 'start_region_y' => '1000');
+
$myRemoteAdmin->SendCommand('admin_create_user', $parameters);
+
?>
+
</source>
+
 
+
Note: This script does not appear to work for create user because it tries to pass the start region x and y as a string when the RemoteAdmin needs a string.  The class needs to be edited to pass it as a number or edit the remoteadmin source to convert the string to a unsigned int.
+
 
+
Another example in PHP5, using CURL.
+
<source lang="php">
+
//This is the slightly modified RPC-class of the BSD-licensed WiXTD webportal
+
<?php
+
class RemotePC {
+
 
+
function __construct() {
+
        $this->serveruri = "http://myhost";
+
        $this->serverport ="9000";
+
        $this->password ="foobar";
+
}
+
+
function call($command,$parameters) {
+
        $parameters['password'] = $this->password;
+
$request = xmlrpc_encode_request($command, $parameters);
+
$ch = curl_init();
+
curl_setopt( $ch, CURLOPT_URL, $this->serveruri);
+
curl_setopt( $ch, CURLOPT_PORT, $this->serverport]);
+
curl_setopt($ch, CURLOPT_POST, 1);
+
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1);
+
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $request);
+
curl_setopt ( $ch, CURLOPT_TIMEOUT, 5);
+
$result = curl_exec($ch);
+
curl_close($ch);
+
return xmlrpc_decode($result);
+
}
+
}
+
?>
+
</source>
+
 
+
 
+
=== Example in Perl ===
+
 
+
Because the OpenSim internal web server just accepts HTTP/1.0 requests, it's worth to give a perl example. It's not a daily thing to do HTTP/1.0 within the LWP environment. You can get the '''[[Users:Thomax:perl-xmlrpc | Perl example here]]'''.
+
 
+
== RemoteAdmin Commands ==
+
<table border="1" cellspacing="0" cellpadding="4">
+
<tr>
+
  <th>Name</th>
+
  <th>Status</th>
+
  <th>Description</th>
+
  <th>Parameters</th> 
+
</tr>
+
<tr>
+
  <td>[[remoteadmin:admin_create_region | admin_create_region]]</td>
+
  <td></td>
+
  <td>Create a new region</td>
+
  <td>region_name, region_id (optional), region_master_first,
+
region_master_last, region_master_uuid (optional), region_master_password, listen_ip, listen_port (integer), external_address, region_x (integer), region_y (integer), persist (optional)</td>
+
</tr>
+
<tr>
+
  <td>[[remoteadmin:admin_delete_region | admin_delete_region]]</td>
+
  <td></td>
+
  <td>Delete a region</td>
+
  <td>region_name</td>
+
</tr>
+
<tr>
+
  <td>[[remoteadmin:admin_modify_region | admin_modify_region]]</td>
+
  <td></td>
+
  <td>Modify a region</td>
+
  <td>region_name, region_id (optional), public, enable_voice</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_region_query| admin_region_query]]</td>
+
<td></td>
+
<td>Query the 'health' of a region</td>
+
        <td>region_uuid or region_name</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_shutdown | admin_shutdown]]</td>
+
<td></td>
+
<td>Shut down the simulator</td>
+
        <td>shutdown (optional, expects 'delayed'), milliseconds</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_broadcast| admin_broadcast]]</td>
+
<td></td>
+
<td>Send a general alert</td>
+
        <td>message</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_restart| admin_restart]]</td>
+
<td></td>
+
<td>Restart Region</td>
+
        <td>regionid</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_load_heightmap| admin_load_heightmap]]</td>
+
<td></td>
+
<td>Load Height Map</td>
+
        <td>filename, regionid</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_create_user| admin_create_user]]</td>
+
<td></td>
+
<td>Create a new user</td>
+
        <td>user_firstname, user_lastname, user_password,
+
start_region_x, start_region_y</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_create_user_email| admin_create_user_email]]</td>
+
<td></td>
+
<td>Create a new user (alias for admin_create_user)</td>
+
        <td>user_firstname, user_lastname, user_password,
+
start_region_x, start_region_y</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_exists_user| admin_exists_user]]</td>
+
<td></td>
+
<td>Check whether a certain user account exists</td>
+
        <td>user_firstname, user_lastname</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_update_user| admin_update_user]]</td>
+
<td></td>
+
<td>Update the password/home of a user account</td>
+
        <td>user_firstname, user_lastname, user_password, start_region_x, start_region_y</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_load_xml| admin_load_xml]]</td>
+
<td></td>
+
<td>Execute the Load XML command</td>
+
        <td>filename, region_uuid (or region_name), xml_version</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_save_xml| admin_save_xml]]</td>
+
<td></td>
+
<td>Execute the Save XML command</td>
+
        <td>filename, region_uuid (or region_name), xml_version</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_load_oar| admin_load_oar]]</td>
+
<td></td>
+
<td>Load a saved OAR file into a region</td>
+
        <td>filename, region_uuid (or region_name)</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_save_oar| admin_save_oar]]</td>
+
<td></td>
+
<td>Saved an OAR file of a regions contents</td>
+
        <td>filename, region_uuid (or region_name)</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_region_query| admin_region_query]]</td>
+
<td></td>
+
<td>Query the 'health' of a region</td>
+
        <td>region_uuid or region_name</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_acl_list| admin_acl_list]]</td>
+
<td></td>
+
<td>Retrieve a list of users who can access the region</td>
+
        <td>region_uuid or region_name</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_acl_clear| admin_acl_clear]]</td>
+
<td></td>
+
<td>Clear the access list for the region</td>
+
        <td>region_uuid or region_name</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_acl_add| admin_acl_add]]</td>
+
<td></td>
+
<td>Add a list of users to the access control list</td>
+
        <td>region_uuid or region_name, users</td>
+
</tr>
+
<tr>
+
<td>[[remoteadmin:admin_acl_remove| admin_acl_remove]]</td>
+
<td></td>
+
<td>Remove a list of users from the access control list</td>
+
        <td>region_uuid or region_name, users</td>
+
</tr>
+
</table>
+
  
== Credits ==
+
== Subcategories ==
Thanks to DrScofield for the Python Script
+
Sources : http://xyzzyxyzzy.net/2008/01/23/using-pythons-xmlrpclib-with-opensim/
+
  
 +
* [[RemoteAdmin:RemoteAdmin Examples|RemoteAdmin Examples]]
 +
* [[RemoteAdmin:RemoteAdmin Proposals|RemoteAdmin Proposals]]
 +
* [[RemoteAdmin:RemoteAdmin Standards|RemoteAdmin Standards]]
 +
* [[RemoteAdmin:RemoteAdmin Implement new command|RemoteAdmin How to implement new commands]]
 +
* [[RemoteAdmin:RemoteAdmin Class|RemoteAdmin Class]]
  
 
[[Category:Development]]
 
[[Category:Development]]
 +
[[Category:RemoteAdmin]]

Latest revision as of 12:24, 14 April 2017

Contents

[edit] Introduction

RemoteAdmin is an interface for simulators that allows various operations to be executed from outside the simulator. Operations that relate to the simulator itself (e.g teleport user) are always available. Those that relate to grid services (user creation and updating) are only available in standalone mode. In grid mode, one has to use ROBUST level UserManipulation capabilities instead.

[edit] How to Setup the Remote Admin interface

First you should enable the remote admin interface to do so just add the following lines to your OpenSim.ini file Port should be set to a nonzero value to have the remote admin on a different port

As of r/16843 you can limit access to remote admin to specific IP addresses by using the optional access_ip_addresses. You can list all IP's allowed to access remote admin by seperating each IP by a comma. If access_ip_addresses isn't set, then all IP addresses can access RemoteAdmin.

[RemoteAdmin]
enabled = true
access_password = secret
enabled_methods = all

See OpenSim.ini.example in the OpenSimulator distribution for more details.

[edit] Further options

You can also specify a different port for the XMLRPCAdmin command listener from the default simulator HTTP port

[RemoteAdmin]
port = <port-number>

[edit] RemoteAdmin Commands

Caution ! All commands using parameters for the uuid of a region use "region_id" as parameter. All other parameters eg. region_uuid or regionID will be removed after June 2012

[edit] Agent management

[edit] User account management

[edit] Object management

[edit] Parcel management

[edit] Region management

[edit] Region file management

[edit] Region access management

[edit] Estate management

[edit] Administration

[edit] Misc (Undocumented)

[edit] Subcategories

Personal tools
General
About This Wiki