Using LDAP for auth and MSSQL for roster storage

I'm running ejabberd 2.0.1 on FreeBSD. Here are some key parts of my configuration:

%% Authentication using LDAP
%%
{auth_method, ldap}.
%%
%% List of LDAP servers:
{ldap_servers, ["ad.***.***"]}.   
%%
%% LDAP attribute that holds user ID:
{ldap_uids, [{"cn", "%u"}]}.
%%
%% Search base of LDAP directory:
%ldap_base, "***"}.
%%
%% LDAP manager:
{ldap_rootdn, "***"}.
%%
%% Password to LDAP manager:
%%{ldap_password, "***"}.

%%
%% ODBC compatible or MSSQL server:
%%
{odbc_server, "Server=gilmore;Database=ejabberd;Uid=**;Pwd=****"}.

<code>
I've loaded mod_roster_odbc in place of mod_roster and mod_vcard_odbc.
LDAP auth works, but it can't seem to connect to MS SQL server.  I think this error from doing a "live" run is relevant.

<code>
=CRASH REPORT==== 29-Jul-2008::18:22:39 ===
  crasher:
    pid: <0.271.0>
    registered_name: []
    exception exit: {undef,[{odbc,connect,
                                  ["Server=gilmore;Database=ejabberd;Uid=***;Pwd=***",
                                   [{scrollable_cursors,off}]]},
                            {ejabberd_odbc,odbc_connect,1},
                            {gen_server,init_it,6},
                            {proc_lib,init_p,5}]}
      in function  gen_server:init_it/6
    initial call: gen:init_it(gen_server,<0.270.0>,<0.270.0>,ejabberd_odbc,
                              ["scs.wsu.edu"],
                              [])
    ancestors: ['ejabberd_odbc_sup_scs.wsu.edu',ejabberd_sup,<0.39.0>]
    messages: []
    links: [<0.270.0>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 377
    stack_size: 23
    reductions: 155
  neighbours:

=SUPERVISOR REPORT==== 29-Jul-2008::18:22:39 ===
     Supervisor: {local,
                                           'ejabberd_odbc_sup_scs.wsu.edu'}
     Context:    start_error
     Reason:     {undef,[{odbc,connect,
                               ["Server=gilmore;Database=ejabberd;Uid=**;Pwd=****",
                                [{scrollable_cursors,off}]]},
                         {ejabberd_odbc,odbc_connect,1},
                         {gen_server,init_it,6},
                         {proc_lib,init_p,5}]}
     Offender:   [{pid,undefined},
                  {name,1},
                  {mfa,{ejabberd_odbc,start_link,["scs.wsu.edu"]}},
                  {restart_type,transient},
                  {shutdown,brutal_kill},
                  {child_type,worker}]

thanks in advance.

odbc

I had ODBC all setup wrong. I can now connect to the sql server using iodbctest put not from erl with the same connection string.

LDAP + SQL Server

I'm having quite the same problems : I'd like ldap authentication for users and ODBC MS SQL Server for logging.
LDAP authentication = OK but nothing is logged in my SQL "EJABBERD" database.

My DSN = OK (tested, no error)

My ejabberd.cfg file (part of) :

------------------------------

%%
%% Authentication using LDAP
%%
{auth_method, ldap}.
%%
%% List of LDAP servers:
{ldap_servers, ["10.6.169.88"]}.
%% LDAP Server port to use
{ldap_port, 389}.
%% LDAP attribute that holds user ID:
{ldap_uids, [{"sAMAccountName","%u"}]}.
{ldap_filter, "(&(objectClass=user)(objectCategory=person))"}.
%%
%% Search base of LDAP directory:
{ldap_base, "OU=Tsung_Users,DC=COMMUNDEV-EVO,DC=FR"}.
%%
%% LDAP manager:
{ldap_rootdn, "CN=EJABBERD,CN=Users,DC=COMMUNDEV-EVO,DC=FR"}.
%%
%% Password to LDAP manager:
{ldap_password, "*********"}.

%%
%% ODBC compatible or MSSQL server:
%%
{odbc_server, "DSN=ejabberd;UID=ejabberd;PWD=********"}.

%%
%% Modules enabled in all ejabberd virtual hosts.
%%
{modules,
[
{mod_adhoc, []},
{mod_announce, [{access, announce}]}, % requires mod_adhoc
{mod_caps, []},
{mod_configure,[]}, % requires mod_adhoc
{mod_disco, []},
%%{mod_echo, [{host, "echo.SRV-EJABBERD"}]},
{mod_http_bind,[]},
%%{mod_http_fileserver, [{docroot, "C:\\Program Files\\ejabberd-2.0.2_2\\www"}]},
{mod_irc, []},
{mod_last_odbc, []},
{mod_muc, [
%%{host, "conference.@HOST@"},
{access, muc},
{access_create, muc},
{access_persistent, muc},
{access_admin, muc_admin}
]},
%%{mod_muc_log,[]},
{mod_offline_odbc, []},
{mod_privacy, []},
{mod_private, []},
%%{mod_proxy65,[]},
{mod_pubsub, [ % requires mod_caps
{access_createnode, pubsub_createnode},
{plugins, ["default", "pep"]}
]},
{mod_register, [
%%
%% After successful registration, the user receives
%% a message with this subject and body.
%%
{welcome_message, {"Bienvenue !",
"Bienvenue sur le serveur JABBER SRV-EJABBERD."}},

%%
%% When a user registers, send a notification to
%% these Jabber accounts.
%%
%%{registration_watchers, ["admin1@example.org"]},

{access, register}
]},
{mod_roster_odbc, []},
%%{mod_service_log,[]},
{mod_shared_roster,[]},
%%{mod_stats, []},
{mod_time, []},
{mod_vcard, []},
{mod_vcard_ldap,
[{ldap_vcard_map,
[{"NICKNAME", "%u", []},
{"GIVEN", "%s", ["givenName"]},
{"MIDDLE", "%s", ["initials"]},
{"FAMILY", "%s", ["sn"]},
{"FN", "%s", ["displayName"]},
{"EMAIL", "%s", ["mail"]},
{"ORGNAME", "%s", ["company"]},
{"ORGUNIT", "%s", ["department"]},
{"CTRY", "%s", ["c"]},
{"LOCALITY", "%s", ["l"]},
{"STREET", "%s", ["streetAddress"]},
{"REGION", "%s", ["st"]},
{"PCODE", "%s", ["postalCode"]},
{"TITLE", "%s", ["title"]},
{"URL", "%s", ["wWWHomePage"]},
{"DESC", "%s", ["description"]},
{"TEL", "%s", ["telephoneNumber"]}]},
{ldap_search_fields,
[{"Utilisateur", "%u"},
{"Prénom", "givenName"},
{"Nom", "sn"},
{"Email", "mail"},
{"Société", "company"},
{"Service", "department"},
{"Mission principale", "title"},
{"Description", "description"},
{"Téléphone", "telephoneNumber"}]},
{ldap_search_reported,
[{"Nom complet", "FN"},
{"Utilisateur", "NICKNAME"},
{"Email", "EMAIL"}]}
]},
{mod_version, []}
]}.

Check logs. Simple test to know where is data stored

dray wrote:

I'm having quite the same problems : I'd like ldap authentication for users and ODBC MS SQL Server for logging.
LDAP authentication = OK but nothing is logged in my SQL "EJABBERD" database.

My DSN = OK (tested, no error)

My ejabberd.cfg file (part of) :

------------------------------

{auth_method, ldap}.

{ldap_servers, ["10.6.169.88"]}.
{ldap_port, 389}.
{ldap_uids, [{"sAMAccountName","%u"}]}.
{ldap_filter, "(&(objectClass=user)(objectCategory=person))"}.
{ldap_base, "OU=Tsung_Users,DC=COMMUNDEV-EVO,DC=FR"}.
{ldap_rootdn, "CN=EJABBERD,CN=Users,DC=COMMUNDEV-EVO,DC=FR"}.
{ldap_password, "*********"}.

{odbc_server, "DSN=ejabberd;UID=ejabberd;PWD=********"}.

{modules,
[
{mod_roster_odbc, []},
...
]}.

I tried a similar setup with ejabberd trunk SVN with MySQL; everything worked correctly.

You should check ejabberd.log and sasl.log when ejabberd starts and you add a contact, maybe they show an error message about trouble connecting to the SQL database.

If you use mod_roster, the contacts should be stored in the table 'roster' of the internal database. If you use mod_roster_odbc, the contacts should be stored in the table 'rosterusers' in the database you specified.

You can try this:

  1. Check the size of roster table of the internal database. You can see the size in the ejabberd Web Admin -> Nodes -> your node -> Database
  2. Also check the size of the rosterusers table in your SQL database.
  3. Now login to a jabber account, and add any contact, for example testcontact@localhost or similar
  4. Finally, check again the size of the tables in internal and SQL. This may give you an idea of where is the roster contacts stored.

Thanks a lot : I've just

Thanks a lot : I've just added the server IP address ans it's working fine :

{odbc_server, "Server=192.168.0.254;DSN=ejabberd;UID=ejabberd;PWD=*********"}.

But what kind of interest using MSSQL if the only updated database table is dbo.rosterusers ?

That was only in my case.

dray wrote:

But what kind of interest using MSSQL if the only updated database table is dbo.rosterusers ?

I mean: if using the default modules, and the only *_odbc module is mod_roster_odbc, then all data is stored in Mnesia except rosters. This is the test that I made.

In your case, as you use several *_odbc modules, most of the information in your server will be stored in the SQL database.

Thanks -o)

Thanks -o)

Syndicate content