Installer le connecteur funambol pour SOGo

  • Télécharger le serveur funambol
mkdir -p ./funambol
cd ./funambol
wget http://download.forge.objectweb.org/sync4j/funambol-9.0.0.bin
  • Puis l'exécuter
chmod +x funambol-9.0.0.bin
./funambol-9.0.0.bin
  • Accepter la licence, et valider le choix du répertoire de destination (/opt)
  • À la fin, l'installateur vous demande si vous voulez démarrer, le serveur, il faut choisir no

Pour que le connecteur SOGo fonctionne, funambol doit utiliser une base MySQL. Il faut donc installer le driver MySQL.

mkdir -p /opt/Funambol/tools/mysql/lib
wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.0.8.tar.gz/from/http://www.mirrorservice.org/sites/ftp.mysql.com/
tar xvzf mysql-connector-java-5.0.8.tar.gz
mv mysql-connector-java-5.0.8/mysql-connector-java-5.0.8-bin.jar /opt/Funambol/tools/mysql/lib
rm -rf mysql-connector-java-5.0.8/
  • Créer une base de données mysql pour funambol
/usr/bin/openssl rand -base64 60 | tr -c -d '[:alnum:]' > my.pw
chmod 600 my.pw
db configuration setprop mysqld InnoDB enabled LocalNetworkingOnly no
expand-template /etc/my.cnf
sv t /service/mysqld
sleep 10
mysqladmin create funamboldb  --default-character-set=utf8
mysql -e "grant all privileges on funamboldb.* to 'funamboluser'@'localhost' identified by '$(cat my.pw)'"
mysql -e 'flush privileges'
  • Configurer funambol pour utiliser cette base de donnée
pw=$(cat my.pw)
sed -i -e "s/^dbms=.*/dbms=mysql/" \
    -e "s/^jdbc\.classpath=.*/jdbc\.classpath=\.\.\/tools\/mysql\/lib\/mysql-connector-java-5.0.8-bin\.jar/" \
    -e "s/^jdbc\.driver=.*/jdbc\.driver=com.mysql.jdbc.Driver/" \
    -e "s/^jdbc\.url=.*/jdbc\.url=jdbc:mysql:\/\/localhost\/funamboldb?characterEncoding=UTF-8/" \
    -e "s/^jdbc\.user=.*/jdbc\.user=funamboluser/" \
    -e "s/^jdbc\.password=.*/jdbc\.password=$pw/" \
    /opt/Funambol/ds-server/install.properties
dos2unix /opt/Funambol/ds-server/install.properties
  • Désactiver le driver hypersonyc
sed -i -e "s/COMED=.*/COMED=false/" /opt/Funambol/bin/funambol
useradd -d /opt/Funambol -s /bin/false -c 'Funambol user' funambol
db configuration set funambol service status enabled access private TCPPort 8080

Attention: par défaut, funambol utilise le port TCP 8080 et peut donc entrer en conflit avec dansguardian par exemple

Créer le script de démarrage:

cat <<'EOF' > /etc/init.d/funambol
#! /bin/bash
#
# funambol Start the funambol services
#
NAME="Funambol Server"
FUNAMBOL_HOME=/opt/Funambol/bin
FUNAMBOL_USER=funambol
FUNAMBOL_BIN=$FUNAMBOL_HOME"/funambol"
 
. /etc/rc.d/init.d/functions
 
#cd $FUNAMBOL_HOME
case "$1" in
  start)
    action "Starting $NAME" \
        /bin/su -s /bin/bash -l $FUNAMBOL_USER $FUNAMBOL_BIN start
    ;;
  stop)
    action "Stopping $NAME" \
        /bin/su -s /bin/bash -l $FUNAMBOL_USER $FUNAMBOL_BIN stop
    ;;
  restart)
    action "Restarting $NAME" \
        /bin/su -s /bin/bash -l $FUNAMBOL_USER $FUNAMBOL_BIN stop && \
        /bin/su -s /bin/bash -l $FUNAMBOL_USER $FUNAMBOL_BIN start
    ;;
  *)
    echo "Usage: /etc/init.d/funambol {start|stop|restart}"
    exit 1
    ;;
esac
exit 0
EOF
chmod 755 /etc/init.d/funambol
  • Créer les liens de démarrage et d'arrêt
ln -s /etc/init.d/e-smith-service /etc/rc.d/rc7.d/S98funambol
ln -s /etc/init.d/e-smith-service /etc/rc.d/rc6.d/K02funambol
ln -s /etc/init.d/e-smith-service /etc/rc.d/rc2.d/K02funambol
ln -s /etc/init.d/e-smith-service /etc/rc.d/rc1.d/K02funambol
ln -s /etc/init.d/e-smith-service /etc/rc.d/rc0.d/K02funambol

Maintenant que le cœur du serveur funambol est installé, il faut mettre en place le connecteur SOGo

Installation des dépendances du connecteur

Le connecteur SOGo nécessite plusieurs composants java supplémentaires

wget http://www.apache.org/dist/commons/collections/binaries/commons-collections-3.2.1-bin.zip
unzip commons-collections-3.2.1-bin.zip
cp -p commons-collections-3.2.1/commons-collections-3.2.1.jar /opt/Funambol/tools/tomcat/lib/
rm -rf commons-collections-3.2.1
wget http://www.apache.org/dist/commons/configuration/binaries/commons-configuration-1.6.zip
unzip commons-configuration-1.6.zip
cp -p commons-configuration-1.6/commons-configuration-1.6.jar /opt/Funambol/tools/tomcat/lib/
rm -rf  commons-configuration-1.6
wget http://www.apache.org/dist/commons/logging/binaries/commons-logging-1.1.1-bin.zip
unzip commons-logging-1.1.1-bin.zip
cp -p commons-logging-1.1.1/commons-logging-1.1.1.jar /opt/Funambol/tools/tomcat/lib/
rm -rf  commons-logging-1.1.1
wget http://www.apache.org/dist/commons/lang/binaries/commons-lang-2.5-bin.zip
unzip commons-lang-2.5-bin.zip
cp -p commons-lang-2.5/commons-lang-2.5.jar /opt/Funambol/tools/tomcat/lib/
rm -rf commons-lang-2.5
wget http://json-simple.googlecode.com/files/json_simple.jar
cp json_simple.jar /opt/Funambol/tools/tomcat/lib/

Installation du connecteur

Maintenant que les dépendances sont installées, on peut nstaller le connecteur lui-même. Il faut vérifier la dernière version disponible sur http://www.sogo.nu/downloads/backend.html

  • Téléchargement
wget http://www.sogo.nu/uploads/Funambol/funambol-sogo-1.0.8.s4j
cp funambol-sogo-1.0.8.s4j /opt/Funambol/ds-server/modules
  • Configuration pour installation

Il faut éditer le fichier install.properties, et ajouter le module sogo sur la ligne modules-to-install

sed -i -r -e "s/^modules\-to\-install=(.*)$/modules\-to\-install=\1,funambol\-sogo\-1.0.8/" \
    /opt/Funambol/ds-server/install.properties
/opt/Funambol/bin/install

Et répondre oui (y) à toutes les questions

On peut maintenant modifier les droits sur l'ensemble de l'installation de funambol

chown -R funambol:funambol /opt/Funambol/
chmod 750 /opt/Funambol/

On peut maintenant démarrer le serveur funambol

/etc/init.d/funambol start

qui devrait retourner OK si tout s'est bien passé

Si on accède à la page http://<nom du serveur>:8080/funambol/ds on devrait voir les informations du serveur.

sed -i -e "s/^JDBC_JAR=.*/JDBC_JAR=\/opt\/Funambol\/tools\/mysql\/lib\/mysql-connector-java-5.0.8-bin.jar/" \
    /opt/Funambol/bin/admin-passwd

Puis:

/opt/Funambol/bin/admin-passwd

Et suivre les instructions (le mot de passe par défaut est sa)

Plutôt que d'ouvrir le serveur funambol directement sur l'interface externe, nous allons configurer un proxypass (apache redirigera les requêtes /funambol vers le serveur funambol)

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts
cat <<'EOF' > /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/28funambolProxyPass
{
    $haveSSL = (exists ${modSSL}{status} and ${modSSL}{status} eq "enabled") ?  'yes' : 'no';
    $access = (($funambol{'PublicAccess'} || 'no') eq 'yes') ? "all" : "$localAccess $externalSSLAccess";
 
    $OUT = '';
    if (($funambol{'status'} || 'disabled') eq 'enabled'){
 
        if (($port eq ${'httpd-e-smith'}{'TCPPort'}) && ($haveSSL eq 'yes')){
            $OUT .= "    RewriteRule ^/funambol(/.*|\$)    https://%{HTTP_HOST}/funambol/ds\$1 [L,R]\n";
        }
        else{
            $OUT .= "    ProxyPass /funambol http://127.0.0.1:$funambol{TCPPort}/funambol/ds\n";
            $OUT .= "    ProxyPassReverse /funambol http://127.0.0.1:$funambol{TCPPort}/funambol/ds\n";
        }
 
        $OUT .=<<"HERE";
 
    <Location /funambol>
        SSLRequireSSL on
        order deny,allow
        deny from all
        allow from $access
    </Location>
 
HERE
    }
}
EOF

Puis on régénère la configuration d'apache, on vérifie que tout est ok, et on relance apache:

expand-template /etc/httpd/conf/httpd.conf
httpd -t

Si aucune erreur de syntaxe n'est détectée, on relance apache:

sv t /service/httpd-e-smith
cat <<'EOF' > sogo-sync-source-insert.sql
INSERT INTO `fnbl_sync_source` (`uri`, `config`, `name`, `sourcetype`) VALUES
('sogo-cal', 'sogo/sogo/sogo/sogo-cal.xml', 'sogo-cal', 'sogo'),
('sogo-card', 'sogo/sogo/sogo/sogo-card.xml', 'sogo-card', 'sogo'),
('sogo-todo', 'sogo/sogo/sogo/sogo-todo.xml', 'sogo-todo', 'sogo');
EOF
mysql funamboldb < sogo-sync-source-insert.sql

Calendrier

mkdir -p /opt/Funambol/config/sogo/sogo/sogo
mkdir -p /etc/e-smith/templates-custom/opt/Funambol/config/sogo/sogo/sogo/sogo-cal.xml
touch /etc/e-smith/templates-custom/opt/Funambol/config/sogo/sogo/sogo/sogo-cal.xml/template-begin
cat <<'EOF' > /etc/e-smith/templates-custom/opt/Funambol/config/sogo/sogo/sogo/sogo-cal.xml/all
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.5.0_10" class="java.beans.XMLDecoder">
 <object class="ca.inverse.sogo.engine.source.SOGoSyncSource">
  <void property="databasePassword">
   <string>{$sogod{'DbPassword'}}</string>
  </void>
  <void property="databaseURL">
   <string>jdbc:mysql://localhost/sogo</string>
  </void>
  <void property="databaseUsername">
   <string>sogo</string>
  </void>
  <void property="info">
   <object class="com.funambol.framework.engine.source.SyncSourceInfo">
    <void property="supportedTypes">
     <array class="com.funambol.framework.engine.source.ContentType" length="1">
      <void index="0">
       <object class="com.funambol.framework.engine.source.ContentType">
        <void property="type">
         <string>text/x-vevent</string>
        </void>
        <void property="version">
         <string>1</string>
        </void>
       </object>
      </void>
     </array>
    </void>
   </object>
  </void>
  <void property="name">
   <string>sogo-cal</string>
  </void>
  <void property="sourceURI">
   <string>sogo-cal</string>
  </void>
 </object>
</java>
EOF
expand-template /opt/Funambol/config/sogo/sogo/sogo/sogo-cal.xml

Carnet d'adresses

mkdir -p /etc/e-smith/templates-custom/opt/Funambol/config/sogo/sogo/sogo/sogo-card.xml
touch /etc/e-smith/templates-custom/opt/Funambol/config/sogo/sogo/sogo/sogo-card.xml/template-begin
cat <<'EOF' >  /etc/e-smith/templates-custom/opt/Funambol/config/sogo/sogo/sogo/sogo-card.xml/all
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.5.0_10" class="java.beans.XMLDecoder">
 <object class="ca.inverse.sogo.engine.source.SOGoSyncSource">
  <void property="databasePassword">
   <string>{$sogod{'DbPassword'}}</string>
  </void>
  <void property="databaseURL">
   <string>jdbc:mysql://localhost/sogo</string>
  </void>
  <void property="databaseUsername">
   <string>sogo</string>
  </void>
  <void property="info">
   <object class="com.funambol.framework.engine.source.SyncSourceInfo">
    <void property="supportedTypes">
     <array class="com.funambol.framework.engine.source.ContentType" length="1">
      <void index="0">
       <object class="com.funambol.framework.engine.source.ContentType">
        <void property="type">
         <string>text/x-vcard</string>
        </void>
        <void property="version">
         <string>1</string>
        </void>
       </object>
      </void>
     </array>
    </void>
   </object>
  </void>
  <void property="name">
   <string>sogo-card</string>
  </void>
  <void property="sourceURI">
   <string>sogo-card</string>
  </void>
 </object>
</java>
EOF
expand-template /opt/Funambol/config/sogo/sogo/sogo/sogo-card.xml

Tâches

mkdir -p /etc/e-smith/templates-custom/opt/Funambol/config/sogo/sogo/sogo/sogo-todo.xml
touch /etc/e-smith/templates-custom/opt/Funambol/config/sogo/sogo/sogo/sogo-todo.xml/template-begin
cat <<'EOF' >  /etc/e-smith/templates-custom/opt/Funambol/config/sogo/sogo/sogo/sogo-todo.xml/all
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.5.0_10" class="java.beans.XMLDecoder">
 <object class="ca.inverse.sogo.engine.source.SOGoSyncSource">
  <void property="databasePassword">
   <string>{$sogod{'DbPassword'}}</string>
  </void>
  <void property="databaseURL">
   <string>jdbc:mysql://localhost/sogo</string>
  </void>
  <void property="databaseUsername">
   <string>sogo</string>
  </void>
  <void property="info">
   <object class="com.funambol.framework.engine.source.SyncSourceInfo">
    <void property="supportedTypes">
     <array class="com.funambol.framework.engine.source.ContentType" length="1">
      <void index="0">
       <object class="com.funambol.framework.engine.source.ContentType">
        <void property="type">
         <string>text/x-vtodo</string>
        </void>
        <void property="version">
         <string>1</string>
        </void>
       </object>
      </void>
     </array>
    </void>
   </object>
  </void>
  <void property="name">
   <string>sogo-todo</string>
  </void>
  <void property="sourceURI">
   <string>sogo-todo</string>
  </void>
 </object>
</java>
EOF
expand-template /opt/Funambol/config/sogo/sogo/sogo/sogo-todo.xml
sed -i -e "s|com/funambol/server/security/UserProvisioningOfficer.xml|ca/inverse/sogo/security/SOGoOfficer.xml|" \
    /opt/Funambol/config/Funambol.xml
cat <<'EOF' > /opt/Funambol/config/ca/inverse/sogo/security/SOGoOfficer.xml
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.4.0" class="java.beans.XMLDecoder">
  <object class="ca.inverse.sogo.security.SOGoOfficer">
    <void property="host">
      <string>localhost</string>
    </void>
    <void property="port">
      <string>20000</string>
    </void>
  </object>
</java>
EOF

Dernière étape:

/etc/init.d/funambol restart
  • tuto/ipasserelle/divers/connecteur_funambol_sogo.txt
  • Dernière modification: 12/07/2012 22:55
  • par dani