Funky Penguin Forums
  Thread Tools Linear ModeHybrid ModeThreaded Mode
davidy's Avatar
davidy
 
Join Date: Jul 2006
Send a message via MSN to davidy Send a message via Skype™ to davidy
Using Bandersnatch with Jabberd2, Posted 07-26-2006, 01:56 PM Quote
This tutorial attempts to guide the reader through the process of installing Bandersnatch for use with an existing Jabberd2 server... Please post comments / discussion in this thread

Get the sources

We need the following:
- Bandersnatch
- Perl 5.8.x
- Perl POE
- Perl module: XML::Stream
- Perl module: Net::Jabber 2.x
- Perl module: DBI (mysql)
- Perl module: POE::Component-Jabber
- Perl module: POE::Filter-XML

Extract the Bandersnatch installation into a working directory. Install all the above modules, with their dependancies.

Configure database

Ensure that you have a working mySQL server installation. To automatically create the database permissions / structure, run the following command (as a priviledged mySQL user) from the Bandersnatch working directory:

Code:
    mysql -p < bandersnatch.sql
Then restart the mysql server (we have changed permissions, must reload), by running :
Code:
kill -HUP `pidof mysqld`
(If this doesn't work, restart mySQL manually. This may depend on your distribution)


Config files

router-users.xml

This file is where the router gets its component and secret information from for component authentication. We want to tell it about a component called "bandersnatch", whose secret is also "bandersnatch"...

Add the following lines:
Code:
    <name>bandersnatch</name>
    <secret>bandersnatch</secret>
...between the new <user> tags. i.e., a file modified from default will now look like this:

Code:
<users>
  <user>
    <name>jabberd</name>
    <secret>secret</secret>
  </user>
  <user>
    <name>bandersnatch</name>
    <secret>bandersnatch</secret>
  </user>
</users>

router.xml

Now that we have defined our component (above), we need to give it access to connect to the router, and log messages. Edit router.xml, and at the bottom, uncomment the log type ACL, as follows:

Code:
    <acl type='log'>
      <user>bandersnatch</user>
    </acl>

config.xml

Finally, we edit bandersnatch's config.xml, make sure the following are set:

Code:
        <server>
                <connectiontype>tcpip</connectiontype>
                <hostname>localhost</hostname>
                <port>5347</port>
                <secret>bandersnatch</secret>
        </server>
        <component>
                 <name>bandersnatch</name>
        </component>
Double-check the port (you may have to change it from 5526 to 5347), and the component name. Also, as per the Bandersnatch documentation, make sure that <local_server> is set to the name of your jabber server, else you won't log anything


Run it

Finally, once you've confirmed that:
  1. Jabberd is running properly
  2. MySQL is running properly
  3. Bandersnatch tables have been created in mySQL
  4. The bandersnatch2.pl script is executable ("chmod 755 bandersnatch2.pl" if it's not)
run: "./bandersnatch2.pl" The output should be something like this:

Code:
Use of uninitialized value in substitution (s///) at /usr/local/share/perl/5.8.4/POE/Component/Jabber/Client/J2.pm line 293. Use of uninitialized value in subroutine entry at /usr/local/share/perl/5.8.4/POE/Component/Jabber/Client/J2.pm line 294. Connected to MySQL database (bandersnatch@localhost) ... Bandersnatch is listening! ;)
I ignore the errors. I think they have to do with the Jabber component, and they aren't fatal. If anybody wants to enlighten me, please go ahead

Please post comments / discussion in this threadw
David Young
Solution Provider

Funky Penguin
Blog: The Raw Penguin
Last edited by davidy : 07-26-2006 at 02:25 PM.
Thread Tools
Show Printable Version Show Printable Version   Email this Page Email this Page  
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off