Coder Social home page Coder Social logo

xmpp-server's Introduction

xmpp-server

A full XMPP server using node-xmpp, with some modules. Feel free to fork this and configure all the modules you need in server.js This server uses Redis as its datastore.

Unfortunately, the lack of time is slowly killing this project. If you feel like saving it, please, go ahead, message us and we'll set you up as the owner!

Installation

Beware : this project is really early stage... There are a lot of things to fix :) Install it for fun or for help... but probably not for profit just yet!

  1. First, you need nodejs installed. Pre-compiled packages exist for Unix (Linux, BSD, Mac OS X) as explained in these instructions. Skip to 2. if you already have a working Node.JS environment.

  2. Then, you need npm installed. As in step 1, follow these instructions or skip to 3.

  3. Install redis (used to store the data). apt-get install redis-server should work just fine on most Ubuntus and Debians. On MacOS X redis can be installed e.g. with Homebrew: brew install redis

  4. Install xmpp-server, finally. With package manager npm:

npm install -g xmpp-server

Running

TODO : automate this with a script that asks the right questions to the user when starting.

First, create a config file and place it at /etc/xmpp-server/config.js that includes the following (tls support is optional. You can follow the instructions there to create the key and certificate, and then uncomment the tls lines.):

    
    exports.config = {
        port: 5222, 
        domain: 'localhost',
        //tls: {
        //    keyPath: '/etc/xmpp-server/tls/localhost-key.pem',
        //    certPath: '/etc/xmpp-server/tls/localhost-cert.pem'
        //}
    }
    

Then, run the server:

xmpp-server /etc/xmpp-server/config.js

Trying

There is a server running at ouvre-boite.com. You can certainly create an account there, but don't leave any valuable belongings as they will be trashed every couple hours :)

TODO

  • In-band registration
  • C2S
  • TLS
  • Digets Auth
  • Roster
  • Presence
  • Pass on global configuration to modules.

Dependencies

xmpp-server's People

Contributors

astro avatar dodo avatar julien51 avatar srajbr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xmpp-server's Issues

Testing with Adium not Okay

Hi guys,

I've just came across xmpp-server and hitten my first try with it. I wanted to test it against a simple jabber client, Adium, and I get some difficulties..

That's what I did :

First of all, in server.js, I've disactivated the authenticate part (i call cb() without any verification) and logged any try of authentication. I don't care about auth for my use..

I've launched my adium client and try to connect as, for instance, foo@localhost with password bar. Adium warns me about the fact that my connection is not encrypted, my auth log is hitten and I'm sure that the authenticate callback is called.

But Adium remains in state connecting.

has someone any hints about it ?

EDIT : I forgot to mention that I also disactivated the Roster and Presence modules.

Error with pidgin

Adium appears to connect to the server without problem. Pidgin however fails

The following is a log from pidgin of a connection request failure.

(14:20:21) account: Connecting to account test2@localhost/r.
(14:20:21) connection: Connecting. gc = 0x7fde8b931ed0
(14:20:21) dnssrv: querying SRV record for localhost: _xmpp-client._tcp.localhost
(14:20:21) dnssrv: res_query returned an error
(14:20:21) dnsquery: Performing DNS lookup for localhost
(14:20:21) dns: Successfully sent DNS request to child 39208
(14:20:21) dns: Got response for 'localhost'
(14:20:21) dnsquery: IP resolved for localhost
(14:20:21) proxy: Attempting connection to 127.0.0.1
(14:20:21) proxy: Connecting to localhost:5222 with no proxy
(14:20:21) proxy: Connection in progress
(14:20:21) proxy: Connecting to localhost:5222.
(14:20:21) proxy: Connected to localhost:5222.
(14:20:21) jabber: Sending (test2@localhost/r): <?xml version='1.0' ?>
(14:20:21) jabber: Sending (test2@localhost/r): <stream:stream to='localhost' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>
(14:20:21) jabber: Recv (267): <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0" id="8129986983794772" from="localhost"><stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism></mechanisms></stream:features>
(14:20:21) jabber: Sending (test2@localhost/r): <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' xmlns:ga='http://www.google.com/talk/protocol/auth' ga:client-uses-full-bind-result='true' mechanism='PLAIN'>password removed</auth>
(14:20:21) jabber: Recv (51): <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>
(14:20:21) jabber: Sending (test2@localhost/r): <stream:stream to='localhost' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>
(14:20:21) jabber: Recv (275): <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0" id="8129986983794772" from="localhost"><stream:features><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></stream:features>
(14:20:21) jabber: Sending (test2@localhost/r): <iq type='set' id='purple43594b97'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><resource>r</resource></bind></iq>
(14:20:21) jabber: Recv (125): <iq type="result" id="purple43594b97"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>test2@localhost/r</jid></bind></iq>
(14:20:21) jabber: Sending (test2@localhost/r): <iq type='set' id='purple43594b98'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>
(14:20:21) jabber: Recv (97): <iq type="result" id="purple43594b98"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq>
(14:20:22) jabber: Sending (test2@localhost/r): <iq type='get' id='purple43594b99' to='localhost'><query xmlns='http://jabber.org/protocol/disco#items'/></iq>
(14:20:22) jabber: Sending (test2@localhost/r): <iq type='get' id='purple43594b9a' to='localhost'><query xmlns='http://jabber.org/protocol/disco#info'/></iq>
(14:20:22) jabber: Recv (239): <iq type="error" id="purple43594b99" to="test2@localhost/r"><query xmlns="http://jabber.org/protocol/disco#items"/></iq><iq type="error" id="purple43594b9a" to="test2@localhost/r"><query xmlns="http://jabber.org/protocol/disco#info"/></iq>
(14:20:22) jabber: Got a result iq with id purple43594b99 from (null) instead of expected localhost!
(14:20:22) jabber: Got a result iq with id purple43594b9a from (null) instead of expected localhost!

here is the log from node-redis (redis client) debug

send 127.0.0.1:6379 id 3: *2
$7
hgetall
$20
user:test2@localhost

send_command buffered_writes: 0  should_buffer: false
net read 127.0.0.1:6379 id 3: *2
$8
password
$5
test1

send 127.0.0.1:6379 id 1: *2
$4
rpop
$23
offline:test2@localhost

send_command buffered_writes: 0  should_buffer: false
net read 127.0.0.1:6379 id 1: $-1

Here is the log from redis-cli monitor (server):

1424870731.913612 [0 127.0.0.1:54941] "hgetall" "user:test2@localhost"
1424870731.936767 [0 127.0.0.1:54939] "rpop" "offline:test2@localhost"

For comparison here is the node-redis and redis-cli logs from a successful connection via Adium

send 127.0.0.1:6379 id 3: *2
$7
hgetall
$20
user:test2@localhost

send_command buffered_writes: 0  should_buffer: false
net read 127.0.0.1:6379 id 3: *2
$8
password
$5
test1

send 127.0.0.1:6379 id 1: *2
$4
rpop
$23
offline:test2@localhost

send_command buffered_writes: 0  should_buffer: false
net read 127.0.0.1:6379 id 1: $-1

send 127.0.0.1:6379 id 2: *2
$8
smembers
$22
roster:test2@localhost

send_command buffered_writes: 0  should_buffer: false
net read 127.0.0.1:6379 id 2: *0
1424870801.584255 [0 127.0.0.1:54941] "hgetall" "user:test2@localhost"
1424870801.662982 [0 127.0.0.1:54939] "rpop" "offline:test2@localhost"
1424870801.677138 [0 127.0.0.1:54940] "smembers" "roster:test2@localhost"

Debug Help

After patching node-xmpp from :

xmppjs/xmpp.js#87

I can get xmpp-server to authenticate against a test mysql table, however after authentication, I get :

/usr/local/lib/node_modules/xmpp-server/node_modules/node-xmpp/lib/xmpp/connection.js:36
this.streamAttrs = opts.streamAttrs || {};
^
TypeError: Cannot read property 'streamAttrs' of undefined
at Connection (/usr/local/lib/node_modules/xmpp-server/node_modules/node-xmpp/lib/xmpp/connection.js:36:28)
at Server (/usr/local/lib/node_modules/xmpp-server/node_modules/node-xmpp/lib/xmpp/server.js:20:27)
at new exports.OutgoingServer (/usr/local/lib/node_modules/xmpp-server/node_modules/node-xmpp/lib/xmpp/server.js:132:12)
at DomainContext.getOutStream (/usr/local/lib/node_modules/xmpp-server/node_modules/node-xmpp/lib/xmpp/router.js:111:25)
at DomainContext.send (/usr/local/lib/node_modules/xmpp-server/node_modules/node-xmpp/lib/xmpp/router.js:61:26)
at Router.send (/usr/local/lib/node_modules/xmpp-server/node_modules/node-xmpp/lib/xmpp/router.js:500:33)
at Router.exports.configure (/usr/local/lib/node_modules/xmpp-server/modules/s2s.js:25:17)
at Router.EventEmitter.emit (events.js:93:17)
at Router.route (/usr/local/lib/node_modules/xmpp-server/modules/router.js:52:18)
at C2SStream.exports.configure.server.router (/usr/local/lib/node_modules/xmpp-server/modules/router.js:121:20)

I must admit, I'm a newcomer to node so any light on this would be greatly appreciated. I've tried the native debugger and with node-inspector, but I cant say thats helped me much.

Thanks

Question: debugging?

Perhaps this is n00b question but how would I debug the server? I would like to see client connection attempts. At the moment registration succeeds but connections fail.

Thanks

xmpp-server exit when a client connection

i used Adium / Psi a client for testing.
when connect to the server, i got error and xmpp-server just exit.
how can i fix that?

here's the log:

PengmatoMacBook-Pro:xmpp-server ph$ node xmpp-server.js

events.js:101
this.domain.exit();
^
TypeError: Object localhost has no method 'exit'
at C2SStream.EventEmitter.emit (events.js:101:19)
at StreamParser.Connection.startParser (/Users/ph/node_modules/node-xmpp/lib/xmpp/connection.js:133:14)
at StreamParser.EventEmitter.emit (events.js:88:17)
at null. (/Users/ph/node_modules/node-xmpp/lib/xmpp/stream_parser.js:18:18)
at EventEmitter.emit (events.js:91:17)
at Parser.parse (/Users/ph/node_modules/node-xmpp/node_modules/node-expat/lib/node-expat.js:18:22)
at StreamParser.write (/Users/ph/node_modules/node-xmpp/lib/xmpp/stream_parser.js:78:26)
at C2SStream.Connection.onData (/Users/ph/node_modules/node-xmpp/lib/xmpp/connection.js:184:21)
at Socket.Connection.setupStream.proxyEvent (/Users/ph/node_modules/node-xmpp/lib/xmpp/connection.js:53:14)
at Socket.EventEmitter.emit (events.js:115:20)

Issue with cb() on authenticate

in server.js

    // On Connect event. When a client connects.
    server.on("connect", function(client) {
        // Allows the developer to authenticate users against anything they want.
        client.on("authenticate", function(opts, cb) {
            User.find(opts.jid, function(user) {
                if (user && user.attrs.password === opts.password)
                    cb();
                else
                    cb(new Error("Authentication failure"));
            });
        });

Using a simple local redis server the authentication would constantly fail until I changed the cb call to

                if (user && user.attrs.password === opts.password)
                    cb(null, user);

Now some clients succeed, others (pidgin) appear to not receive or properly parse the success response.

Installation step : sudo npm install -g xmpp-server

Hello,
when trying to run

sudo npm install -g xmpp-server

I get the following problem:

npm ERR! failed to fetch https://github.com/superfeedr/node-xmpp/tarball/c2s
npm ERR! error installing [email protected] Error: 400 { server: 'nginx/1.0.4',
npm ERR! error installing [email protected] date: 'Wed, 14 Sep 2011 13:00:38 GMT',
npm ERR! error installing [email protected] 'content-type': 'text/html',
npm ERR! error installing [email protected] 'content-length': '270',
npm ERR! error installing [email protected] connection: 'close' }
npm ERR! error installing [email protected] at ClientRequest. (/usr/lib/node_modules/npm/lib/utils/fetch.js:108:33)
npm ERR! error installing [email protected] at ClientRequest.emit (events.js:67:17)
npm ERR! error installing [email protected] at HTTPParser.onIncoming (http2.js:1197:9)
npm ERR! error installing [email protected] at HTTPParser.onHeadersComplete (http2.js:108:31)
npm ERR! error installing [email protected] at Socket.ondata (http2.js:1096:22)
npm ERR! error installing [email protected] at Socket._onReadable (net_legacy.js:689:27)
npm ERR! error installing [email protected] at IOWatcher.onReadable as callback
npm ERR! Error: 400 { server: 'nginx/1.0.4',
npm ERR! date: 'Wed, 14 Sep 2011 13:00:38 GMT',
npm ERR! 'content-type': 'text/html',
npm ERR! 'content-length': '270',
npm ERR! connection: 'close' }
npm ERR! at ClientRequest. (/usr/lib/node_modules/npm/lib/utils/fetch.js:108:33)
npm ERR! at ClientRequest.emit (events.js:67:17)
npm ERR! at HTTPParser.onIncoming (http2.js:1197:9)
npm ERR! at HTTPParser.onHeadersComplete (http2.js:108:31)
npm ERR! at Socket.ondata (http2.js:1096:22)
npm ERR! at Socket._onReadable (net_legacy.js:689:27)
npm ERR! at IOWatcher.onReadable as callback
npm ERR! Report this entire log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]
npm ERR!
npm ERR! System Darwin 11.0.1
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "xmpp-server"
npm ERR! cwd /Users/pmu/projects/
npm ERR! node -v v0.5.4
npm ERR! npm -v 1.0.17
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/pmu/projects/npm-debug.log
npm not ok

What could be wrong?

Cheers,

Patrick

actialize node-xmpp version

As I known in node 0.8 node-xmpp replace c2s.domain -> c2s.serverdomain, etc. and more minor diff

Do you plan to actialize project to last version nodejs and node-xmpp?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.