install_xmpp.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. .. _extensions_wps_remote_install_xmpp:
  2. Installation Of OpenFire XMPP Server To Exchange Messages
  3. =========================================================
  4. The following commands will prepare a CentOS 7 Minimal ISO machine for the deployment of:
  5. * Openfire XMPP Server
  6. * NFS shared file-system
  7. .. note:: Prerequisite to this section, is the basic preparation of the CentOS machine as described on the section :ref:`extensions_wps_remote_install_geoserver`.
  8. Setup and configuration of Openfire XMPP Server
  9. -----------------------------------------------
  10. Originally named Jabber, XMPP is the new label for *Extensible Messaging and Presence Protocol.* and it is associated mostly with instant messaging.
  11. Setting up PostgreSQL database backend
  12. ++++++++++++++++++++++++++++++++++++++
  13. For the purposes of running a private XMPP communication platform, we can safely stick with PostgreSQL 9.2 which is stable and comes in CentOS 7 by default.
  14. .. code-block:: bash
  15. # as root
  16. $> yum install -y postgresql postgresql-server postgresql-devel postgresql-libs
  17. # After PostgreSQL packages are installed, enable PostgreSQL to start after each reboot.
  18. $> systemctl enable postgresql.service
  19. # Initialize directory structure and postgres system database.
  20. $> postgresql-setup initdb
  21. # And start the service.
  22. $> systemctl start postgresql.service
  23. Postgres installation is now up and running, lets proceed with setting up the specific database and the dedicated user for OpenFire, together with authentication method and administration password.
  24. For full administration access, switch to postgres user.
  25. .. code-block:: bash
  26. su postgres
  27. # as postgres
  28. $> createdb openfire
  29. $> createuser -P openfire
  30. # The '-P' parameter ensures that the shell will explicitly ask for user's password and you will need to type it in. Enter the password twice
  31. R3m0T3wP5
  32. $> psql -U postgres -d postgres -c "ALTER USER postgres WITH PASSWORD 'R3m0T3wP5';"
  33. Postgres user is secured with the new password. Lets put authentication methods in practice and force every application or shell login to prompt for these passwords.
  34. .. code-block:: bash
  35. # as postgres
  36. $> vim /var/lib/pgsql/data/pg_hba.conf
  37. # Scroll down to the bottom of the file and replace all peer and ident strings with md5 string.
  38. # The configuration should look like this:
  39. # TYPE DATABASE USER CIDR-ADDRESS METHOD
  40. # "local" is for Unix domain socket connections only
  41. local all all md5
  42. # IPv4 local connections:
  43. host all all 127.0.0.1/32 md5
  44. # IPv6 local connections:
  45. host all all ::1/128 md5
  46. Go back from postgres shell (Ctrl+D) and restart postgresql service as root.
  47. .. code-block:: bash
  48. # as root
  49. $> systemctl restart postgresql.service
  50. Download and install Openfire from Ignite Realtime
  51. ++++++++++++++++++++++++++++++++++++++++++++++++++
  52. Since OpenFire RPM package is not included in any major RHEL / CentOS / Fedora distribution repositories, it must be downloaded directly from Ignite Realtime website.
  53. .. code-block:: bash
  54. # as root
  55. $> wget http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire-3.10.0-1.i386.rpm -O openfire-3.10.0-1.i386.rpm
  56. # This package come in 32bit version only, so in case we run this installation on x86_64 system, we need to make sure to install corresponding 32bit libraries as well.
  57. $> yum install -y /root/openfire-3.9.3-1.i386.rpm
  58. $> yum install -y glibc.i686
  59. Enable the openfire service and start it
  60. .. code-block:: bash
  61. # as root
  62. $> chkconfig openfire on
  63. $> systemctl start openfire.service
  64. # We need to open the firewall ports in order to expose the gui to the outside
  65. $> firewall-cmd --permanent --zone=public --add-port=9090/tcp
  66. $> firewall-cmd --permanent --zone=public --add-port=9091/tcp
  67. $> firewall-cmd --reload
  68. **Configuration of Openfire server**
  69. Move the browser to the url
  70. http://YOUR-SERVER-IP:9090
  71. Choose preferable language and hit ``Contine``
  72. .. figure:: images/openfire001.jpg
  73. :align: center
  74. Specify the server Domain as
  75. ``geoserver.org``
  76. .. figure:: images/openfire002.jpg
  77. :align: center
  78. Choose the *Standard Database Connection* in the next section
  79. .. figure:: images/openfire003.jpg
  80. :align: center
  81. Provide the Database connection parameters for the PostgreSQL DB in the standard connection section.
  82. The password for the user ``openfire`` is the same provided in the PostgreSQL DB setup (see above).
  83. .. figure:: images/openfire004.jpg
  84. :align: center
  85. .. note:: Be sure the ``openfire`` database and user have been correctly created on PostgreSQL and the passwords provided (see above for instructions).
  86. If there are no connection issues, choose ``Default`` value on the users profile settings section.
  87. .. figure:: images/openfire005.jpg
  88. :align: center
  89. Create the *Administrator* account in the next section.
  90. The password ***must*** match the one specified in the ``remoteProcess.properties`` file
  91. ``R3m0T3wP5``
  92. .. figure:: images/openfire006.jpg
  93. :align: center
  94. The initial setup is now complete. Log into the system using the newly created *admin* account.
  95. .. figure:: images/openfire007.jpg
  96. :align: center
  97. .. figure:: images/openfire008.jpg
  98. :align: center
  99. Move to the ``Server Certificates`` section of the ``Server Settings`` tab panel.
  100. .. warning:: This passage is not needed anymnore on Openfire 4.0+. At least the management of the certificates is a bit different. Please refer to the specific Openfire documentation for more information.
  101. .. figure:: images/openfire009.jpg
  102. :align: center
  103. Make sure that the self-signed certificates have been correctly generated and click on ``here`` in order to restart the server
  104. .. warning:: This passage is not needed anymnore on Openfire 4.0+. At least the management of the certificates is a bit different. Please refer to the specific Openfire documentation for more information.
  105. .. figure:: images/openfire010.jpg
  106. :align: center
  107. The same section now shows the server certificates and won't ask for another restart unless the certificates are generated again.
  108. Update the ``Security Settings`` in order to allow the server accepting self-signed certificates on secured connections.
  109. .. warning:: This passage is not needed anymnore on Openfire 4.0+. At least the management of the certificates is a bit different. Please refer to the specific Openfire documentation for more information.
  110. .. figure:: images/openfire011.jpg
  111. :align: center
  112. Create the ``default`` channel as shown in the next figure.
  113. .. figure:: images/openfire012.jpg
  114. :align: center
  115. Create the ``management`` channel as shown in the next figure. Pay attention to the ``Room Options`` and specify the password for the channel
  116. ``R3m0T3wP5``
  117. .. figure:: images/openfire013.jpg
  118. :align: center
  119. Double check that the channels have been correctly created and they appear in the ``Group Chat Rooms``.
  120. .. figure:: images/openfire014.jpg
  121. :align: center
  122. *Restart GeoServer*
  123. .. code-block:: bash
  124. # as root
  125. $> systemctl restart geoserver
  126. After the GeoServer has successfully restarted, double check that it is connected to the server using the ``admin`` credentials.
  127. It is ***very*** important that the user is shown as ``Authenticated``.
  128. .. figure:: images/openfire015.jpg
  129. :align: center
  130. Check also that the user is registered to the XMPP channels created above.
  131. .. figure:: images/openfire016.jpg
  132. :align: center
  133. Firewall Rules For XMPP Ports
  134. +++++++++++++++++++++++++++++
  135. By default the TCP Ports where the XMPP Server is listening for incoming connection are closed to the outside. Therefore it is necessary to enable the Firewall rules at least for the Openfire default secured port *5223* unless it has been changed by the user during the server setup.
  136. In order to do that issue the following commands:
  137. .. code-block:: bash
  138. # as root
  139. # We need to open the firewall ports in order to expose the gui to the outside
  140. $> firewall-cmd --permanent --zone=public --add-port=5222/tcp
  141. $> firewall-cmd --permanent --zone=public --add-port=5223/tcp
  142. $> firewall-cmd --reload
  143. Forward Proxy to Apache HTTPD Server
  144. ++++++++++++++++++++++++++++++++++++
  145. The procedures described in this section allows to expose GeoServer via HTTPD through Apache HTTPD Server.
  146. Those steps are not mandatory and the procedure may change accordingly to the final deployment on production systems.
  147. In order to install Apache HTTPD Server proceed as follows:
  148. .. code-block:: bash
  149. # as root
  150. $> yum -y install httpd mod_ssl
  151. $> vi /etc/httpd/conf.d/forward-proxy.conf
  152. ProxyRequests Off
  153. ProxyPass /geoserver ajp://localhost:8009/geoserver
  154. ProxyPassReverse /geoserver ajp://localhost:8009/geoserver
  155. $> systemctl enable httpd.service
  156. $> service httpd restart
  157. *Selinux*, enabled by default, needs to be instructed to allow http network connections. This can be done by running the command:
  158. .. code-block:: bash
  159. # as root
  160. $> /usr/sbin/setsebool -P httpd_can_network_connect 1
  161. Shared Folder through the NFS protocol
  162. ++++++++++++++++++++++++++++++++++++++
  163. The next steps describe how to setup the system in order to expose a Shared Network Folder which will be used to store the outcomes of the remote processing.
  164. The following procedures are not mandatory and the final deployment on the production system may be configured to use different protocols and frameworks to expose shared file-systems.
  165. The setup and initial configuration of the NFS packages can be done by following the next procedure:
  166. .. code-block:: bash
  167. # as root
  168. $> yum -y install nfs-utils
  169. $> vi /etc/idmapd.conf
  170. # The following should be set to the local NFSv4 domain name
  171. # The default is the host's DNS domain name.
  172. Domain = geoserver.org
  173. .. note:: The domain specified above maybe different depending on the final system deployment and the production environment setup.
  174. Creating and exposing a shared folder is possible by following the next steps:
  175. 1. as root
  176. 2. Create the physical folder structure to be exposed via the Network Filesystem
  177. .. code-block:: bash
  178. $> mkdir /share
  179. $> mkdir /share/xmpp_data
  180. $> mkdir /share/xmpp_data/output
  181. $> mkdir /share/xmpp_data/resource_dir
  182. 3. Modify the rights in order to allow
  183. .. code-block:: bash
  184. $> chmod -Rf 777 /share
  185. 3. Once the physical folder is ready it must be exposed via the ``exports``
  186. .. code-block:: bash
  187. $> vi /etc/exports
  188. 4. write settings for NFS exports
  189. .. code-block:: bash
  190. /share host_ip/24(rw,no_root_squash)
  191. 4. Restart the NFS services
  192. .. code-block:: bash
  193. $> systemctl start rpcbind nfs-server
  194. $> systemctl enable rpcbind nfs-server
  195. .. note:: The **host_ip** must be the one of the host exposing the shared folder.
  196. *Selinux*, enabled by default, needs to be instructed to allow NFS connections. This can be done by running the following commands:
  197. .. code-block:: bash
  198. # as root
  199. $> setsebool -P httpd_use_nfs=1
  200. $> setsebool -P samba_share_nfs=1
  201. $> setsebool -P samba_export_all_ro=1
  202. $> setsebool -P samba_export_all_rw=1