|
|
(34 intermediate revisions by 8 users not shown) |
Line 1: |
Line 1: |
− | __NOTOC__ {{Quicklinks}} <br>
| + | {{Quicklinks}} |
| | | |
− | == How to Setup the Remote Admin == | + | == Introduction == |
| | | |
− | === Setup OpenSim === | + | 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.''' |
| + | |
| + | == 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 | | 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 |
Line 13: |
Line 15: |
| access_password = secret | | access_password = secret |
| enabled_methods = all | | enabled_methods = all |
− | ;access_ip_addresses = 0.0.0.0, 0.0.0.0, ...
| |
| | | |
− | === 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 === |
| | | |
− | <source lang="csharp">
| + | 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 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); | + | |
− | }
| + | |
− | </source>
| + | |
− | | + | |
− | === Another Example in C# .NET ===
| + | |
− | | + | |
− | <source lang="csharp">
| + | |
− | //Author Ottalese complements of yoursimspot.com
| + | |
− | //This example needs the CookComputing.XmlRpc library, this can be downloaded from http://www.xml-rpc.net/.
| + | |
− | //Recently updated code I originally posted, this can be secured using SSL.
| + | |
− | | + | |
− | 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;
| + | |
− | | + | |
− | [XmlRpcUrl("http://ServerIpAddress:9000/")] | + | |
− | public interface RemoteOpensim : IXmlRpcProxy | + | |
− | {
| + | |
− | //Create new user
| + | |
− | [XmlRpcMethod("admin_create_user")]
| + | |
− | XmlRpcStruct admin_create_user(XmlRpcStruct Parameters);
| + | |
− | }
| + | |
− | | + | |
− | public partial class _Default : System.Web.UI.Page
| + | |
− | {
| + | |
− | protected void Page_Load(object sender, EventArgs e)
| + | |
− | {
| + | |
− | }
| + | |
− | protected void SubmitButton_Click(object sender, EventArgs e)
| + | |
− | {
| + | |
− | XmlRpcStruct NewUser = new XmlRpcStruct(); //Will contain return results.
| + | |
− | XmlRpcStruct Parameters = new XmlRpcStruct();//Parameters passed.
| + | |
− | try
| + | |
− | {
| + | |
− | RemoteOpensim Admin = XmlRpcProxyGen.Create<RemoteOpensim>();
| + | |
− | | + | |
− | Parameters.Add("password", "RemotePassword"); //Password you set in the .ini file for the RemoteAdmin
| + | |
− | Parameters.Add("user_firstname", SomeStringWithFirstName);
| + | |
− | Parameters.Add("user_lastname", SomeStringWithLastName);
| + | |
− | Parameters.Add("user_password", SomePassword);
| + | |
− | Parameters.Add("start_region_x", 0);
| + | |
− | Parameters.Add("start_region_y", 0);
| + | |
− | NewUser = Admin.admin_create_user(Parameters);
| + | |
− | | + | |
− | foreach (DictionaryEntry ReturnResults in NewUser)
| + | |
− | {
| + | |
− | Response.Write(ReturnResults.Key.ToString() + " : " + d.Value.ToString());//Returns if the user was added or not
| + | |
− | }
| + | |
− | }
| + | |
− | catch (Exception ex)
| + | |
− | {
| + | |
− | Response.Write(ex.Message);
| + | |
− | }
| + | |
− | }
| + | |
− | }
| + | |
− | </source> | + | |
− | | + | |
− | === Example in Python ===
| + | |
− | | + | |
− | <source lang="python">
| + | |
− | # Author : DrScofield
| + | |
− | # Source : http://xyzzyxyzzy.net/2008/01/23/using-pythons-xmlrpclib-with-opensim/
| + | |
− | # License : BSD License
| + | |
− |
| + | |
− | #!/usr/bin/python
| + | |
− | import xmlrpclib
| + | |
− |
| + | |
− | # XML-RPC URL (http_listener_port)
| + | |
− | simulatorUrl = "http://127.0.0.1:9000"
| + | |
− |
| + | |
− | # instantiate server object
| + | |
− | simulator = xmlrpclib.Server(simulatorUrl)
| + | |
− |
| + | |
− | # invoke admin_alert: requires password and message
| + | |
− | simulator.admin_broadcast({'password': 'secret', 'message': 'the answer is 42'})
| + | |
− | </source>
| + | |
− | | + | |
− | === Example XML-RPC string to "create user" ===
| + | |
− | | + | |
− | (used with first C#.NET method above)
| + | |
− | | + | |
− | POST admin_create_user HTTP/1.0<br>Host: http://10.0.0.12:16384/<br>Content-type: text/xml<br>Content-Length: 993
| + | |
− | | + | |
− | <?xml version="1.0"?><br><methodCall><br> <methodName>admin_create_user</methodName><br> <params><br> <param><br> <value><br> <struct><br> <member><br> <name>password</name><br> <value><string>password</string></value><br> </member><br> <member><br> <name>user_firstname</name><br> <value><string>male</string></value> <br> </member><br> <member><br> <name>user_lastname</name><br> <value><string>9999</string></value><br> </member><br> <member><br> <name>user_password</name><br> <value><string>password</string></value><br> </member><br> <member><br> <name>user_email</name><br> <value><string>none@email.com</string></value><br> </member><br> <member><br> <name>start_region_x</name><br> <value><int>128</int></value><br> </member><br> <member><br> <name>start_region_y</name><br> <value><int>128</int></value><br> </member><br> </struct><br> </value><br> </param><br> </params><br> </methodCall>
| + | |
− | | + | |
− | === RemoteAdmin executable for Windows ===
| + | |
− | | + | |
− | The RemoteAdmin executable for Windows is a command line tool based on the RemoteAdmin PHP Class.
| + | |
− | | + | |
− | Downloads and documentation on the [http://lab.newworldgrid.com/index.php/RemoteAdmin_Executable RemoteAdmin Executable webpage]
| + | |
− | | + | |
− | === Example in PHP ===
| + | |
− | | + | |
− | This example needs the RemoteAdmin PHP Class file available [http://code.google.com/p/opensimtools/wiki/RemoteAdminPHPClass here]. <source lang="php">
| + | |
− | <?php
| + | |
− | | + | |
− | // 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
| + | == RemoteAdmin Commands == |
− | $parameters = array('message' => 'the answer is 42');
| + | <div style="background-color:#FFA0A0; padding:10px; padding-bottom:5px; border: 1px #FF544F solid"> |
− | $myRemoteAdmin->SendCommand('admin_broadcast', $parameters);
| + | '''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> |
| | | |
− | // Invoke admin_shutdown (example for use without parameters)
| + | === Agent management === |
− | $myRemoteAdmin->SendCommand('admin_shutdown');
| + | *[[Remoteadmin:admin teleport agent|admin_teleport_agent]] |
| + | *[[Remoteadmin:admin get agents|admin_get_agents]] (post OpenSimulator 0.7.5) |
| | | |
− | // Invoke admin_create_user (multiple parameters)
| + | === User account management === |
− | $parameters = array('user_firstname' => 'Ruth', 'user_lastname' => 'OpenSim', 'user_password' => 'MyPassword', 'start_region_x' => '1000', 'start_region_y' => '1000');
| + | *[[RemoteAdmin:admin create user|admin_create_user]] |
− | $myRemoteAdmin->SendCommand('admin_create_user', $parameters);
| + | *[[RemoteAdmin:admin create user email|admin_create_user_email]] |
− | ?>
| + | *[[RemoteAdmin:admin exists user|admin_exists_user]] |
− | </source>
| + | *[[RemoteAdmin:admin update user|admin_update_user]] |
| + | *[[RemoteAdmin:admin authenticate user|admin_authenticate_user]] (not in 0.7.6.1) |
| | | |
− | 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.
| + | === Object management === |
| | | |
− | Another example in PHP5, using CURL. <source lang="php">
| + | === Parcel management === |
− | //This is the slightly modified RPC-class of the BSD-licensed WiXTD webportal
| + | |
− | <?php
| + | |
− | class RemotePC {
| + | |
| | | |
− | function __construct() {
| + | === Region management === |
− | $this->serveruri = "http://myhost";
| + | *[[RemoteAdmin:admin broadcast|admin_broadcast]] |
− | $this->serverport ="9000";
| + | *[[RemoteAdmin:admin close region|admin_close_region]] |
− | $this->password ="foobar";
| + | *[[RemoteAdmin:admin create region|admin_create_region]] |
− | }
| + | *[[RemoteAdmin:admin delete region|admin_delete_region]] |
− |
| + | *[[RemoteAdmin:admin modify region|admin_modify_region]] |
− | function call($command,$parameters) {
| + | *[[RemoteAdmin:admin region query|admin_region_query]] |
− | $parameters['password'] = $this->password;
| + | *[[RemoteAdmin:admin restart|admin_restart]] |
− | $request = xmlrpc_encode_request($command, $parameters);
| + | *[[RemoteAdmin:admin shutdown|admin_shutdown]] |
− | $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>
| + | |
| | | |
− | <br>
| + | === Region file management === |
| + | * [[RemoteAdmin:admin load heightmap|admin_load_heightmap]] |
| + | * [[RemoteAdmin:admin load oar|admin_load_oar]] |
| + | * [[RemoteAdmin:admin load xml|admin_load_xml]] |
| + | * [[RemoteAdmin:admin save heightmap|admin_save_heightmap]] |
| + | * [[RemoteAdmin:admin save oar|admin_save_oar]] |
| + | * [[RemoteAdmin:admin save xml|admin_save_xml]] |
| | | |
− | === Example in Perl === | + | === Region access management === |
| + | * [[RemoteAdmin:admin acl list|admin_acl_list]] |
| + | * [[RemoteAdmin:admin acl clear|admin_acl_clear]] |
| + | * [[RemoteAdmin:admin acl add|admin_acl_add]] |
| + | * [[RemoteAdmin:admin acl remove|admin_acl_remove]] |
| | | |
− | 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]]'''.
| + | === Estate management === |
| + | * [[RemoteAdmin:admin estate reload|admin_estate_reload]] |
| | | |
− | == RemoteAdmin Commands == | + | === Administration === |
| + | * [[RemoteAdmin:admin console command|admin_console_command]] |
| | | |
− | {| cellspacing="0" cellpadding="4" border="1"
| + | === Misc (Undocumented) === |
− | |-
| + | * [[RemoteAdmin:admin dialog|admin_dialog]] |
− | ! Name
| + | * [[RemoteAdmin:admin reset land|admin_reset_land]] |
− | ! Status
| + | * [[RemoteAdmin:admin refresh search|admin_refresh_search]] |
− | ! Description
| + | * [[RemoteAdmin:admin refresh map|admin_refresh_map]] |
− | ! Parameters
| + | * [[RemoteAdmin:admin get opensim version|admin_get_opensim_version]] |
− | |-
| + | * [[RemoteAdmin:admin get agent count|admin_get_agent_count]] |
− | | [[Remoteadmin:admin create region|admin_create_region]]
| + | |
− | | <br>
| + | |
− | | Create a new region
| + | |
− | | region_name, region_id (optional), estate_owner_first (optional), estate_owner_last (optional), estate_owner_uuid (optional), listen_ip, listen_port (integer), external_address, region_x (integer), region_y (integer), persist (optional), estate_name (an estate owner must be specified if the estate does not already exist)
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin delete region|admin_delete_region]]
| + | |
− | | <br>
| + | |
− | | Delete a region
| + | |
− | | region_name
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin close region|admin_close_region]]
| + | |
− | | <br>
| + | |
− | | Close a region without deleting it.
| + | |
− | | region_name, region_id (optional)
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin modify region|admin_modify_region]]
| + | |
− | | <br>
| + | |
− | | Modify a region
| + | |
− | | region_name, region_id (optional), public, enable_voice
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin region query|admin_region_query]]
| + | |
− | | <br>
| + | |
− | | Query the 'health' of a region
| + | |
− | | region_uuid or region_name
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin shutdown|admin_shutdown]]
| + | |
− | | <br>
| + | |
− | | Shut down the simulator
| + | |
− | | shutdown (optional, expects 'delayed'), milliseconds
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin broadcast|admin_broadcast]]
| + | |
− | | <br>
| + | |
− | | Send a general alert
| + | |
− | | message
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin restart|admin_restart]]
| + | |
− | | <br>
| + | |
− | | Restart Region
| + | |
− | | regionid
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin load heightmap|admin_load_heightmap]]
| + | |
− | | <br>
| + | |
− | | Load Height Map
| + | |
− | | filename, regionid
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin save heightmap|admin_save_heightmap]]
| + | |
− | | <br>
| + | |
− | | Execute the terrain save command
| + | |
− | | filename, regionid
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin create user|admin_create_user]]
| + | |
− | | <br>
| + | |
− | | Create a new user
| + | |
− | | user_firstname, user_lastname, user_password, start_region_x, start_region_y
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin create user email|admin_create_user_email]]
| + | |
− | | <br>
| + | |
− | | Create a new user (alias for admin_create_user)
| + | |
− | | user_firstname, user_lastname, user_password, start_region_x, start_region_y
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin exists user|admin_exists_user]]
| + | |
− | | <br>
| + | |
− | | Check whether a certain user account exists
| + | |
− | | user_firstname, user_lastname
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin update user|admin_update_user]]
| + | |
− | | <br>
| + | |
− | | Update the password/home of a user account
| + | |
− | | user_firstname, user_lastname, user_password, start_region_x, start_region_y
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin load xml|admin_load_xml]]
| + | |
− | | <br>
| + | |
− | | Execute the Load XML command
| + | |
− | | filename, region_uuid (or region_name), xml_version
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin save xml|admin_save_xml]]
| + | |
− | | <br>
| + | |
− | | Execute the Save XML command
| + | |
− | | filename, region_uuid (or region_name), xml_version
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin load oar|admin_load_oar]]
| + | |
− | | <br>
| + | |
− | | Load a saved OAR file into a region
| + | |
− | | filename, region_uuid (or region_name), merge (optional, use "true"), skip-assets (optional, use "true)<br>
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin save oar|admin_save_oar]]
| + | |
− | | <br>
| + | |
− | | Saved an OAR file of a regions contents
| + | |
− | | filename, region_uuid (or region_name), profile (optinal, use profile url), noassets (optional, use "true"), perm(optinal, use C, T or CT),<br>
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin acl list|admin_acl_list]]
| + | |
− | | <br>
| + | |
− | | Retrieve a list of users who can access the region
| + | |
− | | region_uuid or region_name
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin acl clear|admin_acl_clear]]
| + | |
− | | <br>
| + | |
− | | Clear the access list for the region
| + | |
− | | region_uuid or region_name
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin acl add|admin_acl_add]]
| + | |
− | | <br>
| + | |
− | | Add a list of users to the access control list
| + | |
− | | region_uuid or region_name, users
| + | |
− | |-
| + | |
− | | [[Remoteadmin:admin acl remove|admin_acl_remove]]
| + | |
− | | <br>
| + | |
− | | Remove a list of users from the access control list
| + | |
− | | region_uuid or region_name, users
| + | |
− | |}
| + | |
| | | |
− | == 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]] |
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.
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.
See OpenSim.ini.example in the OpenSimulator distribution for more details.
You can also specify a different port for the XMLRPCAdmin command listener from the default simulator HTTP port