Jabberd2 - Completo e sem mistérios
Para quem não conhece o Jabberd2 é um ótimo servidor de troca de mensagens instantâneas que interage com o banco MySQL e tem uma ampla variedade de programas clientes para acesso. Nessa primeira etapa do artigo estarei falando do Jabberd2, MySQL e dos clientes SIM, Exodus, CenterICQ e PSI.
Parte 7: Gerenciando usuários
Criando usuários com o MySQL
Logue no MySQL com o usuário "jabberd2" e senha "secret":
# mysql -u jabberd2 -p
Inserindo o usuário:
mysql> use jabberd2;
mysql> insert into authreg (username, realm, password) values ('guinet', 'serverlinux.com', '12345678');
Deletando um usuário
mysql> delete from authreg where username='guinet';
Lembrando que deletando um usuário desta forma, ele não estará deletando informações adicionais como rosters. Entretanto depois de deletado como foi especificado acima, ele não poderá mais acessar.
Criando usuários automaticamente
Basta descomentar o <auto-create/> como abaixo:
# cd /usr/local/etc/jabberd
# vim sm.xml
<!-- User options -->
<user>
<!-- By default, users must explicitly created before they can start
a session. The creation process is usually triggered by a c2s
component in response to a client registering a new user.
Enableing this option will make it so that a user create will be
triggered the first time a non-existant user attempts to start
a session. This is useful if you already have users in an
external authentication database (eg LDAP) and you don't want
them to have to register. -->
<auto-create/>
<!-- Templates. If defined, the contents of these files will be
stored in the users data store when they are created. -->
<template>
<!--
<roster>/usr/local/etc/jabberd/templates/roster.xml</roster>
-->
</template>
</user>
<user>
<!-- By default, users must explicitly created before they can start
a session. The creation process is usually triggered by a c2s
component in response to a client registering a new user.
Enableing this option will make it so that a user create will be
triggered the first time a non-existant user attempts to start
a session. This is useful if you already have users in an
external authentication database (eg LDAP) and you don't want
them to have to register. -->
<auto-create/>
<!-- Templates. If defined, the contents of these files will be
stored in the users data store when they are created. -->
<template>
<!--
<roster>/usr/local/etc/jabberd/templates/roster.xml</roster>
-->
</template>
</user>
Essa dica vai para quem sem querer esqueceu de alguma configuração, para que funcione corretamente, verificar essas que declaro como as mais importantes:
1) Mudar no cliente o login de acesso para "guinet@hostname.ou.ip";
2) No sm.xml verificar se ele esta com o ip do servidor onde se encontra instalado o jabberd.
<!-- Session manager configuration -->
<sm>
<!-- Our ID on the network. Users will have this as the domain part of
their JID. If you want your server to be accessible from other
Jabber servers, this ID must be resolvable by DNS.s
(default: localhost) -->
<id>192.168.0.1</id>
3)No c2s.xml verificar se ele esta com o ip do servidor onde se encontra intalado o jabberd
<!-- Local network configuration -->
<local>
<!-- Who we identify ourselves as. This should correspond to the
ID (host) that the session manager thinks it is. You can
specify more than one to support virtual hosts, as long as you
have additional session manager instances on the network to
handle those hosts. The realm attribute specifies the auth/reg
or SASL authentication realm for the host. If the attribute is
not specified, the realm will be selected by the SASL
mechanism, or will be the same as the ID itself. Be aware that
users are assigned to a realm, not a host, so two hosts in the
same realm will have the same users.
If no realm is specified, it will be set to be the same as the
ID. -->
<!-- <id realm='company'>localhost</id> -->
<id>192.168.0.1</id>
<sm>
<!-- Our ID on the network. Users will have this as the domain part of
their JID. If you want your server to be accessible from other
Jabber servers, this ID must be resolvable by DNS.s
(default: localhost) -->
<id>192.168.0.1</id>
3)No c2s.xml verificar se ele esta com o ip do servidor onde se encontra intalado o jabberd
<!-- Local network configuration -->
<local>
<!-- Who we identify ourselves as. This should correspond to the
ID (host) that the session manager thinks it is. You can
specify more than one to support virtual hosts, as long as you
have additional session manager instances on the network to
handle those hosts. The realm attribute specifies the auth/reg
or SASL authentication realm for the host. If the attribute is
not specified, the realm will be selected by the SASL
mechanism, or will be the same as the ID itself. Be aware that
users are assigned to a realm, not a host, so two hosts in the
same realm will have the same users.
If no realm is specified, it will be set to be the same as the
ID. -->
<!-- <id realm='company'>localhost</id> -->
<id>192.168.0.1</id>
4) No MySQL, na tabela "authreg" mudar a coluna "realm" com o hostname ou ip do server ;
5) Caso já foi inserido os dados pessoais do usuário na tabela "vcard", mudar a coluna "collection-owner" para "usuario@hostname.ou.ip".
Já tinha instalado jabber uma vez lá em casa e testado aqui do trampo.
Mas esse artigo complementa várias coisas para mim.
Assim que puder vou instalar o jabberd2 aqui no trampo para comunicar as duas filias do nosso escritório.