ejabberd with xmpp

15
Ejabberd with XMPP Written By: Prem Na

Upload: prem-narain

Post on 18-Jan-2017

266 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Ejabberd with xmpp

Ejabberd with XMPP

Written By: Prem Narain

Page 2: Ejabberd with xmpp

Introduction: ejabberd

ejabberd is a free and open source instant messaging server written in Erlang/OTP.

ejabberd is cross-platform, distributed, fault-tolerant, and based on open standards to achieve real-time communication.

ejabberd is designed to be a rock-solid and feature rich XMPP server.

ejabberd is suitable for small deployments, whether they need to be scalable or not, as well as extremely big deployments.

Ejabberd is developed by ProcessOne and written by Alexey Shchepin under the licence of GNU.

2

Page 3: Ejabberd with xmpp

Features: ejabberdCross-platform: ejabberd runs under Microsoft Windows and Unix derived systems such as Linux, FreeBSD and NetBSD.Open Standards: ejabberd is the first Open Source Jabber server claiming to fully comply to the XMPP standard.

Authentication:

a) Internal Authentication.b)PAM, LDAP and ODBC.

c) External Authentication scriptEjabberd can communicate with other XMPP servers and with non-XMPP instant messaging networks as well, using a special type of XMPP component called transport or gateway.

3

Page 4: Ejabberd with xmpp

Others:

Support for virtual hosting.

Compressing XML streams with Stream Compression (XEP-0138).

Statistics via Statistics Gathering (XEP-0039).

IPv6 support both for c2s and s2s connections.

Multi-User Chat module with support for clustering and HTML logging.

Users Directory based on users vCards.

Publish-Subscribe component with support for Personal Eventing via Pubsub.

Support for web clients: HTTP Polling and HTTP Binding (BOSH) services.

IRC transport.

Component support: interface with networks such as AIM, ICQ and MSN installing special transports.

4

Page 5: Ejabberd with xmpp

Introduction: XMPP

Extensible Messaging and Presence Protocol (XMPP) is a communications protocol for message-oriented middleware based on XML (Extensible Markup Language).

XMPP powers a wide range of applications including instant messaging, multi-user chat, voice and video conferencing, collaborative spaces, real-time gaming, data synchronization, and even search.

XMPP, like all protocols, defines a format for moving data between two or more communicating entities.One major feature XMPP gets by using XML is XML’s extensibility. It is extremely easy to add new features to the protocol that are both backward and forward compatible.

5

Page 6: Ejabberd with xmpp

Pros and Cons: XMPPPros: XMPP has the following Pros over HTTP

➤ Enables pushing data, not just pulling ➤ Firewall friendly ➤ Strong authentication and security ➤ Provides many out-of-the-box tools for solving a wide range of problems

Cons: XMPP has the following Cons which are

➤ Stateful protocol ➤ Community and deployments are not as broad as HTTP ➤ More overhead than HTTP for simple chores ➤ Specialized implementations still needed

6

Page 7: Ejabberd with xmpp

Uses of XMPP● Instant Messaging● Internet of Things (IoT) ● Social (like Movim,Jappix) ● WebRTC

XMPP Session Life Cycle

● Connection● Stream Set Up● Authentication● The Session Body● Disconnection

7

Page 8: Ejabberd with xmpp

Installation: ejabberd

On Ubuntu/Debian : For installing ejabberd first go to superuser mode then write

apt-get install -y ejabberdOn Windows : Browse

https://www.process-one.net/en/ejabberd/archive/

And download latest window installer .exe file and install it.

8

Page 9: Ejabberd with xmpp

Setup and Configuration: ejabberdFor Setup Admin User

ejabberdctl register admin localhost password

Give Admin Privileges

Go to configuration file (vi /etc/ejabberd/ejabberd.cfg) as superuser and type following lines as

%% Admin user{acl, admin, {user, "admin", "localhost"}}.%% Hostname{hosts, ["localhost"]}.

9

Page 10: Ejabberd with xmpp

Restart Ejabberd

Service ejabberd restart

Now you can navigate to your eJabberd Web Admin interface on droplet's IP address port 5280

http://yourserverhostIP:5280_or_localhost:5280/admin

Enter username as admin@localhost and your password then ejabberd admin interface will start there will 5 items list at left corner as

● Access Control list● Access Rules● Virtual Hosts● Nodes● Statistics 10

Page 11: Ejabberd with xmpp

For Add New User

Virtual host Hosts Users Add New User details Submit

For Add New Host

Go to configuration file (vi /etc/ejabberd/ejabberd.cfg) and edit %%Hostname as

%% Hostname{hosts, ["localhost","yourhostIP"]}.

Now restart ejabberd while you will go to virtual host,there will be two hosts one is localhost another is that one which you did edit,like as you can add multiple hosts and users in individual host as described above.

11

Page 12: Ejabberd with xmpp

Ejabberd file and directories structure

/etc/ejabberd/ Configuration Directoryejabberd.yml ejabberd configuration fileejabberd.cfg configuration file on the administration

scriptinetrc network DNS file

/lib/ejabberd/ ebin/ erlang binary files (*.beam)include/ erlang header files (*.hrl)priv/ additional file required at runtime

bin/ executable programslib/ binary system libraries (*.so)msgs/ translation files (*.msgs)

12

Page 13: Ejabberd with xmpp

lib/ejabberd/sbin/ejabberdctl Administration scriptlib/ejabberd/share/doc/ejabberd Documentation of ejabberd

/var/lib/ejabberd/ Spool directory .erlang.cookie erlang cookie file .acl.DCD Mnesia database spool files

/var/log/ejabberd/ Log Directory ejabberd.log ejabberd service log erlang.log erlang/OTP system log

13

Page 14: Ejabberd with xmpp

Referenceshttp://xmpp.org/

http://ejabberd.im/

For installation Guide

For Windowshttp://sharepointtaskmaster.blogspot.in/2013/10/web-chat-with-ejabberd-xmpp-server-step.html

For Ubuntu:https://www.digitalocean.com/community/tutorials/how-to-install-ejabberd-xmpp-server-on-ubuntu

14

Page 15: Ejabberd with xmpp

15