Ejabberd

From Geitenpad
Jump to navigation Jump to search

ProBook 6550b

root@paardenpad:/etc/apache2# a2enmod proxy
root@paardenpad:/etc/apache2# a2enmod proxy_http
root@paardenpad:/etc/apache2# vim apache.conf
  • Add lines
# Proxypass for bosh on ejabberd (xmpp)
ProxyRequests Off
ProxyPass /http-bind/ http://localhost:5280/http-bind/
ProxyPassReverse /http-bind/ http://localhost:5280/http-bind/
root@paardenpad:~# aptitude install ejabberd
root@paardenpad:~# usermod -a -G www-data ejabberd
root@paardenpad:~# chmod -R g+w /var/www/OWNCLOUD_DIR
root@paardenpad:/etc/ejabberd# vim auth_ejabberd_oc.php
  • Copy content from jsxc
  • Adjust owncloud root
/** The root of your owncloud installation. */
$oc_root = '/var/www/owncloud/';
root@paardenpad:/etc/ejabberd# vim auth_oc_user.php 
  • Copy content from jsxc
root@paardenpad:/etc/ejabberd# chown ejabberd:ejabberd auth_ejabberd_oc.php
root@paardenpad:/etc/ejabberd# chown ejabberd:ejabberd auth_oc_user.php
root@paardenpad:/etc/ejabberd# chmod u+x auth_ejabberd_oc.php
root@paardenpad:/etc/ejabberd# chmod u+x auth_oc_user.php
root@paardenpad:/etc/ejabberd# dpkg-reconfigure ejabberd
host: paardenpad.rijkenmiel.nl
admin account: admin
password: FHuNYyUz
root@paardenpad:~# service ejabberd restart
root@paardenpad:~# service apache2 restart
  • Browse to [[1]]
  • Login with admin@paardenpad.rijkenmiel.nl/FHuNYyUz
  • Add user rijk00st and md00st
  • Check of bosh werkt
root@paardenpad:~# curl -i http://localhost/http-bind/
HTTP/1.1 200 OK
Date: Wed, 28 Oct 2015 11:54:49 GMT
Server: Apache/2.4.10 (Debian)
Content-Length: 502
Content-Type: text/xml; charset=utf-8
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type
Vary: Accept-Encoding

<?xml version='1.0'?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-  transitional.dtd">
 <html xmlns='http://www.w3.org/1999/xhtml'><head><title>ejabberd mod_http_bind</title></head><body>   <h1>ejabberd mod_http_bind</h1><p>An implementation of <a href='http://xmpp.org/extensions/xep-0206.html'>XMPP over BOSH (XEP-0206)</a></p><p>This web page is only informative. To use HTTP-Bind  you need a Jabber/XMPP client that supports it.</p></body></html>
  • Disable In-band registration (automatic accounts)
root@paardenpad:/etc/ejabberd# vim ejabberd.yml 
 ## In-band registration allows registration of any possible username.
 ## To disable in-band registration, replace 'allow' with 'deny'.
 register:
   all: deny
  • Set certificate
root@paardenpad:/etc/ssl/cert# cat paardenpad_rijkenmiel_nl.key >> ejabberd.pem
root@paardenpad:/etc/ssl/cert# cat paardenpad_rijkenmiel_nl.cer >> ejabberd.pem 
root@paardenpad:/etc/ssl/cert# cat CA_Intermediate.cer >> ejabberd.pem 
  • This will create a faulty file. It contains strange ^M characters en no new lines between begin and end (-----END CERTIFICATE----------BEGIN CERTIFICATE-----). Repair this using vim.
root@paardenpad:/etc/ejabberd# mv ejabberd.pem ejabberd.pem.org
root@paardenpad:/etc/ejabberd# cp /etc/ssl/cert/ejabberd.pem .