25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

* src/ejabberd_config.erl: Add support to include additional

configuration files. Add support for macro definition and
usage. (EJAB-593)
* doc/guide.tex: Likewise
* doc/guide.html: Likewise

SVN Revision: 1273
This commit is contained in:
Badlop 2008-04-02 16:31:15 +00:00
parent f0ee4f999d
commit 1649dec58e
4 changed files with 548 additions and 136 deletions

View File

@ -1,3 +1,11 @@
2008-04-02 Badlop <badlop@process-one.net>
* src/ejabberd_config.erl: Add support to include additional
configuration files. Add support for macro definition and
usage. (EJAB-593)
* doc/guide.tex: Likewise
* doc/guide.html: Likewise
2008-04-02 Christophe Romain <christophe.romain@process-one.net>
* src/mod_pubsub/mod_pubsub.erl: add condition inclusion of pep in

View File

@ -146,87 +146,89 @@ SPAN{width:20%; float:right; text-align:left; margin-left:auto;}
</LI><LI CLASS="li-toc"><A HREF="#htoc24">3.1.5&#XA0;&#XA0;Access Rules</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc25">3.1.6&#XA0;&#XA0;Shapers</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc26">3.1.7&#XA0;&#XA0;Default Language</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc27">3.1.8&#XA0;&#XA0;Include Additional Configuration Files</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc28">3.1.9&#XA0;&#XA0;Option Macros in Configuration File</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc27">3.2&#XA0;&#XA0;Database and LDAP Configuration</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc29">3.2&#XA0;&#XA0;Database and LDAP Configuration</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc28">3.2.1&#XA0;&#XA0;MySQL</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc29">3.2.2&#XA0;&#XA0;Microsoft SQL Server</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc30">3.2.3&#XA0;&#XA0;PostgreSQL</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc31">3.2.4&#XA0;&#XA0;ODBC Compatible</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc32">3.2.5&#XA0;&#XA0;LDAP</A>
<A HREF="#htoc30">3.2.1&#XA0;&#XA0;MySQL</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc31">3.2.2&#XA0;&#XA0;Microsoft SQL Server</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc32">3.2.3&#XA0;&#XA0;PostgreSQL</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc33">3.2.4&#XA0;&#XA0;ODBC Compatible</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc34">3.2.5&#XA0;&#XA0;LDAP</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc33">3.3&#XA0;&#XA0;Modules Configuration</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc35">3.3&#XA0;&#XA0;Modules Configuration</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc34">3.3.1&#XA0;&#XA0;Overview</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc35">3.3.2&#XA0;&#XA0;Common Options</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc36">3.3.3&#XA0;&#XA0;<TT>mod_announce</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc37">3.3.4&#XA0;&#XA0;<TT>mod_disco</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc38">3.3.5&#XA0;&#XA0;<TT>mod_echo</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc39">3.3.6&#XA0;&#XA0;<TT>mod_irc</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc40">3.3.7&#XA0;&#XA0;<TT>mod_last</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc41">3.3.8&#XA0;&#XA0;<TT>mod_muc</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc42">3.3.9&#XA0;&#XA0;<TT>mod_muc_log</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc43">3.3.10&#XA0;&#XA0;<TT>mod_offline</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc44">3.3.11&#XA0;&#XA0;<TT>mod_privacy</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc45">3.3.12&#XA0;&#XA0;<TT>mod_private</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc46">3.3.13&#XA0;&#XA0;<TT>mod_proxy65</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc47">3.3.14&#XA0;&#XA0;<TT>mod_pubsub</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc48">3.3.15&#XA0;&#XA0;<TT>mod_register</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc49">3.3.16&#XA0;&#XA0;<TT>mod_roster</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc50">3.3.17&#XA0;&#XA0;<TT>mod_service_log</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc51">3.3.18&#XA0;&#XA0;<TT>mod_shared_roster</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc52">3.3.19&#XA0;&#XA0;<TT>mod_stats</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc53">3.3.20&#XA0;&#XA0;<TT>mod_time</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc54">3.3.21&#XA0;&#XA0;<TT>mod_vcard</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc55">3.3.22&#XA0;&#XA0;<TT>mod_vcard_ldap</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc56">3.3.23&#XA0;&#XA0;<TT>mod_version</TT></A>
<A HREF="#htoc36">3.3.1&#XA0;&#XA0;Overview</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc37">3.3.2&#XA0;&#XA0;Common Options</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc38">3.3.3&#XA0;&#XA0;<TT>mod_announce</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc39">3.3.4&#XA0;&#XA0;<TT>mod_disco</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc40">3.3.5&#XA0;&#XA0;<TT>mod_echo</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc41">3.3.6&#XA0;&#XA0;<TT>mod_irc</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc42">3.3.7&#XA0;&#XA0;<TT>mod_last</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc43">3.3.8&#XA0;&#XA0;<TT>mod_muc</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc44">3.3.9&#XA0;&#XA0;<TT>mod_muc_log</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc45">3.3.10&#XA0;&#XA0;<TT>mod_offline</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc46">3.3.11&#XA0;&#XA0;<TT>mod_privacy</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc47">3.3.12&#XA0;&#XA0;<TT>mod_private</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc48">3.3.13&#XA0;&#XA0;<TT>mod_proxy65</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc49">3.3.14&#XA0;&#XA0;<TT>mod_pubsub</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc50">3.3.15&#XA0;&#XA0;<TT>mod_register</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc51">3.3.16&#XA0;&#XA0;<TT>mod_roster</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc52">3.3.17&#XA0;&#XA0;<TT>mod_service_log</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc53">3.3.18&#XA0;&#XA0;<TT>mod_shared_roster</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc54">3.3.19&#XA0;&#XA0;<TT>mod_stats</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc55">3.3.20&#XA0;&#XA0;<TT>mod_time</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc56">3.3.21&#XA0;&#XA0;<TT>mod_vcard</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc57">3.3.22&#XA0;&#XA0;<TT>mod_vcard_ldap</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc58">3.3.23&#XA0;&#XA0;<TT>mod_version</TT></A>
</LI></UL>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc57">Chapter&#XA0;4&#XA0;&#XA0;Managing an <TT>ejabberd</TT> server</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc59">Chapter&#XA0;4&#XA0;&#XA0;Managing an <TT>ejabberd</TT> server</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc58">4.1&#XA0;&#XA0;<TT>ejabberdctl</TT></A>
<A HREF="#htoc60">4.1&#XA0;&#XA0;<TT>ejabberdctl</TT></A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc59">4.1.1&#XA0;&#XA0;Commands</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc60">4.1.2&#XA0;&#XA0;Erlang runtime system</A>
<A HREF="#htoc61">4.1.1&#XA0;&#XA0;Commands</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc62">4.1.2&#XA0;&#XA0;Erlang runtime system</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc61">4.2&#XA0;&#XA0;Web Admin</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc62">4.3&#XA0;&#XA0;Ad-hoc Commands</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc63">4.4&#XA0;&#XA0;Change Computer Hostname</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc63">4.2&#XA0;&#XA0;Web Admin</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc64">4.3&#XA0;&#XA0;Ad-hoc Commands</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc65">4.4&#XA0;&#XA0;Change Computer Hostname</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc64">Chapter&#XA0;5&#XA0;&#XA0;Securing <TT>ejabberd</TT></A>
</LI><LI CLASS="li-toc"><A HREF="#htoc66">Chapter&#XA0;5&#XA0;&#XA0;Securing <TT>ejabberd</TT></A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc65">5.1&#XA0;&#XA0;Firewall Settings</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc66">5.2&#XA0;&#XA0;epmd </A>
</LI><LI CLASS="li-toc"><A HREF="#htoc67">5.3&#XA0;&#XA0;Erlang Cookie</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc68">5.4&#XA0;&#XA0;Erlang node name</A>
<A HREF="#htoc67">5.1&#XA0;&#XA0;Firewall Settings</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc68">5.2&#XA0;&#XA0;epmd </A>
</LI><LI CLASS="li-toc"><A HREF="#htoc69">5.3&#XA0;&#XA0;Erlang Cookie</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc70">5.4&#XA0;&#XA0;Erlang node name</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc69">Chapter&#XA0;6&#XA0;&#XA0;Clustering</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc71">Chapter&#XA0;6&#XA0;&#XA0;Clustering</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc70">6.1&#XA0;&#XA0;How it Works</A>
<A HREF="#htoc72">6.1&#XA0;&#XA0;How it Works</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc71">6.1.1&#XA0;&#XA0;Router</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc72">6.1.2&#XA0;&#XA0;Local Router</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc73">6.1.3&#XA0;&#XA0;Session Manager</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc74">6.1.4&#XA0;&#XA0;s2s Manager</A>
<A HREF="#htoc73">6.1.1&#XA0;&#XA0;Router</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc74">6.1.2&#XA0;&#XA0;Local Router</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc75">6.1.3&#XA0;&#XA0;Session Manager</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc76">6.1.4&#XA0;&#XA0;s2s Manager</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc75">6.2&#XA0;&#XA0;Clustering Setup</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc76">6.3&#XA0;&#XA0;Service Load-Balancing</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc77">6.2&#XA0;&#XA0;Clustering Setup</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc78">6.3&#XA0;&#XA0;Service Load-Balancing</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc77">6.3.1&#XA0;&#XA0;Components Load-Balancing</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc78">6.3.2&#XA0;&#XA0;Domain Load-Balancing Algorithm</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc79">6.3.3&#XA0;&#XA0;Load-Balancing Buckets</A>
<A HREF="#htoc79">6.3.1&#XA0;&#XA0;Components Load-Balancing</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc80">6.3.2&#XA0;&#XA0;Domain Load-Balancing Algorithm</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc81">6.3.3&#XA0;&#XA0;Load-Balancing Buckets</A>
</LI></UL>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc80">Chapter&#XA0;7&#XA0;&#XA0;Debugging</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc82">Chapter&#XA0;7&#XA0;&#XA0;Debugging</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc81">7.1&#XA0;&#XA0;Watchdog Alerts</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc82">7.2&#XA0;&#XA0;Log Files</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc83">7.3&#XA0;&#XA0;Debug Console</A>
<A HREF="#htoc83">7.1&#XA0;&#XA0;Watchdog Alerts</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc84">7.2&#XA0;&#XA0;Log Files</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc85">7.3&#XA0;&#XA0;Debug Console</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc84">Appendix&#XA0;A&#XA0;&#XA0;Internationalization and Localization</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc85">Appendix&#XA0;B&#XA0;&#XA0;Release Notes</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc86">Appendix&#XA0;C&#XA0;&#XA0;Acknowledgements</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc87">Appendix&#XA0;D&#XA0;&#XA0;Copyright Information</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc86">Appendix&#XA0;A&#XA0;&#XA0;Internationalization and Localization</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc87">Appendix&#XA0;B&#XA0;&#XA0;Release Notes</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc88">Appendix&#XA0;C&#XA0;&#XA0;Acknowledgements</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc89">Appendix&#XA0;D&#XA0;&#XA0;Copyright Information</A>
</LI></UL><!--TOC chapter Introduction-->
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc1">Chapter&#XA0;1</A>&#XA0;&#XA0;Introduction</H1><!--SEC END --><P>
<A NAME="intro"></A></P><P><TT>ejabberd</TT> is a free and open source instant messaging server written in <A HREF="http://www.erlang.org/">Erlang</A>.</P><P><TT>ejabberd</TT> is cross-platform, distributed, fault-tolerant, and based on open standards to achieve real-time communication.</P><P><TT>ejabberd</TT> is designed to be a rock-solid and feature rich XMPP server.</P><P><TT>ejabberd</TT> is suitable for small deployments, whether they need to be scalable or not, as well as extremely big deployments.</P><!--TOC section Key Features-->
@ -1098,8 +1100,89 @@ To set Russian as default language:
<PRE CLASS="verbatim"> {language, "ru"}.
</PRE></LI><LI CLASS="li-itemize">To set Spanish as default language:
<PRE CLASS="verbatim"> {language, "es"}.
</PRE></LI></UL><!--TOC section Database and LDAP Configuration-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc27">3.2</A>&#XA0;&#XA0;Database and LDAP Configuration</H2><!--SEC END --><P>
</PRE></LI></UL><!--TOC subsection Include Additional Configuration Files-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc27">3.1.8</A>&#XA0;&#XA0;Include Additional Configuration Files</H3><!--SEC END --><P>
<A NAME="includeconfigfile"></A>
</P><P>The option <TT>include_config_file</TT> in a configuration file instructs <TT>ejabberd</TT> to include other configuration files immediately.</P><P>The basic usage is:
</P><PRE CLASS="verbatim"> {include_config_file, &lt;filename&gt;}.
</PRE><P>It is also possible to specify suboptions:
</P><PRE CLASS="verbatim"> {include_config_file, &lt;filename&gt;, [&lt;suboption&gt;, &lt;suboption&gt;, ...]}.
</PRE><P>The filename can be indicated either as an absolute path,
or relative to the main <TT>ejabberd</TT> configuration file.
It isn&#X2019;t possible to use wildcards.
The file must exist and be readable.</P><P>The allowed suboptions are:
</P><DL CLASS="description"><DT CLASS="dt-description">
<B><TT>{disallow, [&lt;option&gt;, &lt;option&gt;, ...]}</TT></B></DT><DD CLASS="dd-description"> Disallows the usage of those options in the included configuration file.
The options that match this criteria are not accepted.
The default value is an empty list: <TT>[]</TT>
</DD><DT CLASS="dt-description"><B><TT>{allow_only, [&lt;option&gt;, &lt;option&gt;, ...]}</TT></B></DT><DD CLASS="dd-description"> Allows only the usage of those options in the included configuration file.
The options that do not match this criteria are not accepted.
The default value is: <TT>all</TT>
</DD></DL><P>This is a basic example:
</P><PRE CLASS="verbatim"> {include_config_file, "/etc/ejabberd/additional.cfg"}.
</PRE><P>In this example, the included file is not allowed to contain a <TT>listen</TT> option.
If such an option is present, the option will not be accepted.
The file is in a subdirectory from where the main configuration file is.
</P><PRE CLASS="verbatim"> {include_config_file, "./example.org/additional_not_listen.cfg", [{disallow, [listen]}]}.
</PRE><P>In this example, <TT>ejabberd.cfg</TT> defines some ACL and Access rules,
and later includes another file with additional rules:
</P><PRE CLASS="verbatim"> {acl, admin, {user, "admin", "localhost"}}.
{access, announce, [{allow, admin}]}.
{include_config_file, "/etc/ejabberd/acl_and_access.cfg", [{allow_only, [acl, access]}]}.
</PRE><P>and content of the file <TT>acl_and_access.cfg</TT> can be, for example:
</P><PRE CLASS="verbatim"> {acl, admin, {user, "bob", "localhost"}}.
{acl, admin, {user, "jan", "localhost"}}.
</PRE><!--TOC subsection Option Macros in Configuration File-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc28">3.1.9</A>&#XA0;&#XA0;Option Macros in Configuration File</H3><!--SEC END --><P>
<A NAME="optionmacros"></A>
</P><P>In the <TT>ejabberd</TT> configuration file,
it is possible to define a macro for a value
and later use this macro when defining an option.</P><P>A macro is defined with this syntax:
</P><PRE CLASS="verbatim"> {define_macro, '&lt;MACRO&gt;', &lt;value&gt;}.
</PRE><P>The <TT>MACRO</TT> must be surrounded by commas, and all in uppercase.
The <TT>value</TT> can be any valid arbitrary Erlang term.</P><P>The first definition of a macro is preserved,
and additional definitions of the same macro are forgotten.</P><P>Macros are processed after
additional configuration files have been included,
so it is possible to use macros that
are defined in configuration files included before the usage.</P><P>It isn&#X2019;t possible to use a macro in the definition
of another macro.</P><P>There are two ways to use a macro:
</P><DL CLASS="description"><DT CLASS="dt-description"><B><TT>&#X2019;&lt;MACRO&gt;&#X2019;</TT></B></DT><DD CLASS="dd-description">
You can put this instead of a value in an <TT>ejabberd</TT> option,
and will be replaced with the <TT>value</TT> previously defined.
If the macro is not defined previously,
the program will crash and report an error.</DD><DT CLASS="dt-description"><B><TT>{use_macro, &#X2019;&lt;MACRO&gt;&#X2019;, &lt;defaultvalue&gt;}</TT></B></DT><DD CLASS="dd-description">
Use a macro even if it may not be defined.
If the macro is not defined previously,
the provided <TT>defaultvalue</TT> is used.
This usage behaves as if it were defined and used this way:
<PRE CLASS="verbatim"> {define_macro, '&lt;MACRO&gt;', &lt;defaultvalue&gt;}.
'&lt;MACRO&gt;'
</PRE></DD></DL><P>This example shows the basic usage of a macro:
</P><PRE CLASS="verbatim"> {define_macro, 'LOG_LEVEL_NUMBER', 5}.
{loglevel, 'LOG_LEVEL_NUMBER'}.
</PRE><P>The resulting option interpreted by <TT>ejabberd</TT> is: <TT>{loglevel, 5}</TT>.</P><P>This example shows that values can be any arbitrary Erlang term:
</P><PRE CLASS="verbatim"> {define_macro, 'USERBOB', {user, "bob", "localhost"}}.
{acl, admin, 'USERBOB'}.
</PRE><P>The resulting option interpreted by <TT>ejabberd</TT> is: <TT>{acl, admin, {user, "bob", "localhost"}}</TT>.</P><P>This complex example:
</P><PRE CLASS="verbatim">{define_macro, 'NUMBER_PORT_C2S', 5222}.
{define_macro, 'PORT_S2S_IN', {5269, ejabberd_s2s_in, []}}.
{listen,
[
{'NUMBER_PORT_C2S', ejabberd_c2s, []},
'PORT_S2S_IN',
{{use_macro, 'NUMBER_PORT_HTTP', 5280}, ejabberd_http, []}
]
}.
</PRE><P>produces this result after being interpreted:
</P><PRE CLASS="verbatim">{listen,
[
{5222, ejabberd_c2s, []},
{5269, ejabberd_s2s_in, []},
{5280, ejabberd_http, []}
]
}.
</PRE><!--TOC section Database and LDAP Configuration-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc29">3.2</A>&#XA0;&#XA0;Database and LDAP Configuration</H2><!--SEC END --><P>
<A NAME="database"></A>
</P><P><TT>ejabberd</TT> uses its internal Mnesia database by default. However, it is
@ -1122,7 +1205,7 @@ different storage systems for modules, and so forth.</P><P>The following databas
</LI><LI CLASS="li-itemize">Normally any LDAP compatible server should work; inform us about your
success with a not-listed server so that we can list it here.
</LI></UL><!--TOC subsection MySQL-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc28">3.2.1</A>&#XA0;&#XA0;MySQL</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc30">3.2.1</A>&#XA0;&#XA0;MySQL</H3><!--SEC END --><P>
<A NAME="mysql"></A>
</P><P>Although this section will describe <TT>ejabberd</TT>&#X2019;s configuration when you want to
use the native MySQL driver, it does not describe MySQL&#X2019;s installation and
@ -1182,7 +1265,7 @@ relational databases like MySQL. To enable storage to your database, just make
sure that your database is running well (see previous sections), and replace the
suffix-less or ldap module variant with the odbc module variant. Keep in mind
that you cannot have several variants of the same module loaded!</P><!--TOC subsection Microsoft SQL Server-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc29">3.2.2</A>&#XA0;&#XA0;Microsoft SQL Server</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc31">3.2.2</A>&#XA0;&#XA0;Microsoft SQL Server</H3><!--SEC END --><P>
<A NAME="mssql"></A>
</P><P>Although this section will describe <TT>ejabberd</TT>&#X2019;s configuration when you want to
use Microsoft SQL Server, it does not describe Microsoft SQL Server&#X2019;s
@ -1222,7 +1305,7 @@ database, just make sure that your database is running well (see previous
sections), and replace the suffix-less or ldap module variant with the odbc
module variant. Keep in mind that you cannot have several variants of the same
module loaded!</P><!--TOC subsection PostgreSQL-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc30">3.2.3</A>&#XA0;&#XA0;PostgreSQL</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc32">3.2.3</A>&#XA0;&#XA0;PostgreSQL</H3><!--SEC END --><P>
<A NAME="pgsql"></A>
</P><P>Although this section will describe <TT>ejabberd</TT>&#X2019;s configuration when you want to
use the native PostgreSQL driver, it does not describe PostgreSQL&#X2019;s installation
@ -1285,7 +1368,7 @@ relational databases like PostgreSQL. To enable storage to your database, just
make sure that your database is running well (see previous sections), and
replace the suffix-less or ldap module variant with the odbc module variant.
Keep in mind that you cannot have several variants of the same module loaded!</P><!--TOC subsection ODBC Compatible-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc31">3.2.4</A>&#XA0;&#XA0;ODBC Compatible</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc33">3.2.4</A>&#XA0;&#XA0;ODBC Compatible</H3><!--SEC END --><P>
<A NAME="odbc"></A>
</P><P>Although this section will describe <TT>ejabberd</TT>&#X2019;s configuration when you want to
use the ODBC driver, it does not describe the installation and database creation
@ -1332,7 +1415,7 @@ database, just make sure that your database is running well (see previous
sections), and replace the suffix-less or ldap module variant with the odbc
module variant. Keep in mind that you cannot have several variants of the same
module loaded!</P><!--TOC subsection LDAP-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc32">3.2.5</A>&#XA0;&#XA0;LDAP</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc34">3.2.5</A>&#XA0;&#XA0;LDAP</H3><!--SEC END --><P>
<A NAME="ldap"></A>
</P><P><TT>ejabberd</TT> has built-in LDAP support. You can authenticate users against LDAP
server and use LDAP directory as vCard storage. Shared rosters are not supported
@ -1502,7 +1585,7 @@ configuration is shown below:</P><PRE CLASS="verbatim"> {auth_method, ldap}.
...
}.
</PRE><!--TOC section Modules Configuration-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc33">3.3</A>&#XA0;&#XA0;Modules Configuration</H2><!--SEC END --><P>
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc35">3.3</A>&#XA0;&#XA0;Modules Configuration</H2><!--SEC END --><P>
<A NAME="modules"></A>
</P><P>The option <TT>modules</TT> defines the list of modules that will be loaded after
<TT>ejabberd</TT>&#X2019;s startup. Each entry in the list is a tuple in which the first
@ -1523,7 +1606,7 @@ all entries end with a comma:
{mod_version, []}
]}.
</PRE></LI></UL><!--TOC subsection Overview-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc34">3.3.1</A>&#XA0;&#XA0;Overview</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc36">3.3.1</A>&#XA0;&#XA0;Overview</H3><!--SEC END --><P>
<A NAME="modoverview"></A>
</P><P>The following table lists all modules included in <TT>ejabberd</TT>.</P><BLOCKQUOTE CLASS="table"><DIV CLASS="center"><DIV CLASS="center"><HR WIDTH="80%" SIZE=2></DIV>
<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1><TR><TD ALIGN=left NOWRAP>Module</TD><TD ALIGN=left NOWRAP>Feature</TD><TD ALIGN=left NOWRAP>Dependencies</TD><TD ALIGN=left NOWRAP>Needed for XMPP?</TD></TR>
@ -1588,7 +1671,7 @@ Last connection date and time: Use <TT>mod_last_odbc</TT> instead of
<TT>ejabberd</TT> website. Please remember that these contributions might not work or
that they can contain severe bugs and security leaks. Therefore, use them at
your own risk!</P><!--TOC subsection Common Options-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc35">3.3.2</A>&#XA0;&#XA0;Common Options</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc37">3.3.2</A>&#XA0;&#XA0;Common Options</H3><!--SEC END --><P>
<A NAME="modcommonoptions"></A></P><P>The following options are used by many modules. Therefore, they are described in
this separate section.</P><!--TOC subsubsection <TT>iqdisc</TT>-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><TT>iqdisc</TT></H4><!--SEC END --><P>
@ -1640,7 +1723,7 @@ the "@HOST@" keyword must be used:
...
]}.
</PRE><!--TOC subsection <TT>mod_announce</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc36">3.3.3</A>&#XA0;&#XA0;<TT>mod_announce</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc38">3.3.3</A>&#XA0;&#XA0;<TT>mod_announce</TT></H3><!--SEC END --><P>
<A NAME="modannounce"></A>
</P><P>This module enables configured users to broadcast announcements and to set
the message of the day (MOTD).
@ -1705,7 +1788,7 @@ Only administrators can send announcements:
</PRE></LI></UL><P>Note that <TT>mod_announce</TT> can be resource intensive on large
deployments as it can broadcast lot of messages. This module should be
disabled for instances of <TT>ejabberd</TT> with hundreds of thousands users.</P><!--TOC subsection <TT>mod_disco</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc37">3.3.4</A>&#XA0;&#XA0;<TT>mod_disco</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc39">3.3.4</A>&#XA0;&#XA0;<TT>mod_disco</TT></H3><!--SEC END --><P>
<A NAME="moddisco"></A>
</P><P>This module adds support for Service Discovery (<A HREF="http://www.xmpp.org/extensions/xep-0030.html">XEP-0030</A>). With
this module enabled, services on your server can be discovered by
@ -1746,7 +1829,7 @@ To serve a link to the Jabber User Directory on <TT>jabber.org</TT>:
...
]}.
</PRE></LI></UL><!--TOC subsection <TT>mod_echo</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc38">3.3.5</A>&#XA0;&#XA0;<TT>mod_echo</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc40">3.3.5</A>&#XA0;&#XA0;<TT>mod_echo</TT></H3><!--SEC END --><P>
<A NAME="modecho"></A>
</P><P>This module simply echoes any Jabber
packet back to the sender. This mirror can be of interest for
@ -1767,7 +1850,7 @@ of them all?
...
]}.
</PRE><!--TOC subsection <TT>mod_irc</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc39">3.3.6</A>&#XA0;&#XA0;<TT>mod_irc</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc41">3.3.6</A>&#XA0;&#XA0;<TT>mod_irc</TT></H3><!--SEC END --><P>
<A NAME="modirc"></A>
</P><P>This module is an IRC transport that can be used to join channels on IRC
servers.</P><P>End user information:
@ -1827,7 +1910,7 @@ our domains and on other servers.
...
]}.
</PRE></LI></UL><!--TOC subsection <TT>mod_last</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc40">3.3.7</A>&#XA0;&#XA0;<TT>mod_last</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc42">3.3.7</A>&#XA0;&#XA0;<TT>mod_last</TT></H3><!--SEC END --><P>
<A NAME="modlast"></A>
</P><P>This module adds support for Last Activity (<A HREF="http://www.xmpp.org/extensions/xep-0012.html">XEP-0012</A>). It can be used to
discover when a disconnected user last accessed the server, to know when a
@ -1837,7 +1920,7 @@ connected user was last active on the server, or to query the uptime of the
<B><TT>iqdisc</TT></B></DT><DD CLASS="dd-description"> This specifies
the processing discipline for Last activity (<TT>jabber:iq:last</TT>) IQ queries (see section&#XA0;<A HREF="#modiqdiscoption">3.3.2</A>).
</DD></DL><!--TOC subsection <TT>mod_muc</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc41">3.3.8</A>&#XA0;&#XA0;<TT>mod_muc</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc43">3.3.8</A>&#XA0;&#XA0;<TT>mod_muc</TT></H3><!--SEC END --><P>
<A NAME="modmuc"></A>
</P><P>With this module enabled, your server will support Multi-User Chat
(<A HREF="http://www.xmpp.org/extensions/xep-0045.html">XEP-0045</A>). End users will be able to join text conferences.</P><P>Some of the features of Multi-User Chat:
@ -2015,7 +2098,7 @@ newly created chatrooms have by default those options.
...
]}.
</PRE></LI></UL><!--TOC subsection <TT>mod_muc_log</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc42">3.3.9</A>&#XA0;&#XA0;<TT>mod_muc_log</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc44">3.3.9</A>&#XA0;&#XA0;<TT>mod_muc_log</TT></H3><!--SEC END --><P>
<A NAME="modmuclog"></A>
</P><P>This module enables optional logging of Multi-User Chat (MUC) conversations to
HTML. Once you enable this module, users can join a chatroom using a MUC capable
@ -2123,7 +2206,7 @@ top link will be the default <CODE>&lt;a href="/"&gt;Home&lt;/a&gt;</CODE>.
...
]}.
</PRE></LI></UL><!--TOC subsection <TT>mod_offline</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc43">3.3.10</A>&#XA0;&#XA0;<TT>mod_offline</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc45">3.3.10</A>&#XA0;&#XA0;<TT>mod_offline</TT></H3><!--SEC END --><P>
<A NAME="modoffline"></A>
</P><P>This module implements offline message storage. This means that all messages
sent to an offline user will be stored on the server until that user comes
@ -2135,7 +2218,7 @@ is use to set a max number of offline messages per user (quota). Its
value can be either <TT>infinity</TT> or a strictly positive
integer. The default value is <TT>infinity</TT>.
</DD></DL><!--TOC subsection <TT>mod_privacy</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc44">3.3.11</A>&#XA0;&#XA0;<TT>mod_privacy</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc46">3.3.11</A>&#XA0;&#XA0;<TT>mod_privacy</TT></H3><!--SEC END --><P>
<A NAME="modprivacy"></A>
</P><P>This module implements Blocking Communication (also known as Privacy Rules)
as defined in section 10 from XMPP IM. If end users have support for it in
@ -2164,7 +2247,7 @@ subscription type (or globally).
<B><TT>iqdisc</TT></B></DT><DD CLASS="dd-description"> This specifies
the processing discipline for Blocking Communication (<TT>jabber:iq:privacy</TT>) IQ queries (see section&#XA0;<A HREF="#modiqdiscoption">3.3.2</A>).
</DD></DL><!--TOC subsection <TT>mod_private</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc45">3.3.12</A>&#XA0;&#XA0;<TT>mod_private</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc47">3.3.12</A>&#XA0;&#XA0;<TT>mod_private</TT></H3><!--SEC END --><P>
<A NAME="modprivate"></A>
</P><P>This module adds support for Private XML Storage (<A HREF="http://www.xmpp.org/extensions/xep-0049.html">XEP-0049</A>):
</P><BLOCKQUOTE CLASS="quote">
@ -2177,7 +2260,7 @@ of client-specific preferences; another is Bookmark Storage (<A HREF="http://www
<B><TT>iqdisc</TT></B></DT><DD CLASS="dd-description"> This specifies
the processing discipline for Private XML Storage (<TT>jabber:iq:private</TT>) IQ queries (see section&#XA0;<A HREF="#modiqdiscoption">3.3.2</A>).
</DD></DL><!--TOC subsection <TT>mod_proxy65</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc46">3.3.13</A>&#XA0;&#XA0;<TT>mod_proxy65</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc48">3.3.13</A>&#XA0;&#XA0;<TT>mod_proxy65</TT></H3><!--SEC END --><P>
<A NAME="modproxy"></A>
</P><P>This module implements SOCKS5 Bytestreams (<A HREF="http://www.xmpp.org/extensions/xep-0065.html">XEP-0065</A>).
It allows <TT>ejabberd</TT> to act as a file transfer proxy between two
@ -2233,7 +2316,7 @@ The simpliest configuration of the module:
...
]}.
</PRE></LI></UL><!--TOC subsection <TT>mod_pubsub</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc47">3.3.14</A>&#XA0;&#XA0;<TT>mod_pubsub</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc49">3.3.14</A>&#XA0;&#XA0;<TT>mod_pubsub</TT></H3><!--SEC END --><P>
<A NAME="modpubsub"></A>
</P><P>This module offers a Publish-Subscribe Service (<A HREF="http://www.xmpp.org/extensions/xep-0060.html">XEP-0060</A>).
The functionality in <TT>mod_pubsub</TT> can be extended using plugins.
@ -2264,7 +2347,7 @@ and is shared by all node plugins.
...
]}.
</PRE><!--TOC subsection <TT>mod_register</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc48">3.3.15</A>&#XA0;&#XA0;<TT>mod_register</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc50">3.3.15</A>&#XA0;&#XA0;<TT>mod_register</TT></H3><!--SEC END --><P>
<A NAME="modregister"></A>
</P><P>This module adds support for In-Band Registration (<A HREF="http://www.xmpp.org/extensions/xep-0077.html">XEP-0077</A>). This protocol
enables end users to use a Jabber client to:
@ -2326,14 +2409,14 @@ example all In-Band Registration functionality is disabled:
...
]}.
</PRE></LI></UL><!--TOC subsection <TT>mod_roster</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc49">3.3.16</A>&#XA0;&#XA0;<TT>mod_roster</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc51">3.3.16</A>&#XA0;&#XA0;<TT>mod_roster</TT></H3><!--SEC END --><P>
<A NAME="modroster"></A>
</P><P>This module implements roster management as defined in <A HREF="http://www.xmpp.org/specs/rfc3921.html#roster">RFC 3921: XMPP IM</A>.</P><P>Options:
</P><DL CLASS="description"><DT CLASS="dt-description">
<B><TT>iqdisc</TT></B></DT><DD CLASS="dd-description"> This specifies
the processing discipline for Roster Management (<TT>jabber:iq:roster</TT>) IQ queries (see section&#XA0;<A HREF="#modiqdiscoption">3.3.2</A>).
</DD></DL><!--TOC subsection <TT>mod_service_log</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc50">3.3.17</A>&#XA0;&#XA0;<TT>mod_service_log</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc52">3.3.17</A>&#XA0;&#XA0;<TT>mod_service_log</TT></H3><!--SEC END --><P>
<A NAME="modservicelog"></A>
</P><P>This module adds support for logging end user packets via a Jabber message
auditing service such as
@ -2364,7 +2447,7 @@ To log all end user packets to the Bandersnatch service running on
...
]}.
</PRE></LI></UL><!--TOC subsection <TT>mod_shared_roster</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc51">3.3.18</A>&#XA0;&#XA0;<TT>mod_shared_roster</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc53">3.3.18</A>&#XA0;&#XA0;<TT>mod_shared_roster</TT></H3><!--SEC END --><P>
<A NAME="modsharedroster"></A>
</P><P>This module enables you to create shared roster groups. This means that you can
create groups of people that can see members from (other) groups in their
@ -2440,7 +2523,7 @@ roster groups as shown in the following table:
</TABLE>
<DIV CLASS="center"><HR WIDTH="80%" SIZE=2></DIV></DIV></BLOCKQUOTE>
</LI></UL><!--TOC subsection <TT>mod_stats</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc52">3.3.19</A>&#XA0;&#XA0;<TT>mod_stats</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc54">3.3.19</A>&#XA0;&#XA0;<TT>mod_stats</TT></H3><!--SEC END --><P>
<A NAME="modstats"></A>
</P><P>This module adds support for Statistics Gathering (<A HREF="http://www.xmpp.org/extensions/xep-0039.html">XEP-0039</A>). This protocol
allows you to retrieve next statistics from your <TT>ejabberd</TT> deployment:
@ -2473,7 +2556,7 @@ by sending:
&lt;/query&gt;
&lt;/iq&gt;
</PRE></LI></UL><!--TOC subsection <TT>mod_time</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc53">3.3.20</A>&#XA0;&#XA0;<TT>mod_time</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc55">3.3.20</A>&#XA0;&#XA0;<TT>mod_time</TT></H3><!--SEC END --><P>
<A NAME="modtime"></A>
</P><P>This module features support for Entity Time (<A HREF="http://www.xmpp.org/extensions/xep-0090.html">XEP-0090</A>). By using this XEP,
you are able to discover the time at another entity&#X2019;s location.</P><P>Options:
@ -2481,7 +2564,7 @@ you are able to discover the time at another entity&#X2019;s location.</P><P>Opt
<B><TT>iqdisc</TT></B></DT><DD CLASS="dd-description"> This specifies
the processing discipline for Entity Time (<TT>jabber:iq:time</TT>) IQ queries (see section&#XA0;<A HREF="#modiqdiscoption">3.3.2</A>).
</DD></DL><!--TOC subsection <TT>mod_vcard</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc54">3.3.21</A>&#XA0;&#XA0;<TT>mod_vcard</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc56">3.3.21</A>&#XA0;&#XA0;<TT>mod_vcard</TT></H3><!--SEC END --><P>
<A NAME="modvcard"></A>
</P><P>This module allows end users to store and retrieve their vCard, and to retrieve
other users vCards, as defined in vcard-temp (<A HREF="http://www.xmpp.org/extensions/xep-0054.html">XEP-0054</A>). The module also
@ -2537,7 +2620,7 @@ and that all virtual hosts will be searched instead of only the current one:
...
]}.
</PRE></LI></UL><!--TOC subsection <TT>mod_vcard_ldap</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc55">3.3.22</A>&#XA0;&#XA0;<TT>mod_vcard_ldap</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc57">3.3.22</A>&#XA0;&#XA0;<TT>mod_vcard_ldap</TT></H3><!--SEC END --><P>
<A NAME="modvcardldap"></A>
</P><P><TT>ejabberd</TT> can map LDAP attributes to vCard fields. This behaviour is
implemented in the <TT>mod_vcard_ldap</TT> module. This module does not depend on the
@ -2712,7 +2795,7 @@ searching his info in LDAP.</P></LI><LI CLASS="li-itemize"><TT>ldap_vcard_map</T
{"Nickname", "NICKNAME"}
]},
</PRE></LI></UL><!--TOC subsection <TT>mod_version</TT>-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc56">3.3.23</A>&#XA0;&#XA0;<TT>mod_version</TT></H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc58">3.3.23</A>&#XA0;&#XA0;<TT>mod_version</TT></H3><!--SEC END --><P>
<A NAME="modversion"></A>
</P><P>This module implements Software Version (<A HREF="http://www.xmpp.org/extensions/xep-0092.html">XEP-0092</A>). Consequently, it
answers <TT>ejabberd</TT>&#X2019;s version when queried.</P><P>Options:
@ -2722,10 +2805,10 @@ The default value is <TT>true</TT>.
</DD><DT CLASS="dt-description"><B><TT>iqdisc</TT></B></DT><DD CLASS="dd-description"> This specifies
the processing discipline for Software Version (<TT>jabber:iq:version</TT>) IQ queries (see section&#XA0;<A HREF="#modiqdiscoption">3.3.2</A>).
</DD></DL><!--TOC chapter Managing an <TT>ejabberd</TT> server-->
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc57">Chapter&#XA0;4</A>&#XA0;&#XA0;Managing an <TT>ejabberd</TT> server</H1><!--SEC END --><!--TOC section <TT>ejabberdctl</TT>-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc58">4.1</A>&#XA0;&#XA0;<TT>ejabberdctl</TT></H2><!--SEC END --><P>
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc59">Chapter&#XA0;4</A>&#XA0;&#XA0;Managing an <TT>ejabberd</TT> server</H1><!--SEC END --><!--TOC section <TT>ejabberdctl</TT>-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc60">4.1</A>&#XA0;&#XA0;<TT>ejabberdctl</TT></H2><!--SEC END --><P>
<A NAME="ejabberdctl"></A></P><!--TOC subsection Commands-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc59">4.1.1</A>&#XA0;&#XA0;Commands</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc61">4.1.1</A>&#XA0;&#XA0;Commands</H3><!--SEC END --><P>
<A NAME="commands"></A></P><P>The <TT>ejabberdctl</TT> command line script allows to start, stop and perform
many other administrative tasks in a local or remote <TT>ejabberd</TT> server.</P><P>When <TT>ejabberdctl</TT> is executed without any parameter,
it displays the available options. If there isn&#X2019;t an <TT>ejabberd</TT> server running,
@ -2753,7 +2836,7 @@ is very high.
</DD></DL><P>The <TT>ejabberdctl</TT> script also allows the argument <TT>--node NODENAME</TT>.
This allows to administer a remote node.</P><P>The <TT>ejabberdctl</TT> administration script can be configured in the file ejabberdctl.cfg.
This file provides detailed information about each configurable option.</P><!--TOC subsection Erlang runtime system-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc60">4.1.2</A>&#XA0;&#XA0;Erlang runtime system</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc62">4.1.2</A>&#XA0;&#XA0;Erlang runtime system</H3><!--SEC END --><P>
<A NAME="erlangconfiguration"></A></P><P><TT>ejabberd</TT> is an Erlang/OTP application that runs inside an Erlang runtime system.
This system is configured using environment variables and command line parameters.
The <TT>ejabberdctl</TT> administration script uses many of those possibilities.
@ -2821,7 +2904,7 @@ Starts the Erlang system detached from the system console.
</DD></DL><P>
Note that some characters need to be escaped when used in shell scripts, for instance <CODE>"</CODE> and <CODE>{}</CODE>.
You can find other options in the Erlang manual page (<TT>erl -man erl</TT>).</P><!--TOC section Web Admin-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc61">4.2</A>&#XA0;&#XA0;Web Admin</H2><!--SEC END --><P>
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc63">4.2</A>&#XA0;&#XA0;Web Admin</H2><!--SEC END --><P>
<A NAME="webadmin"></A>
</P><P>The <TT>ejabberd</TT> Web Admin allows to administer most of <TT>ejabberd</TT> using a web browser.</P><P>This feature is enabled by default:
a <TT>ejabberd_http</TT> listener with the option <TT>web_admin</TT> (see
@ -2883,14 +2966,14 @@ web browser to <CODE>https://192.168.1.1:5280/admin/</CODE>:
]
}.
</PRE></LI></UL><!--TOC section Ad-hoc Commands-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc62">4.3</A>&#XA0;&#XA0;Ad-hoc Commands</H2><!--SEC END --><P>
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc64">4.3</A>&#XA0;&#XA0;Ad-hoc Commands</H2><!--SEC END --><P>
<A NAME="adhoccommands"></A></P><P>If you enable <TT>mod_configure</TT> and <TT>mod_adhoc</TT>,
you can perform several administrative tasks in <TT>ejabberd</TT>
with a Jabber client.
The client must support Ad-Hoc Commands (<A HREF="http://www.xmpp.org/extensions/xep-0050.html">XEP-0050</A>),
and you must login in the Jabber server with
an account with proper privileges.</P><!--TOC section Change Computer Hostname-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc63">4.4</A>&#XA0;&#XA0;Change Computer Hostname</H2><!--SEC END --><P>
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc65">4.4</A>&#XA0;&#XA0;Change Computer Hostname</H2><!--SEC END --><P>
<A NAME="changeerlangnodename"></A></P><P><TT>ejabberd</TT> uses the distributed Mnesia database.
Being distributed, Mnesia enforces consistency of its file,
so it stores the name of the Erlang node in it.
@ -2907,8 +2990,8 @@ you must follow these instructions:
For example:
<PRE CLASS="verbatim">ejabberdctl restore /tmp/ejabberd-oldhost.backup
</PRE></LI></OL><!--TOC chapter Securing <TT>ejabberd</TT>-->
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc64">Chapter&#XA0;5</A>&#XA0;&#XA0;Securing <TT>ejabberd</TT></H1><!--SEC END --><!--TOC section Firewall Settings-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc65">5.1</A>&#XA0;&#XA0;Firewall Settings</H2><!--SEC END --><P>
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc66">Chapter&#XA0;5</A>&#XA0;&#XA0;Securing <TT>ejabberd</TT></H1><!--SEC END --><!--TOC section Firewall Settings-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc67">5.1</A>&#XA0;&#XA0;Firewall Settings</H2><!--SEC END --><P>
<A NAME="firewall"></A>
</P><P>You need to take the following TCP ports in mind when configuring your firewall:
</P><BLOCKQUOTE CLASS="table"><DIV CLASS="center"><DIV CLASS="center"><HR WIDTH="80%" SIZE=2></DIV>
@ -2920,7 +3003,7 @@ you must follow these instructions:
<TR><TD ALIGN=left NOWRAP>port range</TD><TD ALIGN=left NOWRAP>Used for connections between Erlang nodes. This range is configurable (see section <A HREF="#epmd">5.2</A>).</TD></TR>
</TABLE>
<DIV CLASS="center"><HR WIDTH="80%" SIZE=2></DIV></DIV></BLOCKQUOTE><!--TOC section epmd -->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc66">5.2</A>&#XA0;&#XA0;epmd </H2><!--SEC END --><P>
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc68">5.2</A>&#XA0;&#XA0;epmd </H2><!--SEC END --><P>
<A NAME="epmd"></A></P><P><A HREF="http://www.erlang.org/doc/man/epmd.html">epmd (Erlang Port Mapper Daemon)</A>
is a small name server included in Erlang/OTP
and used by Erlang programs when establishing distributed Erlang communications.
@ -2946,7 +3029,7 @@ but can be configured in the file <TT>ejabberdctl.cfg</TT>.
The Erlang command-line parameter used internally is, for example:
</P><PRE CLASS="verbatim">erl ... -kernel inet_dist_listen_min 4370 inet_dist_listen_max 4375
</PRE><!--TOC section Erlang Cookie-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc67">5.3</A>&#XA0;&#XA0;Erlang Cookie</H2><!--SEC END --><P>
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc69">5.3</A>&#XA0;&#XA0;Erlang Cookie</H2><!--SEC END --><P>
<A NAME="cookie"></A></P><P>The Erlang cookie is a string with numbers and letters.
An Erlang node reads the cookie at startup from the command-line parameter <TT>-setcookie</TT>
or from a cookie file.
@ -2960,7 +3043,7 @@ to prevent unauthorized access or intrusion to an Erlang node.
The communication between Erlang nodes are not encrypted,
so the cookie could be read sniffing the traffic on the network.
The recommended way to secure the Erlang node is to block the port 4369.</P><!--TOC section Erlang node name-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc68">5.4</A>&#XA0;&#XA0;Erlang node name</H2><!--SEC END --><P>
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc70">5.4</A>&#XA0;&#XA0;Erlang node name</H2><!--SEC END --><P>
<A NAME="nodename"></A></P><P>An Erlang node may have a node name.
The name can be short (if indicated with the command-line parameter <TT>-sname</TT>)
or long (if indicated with the parameter <TT>-name</TT>).
@ -2970,10 +3053,10 @@ However, it is not ultimately effective to prevent access to the Erlang node,
because it may be possible to fake the fact that you are on another network
using a modified version of Erlang <TT>epmd</TT>.
The recommended way to secure the Erlang node is to block the port 4369.</P><!--TOC chapter Clustering-->
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc69">Chapter&#XA0;6</A>&#XA0;&#XA0;Clustering</H1><!--SEC END --><P>
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc71">Chapter&#XA0;6</A>&#XA0;&#XA0;Clustering</H1><!--SEC END --><P>
<A NAME="clustering"></A>
</P><!--TOC section How it Works-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc70">6.1</A>&#XA0;&#XA0;How it Works</H2><!--SEC END --><P>
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc72">6.1</A>&#XA0;&#XA0;How it Works</H2><!--SEC END --><P>
<A NAME="howitworks"></A>
</P><P>A Jabber domain is served by one or more <TT>ejabberd</TT> nodes. These nodes can
be run on different machines that are connected via a network. They all
@ -2988,33 +3071,33 @@ router,
</LI><LI CLASS="li-itemize">session manager,
</LI><LI CLASS="li-itemize">s2s manager.
</LI></UL><!--TOC subsection Router-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc71">6.1.1</A>&#XA0;&#XA0;Router</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc73">6.1.1</A>&#XA0;&#XA0;Router</H3><!--SEC END --><P>
<A NAME="router"></A>
</P><P>This module is the main router of Jabber packets on each node. It
routes them based on their destination&#X2019;s domains. It uses a global
routing table. The domain of the packet&#X2019;s destination is searched in the
routing table, and if it is found, the packet is routed to the
appropriate process. If not, it is sent to the s2s manager.</P><!--TOC subsection Local Router-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc72">6.1.2</A>&#XA0;&#XA0;Local Router</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc74">6.1.2</A>&#XA0;&#XA0;Local Router</H3><!--SEC END --><P>
<A NAME="localrouter"></A>
</P><P>This module routes packets which have a destination domain equal to
one of this server&#X2019;s host names. If the destination JID has a non-empty user
part, it is routed to the session manager, otherwise it is processed depending
on its content.</P><!--TOC subsection Session Manager-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc73">6.1.3</A>&#XA0;&#XA0;Session Manager</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc75">6.1.3</A>&#XA0;&#XA0;Session Manager</H3><!--SEC END --><P>
<A NAME="sessionmanager"></A>
</P><P>This module routes packets to local users. It looks up to which user
resource a packet must be sent via a presence table. Then the packet is
either routed to the appropriate c2s process, or stored in offline
storage, or bounced back.</P><!--TOC subsection s2s Manager-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc74">6.1.4</A>&#XA0;&#XA0;s2s Manager</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc76">6.1.4</A>&#XA0;&#XA0;s2s Manager</H3><!--SEC END --><P>
<A NAME="s2smanager"></A>
</P><P>This module routes packets to other Jabber servers. First, it
checks if an opened s2s connection from the domain of the packet&#X2019;s
source to the domain of the packet&#X2019;s destination exists. If that is the case,
the s2s manager routes the packet to the process
serving this connection, otherwise a new connection is opened.</P><!--TOC section Clustering Setup-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc75">6.2</A>&#XA0;&#XA0;Clustering Setup</H2><!--SEC END --><P>
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc77">6.2</A>&#XA0;&#XA0;Clustering Setup</H2><!--SEC END --><P>
<A NAME="cluster"></A>
</P><P>Suppose you already configured <TT>ejabberd</TT> on one machine named (<TT>first</TT>),
and you need to setup another one to make an <TT>ejabberd</TT> cluster. Then do
@ -3049,11 +3132,11 @@ and &#X2018;<CODE>access</CODE>&#X2019; options &#X2014; they will be taken from
enabled only on one machine in the cluster).
</LI></OL><P>You can repeat these steps for other machines supposed to serve this
domain.</P><!--TOC section Service Load-Balancing-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc76">6.3</A>&#XA0;&#XA0;Service Load-Balancing</H2><!--SEC END --><!--TOC subsection Components Load-Balancing-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc77">6.3.1</A>&#XA0;&#XA0;Components Load-Balancing</H3><!--SEC END --><P>
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc78">6.3</A>&#XA0;&#XA0;Service Load-Balancing</H2><!--SEC END --><!--TOC subsection Components Load-Balancing-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc79">6.3.1</A>&#XA0;&#XA0;Components Load-Balancing</H3><!--SEC END --><P>
<A NAME="componentlb"></A>
</P><!--TOC subsection Domain Load-Balancing Algorithm-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc78">6.3.2</A>&#XA0;&#XA0;Domain Load-Balancing Algorithm</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc80">6.3.2</A>&#XA0;&#XA0;Domain Load-Balancing Algorithm</H3><!--SEC END --><P>
<A NAME="domainlb"></A>
</P><P><TT>ejabberd</TT> includes an algorithm to load balance the components that are plugged on an <TT>ejabberd</TT> cluster. It means that you can plug one or several instances of the same component on each <TT>ejabberd</TT> cluster and that the traffic will be automatically distributed.</P><P>The default distribution algorithm try to deliver to a local instance of a component. If several local instances are available, one instance is chosen randomly. If no instance is available locally, one instance is chosen randomly among the remote component instances.</P><P>If you need a different behaviour, you can change the load balancing behaviour with the option <TT>domain_balancing</TT>. The syntax of the option is the following:</P><PRE CLASS="verbatim"> {domain_balancing, "component.example.com", &lt;balancing_criterium&gt;}.
</PRE><P>Several balancing criteria are available:
@ -3063,15 +3146,15 @@ domain.</P><!--TOC section Service Load-Balancing-->
</LI><LI CLASS="li-itemize"><TT>bare_destination</TT>: the bare JID (without resource) of the packet <TT>to</TT> attribute is used.
</LI><LI CLASS="li-itemize"><TT>bare_source</TT>: the bare JID (without resource) of the packet <TT>from</TT> attribute is used.
</LI></UL><P>If the value corresponding to the criteria is the same, the same component instance in the cluster will be used.</P><!--TOC subsection Load-Balancing Buckets-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc79">6.3.3</A>&#XA0;&#XA0;Load-Balancing Buckets</H3><!--SEC END --><P>
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc81">6.3.3</A>&#XA0;&#XA0;Load-Balancing Buckets</H3><!--SEC END --><P>
<A NAME="lbbuckets"></A>
</P><P>When there is a risk of failure for a given component, domain balancing can cause service trouble. If one component is failing the service will not work correctly unless the sessions are rebalanced.</P><P>In this case, it is best to limit the problem to the sessions handled by the failing component. This is what the <TT>domain_balancing_component_number</TT> option does, making the load balancing algorithm not dynamic, but sticky on a fix number of component instances.</P><P>The syntax is the following:
</P><PRE CLASS="verbatim"> {domain_balancing_component_number, "component.example.com", N}
</PRE><!--TOC chapter Debugging-->
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc80">Chapter&#XA0;7</A>&#XA0;&#XA0;Debugging</H1><!--SEC END --><P>
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc82">Chapter&#XA0;7</A>&#XA0;&#XA0;Debugging</H1><!--SEC END --><P>
<A NAME="debugging"></A>
</P><!--TOC section Watchdog Alerts-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc81">7.1</A>&#XA0;&#XA0;Watchdog Alerts</H2><!--SEC END --><P>
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc83">7.1</A>&#XA0;&#XA0;Watchdog Alerts</H2><!--SEC END --><P>
<A NAME="watchdog"></A>
</P><P><TT>ejabberd</TT> includes a watchdog mechanism.
If a process in the <TT>ejabberd</TT> server consumes too much memory,
@ -3081,7 +3164,7 @@ a message is sent to the Jabber accounts defined with the option
Example configuration:
</P><PRE CLASS="verbatim">{watchdog_admins, ["admin2@localhost", "admin2@example.org"]}.
</PRE><!--TOC section Log Files-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc82">7.2</A>&#XA0;&#XA0;Log Files</H2><!--SEC END --><P>
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc84">7.2</A>&#XA0;&#XA0;Log Files</H2><!--SEC END --><P>
<A NAME="logfiles"></A></P><P>An <TT>ejabberd</TT> node writes two log files:
</P><DL CLASS="description"><DT CLASS="dt-description">
<B><TT>ejabberd.log</TT></B></DT><DD CLASS="dd-description"> is the ejabberd service log, with the messages reported by <TT>ejabberd</TT> code
@ -3099,13 +3182,13 @@ The possible levels are:
For example, the default configuration is:
</P><PRE CLASS="verbatim">{loglevel, 4}.
</PRE><!--TOC section Debug Console-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc83">7.3</A>&#XA0;&#XA0;Debug Console</H2><!--SEC END --><P>
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc85">7.3</A>&#XA0;&#XA0;Debug Console</H2><!--SEC END --><P>
<A NAME="debugconsole"></A></P><P>The Debug Console is an Erlang shell attached to an already running <TT>ejabberd</TT> server.
With this Erlang shell, an experienced administrator can perform complex tasks.</P><P>This shell gives complete control over the <TT>ejabberd</TT> server,
so it is important to use it with extremely care.
There are some simple and safe examples in the article
<A HREF="http://www.ejabberd.im/interconnect-erl-nodes">Interconnecting Erlang Nodes</A></P><P>To exit the shell, close the window or press the keys: control+c control+c.</P><!--TOC chapter Internationalization and Localization-->
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc84">Appendix&#XA0;A</A>&#XA0;&#XA0;Internationalization and Localization</H1><!--SEC END --><P>
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc86">Appendix&#XA0;A</A>&#XA0;&#XA0;Internationalization and Localization</H1><!--SEC END --><P>
<A NAME="i18nl10n"></A>
</P><P>All built-in modules support the <TT>xml:lang</TT> attribute inside IQ queries.
Figure&#XA0;<A HREF="#fig:discorus">A.1</A>, for example, shows the reply to the following query:
@ -3133,10 +3216,10 @@ HTTP header &#X2018;Accept-Language: ru&#X2019;</TD></TR>
</TABLE></DIV>
<A NAME="fig:webadmmainru"></A>
<DIV CLASS="center"><HR WIDTH="80%" SIZE=2></DIV></DIV></BLOCKQUOTE><!--TOC chapter Release Notes-->
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc85">Appendix&#XA0;B</A>&#XA0;&#XA0;Release Notes</H1><!--SEC END --><P>
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc87">Appendix&#XA0;B</A>&#XA0;&#XA0;Release Notes</H1><!--SEC END --><P>
<A NAME="releasenotes"></A>
</P><P>Release notes are available from <A HREF="http://www.process-one.net/en/ejabberd/release_notes/">ejabberd Home Page</A></P><!--TOC chapter Acknowledgements-->
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc86">Appendix&#XA0;C</A>&#XA0;&#XA0;Acknowledgements</H1><!--SEC END --><P>
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc88">Appendix&#XA0;C</A>&#XA0;&#XA0;Acknowledgements</H1><!--SEC END --><P>
<A NAME="acknowledgements"></A>
Thanks to all people who contributed to this guide:
</P><UL CLASS="itemize"><LI CLASS="li-itemize">
@ -3150,7 +3233,7 @@ Alexey Shchepin (<A HREF="xmpp:aleksey@jabber.ru"><TT>xmpp:aleksey@jabber.ru</TT
</LI><LI CLASS="li-itemize">Sergei Golovan (<A HREF="xmpp:sgolovan@nes.ru"><TT>xmpp:sgolovan@nes.ru</TT></A>)
</LI><LI CLASS="li-itemize">Vsevolod Pelipas (<A HREF="xmpp:vsevoload@jabber.ru"><TT>xmpp:vsevoload@jabber.ru</TT></A>)
</LI></UL><!--TOC chapter Copyright Information-->
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc87">Appendix&#XA0;D</A>&#XA0;&#XA0;Copyright Information</H1><!--SEC END --><P>
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc89">Appendix&#XA0;D</A>&#XA0;&#XA0;Copyright Information</H1><!--SEC END --><P>
<A NAME="copyright"></A></P><P>Ejabberd Installation and Operation Guide.<BR>
Copyright &#XA9; 2003 &#X2014; 2008 Process-one</P><P>This document is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License

View File

@ -1296,6 +1296,147 @@ Examples:
\end{verbatim}
\end{itemize}
\subsection{Include Additional Configuration Files}
\label{includeconfigfile}
\ind{options!includeconfigfile}\ind{includeconfigfile}
The option \option{include\_config\_file} in a configuration file instructs \ejabberd{} to include other configuration files immediately.
The basic usage is:
\begin{verbatim}
{include_config_file, <filename>}.
\end{verbatim}
It is also possible to specify suboptions:
\begin{verbatim}
{include_config_file, <filename>, [<suboption>, <suboption>, ...]}.
\end{verbatim}
The filename can be indicated either as an absolute path,
or relative to the main \ejabberd{} configuration file.
It isn't possible to use wildcards.
The file must exist and be readable.
The allowed suboptions are:
\begin{description}
\titem{\{disallow, [<option>, <option>, ...]\}} Disallows the usage of those options in the included configuration file.
The options that match this criteria are not accepted.
The default value is an empty list: \term{[]}
\titem{\{allow\_only, [<option>, <option>, ...]\}} Allows only the usage of those options in the included configuration file.
The options that do not match this criteria are not accepted.
The default value is: \term{all}
\end{description}
This is a basic example:
\begin{verbatim}
{include_config_file, "/etc/ejabberd/additional.cfg"}.
\end{verbatim}
In this example, the included file is not allowed to contain a \term{listen} option.
If such an option is present, the option will not be accepted.
The file is in a subdirectory from where the main configuration file is.
\begin{verbatim}
{include_config_file, "./example.org/additional_not_listen.cfg", [{disallow, [listen]}]}.
\end{verbatim}
In this example, \term{ejabberd.cfg} defines some ACL and Access rules,
and later includes another file with additional rules:
\begin{verbatim}
{acl, admin, {user, "admin", "localhost"}}.
{access, announce, [{allow, admin}]}.
{include_config_file, "/etc/ejabberd/acl_and_access.cfg", [{allow_only, [acl, access]}]}.
\end{verbatim}
and content of the file \term{acl\_and\_access.cfg} can be, for example:
\begin{verbatim}
{acl, admin, {user, "bob", "localhost"}}.
{acl, admin, {user, "jan", "localhost"}}.
\end{verbatim}
\subsection{Option Macros in Configuration File}
\label{optionmacros}
\ind{options!optionmacros}\ind{optionmacros}
In the \ejabberd{} configuration file,
it is possible to define a macro for a value
and later use this macro when defining an option.
A macro is defined with this syntax:
\begin{verbatim}
{define_macro, '<MACRO>', <value>}.
\end{verbatim}
The \term{MACRO} must be surrounded by commas, and all in uppercase.
The \term{value} can be any valid arbitrary Erlang term.
The first definition of a macro is preserved,
and additional definitions of the same macro are forgotten.
Macros are processed after
additional configuration files have been included,
so it is possible to use macros that
are defined in configuration files included before the usage.
It isn't possible to use a macro in the definition
of another macro.
There are two ways to use a macro:
\begin{description}
\titem{'<MACRO>'}
You can put this instead of a value in an \ejabberd{} option,
and will be replaced with the \term{value} previously defined.
If the macro is not defined previously,
the program will crash and report an error.
\titem{\{use\_macro, '<MACRO>', <defaultvalue>\}}
Use a macro even if it may not be defined.
If the macro is not defined previously,
the provided \term{defaultvalue} is used.
This usage behaves as if it were defined and used this way:
\begin{verbatim}
{define_macro, '<MACRO>', <defaultvalue>}.
'<MACRO>'
\end{verbatim}
\end{description}
This example shows the basic usage of a macro:
\begin{verbatim}
{define_macro, 'LOG_LEVEL_NUMBER', 5}.
{loglevel, 'LOG_LEVEL_NUMBER'}.
\end{verbatim}
The resulting option interpreted by \ejabberd{} is: \term{\{loglevel, 5\}}.
This example shows that values can be any arbitrary Erlang term:
\begin{verbatim}
{define_macro, 'USERBOB', {user, "bob", "localhost"}}.
{acl, admin, 'USERBOB'}.
\end{verbatim}
The resulting option interpreted by \ejabberd{} is: \term{\{acl, admin, \{user, "bob", "localhost"\}\}}.
This complex example:
\begin{verbatim}
{define_macro, 'NUMBER_PORT_C2S', 5222}.
{define_macro, 'PORT_S2S_IN', {5269, ejabberd_s2s_in, []}}.
{listen,
[
{'NUMBER_PORT_C2S', ejabberd_c2s, []},
'PORT_S2S_IN',
{{use_macro, 'NUMBER_PORT_HTTP', 5280}, ejabberd_http, []}
]
}.
\end{verbatim}
produces this result after being interpreted:
\begin{verbatim}
{listen,
[
{5222, ejabberd_c2s, []},
{5269, ejabberd_s2s_in, []},
{5280, ejabberd_http, []}
]
}.
\end{verbatim}
\section{Database and LDAP Configuration}
\label{database}
\ind{database}

View File

@ -35,6 +35,15 @@
-include("ejabberd.hrl").
-include("ejabberd_config.hrl").
%% @type macro() = {macro_key(), macro_value()}
%% @type macro_key() = atom().
%% The atom must have all characters in uppercase.
%% @type macro_value() = term().
start() ->
mnesia:create_table(config,
[{disc_copies, [node()]},
@ -45,30 +54,67 @@ start() ->
{local_content, true},
{attributes, record_info(fields, local_config)}]),
mnesia:add_table_copy(local_config, node(), ram_copies),
Config = case application:get_env(config) of
{ok, Path} -> Path;
undefined ->
case os:getenv("EJABBERD_CONFIG_PATH") of
false ->
?CONFIG_PATH;
Path ->
Path
end
end,
Config = get_ejabberd_config_path(),
load_file(Config).
%% @doc Get the filename of the ejabberd configuration file.
%% The filename can be specified with: erl -config "/path/to/ejabberd.cfg".
%% It can also be specified with the environtment variable EJABBERD_CONFIG_PATH.
%% If not specified, the default value 'ejabberd.cfg' is assumed.
%% @spec () -> string()
get_ejabberd_config_path() ->
case application:get_env(config) of
{ok, Path} -> Path;
undefined ->
case os:getenv("EJABBERD_CONFIG_PATH") of
false ->
?CONFIG_PATH;
Path ->
Path
end
end.
%% @doc Load the ejabberd configuration file.
%% It also includes additional configuration files and replaces macros.
%% @spec (File::string()) -> [term()]
load_file(File) ->
Terms = get_plain_terms_file(File),
State = lists:foldl(fun search_hosts/2, #state{}, Terms),
Terms_macros = replace_macros(Terms),
Res = lists:foldl(fun process_term/2, State, Terms_macros),
set_opts(Res).
%% @doc Read an ejabberd configuration file and return the terms.
%% Input is an absolute or relative path to an ejabberd config file.
%% Returns a list of plain terms,
%% in which the options 'include_config_file' were parsed
%% and the terms in those files were included.
%% @spec(string()) -> [term()]
get_plain_terms_file(File1) ->
File = get_absolute_path(File1),
case file:consult(File) of
{ok, Terms} ->
State = lists:foldl(fun search_hosts/2, #state{}, Terms),
Res = lists:foldl(fun process_term/2, State, Terms),
set_opts(Res);
include_config_files(Terms);
{error, Reason} ->
?ERROR_MSG("Can't load config file ~p: ~p", [File, Reason]),
exit(File ++ ": " ++ file:format_error(Reason))
end.
%% @doc Convert configuration filename to absolute path.
%% Input is an absolute or relative path to an ejabberd configuration file.
%% And returns an absolute path to the configuration file.
%% @spec (string()) -> string()
get_absolute_path(File) ->
case filename:pathtype(File) of
absolute ->
File;
relative ->
Config_path = get_ejabberd_config_path(),
Config_dir = filename:dirname(Config_path),
filename:absname_join(Config_dir, File)
end.
search_hosts(Term, State) ->
case Term of
{host, Host} ->
@ -111,6 +157,140 @@ normalize_hosts([Host|Hosts], PrepHosts) ->
normalize_hosts(Hosts, [PrepHost|PrepHosts])
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Support for 'include_config_file'
%% @doc Include additional configuration files in the list of terms.
%% @spec ([term()]) -> [term()]
include_config_files(Terms) ->
include_config_files(Terms, []).
include_config_files([], Res) ->
Res;
include_config_files([{include_config_file, Filename} | Terms], Res) ->
include_config_files([{include_config_file, Filename, []} | Terms], Res);
include_config_files([{include_config_file, Filename, Options} | Terms], Res) ->
Included_terms = get_plain_terms_file(Filename),
Disallow = proplists:get_value(disallow, Options, []),
Included_terms2 = delete_disallowed(Disallow, Included_terms),
Allow_only = proplists:get_value(allow_only, Options, all),
Included_terms3 = keep_only_allowed(Allow_only, Included_terms2),
include_config_files(Terms, Res ++ Included_terms3);
include_config_files([Term | Terms], Res) ->
include_config_files(Terms, Res ++ [Term]).
%% @doc Filter from the list of terms the disallowed.
%% Returns a sublist of Terms without the ones which first element is
%% included in Disallowed.
%% @spec (Disallowed::[atom()], Terms::[term()]) -> [term()]
delete_disallowed(Disallowed, Terms) ->
lists:foldl(
fun(Dis, Ldis) ->
delete_disallowed2(Dis, Ldis)
end,
Terms,
Disallowed).
delete_disallowed2(Disallowed, [H|T]) ->
case element(1, H) of
Disallowed ->
?WARNING_MSG("The option '~p' is disallowed, "
"and will not be accepted", [Disallowed]),
delete_disallowed2(Disallowed, T);
_ ->
[H|delete_disallowed2(Disallowed, T)]
end;
delete_disallowed2(_, []) ->
[].
%% @doc Keep from the list only the allowed terms.
%% Returns a sublist of Terms with only the ones which first element is
%% included in Allowed.
%% @spec (Allowed::[atom()], Terms::[term()]) -> [term()]
keep_only_allowed(all, Terms) ->
Terms;
keep_only_allowed(Allowed, Terms) ->
{As, NAs} = lists:partition(
fun(Term) ->
lists:member(element(1, Term), Allowed)
end,
Terms),
[?WARNING_MSG("This option is not allowed, "
"and will not be accepted:~n~p", [NA])
|| NA <- NAs],
As.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Support for Macro
%% @doc Replace the macros with their defined values.
%% @spec (Terms::[term()]) -> [term()]
replace_macros(Terms) ->
{TermsOthers, Macros} = split_terms_macros(Terms),
replace(TermsOthers, Macros).
%% @doc Split Terms into normal terms and macro definitions.
%% @spec (Terms) -> {Terms, Macros}
%% Terms = [term()]
%% Macros = [macro()]
split_terms_macros(Terms) ->
lists:foldl(
fun(Term, {TOs, Ms}) ->
case Term of
{define_macro, Key, Value} ->
case is_atom(Key) and is_all_uppercase(Key) of
true ->
{TOs, Ms++[{Key, Value}]};
false ->
exit({macro_not_properly_defined, Term})
end;
Term ->
{TOs ++ [Term], Ms}
end
end,
{[], []},
Terms).
%% @doc Recursively replace in Terms macro usages with the defined value.
%% @spec (Terms, Macros) -> Terms
%% Terms = [term()]
%% Macros = [macro()]
replace([], _) ->
[];
replace([Term|Terms], Macros) ->
[replace_term(Term, Macros) | replace(Terms, Macros)].
replace_term(Key, Macros) when is_atom(Key) ->
case is_all_uppercase(Key) of
true ->
case proplists:get_value(Key, Macros) of
undefined -> exit({undefined_macro, Key});
Value -> Value
end;
false ->
Key
end;
replace_term({use_macro, Key, Value}, Macros) ->
proplists:get_value(Key, Macros, Value);
replace_term(Term, Macros) when is_list(Term) ->
replace(Term, Macros);
replace_term(Term, Macros) when is_tuple(Term) ->
List = tuple_to_list(Term),
List2 = replace(List, Macros),
list_to_tuple(List2);
replace_term(Term, _) ->
Term.
is_all_uppercase(Atom) ->
String = erlang:atom_to_list(Atom),
(String == string:to_upper(String)).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Process terms
process_term(Term, State) ->
case Term of
override_global ->