Chapter 65. Specification for ad-hoc Commands Used to Manage Virtual Domains
Prev |  | Next

# Chapter 65. Specification for ad-hoc Commands Used to Manage Virtual Domains

Artur Hefczyc <artur.hefczyc@tigase.net> v2.0, June 2014: Reformatted for AsciiDoc. :toc: :numbered: :website: http://tigase.net :Date: 2010-04-06 21:18

There are 3 ad-hoc commands for virtual domains management in the Tigase server:

1. VHOSTS_RELOAD used to reload virtual domains list from the repository (database).
2. VHOSTS_UPDATE used to add a new virtual domain or update information for existing one.
3. VHOSTS_REMOVE used to remove an existing virtual host from the running server.

Syntax of the commands follows specification described in the XEP-0050. Extra information required to complete the command is carried as data forms described in the XEP-0004.

All commands are accepted by the server only when send by the installation administrator. If the command is sent from any other account &lt;not-authorized /&gt; error is returned. To grant administrator rights to an account you have to set --admins property in the ////<<initPropertiesGuide,////configuration file.

Commands are sent to 'vhost-man' server component and the 'to' attribute of the stanza must contain a full JID of the VHostManager on the server. The full JID consists of the component name: 'vhost-man' and the local domain, that is domain which is already on the list of virtual domains and is active. Assuming 'existing.domain.com' one of domains already activated for the server installation the JID is: 'vhost-man@existing.domain.com'.

## Reloading the Domains List from the Database

In order to reload virtual domains from the permanent repository other than configuration file you have to send VHOSTS_RELOAD ad-hoc command to the VHostManager on the server.

The reload command request is of the form:

    <iq type="set"
        to="vhost-man@existing.domain.com"
        id="aac8a">
      <command xmlns="http://jabber.org/protocol/commands"
               node="VHOSTS_RELOAD" />
    </iq>

The server sends a response upon successful completion of the command with current number of virtual domains server by the installation:

    <iq from="vhost-man@existing.domain.com"
        type="result"
        to="cmd-sender-admin@existing.domain.com"
        id="aac8a">
      <command xmlns="http://jabber.org/protocol/commands"
               status="completed"
               node="VHOSTS_RELOAD">
        <x xmlns="jabber:x:data" type="result">
          <field type="fixed" var="Note">
            <value>Current number of VHosts: 123</value>
          </field>
        </x>
      </command>
    </iq>

If the command is sent from other than admin account the server returns an error:

    <iq from="vhost-man@existing.domain.com"
        type="error"
        to="cmd-sender-admin@existing.domain.com"
        id="aac8a">
      <command xmlns="http://jabber.org/protocol/commands"
               node="VHOSTS_RELOAD" />
      <error type="auth" code="401">
        <not-authorized xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
        <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"
              xml:lang="en">
          You are not authorized for this action.
        </text>
      </error>
    </iq>

The response doesn’t have any special meaning other then informative for the end-user. The client may ignore response as it is sent after the command has been executed.

Prev |  | Next
Chapter 64. Virtual Hosts in the Tigase Server | Home | Adding a New Domain or Updating Existing One