Статья: Настройка Jabberd2 с транспортами icq, msn, mrim.

Обсуждаем сайт и форум.

Модератор: f0s

Аватара пользователя
hm
ефрейтор
Сообщения: 59
Зарегистрирован: 2008-08-13 12:15:32

Статья: Настройка Jabberd2 с транспортами icq, msn, mrim.

Непрочитанное сообщение hm » 2009-08-03 22:52:27

Недавно вот понадобилось поднять Jabber сервак с icq, msn, mrim транспортами. Конечно, ejabberd функциональный сервак с читаемым конфигом, но чета мне на этот раз расхотелось устанавливать erlang :) да и на jabberd захотелось посмотреть. А в прошлый раз мне было необходимо связать ejabberd c active directory с чем я успешно справился, попробую позже начиркать статью. Ну так остановился я на следующем софте для решения поставленной задачи:
Сервер: Jabberd
СУБД: MySQL-5.0
Транспорты: jabber-pyicq, jabber-pymsn, mrim, mu-conference
Аккаунты всех зареганных юзеров будут храниться в mysql.

Приступим:
Установим mysql.
cd /usr/ports/databases/mysql50-server/ && make install clean

(О настройке mysql писать не буду, о нем и так много написано :) )

Далее:

Код: Выделить всё

cd /usr/ports/net-im/jabberd && make install

Код: Выделить всё

                                           ??????????????????????????????????????????????????????????????????????
                                           ?                   Options for jabberd 2.2.7.1                      ?
                                           ? ?????????????????????????????????????????????????????????????????? ?
                                           ? ?     [X] MYSQL       Support MySQL (storage/auth/reg)           ? ?
                                           ? ?     [ ] POSTGRESQL  Support PostgreSQL (storage/auth/reg)      ? ?
                                           ? ?     [ ] LDAP        Support OpenLDAP (storage/auth/reg)        ? ?
                                           ? ?     [ ] BDB         Support BerkeleyDB (storage/auth/reg)      ? ?
                                           ? ?     [ ] SQLITE      Support SQLite3 (storage/auth/reg)         ? ?
                                           ? ?     [ ] PAM         Enable PAM (auth/reg)                      ? ?
                                           ? ?     [ ] PIPE        Enable pipe (auth/reg)                     ? ?
                                           ? ?     [ ] ANON        Enable anonymous (auth/reg)                ? ?
                                           ? ?     [ ] FS          Filesystem storage (only for testing)      ? ?
                                           ? ?     [X] DEBUG       Compile with debug messages                ? ?
                                           ? ?     [X] REQUIRES    Add backend requires to startup script     ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ??????????????????????????????????????????????????????????????????????
                                           ?                       [  OK  ]       Cancel                        ?
                                           ??????????????????????????????????????????????????????????????????????

Выбираем поддержку mysql

Далее создадим в mysql юзера и базу jabberd2 для него.

Код: Выделить всё

cd /usr/ports/net-im/jabberd/work/jabberd-2.2.7.1/tools

mysql -u root -p
mysql>\. db-setup.mysql

GRANT select,insert,delete,update ON jabberd2.* to jabberd2@localhost IDENTIFIED by 'secret';
Теперь необходимо сконфигурировать jabberd.
Для этого необходимо подправить 3 файла.

Код: Выделить всё

jabber# cat /usr/local/etc/jabberd/router.xml
<router>
  <id>router</id>
  <pidfile>/var/jabberd/pid/router.pid</pidfile>
  <log type='syslog'>
    <ident>jabberd/router</ident>
    <facility>local3</facility>
  </log>
  <local>
    <ip>127.0.0.1</ip>
    <port>5347</port>
    <user>
      <name>jabberd</name>
      <secret>secret</secret>
    </user>
    <secret>secret</secret>
  </local>
  <aliases>
    <alias name='conference.jabber.local.net' target='conference'/>
  </aliases>
  <aci>
    <acl type='all'>
      <user>jabberd</user>
    </acl>
  </aci>
</router>
Здесь все предельно понятно, то есть биндим хост и порт, куда будут конектиться транспорты и мэнэджер сессий.
Идем далее:

Код: Выделить всё

jabber# cat /usr/local/etc/jabberd/sm.xml                                                                                                                                              
<!-- Session manager configuration -->                                                                                                                      
<sm>                                                                                                                                                        
  <id>jabber.local.net</id>                                                                                                                                 

  <pidfile>/var/jabberd/pid/sm.pid</pidfile>

  <router>
    <ip>127.0.0.1</ip>            <!-- default: 127.0.0.1 -->
    <port>5347</port>             <!-- default: 5347 -->     

    <user>jabberd</user>          <!-- default: jabberd -->
    <pass>secret</pass>           <!-- default: secret --> 

    <retry>
      <init>3</init>
      <lost>3</lost>
      <sleep>2</sleep>
    </retry>          
  </router>           

  <log type='syslog'>
    <ident>jabberd/sm</ident>
    <facility>local3</facility>
    <file>/var/jabberd/log/sm.log</file>
  </log>                                

  <storage>
    <path>/usr/local/lib/jabberd</path>
    <driver>mysql</driver>             
    <mysql>                            
      <host>localhost</host>           
      <port>3306</port>                
      <dbname>jabberd2</dbname>        
      <user>jabberd2</user>            
      <pass>secret</pass>              
      <transactions/>                  
    </mysql>                           
  </storage>                           

  <aci>
    <acl type='all'>
      <jid>hm@jabber.local.net</jid>
    </acl>                          
  </aci>                            

  <modules>
    <!-- Dynamic sm modules path -->
    <path>/usr/local/lib/jabberd</path>

    <chain id='sess-start'>
      <module>status</module>           <!-- record status information -->
    </chain>                                                              

    <chain id='sess-end'>
      <module>status</module>           <!-- update status information -->
      <module>iq-last</module>          <!-- update logout time -->       
    </chain>                                                              

    <chain id='in-sess'>
      <module>validate</module>         <!-- validate packet type -->
      <module>status</module>           <!-- update status information -->
      <module>privacy</module>          <!-- manage privacy lists -->     
      <module>roster</module>           <!-- handle roster get/sets and s10ns -->
      <module>vacation</module>         <!-- manage vacation settings -->        
      <module>iq-vcard</module>         <!-- store and retrieve the user's vcard -->
      <module>iq-ping</module>          <!-- return the server ping -->             
      <module>iq-private</module>       <!-- manage the user's private data store -->
      <module>disco</module>            <!-- respond to agents requests from sessions -->
      <module>amp</module>              <!-- advanced message processing -->             
      <module>offline</module>          <!-- if we're coming online for the first time, deliver queued messages -->
      <module>announce</module>         <!-- deliver motd -->                                                      
      <module>presence</module>         <!-- process and distribute presence updates -->                           
      <module>deliver</module>          <!-- deliver packets with full jids directly -->                           
    </chain>                                                                                                       

    <chain id='out-sess'/>

    <chain id='in-router'>
      <module>session</module>          <!-- perform session actions as required by c2s -->
      <module>validate</module>         <!-- validate packet type -->                      
      <module>presence</module>         <!-- drop incoming presence if user not online --> 
      <module>privacy</module>          <!-- filter incoming packets based on privacy rules -->
    </chain>                                                                                   

    <chain id='out-router'>
      <module>privacy</module>          <!-- filter outgoing packets based on privacy rules -->
    </chain>                                                                                   

    <chain id='pkt-sm'>
      <module>iq-last</module>          <!-- return the server uptime -->
      <module>iq-ping</module>          <!-- return the server ping -->  
      <module>iq-time</module>          <!-- return the current server time -->
      <module>iq-version</module>       <!-- return the server name and version -->
      <module>amp</module>              <!-- advanced message processing -->       
      <module>disco</module>            <!-- build the disco list; respond to disco queries -->
      <module>announce</module>         <!-- send broadcast messages (announce, motd, etc) --> 
      <module>help</module>             <!-- resend sm messages to administrators -->          
      <module>echo</module>             <!-- echo messages sent to /echo -->                   
      <module>status</module>           <!-- track status information -->                      
      <module>presence</module>         <!-- proces server presence subscriptions -->          
    </chain>                                                                                   

    <chain id='pkt-user'>
      <module>roster</module>           <!-- handle s10n responses -->
      <module>presence</module>         <!-- process and distribute incoming presence from external entities -->
      <module>iq-vcard</module>         <!-- grab user vcards -->                                               
      <module>amp</module>              <!-- advanced message processing -->                                    
      <module>deliver</module>          <!-- deliver the packet to an active session if we can -->              
      <module>vacation</module>         <!-- send vacation messages -->                                         
      <module>offline</module>          <!-- save messages and s10ns for later -->                              
      <module>disco-publish</module>    <!-- handle disco publishes; return information about user sessions --> 
      <module>iq-last</module>          <!-- return time since last logout -->                                  
    </chain>                                                                                                    

    <chain id='pkt-router'>
      <module>session</module>          <!-- take sessions offline if their c2s disappears -->
      <module>disco</module>            <!-- query new components for service information --> 
    </chain>                                                                                  

    <chain id='user-load'>
      <module>active</module>           <!-- get active status -->
      <module>roster</module>           <!-- load the roster and trust list -->
      <module>roster-publish</module>   <!-- load the published roster -->     
      <module>privacy</module>          <!-- load privacy lists -->            
      <module>disco-publish</module>    <!-- load published information -->    
      <module>vacation</module>         <!-- load vacation settings -->        
    </chain>                                                                   

    <chain id='user-create'>
      <module>active</module>           <!-- activate new users -->
      <module>template-roster</module>  <!-- populate roster from template -->
    </chain>                                                                  

    <chain id='user-delete'>
      <module>active</module>           <!-- deactivate users -->
      <module>announce</module>         <!-- delete motd data -->
      <module>disco-publish</module>    <!-- delete published information -->
      <module>offline</module>          <!-- bounce queued messages -->      
      <module>privacy</module>          <!-- delete privacy lists -->        
      <module>roster</module>           <!-- delete roster -->               
      <module>vacation</module>         <!-- delete vacation settings -->    
      <module>status</module>           <!-- delete status information -->   
      <module>iq-last</module>          <!-- delete last logout time -->     
      <module>iq-private</module>       <!-- delete private data -->         
      <module>iq-vcard</module>         <!-- delete vcard -->                
    </chain>                                                                 

    <chain id='disco-extend'>
      <module>iq-version</module>       <!-- add XEP-xxxx Software Information -->
      <module>help</module>             <!-- add XEP-0157 Contact Addresses -->   
    </chain>                                                                      

  </modules>

  <discovery>

    <identity>
      <category>server</category>       <!-- default: server -->
      <type>im</type>                   <!-- default: im -->    
      <name>Local Jabber server</name>     <!-- default: Jabber IM server -->
    </identity>                                                            
    <agents/>                                                              
    <items>                                                                
    </items>                                                               

  </discovery>

  <user>

    <auto-create/>


    <template>
      <!--    
      <publish>
      -->      

        <!--
        <check-remove-domain>jabber.example.com</check-remove-domain>
        -->                                                          
        <!-- Keep cache of "active" database specified number of seconds.
             This will significantly speed up publishing of roster.      
             If unspecified or 0, no cache is used. -->                  
        <active-cache-ttl>60</active-cache-ttl>                          
        <!-- If <fix-subscriptions/> is not commented, set subscriptions of
             user's contacts to subscriptions of corresponding published   
             contacts. As for now, "both". -->                             
        <!--                                                               
        <fix-subscriptions/>                                               
        -->                                                                
        <!-- If <override-names/> is not commented, then displayed names of
             contacts in user's roster will be updated accordingly to      
             published roster (if they differ). If commented, then user can
             rename contacs in roster -->                                  
        <!--                                                               
        <override-names/>                                                  
        -->                                                                
        <!--                                                               
        <mapped-groups/>                                                   
          <map-groups/>                                                    
          <group-cache-ttl>120</group-cache-ttl>                           
        </mapped-groups>                                                   
        -->                                                                
      <!--                                                                 
      </publish>                                                           
      -->                                                                  

      <!-- If you defined publish, you should comment <roster> -->
      <!--                                                        
      <roster>/usr/local/etc/jabberd/templates/roster.xml</roster>
      -->                                                         
    </template>                                                   
  </user>                                                         

  <!-- Advanced Message Processing module configuration -->
  <amp>                                                    
    <!-- You can disable some actions -->                  
    <!--                                                   
    <disableactions>                                       
      <drop/>                                              
      <error/>                                             
      <alert/>                                             
      <notify/>                                            
    </disableactions>                                      
    -->                                                    

    <!-- You can disable some conditions -->
    <!--                                    
    <disableconditions>                     
      <expireat/>                           
      <matchresource/>                      
      <deliver/>                            
    </disableconditions>                    
    -->                                     

    <!-- You need to enable this if your server has offline storage disabled -->
    <!--                                                                        
    <offlinestoragedisabled/>                                                   
    -->                                                                         
  </amp>                                                                        

  <!-- Offline module configuration -->
  <offline>                            
    <!-- Do not store messages in offline store -->
    <!--                                           
    <dropmessages/>                                
    -->

    <!-- Store headline messages in offline store -->
    <!--
    <storeheadlines/>
    -->

    <!-- Do not store subscription requests in offline store -->
    <!--
    <dropsubscriptions/>
    -->

    <!-- Offline storage message quota.
         Specifies how many messages will be stored in user offline store -->
    <!--
    <userquota>500</userquota>
    -->
  </offline>

  <!-- roster module configuration -->
  <roster>
    <!-- maximum items per user roster -->
    <!--
    <maxitems>100</maxitems>
    -->
  </roster>

  <!-- status module configuration -->
  <status>
    <!-- presence service resource
         disabled when commented out -->
    <!--
    <resource>webstatus</resource>
    -->
  </status>

</sm>
Конфиг почти оригинальный, с тем учетом, что были удалены примеры для различных субд.
Ну и наконец:

Код: Выделить всё

jabber# cat /usr/local/etc/jabberd/c2s.xml                                                                                
<c2s>                                                                                          
  <id>c2s</id>                                                                                 
  <pidfile>/var/jabberd/pid/c2s.pid</pidfile>                                                  
  <log type='syslog'>                                                                          
    <ident>jabberd/c2s</ident>                                                                 
    <facility>local3</facility>                                                                
  </log>                                                                                       
  <router>                                                                                     
    <ip>127.0.0.1</ip>
    <port>5347</port>
    <user>jabberd</user>
    <pass>secret</pass>
  </router>
  <local>
    <id register-enable='true'>jabber.local.net</id>
    <ip>0.0.0.0</ip> <!-- Адреса, с которых будет доступен сервак -->
    <port>5222</port> <!-- Порт -->
  </local>
  <authreg>
    <path>/usr/local/lib/jabberd</path>
    <module>mysql</module>
        <mysql> <!-- Настройки mysql бла-бла-бла -->
                <host>localhost</host>
                <port>3306</port>
                <dbname>jabberd2</dbname>
                <user>jabberd2</user>
                <pass>secret</pass>
                <password_type>
                <plaintext/>
                </password_type>
       </mysql>

    <mechanisms> <!-- Механизм аутентификации юзеров -->
        <traditional>
            <plain></plain>
            <digest></digest>
        </traditional>
        <sasl>
            <plain></plain>
            <digest-md5></digest-md5>
        </sasl>
    </mechanisms>

  </authreg>
</c2s>
Конфиги конечно длинные, но предельно понятные.
Также добавим jabberd_enable="YES" в /etc/rc.conf

Перейдем к установке транспортов
Установим транспорт icq:

Код: Выделить всё

cd /usr/ports/net-im/jabber-pyicq && make install clean

Код: Выделить всё


                                           ??????????????????????????????????????????????????????????????????????
                                           ?           Options for jabber-pyicq-transport 0.8.1.3,1             ?
                                           ? ?????????????????????????????????????????????????????????????????? ?
                                           ? ?      [ ] JABBER    Use with jabberd14 (net-im/jabber)          ? ?
                                           ? ?      [X] JABBERD   Use with jabberd 2.x (net-im/jabberd)       ? ?
                                           ? ?      [ ] EJABBERD  Use with ejabberd (net-im/ejabberd)         ? ?
                                           ? ?      [ ] TWISTED1  Use old py-twisted 1.x                      ? ?
                                           ? ?      [ ] MYSQL     Support MySQL storage                       ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ??????????????????????????????????????????????????????????????????????
                                           ?                       [  OK  ]       Cancel                        ?
                                           ??????????????????????????????????????????????????????????????????????
Выбираем поддержку Jabberd2

Код: Выделить всё

jabber# cat /usr/local/etc/jabber-pyicq.xml                                                                                 
<pyicqt>                                                                                                 
        <!-- The JabberID of the transport. -->                                                          
        <jid>icq.jabber.local.net</jid>                                                                  

        <!-- The component JID of the transport. Unless you're doing clustering, leave this alone -->
        <!-- <compjid>icq1</compjid> -->                                                             

        <!-- The location of the spool directory.. if relative, relative to -->
        <!-- this directory.  Do not include the jid of the transport. -->     
        <spooldir>/var/jabberd/spool</spooldir>                                

        <!-- The location of the PID file.. if relative, relative to this dir. -->
        <!-- Comment out if you do not want a pid file -->                        
        <pid>/var/jabberd/pid/PyICQt.pid</pid>                                    

        <!-- The IP address of the main Jabberd server -->
        <mainServer>127.0.0.1</mainServer>                

        <!-- The JID of the main Jabber server -->
        <mainServerJID>icq.jabber.local.net</mainServerJID>

        <!-- The website of the Jabber service -->
        <website>http://www.local.net/</website>      

        <!-- The website of the transport service -->
        <!-- <transportWebsite></transportWebsite> -->

        <!-- The support room on your server -->
        <!-- <supportRoom></supportRoom> -->    

        <!-- The JID of a service admin or helpdesk -->
        <!-- <supportJid></supportJid> -->             

        <!-- The TCP port to connect to the Jabber server on -->
        <!-- (this is the default for Jabberd2) -->             
        <port>5347</port>                                       

        <!-- The TCP port that the web admin interface will answer on -->
        <!-- (uncomment to enable) -->                                   
        <!-- <webport>12345</webport> -->                                

        <!-- The authentication token to use when connecting to the Jabber server -->
        <secret>secret</secret>                                                      

        <!-- The default language to use (for error/status messages) -->
        <lang>ru</lang>                                                 

        <!-- Default message encoding to use -->
        <encoding>cp1251</encoding>             

        <!-- The hostname of the ICQ server you wish to connect to -->
        <icqServer>login.icq.com</icqServer>                          

        <!-- The port of the ICQ server you wish to connect to -->
        <icqPort>5190</icqPort>                                   

        <!-- Enable it if you want md5 authentication -->
        <usemd5auth/>                                    

        <!-- The name of Socks Proxy if connecting thru a proxy -->
        <!-- <socksProxyServer>im-proxy2</socksProxyServer> -->    

        <!-- The Socks Proxy port to use when connecting thru a proxy -->
        <!-- <socksProxyPort>1080</socksProxyPort> -->                   

        <!-- Send greeting on login (enter text to be sent to users here) -->
        <!-- <sessionGreeting>enter message here</sessionGreeting> -->       

        <!-- Send message to user on transport stop/restart -->
        <enableShutdownMessage/>                               

        <!-- Custom shutdown message -->
        <!-- <customShutdownMessage></customShutdownMessage> -->

        <!-- Send message on successful registration -->
        <!-- <registerMessage>You have successfully registered with PyICQt</registerMessage> -->

        <!-- Allow users of ICQ gateway to chat with AIM users -->
        <!-- (uncomment to enable) -->                            
        <crossChat/>                                              

        <!-- Disable registration with the transport -->
        <!-- (uncomment to disable) -->                 
        <!-- <disableRegister/> -->                     

        <!-- Enable automatic invitation to reconnect on restart -->
        <!-- (uncomment to enable) -->                              
        <!-- <enableAutoInvite/> -->                                

        <!-- Disable xhtml support (messages with fonts and colors) -->
        <!-- (uncomment to disable) -->                                
        <!-- <disableXHTML/> -->                                       

        <!-- Disable mail notifications -->
        <!-- (uncomment to disable) -->    
        <!-- <disableMailNotifications/> -->

        <!-- Disable use of default avatar if none is specified -->
        <!-- (uncomment to disable) -->                            
        <disableDefaultAvatar/>                                    

        <!-- Disable use of iq-based avatars (JEP-0008) -->
        <!-- (uncomment to disable) -->                    
        <!-- <disableIQAvatars/> -->                       

        <!-- Disable use of vcard-based avatars (JEP-0153) -->
        <!-- (uncomment to disable) -->                       
        <!-- <disableVCardAvatars/> -->                       

        <!-- Disable use of PEP-based avatars (JEP-0084) -->
        <!-- (uncomment to disable) -->                     
        <!-- NOT IMPLEMENTED YET -->                        
        <!-- <disablePEPAvatars/> -->                       

        <!-- Support for x-statuses -->
        <xstatusessupport/>            

        <!-- Try detect Unicode:
            0 - never           
            1 - in offline messages
            2 - and in nicknames   
            Attention: this solution can be slowly on high-load servers
        -->                                                            
        <detectunicode>1</detectunicode>                               

        <!-- You can choose which users you wish to have as administrators. These users can perform some tasks with Ad-Hoc commands that others cannot -->
        <admins>                                                                                                                                          
        <jid>hm@jabber.local.net</jid>                                                                                                                    
        </admins>                                                                                                                                         

        <!-- Use kqueue for high-load FreeBSD servers -->
        <reactor>kqueue</reactor>                        

        <!-- Default Ad-Hoc settings -->
        <adhocDefaults>
          <user> <!-- ... for new users - they can change these settings later -->
            <xstatus_receiving_mode>0</xstatus_receiving_mode> <!-- 0 - disable x-status receiving, 1 - receive as ICQ 5.1, 2 - as ICQ 6, 3 - combined -->
            <xstatus_sending_mode>0</xstatus_sending_mode> <!-- 0 - disable x-status sending, 1 - send as ICQ 5.1, 2 - as ICQ 6, 3 - combined -->
            <xstatus_saving_enabled>1</xstatus_saving_enabled> <!-- 1 - restore latest x-status after login, 0 - do not restore -->
            <xstatus_option_smooth>1</xstatus_option_smooth> <!-- 1 - allow partial interconnect between ICQ 5.1 and ICQ 6 x-statuses -->
            <xstatus_display_icon_as_PEP>1</xstatus_display_icon_as_PEP> <!-- 1 - display x-status icon as User Mood/Activity/Tune -->
            <xstatus_display_text_as_PEP>1</xstatus_display_text_as_PEP> <!-- 1 - Try interpret x-status text as User Mood/Activity/Tune -->
            <xstatus_icon_for_transport>0</xstatus_icon_for_transport> <!-- 1 - show self x-status icon as User Mood/Activity/Tune for transport (works for Gajim when transport displayed in roster) -->
            <away_messages_receiving>1</away_messages_receiving> <!-- 1 - ask contacts for Away messages -->
            <away_messages_sending>1</away_messages_sending> <!-- 1 - allow own Away Message sending -->
            <clist_show_phantombuddies>0</clist_show_phantombuddies> <!-- 1 - show old deleted contacts without authorization in roster -->
            <clist_deny_all_auth_requests>0</clist_deny_all_auth_requests> <!-- 1 - auto send 'Deny' reply on any authorization request -->
            <utf8_messages_sendmode>2</utf8_messages_sendmode> <!-- 0 - never send messages in Unicode, 1 - only when contact sends messages in Unicode, 2 - send always -->
            <offline_messages_sendenc>2</offline_messages_sendenc> <!-- 0 - send offline messages in Unicode, 1 - in default message encoding (see above), 2 - auto detect -->
            <msgconfirm_sendmode>2</msgconfirm_sendmode> <!-- 0 - never send message confirmations, 1 - send for Unicode messages, 2 - for all messages -->
            <msgconfirm_recvmode>1</msgconfirm_recvmode> <!-- 1 - receive message confirmations -->
            <user_mood_receiving>1</user_mood_receiving> <!-- 1 - transport should send User Mood/Activity/Tune events to connected user -->
            <user_activity_receiving>1</user_activity_receiving> <!--  (requirted for x-status as icon displaying) -->
            <user_mood_receiving>1</user_mood_receiving> <!-- set options if most of users has client with support of these PEP events -->
          </user>
        </adhocDefaults>
</pyicqt>
Данный конфиг так же типовой, была изменена лишь директива jid.
Добавим jabber_pyicq_enable="YES" в /etc/rc.conf

Затем установим транспорт msn:

Код: Выделить всё

cd /usr/ports/net-im/jabber-pymsn && make install clean

Код: Выделить всё

                                           ??????????????????????????????????????????????????????????????????????
                                           ?          Options for jabber-pymsn-transport 0.11.3_1,1             ?
                                           ? ?????????????????????????????????????????????????????????????????? ?
                                           ? ?      [ ] JABBER    Use with jabberd14 (net-im/jabber)          ? ?
                                           ? ?      [X] JABBERD   Use with jabberd 2.x (net-im/jabberd)       ? ?
                                           ? ?      [ ] EJABBERD  Use with ejabberd (net-im/ejabberd)         ? ?
                                           ? ?      [ ] TWISTED1  Use old py-twisted 1.x                      ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ??????????????????????????????????????????????????????????????????????
                                           ?                       [  OK  ]       Cancel                        ?
                                           ??????????????????????????????????????????????????????????????????????

Код: Выделить всё

ns# cat /usr/local/etc/jabber-pymsn.xml 
<pymsnt>                 
<!-- This file contains options to be configured by the server administrator. -->
<!-- Please read through all the options in this file -->                        

<!-- The JabberID of the transport -->
<jid>msn.jabber.local.net</jid>       
<!-- The public IP or DNS name of the machine the transport is running on -->
<!-- This is needed for file transfer!! This is also used as the IP address for outgoing connections -->
<host>127.0.0.1</host>                                                                                  
<!-- The component JID of the transport. Unless you're doing clustering, leave this alone -->           
<!-- <compjid>msn1</compjid> -->                                                                        
<!-- The name of the transport in the service discovery list. -->                                       
<discoName>MSN Transport</discoName>                                                                    


<!-- The location of the spool directory.. if relative, relative to the PyMSNt dir.
Do not include the jid of the transport -->                                        
<spooldir>/var/jabberd/spool</spooldir>                                            
<!-- The location of the PID file, relative to the PyMSNt directory -->            
<pid>/var/jabberd/pid/PyMSNt.pid</pid>                                             
<!-- If set, the transport will background itself when run -->                     
<background/>                                                                      
<!-- The Twisted reactor to choose. Pick poll or epoll on Linux, kqueue on BSD. Or leave as default (best found) -->
<reactor>kqueue</reactor>                                                                                           


<!-- The IP address of the main Jabber server to connect to -->
<mainServer>127.0.0.1</mainServer>                             
<!-- The TCP port to connect to the Jabber server on (this is the default for Jabberd2) -->
<port>5347</port>                                                                          
<!-- The authentication token to use when connecting to the Jabber server -->              
<secret>secret</secret>                                                                    
<!-- Use Jabber.com's XCP component protocol extensions. -->                               
<useXCP/>                                                                                  


<!-- The default language to use -->
<lang>ru</lang>                     
<!-- The website of the Jabber service -->
<website>http://jabber.local.net</website>


<!-- Comment out the following options to disable them, or uncomment them to enable them -->
<!-- Send email notification messages to users -->                                          
<mailNotifications/>                                                                        
<!-- Send greeting on login -->                                                             
<sessionGreeting>You have just started a session with PyMSNt</sessionGreeting>              
<!-- Send message on successful registration -->                                            
<registerMessage>You have successfully registered with PyMSNt</registerMessage>             
<!-- Allow users to register with this transport -->                                        
<allowRegister/>                                                                            
<!-- Get all avatars. If this is set to true then avatars are grabbed for all your contacts immediately. If false then avatars are only grabbed when you're in a chat with a contact -->                                                                                                                                
<getAllAvatars/>                                                                                                                                            
<!-- The amount of time a user has to join a groupchat they are invited to before the transport makes them leave the room. (MSN protocol requires autojoining of groupchats) -->                                                                                                                                        
<!-- <groupchatTimeout>120</groupchatTimeout> -->                                                                                                           


<!-- File transfer settings -->
<!-- The maximum size of a file transfer (in bytes). For unlimited, comment out, or set to 0 -->
<ftSizeLimit>524288</ftSizeLimit>
<!-- The maximum rate for file transfer (in bytes). For unlimited, comment out, or set to 0 -->
<ftRateLimit>2048</ftRateLimit>
<!-- Please give the port to listen for Jabber socks5 transfers on. -->
<ftJabberPort>8010</ftJabberPort>
<!-- Please give the port to listen for HTTP GETs here (Used in old-style OOB file transfers. Best to leave this disabled unless you know you need it.) -->
<!--<ftOOBPort>8011</ftOOBPort>-->
<!-- Please give the root URL the transport should send to clients. (You can use an Apache reverse proxy to put this on your ordinary website) -->
<!-- Eg, the transport will listen on port 8011 for HTTP GETs to /RANDOM_FILE.ext. You can set apache to forward any requests to http://yourhost.com:80/msn/files/RANDOM_FILE.ext to http://yourhost.com:8011/RANDOM_FILE.ext. This saves you from opening extra ports. -->
<!--<ftOOBRoot>http://host.com/msn/files/</ftOOBRoot>-->

<!-- You can choose which users you wish to have as administrators. These users can perform some tasks with Ad-Hoc commands that others cannot -->
<admins>
<jid>hm@jabber.local.net</jid>
</admins>


<!-- Log settings -->

<!-- The logging level
0 -> No logging
1 -> Log tracebacks
2 -> Log tracebacks, warnings and errors
3 -> Log all sorts of informational (mostly useless stuff)
4 -> Log the MSN protocol code sent
-->
<!-- <debugLevel>0</debugLevel> -->

<!-- The file to log to. Leave this disabled for stdout -->
<!-- <debugFile>debug.log</debugFile> -->

</pymsnt>
Так же как и в предыдущем изменил лишь jid
Добавляем jabber_pymsn_enable="YES" в /etc/rc.conf

И про mu-conference тоже не забываем:

Код: Выделить всё

cd /usr/ports/net-im/mu-conference/ && make install clean

Код: Выделить всё

                                           ??????????????????????????????????????????????????????????????????????
                                           ?                  Options for mu-conference 0.8                     ?
                                           ? ?????????????????????????????????????????????????????????????????? ?
                                           ? ?      [ ] MYSQL     Enable MySQL support                        ? ?
                                           ? ?      [ ] JABBER    Use with jabberd14 (net-im/jabber)          ? ?
                                           ? ?      [X] JABBERD   Use with jabberd 2.x (net-im/jabberd)       ? ?
                                           ? ?      [ ] EJABBERD  Use with ejabberd (net-im/ejabberd)         ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ? ?                                                                ? ?
                                           ??????????????????????????????????????????????????????????????????????
                                           ?                       [  OK  ]       Cancel                        ?
                                           ??????????????????????????????????????????????????????????????????????
В очередной раз выбираем поддержку Jabberd

Код: Выделить всё

jabber# cat /usr/local/etc/muc.xml 
<jcr>           
  <!--          
       This is a config file for a copy of MU-Conference, compiled against 
       the Jabber Component Runtime (JCR). This is the same file that I use
       to connect to my development server, running jabberd2 beta2         

       In order to connect to a jabberd v1.4 server, simply change the 
       <name> value to muclinker, and make sure the muclinker section is in
       your main jabber.xml file, as per the MU-Conference README file.    
  -->                                                                      

  <name>conference</name> <!-- the jid of your component -->
  <host>conference.jabber.local.net</host> <!-- this should be the same as above -->
  <ip>127.0.0.1</ip> <!-- adress of the jabber server -->                           
  <port>5347</port>  <!-- port used to connect the service to the jabber server --> 
  <secret>secret</secret> <!-- secret shared with the jabber server -->             

  <spool>/var/jabberd/spool/conference.jabber.local.net</spool> <!-- directory containing the rooms data -->
  <logdir>/var/jabberd/logs/</logdir> <!-- directory containing the debug log (the file is called mu-conference.log) -->
  <pidfile>/var/jabberd/pid/mu-conference.pid</pidfile> <!-- file that will contain the PID of the process -->          

  <!--   <logstderr/> --> <!-- uncomment to also send log to stderr -->

  <loglevel>124</loglevel> <!-- log verbosity, 255 for very verbose, 0 for quiet -->

    <conference xmlns="jabber:config:conference">
      <public/> <!-- rooms are public when created, comment to make them private by default -->
      <!-- the vCard section contains the vCard of the service -->
      <vCard>
        <FN>Public Chatrooms</FN>
        <DESC>This service is for public chatrooms.</DESC>
        <URL>http://www.local.net/</URL>
      </vCard>
      <history>40</history> <!-- maximum numbers of history lines send when joining a room -->
      <logdir>/var/jabberd/spool/conference.jabber.local.net/logs/</logdir> <!-- where to store the room logs, comment to disable logging -->
      <logsubdirs/> <!-- uncomment to stores the room logs in subdirs (for example 2007/08/02) -->
      <stylesheet>../style.css</stylesheet> <!--URL of the log stylesheet -->
      <!-- default text to send to legacy clients, will also be used in the logs -->
      <notice>
        <join>has become available</join>
        <leave>has left</leave>
        <rename>is now known as</rename>
      </notice>
      <!-- lists of admins of the service, add a <user/> tag by admin -->
      <sadmin>
        <user>hm@jabber.local.net</user>
      </sadmin>
      <!-- <dynamic/> --> <!-- when uncommented, only dynamic rooms can be created -->
      <!-- <persistent/> --> <!-- persistent rooms will be created, overide <dynamic/> -->
      <!-- <locknicks/> --> <!-- enforce the user nickname to the user part of his jid -->
      <!-- <roomlock/> --> <!-- uncomment to allow only admins to create rooms -->
      <!-- <hideempty/> --> <!-- uncomment to hide rooms with no participants -->
      <!-- configuration of MySQL, only used if the MySQL exports is activated, see README.sql -->
      <!--<mysql>
        <user>root</user>
        <pass/>
        <database>chat</database>
        <host>localhost</host>
      </mysql>-->
    </conference>
</jcr>
В этом же конфиге подправил лишь host, spool, logdir, pidfile и sadmin директивы/
Добавляем mu_conference_enable="YES" в /etc/rc.conf

Ввиду отсутствия в портах Freebsd транспорта mrim необходимо будет его установить вручную.
В начале установим необходимые пакеты с портов.

Код: Выделить всё

cd /usr/ports/dns/py-dnspython/ && make install clean
и

Код: Выделить всё

cd /usr/ports/net-im/py-xmpppy && make install clean
далее

Код: Выделить всё

cd /usr/local/lib/jabber && fetch http://yo.jabber.ru/files/mrim/mrim-0.1.1.tar.bz2 && tar xvjf mrim-0.1.1.tar.bz2 && cd mrim
затем

Код: Выделить всё

mv mrim.conf.sample /usr/local/etc/mrim.conf
конфиг:

Код: Выделить всё

jabber# cat /usr/local/etc/mrim.conf
[main]
name = mrim.jabber.local.net
password = secret
# -- optional --
admins = hm@jabber.local.net
# -- defaults --
server = localhost
disconame = Mail.ru IM
port = 5347
reconnect = on
probe = on
show_version = on
show_os = on
psyco = off

# -- http proxy for avatars (default is none) --
# http_proxy = http://localhost:3128
# -- PID file (default is none) --

pidfile = /var/jabberd/pid/mrim.pid

[profile]
type = xml
dir = /var/jabberd/spool/mrim

[logger]
logfile = /var/jabberd/logs/mrim.log
loglevel = info

# --- logger defaults ---
# timestamp = %%d/%%m/%%y-%%H:%%M:%%S
# xml_formatting = off
создадим директории для mrim

Код: Выделить всё

mkdir /var/jabberd/spool/mrim
chown jabber:jabber /var/jabberd/spool/mrim
И еще, необходимо добавить строку

Код: Выделить всё

# -*- coding: utf-8 -*-
во все скрипты в директории /usr/local/lib/jabber/mrim/src
иначе mrim будет ругаться на невозможность прочтения символов в скрипте

Так же я решил создать rc скрипт для mrim следующего содержания:
Добавляем mrim_enable="YES" в /etc/rc.conf

Код: Выделить всё

jabber# cat /usr/local/etc/rc.d/mrim
#!/bin/sh
#
# PROVIDE: mrim
# REQUIRE: DAEMON jabberd
# KEYWORD: shutdown
#
# Define these mrim_* variables in one of these files:
#       /etc/rc.conf
#       /etc/rc.conf.local
#

. /etc/rc.subr

name="mrim"
rcvar=`set_rcvar`

load_rc_config $name

: ${mrim_enable="NO"}
: ${mrim_dir="/usr/local/lib/jabber/mrim"}
: ${mrim_piddir="/var/jabberd/pid"}
: ${mrim_user="jabber"}

pidfile="${mrim_piddir}/mrim.pid"
command_args="-d -p ${pidfile} -c /usr/local/etc/mrim.conf"
command="${mrim_dir}/src/mrim.py"

run_rc_command "$1"
Вот и все, критикуйте пожалуйста :)

Хостинговая компания Host-Food.ru
Хостинг HostFood.ru
 

Услуги хостинговой компании Host-Food.ru

Хостинг HostFood.ru

Тарифы на хостинг в России, от 12 рублей: https://www.host-food.ru/tariffs/hosting/
Тарифы на виртуальные сервера (VPS/VDS/KVM) в РФ, от 189 руб.: https://www.host-food.ru/tariffs/virtualny-server-vps/
Выделенные сервера, Россия, Москва, от 2000 рублей (HP Proliant G5, Intel Xeon E5430 (2.66GHz, Quad-Core, 12Mb), 8Gb RAM, 2x300Gb SAS HDD, P400i, 512Mb, BBU):
https://www.host-food.ru/tariffs/vydelennyi-server-ds/
Недорогие домены в популярных зонах: https://www.host-food.ru/domains/

Аватара пользователя
gloom
лейтенант
Сообщения: 738
Зарегистрирован: 2008-03-13 16:29:12
Откуда: UA

Re: Статья: Настройка Jabberd2 с транспортами icq, msn, mrim.

Непрочитанное сообщение gloom » 2009-08-04 1:40:41

вроде интересная ссылочка http://post.hppi.troitsk.ru/~mike/XMPP/myjab.html
вебморды не хватает :(

opt1k
лейтенант
Сообщения: 966
Зарегистрирован: 2007-12-05 9:45:18
Откуда: Mytischi

Re: Статья: Настройка Jabberd2 с транспортами icq, msn, mrim.

Непрочитанное сообщение opt1k » 2009-08-04 16:56:30

критиковать не буду. Но у меня есть вопрос, вот это вроде уже 3я статья на ресурсе по поднятию жабр-сервера и все на разных демонах, по вашему мнению какой из демонов лучше, можно плюсы и минусы.

Аватара пользователя
hm
ефрейтор
Сообщения: 59
Зарегистрирован: 2008-08-13 12:15:32

Re: Статья: Настройка Jabberd2 с транспортами icq, msn, mrim.

Непрочитанное сообщение hm » 2009-08-05 0:15:11

ну так вкусы разные у всех :)

openfire на мой взгляд простой и функциональный сервис, только жрет много ресурсов по сравнению с другими.
ejabberd хороший, простой, функциональный сервис, и жрет не много, только написан на erlang
jabberd2 непростой, ох уж эти xml-ные конфиги ... но функциональный и жрет меньше всех ресурсов

mymymy
сержант
Сообщения: 224
Зарегистрирован: 2008-05-16 21:23:38
Откуда: Москва

Re: Статья: Настройка Jabberd2 с транспортами icq, msn, mrim.

Непрочитанное сообщение mymymy » 2009-08-05 6:41:25

hm писал(а): openfire на мой взгляд простой и функциональный сервис, только жрет много ресурсов по сравнению с другими.
Не знаю где он жрет, такое было в первых версиях,когда память утекала. Сейчас при онлайне 70 пользователей со всеми сервисами и гейтами- выше 70мб не поднимается

Аватара пользователя
server801
ст. лейтенант
Сообщения: 1421
Зарегистрирован: 2008-09-27 21:15:16
Откуда: Саратов
Контактная информация:

Re: Статья: Настройка Jabberd2 с транспортами icq, msn, mrim.

Непрочитанное сообщение server801 » 2009-08-09 23:59:53

Код: Выделить всё

mkdir /var/jabberd/spool/mrim
нет такой директории........как быть?

opt1k
лейтенант
Сообщения: 966
Зарегистрирован: 2007-12-05 9:45:18
Откуда: Mytischi

Re: Статья: Настройка Jabberd2 с транспортами icq, msn, mrim.

Непрочитанное сообщение opt1k » 2009-08-10 9:32:08

mymymy писал(а): Не знаю где он жрет, такое было в первых версиях,когда память утекала. Сейчас при онлайне 70 пользователей со всеми сервисами и гейтами- выше 70мб не поднимается
70 это не мало
server801 писал(а):нет такой директории........как быть?
создать ручками, можно почитать man mkdir для упрощения процесса, иначе каждую недостающую директорию отдельно.

Аватара пользователя
Syward
мл. сержант
Сообщения: 81
Зарегистрирован: 2008-07-06 22:27:33
Откуда: Mytischi
Контактная информация:

Re: Статья: Настройка Jabberd2 с транспортами icq, msn, mrim.

Непрочитанное сообщение Syward » 2009-08-15 12:51:50

mymymy писал(а): Не знаю где он жрет, такое было в первых версиях,когда память утекала. Сейчас при онлайне 70 пользователей со всеми сервисами и гейтами- выше 70мб не поднимается
крутил чего?

Код: Выделить всё

1117 openfire   72  44    0   492M 98004K ucond    1:37  0.00% java

Код: Выделить всё

% pkg_info|grep openfire
openfire-3.6.4      Openfire (formerly Wildfire) is an enterprise instant messa
у меня так.
Это вообще насос, сколько дадут памяти, столько всосет. Думаю переезжать на jabberd
Существует рoвнo oдин интуитивнo пoнятный интерфейс - сoска. Все остальные oсваиваются путем oбучения или методом тыка...©

Аватара пользователя
hawk
рядовой
Сообщения: 32
Зарегистрирован: 2009-02-17 19:09:59
Контактная информация:

Re: Статья: Настройка Jabberd2 с транспортами icq, msn, mrim.

Непрочитанное сообщение hawk » 2009-09-19 9:47:31

Добрый всем день!
Не стал поднимать новую тему, т.к. вопрос касается jabberd2. Сервер настроен и работает "тьфу тьфу" нормально. Это корпоративный сервер, поэтому интересна возможность jabberd - ведение публичных юзер листов или общий ростер, как кому понятнее.
В sm.xml (пишу по памяти за не точности извиняйте, не цепляйтесь), раскоментировал <pablic> и строку <roster>/usr/local/etc/jabberd/templates/roster.xml</roster>
переходим в templates и заполняем roster.xml:

Код: Выделить всё

<query xmlns='jabber:id:roster'>
  <item name='user1' jid=' user1@host.org.ru ' subscription='none'
  <group>Support</group>
  </item>
<item name='user2' jid=' user2@host.org.ru ' subscription='none'
  <group>Nachalnik</group>
  </item>
</query>
Перезапускаем сервер, заводим нового пользователя, и в его ростере сразу уже присутствуют два пользователя user1 и user2 находящиеся в группах Support и Nachalnik.
Идем дальше и вот тут не понятно, баг это jabberd или не хватает каких либо настроек. Вобщем надо сделать чтобы пользователи автоматом авторизовались, для этого вместо ' subscription='none' ставим ' subscription='both', регим пользователя, в его ростер автоматом добавляются пользователи и от каждого пользователя приходит "Отказано в авторизации". Как сделать чтобы авторизация проходила? Что не делал, всегда отказ :(. В организации юзеры настолько тупы, что запросить самостоятельно авторизацию для них непосильная задача, офисы разнесены по всему городу, не наездишься. Подозреваю, что есть что то относящееся к авторизации в базе данных MySQL, но хотелось бы услышать кто реализовывал.
"No! Try not! Do. Or do not. There is no try." -- Yoda

Gridis
проходил мимо
Сообщения: 4
Зарегистрирован: 2011-05-28 5:01:37

Re: Статья: Настройка Jabberd2 с транспортами icq, msn, mrim

Непрочитанное сообщение Gridis » 2011-10-09 15:43:29

Добрый день!

У меня появилась необходимость запустить на jabberd2 поддержку сразу нескольких доменов, искал по всему нету, ничего путного не нашел... нашел только пост, что это можно сделать выставляя несколько копий <id></id>, при этом в jabberd.cnf надо дописать путь ко второму конфигу sm, но я использую ubuntu, там его просто нет... а из исходников пока ставить не охота, так как вроде в репах есть... если кто знает как решить проблему, скажите.... хотя мне кажется я сам уже ответил на свой вопрос :)